-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
53 lines (41 loc) · 1.35 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
cmake_minimum_required(VERSION 3.0)
project (tscaling)
include_directories(include)
file(GLOB SOURCES "src/tscaling.cpp")
file(GLOB TEST_SOURCES "src/test.cpp")
OPTION(FORCE_LBFGSPP "force use bundled LBFGSPP instead of system LBFGS")
OPTION(BUILD_TEST "build test app")
OPTION(BUILD_PYTHON "build python bindings using boost")
find_path(LBFGSPP_LIB LBFGS.h HINTS ${CMAKE_SOURCE_DIR}/lbfgspp)
find_library(LBFGS_LIB lbfgs)
find_package (Eigen3)
if (NOT LBFGS_LIB OR FORCE_LBFGSPP OR BUILD_PYTHON)
set(USE_LBFGSPP ON)
else()
set(USE_LBFGSPP OFF)
endif()
if (USE_LBFGSPP AND NOT LBFGSPP_LIB)
message ( FATAL_ERROR "cannot find LBFGSPP neither liblbfgs")
endif()
if (BUILD_TEST)
add_executable(test_tscaling ${TEST_SOURCES})
endif()
add_library(tscaling SHARED ${SOURCES})
set (CMAKE_CXX_FLAGS "-g -Wall -std=c++11")
if (USE_LBFGSPP)
add_definitions(-DLBFGSPP)
include_directories(${LBFGSPP_LIB} ${EIGEN3_INCLUDE_DIR})
else()
target_link_libraries(tscaling ${LBFGS_LIB})
endif()
if (BUILD_TEST)
target_link_libraries(test_tscaling tscaling)
endif()
if (BUILD_PYTHON)
FIND_PACKAGE(Boost COMPONENTS python)
FIND_PACKAGE(PythonInterp)
FIND_PACKAGE(PythonLibs REQUIRED)
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS})
LINK_LIBRARIES(${Boost_LIBRARIES} ${PYTHON_LIBRARIES} tscaling)
add_subdirectory(python)
endif()