File tree 3 files changed +25
-8
lines changed
3 files changed +25
-8
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,15 @@ cmake_minimum_required(VERSION 2.8)
2
2
3
3
project (tensorflow-predictor-cpp)
4
4
5
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -msse4.1 -fPIC -O3 -ggdb -Wall -finline-functions -undefined dynamic_lookup -all_load" )
5
+ if (UNIX AND NOT APPLE )
6
+ set (LINUX TRUE )
7
+ endif ()
8
+ if (LINUX)
9
+ SET (LDFLAGS "-std=c++11 -msse4.1 -fPIC -O3 -ggdb -Wall -finline-functions -Wl,--allow-multiple-definition -Wl,--whole-archive" )
10
+ else ()
11
+ SET (LDFLAGS "-std=c++11 -msse4.1 -fPIC -O3 -ggdb -Wall -finline-functions -undefined dynamic_lookup -all_load" )
12
+ endif ()
13
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LDFLAGS} " )
6
14
7
15
message (STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER} " )
8
16
message (STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS} " )
Original file line number Diff line number Diff line change @@ -118,10 +118,6 @@ output value: 0.0553177
118
118
The output value may be different.
119
119
120
120
# Build on Linux
121
- The procedure is similar with that of OSX except for you should change those configuration.
122
- * remove ` -undefined dynamic_lookup -all_load ` in ` CMakeLists.txt `
123
- * add ` -Wl,--allow-multiple-definition -Wl,--whole-archive ` in ` CMakeLists.txt `
124
- * change ` default.macos.c++11 ` to ` default.linux.c++11 ` in ` src/CMakeLists.txt `
125
- * append ` dl ` to ` list(APPEND DEEP_CTR_LINKER_LIBS) ` in ` src/CMakeLists.txt `
121
+ The procedure is similar with that of OSX.
126
122
127
123
Original file line number Diff line number Diff line change @@ -12,15 +12,28 @@ include_directories(
12
12
13
13
link_directories (
14
14
${PROJECT_SOURCE_DIR} /../tensorflow/tensorflow/contrib/makefile/gen/lib
15
- ${PROJECT_SOURCE_DIR} /../tensorflow/tensorflow/contrib/makefile/gen/protobuf-host/lib
16
- ${PROJECT_SOURCE_DIR} /../tensorflow/tensorflow/contrib/makefile/downloads/nsync/builds/default.macos.c++11)
15
+ ${PROJECT_SOURCE_DIR} /../tensorflow/tensorflow/contrib/makefile/gen/protobuf-host/lib)
16
+
17
+ if (UNIX AND NOT APPLE )
18
+ set (LINUX TRUE )
19
+ endif ()
20
+ if (LINUX)
21
+ link_directories (
22
+ ${PROJECT_SOURCE_DIR} /../tensorflow/tensorflow/contrib/makefile/downloads/nsync/builds/default.linux.c++11)
23
+ else ()
24
+ link_directories (
25
+ ${PROJECT_SOURCE_DIR} /../tensorflow/tensorflow/contrib/makefile/downloads/nsync/builds/default.maxos.c++11)
26
+ endif ()
17
27
18
28
set (DEEP_CTR_LINKER_LIBS "" )
19
29
list (APPEND DEEP_CTR_LINKER_LIBS
20
30
libtensorflow-core.a
21
31
libprotobuf.a
22
32
${PROJECT_SOURCE_DIR} /../tensorflow/tensorflow/contrib/makefile/downloads/nsync/builds/default.macos.c++11/nsync.a
23
33
pthread m z)
34
+ if (LINUX)
35
+ list (APPEND DEEP_CTR_LINKER_LIBS dl)
36
+ endif ()
24
37
25
38
# executable
26
39
set (SIMPLE_MODEL "simple_model.bin" )
You can’t perform that action at this time.
0 commit comments