-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
40 lines (28 loc) · 1.2 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
cmake_minimum_required(VERSION 3.5.1)
project(hasherbeamhash)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
file(GLOB hasher_beamhash_SRC
"src/*/*.c"
"src/*.c"
"src/*.cpp"
"src/*/*.cpp"
)
#ff building Node JS Addon
if (CMAKE_JS_VERSION)
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -static")
# add node include directories, fix potential backslashes
foreach(CMAKE_JS_INC_ITEM ${CMAKE_JS_INC})
string(REPLACE "\\" "/" CMAKE_JS_INC_ITEM ${CMAKE_JS_INC_ITEM})
message(STATUS "include_directories ${CMAKE_JS_INC_ITEM}")
include_directories(${CMAKE_JS_INC_ITEM})
endforeach(CMAKE_JS_INC_ITEM)
string(REPLACE "\\" "/" PROJECT_SOURCE_DIR ${PROJECT_SOURCE_DIR})
message(STATUS "include_directories ${PROJECT_SOURCE_DIR}")
include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_SOURCE_DIR})
include_directories(${PROJECT_NAME} PUBLIC "./src")
# include static libraries
add_library(${PROJECT_NAME} SHARED ${hasher_beamhash_SRC} "hasherbeamhash.cc")
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "" SUFFIX ".node")
endif()