-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt_old
98 lines (59 loc) · 2.02 KB
/
CMakeLists.txt_old
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
92
93
94
95
96
97
# find the R binary
cmake_minimum_required (VERSION 3.0)
project(FIMS-CMake)
MESSAGE("generating make files for ${CMAKE_PROJECT_NAME}")
MESSAGE(STATUS "Looking for R executable")
EXECUTE_PROCESS(
COMMAND which R
OUTPUT_VARIABLE R_EXECUTABLE)
MESSAGE(STATUS "R_EXECUTABLE is ${R_EXECUTABLE}")
EXECUTE_PROCESS(
COMMAND R "--slave" "--no-save" "-e" "cat(R.home())"
OUTPUT_VARIABLE R_HOME)
MESSAGE(STATUS "R_HOME is ${R_HOME}")
SET(R_INCLUDE ${R_HOME}/include)
include_directories("${R_INCLUDE}")
SET(R_LIB ${R_HOME}/lib/libR)
#link_directories(${R_LIB}/lib)
#set TMB home
SET(TMB_HOME ${R_HOME}/library/TMB)
MESSAGE(STATUS "TMB_HOME is ${TMB_HOME}")
SET(TMB_INCLUDE ${TMB_HOME}/include)
find_library(_LIB_TMB
NAMES TMB.so
PATHS ${TMB_HOME}/libs
NO_CACHE
REQUIRED)
#link_directories(${TMB_HOME}/lib/TMB.so)
MESSAGE(STATUS "TMB_INCLUDE is ${TMB_INCLUDE}")
MESSAGE(STATUS "_LIB_TMB is ${_LIB_TMB}")
include_directories("${TMB_INCLUDE}")
#set Rcpp home
SET(RCPP_HOME ${R_HOME}/library/Rcpp)
SET(RCPP_INCLUDE ${RCPP_HOME}/include)
#link_directories(${R_HOME}/library/Rcpp/lib)
find_library(_LIB_RCPP
NAMES Rcpp.so
PATHS ${RCPP_HOME}/libs
NO_CACHE
REQUIRED)
MESSAGE(STATUS "RCPP_INCLUDE is ${RCPP_INCLUDE}")
MESSAGE(STATUS "R_LIB is ${R_LIB}")
MESSAGE(STATUS "_LIB_RCPP is ${_LIB_RCPP}")
include_directories("${RCPP_INCLUDE}")
link_directories(${TMB_HOME}/libs)
link_directories(${RCPP_HOME}/libs)
link_directories(${R_HOME}/lib)
#target_link_options(TARGETS PRIVATE "-L${_LIB_RCPP}")
#set Eigen home
SET(EIGEN_HOME ${R_HOME}/library/RcppEigen)
MESSAGE(STATUS "EIGEN_HOME is ${EIGEN_HOME}")
SET(EIGEN_INCLUDE ${EIGEN_HOME}/include)
MESSAGE(STATUS "EIGEN_INCLUDE is ${EIGEN_INCLUDE}")
include_directories("${EIGEN_INCLUDE}")
include(GenerateExportHeader)
include_directories("${CMAKE_CURRENT_BINARY_DIR}") # tmb_objective_functioncpp_export.h
add_library(FIMSCmake SHARED src/tmb_objective_function.cpp)
generate_export_header(FIMSCmake)
install(TARGETS FIMSCmake DESTINATION lib)
target_link_libraries(FIMSCmake R)