-
Notifications
You must be signed in to change notification settings - Fork 484
/
CMakeLists.txt
80 lines (71 loc) · 3.02 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
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
cmake_minimum_required(VERSION 2.8)
ADD_SUBDIRECTORY(exe)
# If this variable is defined, a pure cmake build is done end-to-end with no luarocks
IF (WITH_LUAROCKS STREQUAL OFF)
# LUA_INCDIR - place where lua headers exist
# LUA_LIBDIR - place where lua libraries exist
# LUADIR - LUA_PATH
# LIBDIR - LUA_CPATH
# LUALIB - the lua library to link against
IF (NOT DEFINED ${LUA_INCDIR})
SET(LUA_INCDIR ${CMAKE_INSTALL_PREFIX}/include)
MESSAGE(STATUS "LUA_INCDIR: ${LUA_INCDIR}")
ENDIF(NOT DEFINED ${LUA_INCDIR})
IF (NOT DEFINED ${LUA_LIBDIR})
SET(LUA_LIBDIR ${CMAKE_INSTALL_PREFIX}/lib)
MESSAGE(STATUS "LUA_LIBDIR: ${LUA_LIBDIR}")
ENDIF(NOT DEFINED ${LUA_LIBDIR})
IF (NOT DEFINED ${LUA_BINDIR})
SET(LUA_BINDIR ${CMAKE_INSTALL_PREFIX}/bin)
MESSAGE(STATUS "LUA_BINDIR: ${LUA_BINDIR}")
ENDIF(NOT DEFINED ${LUA_BINDIR})
IF (NOT DEFINED ${LUALIB})
IF (WITH_LUAJIT21 OR WITH_LUAJIT20)
SET(LUALIB ${LIBRARY_OUTPUT_PATH}/libluajit.so)
ELSE (WITH_LUAJIT21 OR WITH_LUAJIT20)
SET(LUALIB ${LIBRARY_OUTPUT_PATH}/liblua.so)
ENDIF (WITH_LUAJIT21 OR WITH_LUAJIT20)
MESSAGE(STATUS "LUALIB: ${LUALIB}")
ENDIF(NOT DEFINED ${LUALIB})
IF (NOT DEFINED ${LUADIR})
SET(LUADIR ${CMAKE_INSTALL_PREFIX}/${INSTALL_LUA_PATH_SUBDIR})
MESSAGE(STATUS "LUADIR: ${LUADIR}")
ENDIF(NOT DEFINED ${LUADIR})
IF (NOT DEFINED ${LIBDIR})
SET(LIBDIR ${CMAKE_INSTALL_PREFIX}/${INSTALL_LUA_CPATH_SUBDIR})
MESSAGE(STATUS "LIBDIR: ${LIBDIR}")
ENDIF(NOT DEFINED ${LIBDIR})
IF (NOT DEFINED ${LUA_BINDIR})
SET(LUA_BINDIR ${CMAKE_INSTALL_PREFIX}/bin)
MESSAGE(STATUS "LUA_BINDIR: ${LUA_BINDIR}")
ENDIF(NOT DEFINED ${LUA_BINDIR})
IF (NOT DEFINED ${SCRIPTS_DIR})
SET(SCRIPTS_DIR ${CMAKE_INSTALL_PREFIX}/bin)
MESSAGE(STATUS "SCRIPTS_DIR: ${SCRIPTS_DIR}")
ENDIF(NOT DEFINED ${SCRIPTS_DIR})
INCLUDE_DIRECTORIES(${LUA_INCDIR})
IF (WITH_LUAJIT21 OR WITH_LUAJIT20)
INCLUDE_DIRECTORIES(${LuaJIT_SOURCE_DIR}/src ${LuaJIT_BINARY_DIR})
SET(LUA "luajit")
ELSE (WITH_LUAJIT21 OR WITH_LUAJIT20)
INCLUDE_DIRECTORIES(${Lua_SOURCE_DIR}/src ${Lua_BINARY_DIR})
SET(LUA "lua")
ENDIF (WITH_LUAJIT21 OR WITH_LUAJIT20)
# add torch defs
# this is done to fake compliance with FIND_PACKAGE(Torch)
SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake"
"${CMAKE_CURRENT_BINARY_DIR}/cmake" "${CMAKE_MODULE_PATH}")
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/pkg/torch/lib/TH")
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}/pkg/torch/lib/TH")
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/pkg/torch/lib/luaT")
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}/pkg/torch/lib/luaT")
SET(Torch_INSTALL_INCLUDE_SUBDIR ${LUA_INCDIR})
SET(Torch_INSTALL_INCLUDE ${LUA_INCDIR})
SET(Torch_INSTALL_LUA_PATH_SUBDIR ${LUADIR})
SET(Torch_INSTALL_LUA_CPATH_SUBDIR ${LIBDIR})
SET(Torch_INSTALL_LIB ${LUA_LIBDIR})
SET(Torch_INSTALL_LIB_SUBDIR ${LUA_LIBDIR})
# Finally add the two directories
ADD_SUBDIRECTORY(pkg)
ADD_SUBDIRECTORY(extra)
ENDIF (WITH_LUAROCKS STREQUAL OFF)