-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
91 lines (74 loc) · 2.79 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
80
81
82
83
84
85
86
87
88
89
90
91
# CMake build script for QuantLibXL
PROJECT(QuantLibXL)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
# For non-IDE build only
SET(CMAKE_BUILD_TYPE "Release")
# Set build directory
SET(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/build)
SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR})
IF (MSVC_IDE)
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /INCREMENTAL:NO /MT")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /INCREMENTAL:NO /MTd")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO")
ELSE ()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
ENDIF ()
# dynamic lookup
IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
SET (CMAKE_SHARED_LINKER_FLAGS "-undefined dynamic_lookup")
ENDIF()
FIND_PACKAGE(Boost)
# Load/Find CMake Modules
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
INCLUDE(FindNode)
INCLUDE(FindQuantLib)
# Add include/link directories
INCLUDE_DIRECTORIES(${NODE_GYP_DIR}/include/node)
INCLUDE_DIRECTORIES(${NAN_DIR})
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
IF (MSVC_IDE)
INCLUDE_DIRECTORIES(${QUANTLIB_DIR}/QuantLib)
INCLUDE_DIRECTORIES(${QUANTLIB_DIR}/ObjectHandler)
INCLUDE_DIRECTORIES(${QUANTLIB_DIR}/QuantLibAddin)
ELSE ()
INCLUDE_DIRECTORIES(${QUANTLIB_DIR}/include)
ENDIF ()
LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
IF (MSVC_IDE)
LINK_DIRECTORIES(${QUANTLIB_DIR}/QuantLib/lib)
LINK_DIRECTORIES(${QUANTLIB_DIR}/QuantLibAddin/lib)
LINK_DIRECTORIES(${QUANTLIB_DIR}/ObjectHandler/lib)
ELSE ()
LINK_DIRECTORIES(${QUANTLIB_DIR}/lib)
ENDIF ()
FILE(GLOB SRC_QUANTLIBXL *.hpp *.cpp src/*.hpp src/*.cpp)
IF (MSVC_IDE)
SET_SOURCE_FILES_PROPERTIES(${SRC_QUANTLIBXL} PROPERTIES COMPILE_FLAGS -Od)
ENDIF ()
ADD_LIBRARY(quantlibxl SHARED ${SRC_QUANTLIBXL})
IF (MSVC_IDE)
IF (CMAKE_SIZEOF_VOID_P EQUAL 8)
TARGET_LINK_LIBRARIES(quantlibxl ${NODE_GYP_DIR}/x64/node.lib)
ELSE ()
TARGET_LINK_LIBRARIES(quantlibxl ${NODE_GYP_DIR}/ia32/node.lib)
ENDIF()
ENDIF ()
IF (MSVC_IDE)
IF ( CMAKE_CONFIGURATION_TYPES STREQUAL "Debug" )
TARGET_LINK_LIBRARIES(quantlibxl QuantLib-vc140-mt-gd.lib)
TARGET_LINK_LIBRARIES(quantlibxl QuantLibObjects-vc140-mt-gd-1_8_0.lib)
TARGET_LINK_LIBRARIES(quantlibxl ObjectHandler-vc140-mt-gd-1_8_0.lib)
ELSE ()
TARGET_LINK_LIBRARIES(quantlibxl QuantLib-vc140-mt-s.lib)
TARGET_LINK_LIBRARIES(quantlibxl QuantLibObjects-vc140-mt-s-1_8_0.lib)
TARGET_LINK_LIBRARIES(quantlibxl ObjectHandler-vc140-mt-s-1_8_0.lib)
ENDIF ()
ENDIF ()
IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
TARGET_LINK_LIBRARIES(quantlibxl QuantLib.a)
TARGET_LINK_LIBRARIES(quantlibxl QuantLibAddin.a)
TARGET_LINK_LIBRARIES(quantlibxl ObjectHandler.a)
ENDIF()
SET_TARGET_PROPERTIES(quantlibxl PROPERTIES SUFFIX ".node")
SET_TARGET_PROPERTIES(quantlibxl PROPERTIES PREFIX "")