File tree Expand file tree Collapse file tree 3 files changed +25
-8
lines changed
Expand file tree Collapse file tree 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)
22
33project (tensorflow-predictor-cpp)
44
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} " )
614
715message (STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER} " )
816message (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
118118The output value may be different.
119119
120120# 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.
126122
127123
Original file line number Diff line number Diff line change @@ -12,15 +12,28 @@ include_directories(
1212
1313link_directories (
1414 ${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 ()
1727
1828set (DEEP_CTR_LINKER_LIBS "" )
1929list (APPEND DEEP_CTR_LINKER_LIBS
2030 libtensorflow-core.a
2131 libprotobuf.a
2232 ${PROJECT_SOURCE_DIR} /../tensorflow/tensorflow/contrib/makefile/downloads/nsync/builds/default.macos.c++11/nsync.a
2333 pthread m z)
34+ if (LINUX)
35+ list (APPEND DEEP_CTR_LINKER_LIBS dl)
36+ endif ()
2437
2538# executable
2639set (SIMPLE_MODEL "simple_model.bin" )
You can’t perform that action at this time.
0 commit comments