-
Notifications
You must be signed in to change notification settings - Fork 165
/
CMakeLists.txt
43 lines (30 loc) · 1.1 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
CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR)
CMAKE_POLICY(VERSION 2.6)
SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" "${CMAKE_MODULE_PATH}")
FIND_PACKAGE(Torch REQUIRED)
FIND_PACKAGE(Protobuf REQUIRED)
INCLUDE_DIRECTORIES("${Torch_INSTALL_INCLUDE}/TH" ${PROTOBUF_INCLUDE_DIRS})
LINK_DIRECTORIES("${Torch_INSTALL_LIB}")
PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS caffe.proto)
SET(src loadcaffe.cpp ${PROTO_SRCS})
FILE(GLOB luasrc *.lua)
IF(MSVC)
ADD_DEFINITIONS(/std:c++latest)
ADD_DEFINITIONS(/D_CRT_SECURE_NO_WARNINGS=1)
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
ELSE()
add_definitions(-std=c++11)
ENDIF()
ADD_LIBRARY(loadcaffe MODULE ${src})
TARGET_LINK_LIBRARIES(loadcaffe TH ${PROTOBUF_LIBRARIES})
### Torch packages supposes libraries prefix is "lib"
SET_TARGET_PROPERTIES(loadcaffe PROPERTIES
PREFIX "lib"
IMPORT_PREFIX "lib")
INSTALL(TARGETS loadcaffe
RUNTIME DESTINATION "${Torch_INSTALL_LUA_CPATH_SUBDIR}"
LIBRARY DESTINATION "${Torch_INSTALL_LUA_CPATH_SUBDIR}")
INSTALL(
FILES
${luasrc}
DESTINATION "${Torch_INSTALL_LUA_PATH_SUBDIR}/loadcaffe")