-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
34 lines (28 loc) · 1.07 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
cmake_minimum_required(VERSION 3.22)
cmake_policy(SET CMP0091 NEW)
cmake_policy(SET CMP0042 NEW)
project(highs_addon)
add_definitions(-DNAPI_VERSION=8)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# Download HiGHS
include(ExternalProject)
ExternalProject_Add(highs_download
GIT_REPOSITORY https://github.com/ERGO-Code/HiGHS.git
GIT_TAG "21da9b90e0dceeb22ef9e35e5ff2c3ab17dc5232" # v1.6.0
CMAKE_ARGS
-DCI=OFF
-DFAST_BUILD=OFF
-DSHARED=OFF
-DCMAKE_CXX_COMPILER_LAUNCHER=${CMAKE_CXX_COMPILER_LAUNCHER}
BUILD_COMMAND ${CMAKE_COMMAND} --build . --target libhighs
INSTALL_COMMAND ""
)
ExternalProject_Get_Property(highs_download source_dir)
ExternalProject_Get_Property(highs_download binary_dir)
# Build binding
include_directories(${CMAKE_JS_INC} ${source_dir}/src ${binary_dir})
file(GLOB SOURCE_FILES "src/*.cc")
add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES} ${CMAKE_JS_SRC})
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "" SUFFIX ".node")
target_link_libraries(${PROJECT_NAME} ${CMAKE_JS_LIB} ${binary_dir}/lib/libhighs.a)