-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
79 lines (69 loc) · 2.59 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
cmake_minimum_required(VERSION 3.19)
project(omp-node LANGUAGES C CXX VERSION 0.0.1)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_BUILD_WITH_INSTALL_RPATH true)
if (WIN32)
add_definitions(
-D_CRT_SECURE_NO_WARNINGS
-DWIN32_LEAN_AND_MEAN
)
add_compile_options(/MP)
endif ()
function(GroupSourcesByFolder target)
set(SOURCE_GROUP_DELIMITER "/")
set(last_dir "")
set(files "")
get_target_property(sources ${target} SOURCES)
foreach(file ${sources})
file(RELATIVE_PATH relative_file "${CMAKE_CURRENT_SOURCE_DIR}" ${file})
get_filename_component(dir "${relative_file}" PATH)
if(NOT "${dir}" STREQUAL "${last_dir}")
if(files)
source_group("${last_dir}" FILES ${files})
endif()
set(files "")
endif()
set(files ${files} ${file})
set(last_dir "${dir}")
endforeach()
if(files)
source_group("${last_dir}" FILES ${files})
endif()
endfunction()
add_library(omp-node-sdk INTERFACE)
target_include_directories(omp-node-sdk INTERFACE include/)
file(GLOB_RECURSE omp_node_sdk_source_list "include/*.hpp")
set_property(TARGET omp-node-sdk PROPERTY SOURCES ${omp_node_sdk_source_list})
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
if (NOT TARGET_BUILD_ARCH)
if (MSVC_CXX_ARCHITECTURE_ID)
string(TOLOWER ${MSVC_CXX_ARCHITECTURE_ID} LOWERCASE_CMAKE_SYSTEM_PROCESSOR)
if (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(x64|x86_64|amd64)")
set(TARGET_BUILD_ARCH x64)
elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(i[3-6]86|x86)")
set(TARGET_BUILD_ARCH x86)
else ()
message(FATAL_ERROR "MSVC Arch ID: Unknown CPU '${LOWERCASE_CMAKE_SYSTEM_PROCESSOR}'")
endif ()
else ()
if (CMAKE_SYSTEM_PROCESSOR MATCHES "(x64|x86_64|amd64)")
set(TARGET_BUILD_ARCH x64)
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "(i[3-6]86|x86)")
set(TARGET_BUILD_ARCH x86)
set(CMAKE_C_FLAGS "-m32 ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-m32 ${CMAKE_CXX_FLAGS}")
set(CMAKE_SIZEOF_VOID_P 4)
else ()
if (CMAKE_SYSTEM_PROCESSOR MATCHES "(arm64)")
set(TARGET_BUILD_ARCH armv8)
else ()
set(TARGET_BUILD_ARCH x86)
endif ()
endif ()
endif ()
endif()
add_subdirectory(deps/node)
add_subdirectory(deps/sdk)
add_subdirectory(deps/ghcfs)
add_subdirectory(src)
endif()