-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
made things a bit more modular (qtlua can now compile standalone)
- Loading branch information
Showing
9 changed files
with
226 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# - Find lua | ||
# this module looks for Lua | ||
# | ||
# LUA_EXECUTABLE - the full path to lua | ||
# LUA_LIBRARIES - the lua shared library | ||
# LUA_INCLUDE_DIR - directory for lua includes | ||
# LUA_PACKAGE_PATH - where Lua searches for Lua packages | ||
# LUA_PACKAGE_CPATH - where Lua searches for library packages | ||
# LUA_FOUND - If false, don't attempt to use lua. | ||
|
||
FIND_PROGRAM(LUA_EXECUTABLE | ||
lua | ||
PATH) | ||
|
||
IF(LUA_EXECUTABLE) | ||
GET_FILENAME_COMPONENT(LUA_DIR ${LUA_EXECUTABLE} PATH) | ||
ENDIF(LUA_EXECUTABLE) | ||
|
||
FIND_LIBRARY(LUA_LIBRARIES | ||
NAMES lua liblua | ||
PATHS ${LUA_DIR}/../lib | ||
${LUA_DIR} | ||
NO_DEFAULT_PATH) | ||
|
||
FIND_PATH(LUA_INCLUDE_DIR lua.h | ||
${LUA_DIR}/../include/ | ||
NO_DEFAULT_PATH) | ||
|
||
SET(LUA_PACKAGE_PATH "${LUA_DIR}/../share/lua/5.1" CACHE PATH "where Lua searches for Lua packages") | ||
SET(LUA_PACKAGE_CPATH "${LUA_DIR}/../lib/lua/5.1" CACHE PATH "where Lua searches for library packages") | ||
|
||
MARK_AS_ADVANCED( | ||
LUA_EXECUTABLE | ||
LUA_LIBRARIES | ||
LUA_INCLUDE_DIR | ||
LUA_PACKAGE_PATH | ||
LUA_PACKAGE_CPATH | ||
) | ||
|
||
IF(LUA_EXECUTABLE) | ||
IF(LUA_LIBRARIES) | ||
IF(LUA_INCLUDE_DIR) | ||
SET(LUA_FOUND 1) | ||
ENDIF(LUA_INCLUDE_DIR) | ||
ENDIF(LUA_LIBRARIES) | ||
ENDIF(LUA_EXECUTABLE) | ||
|
||
IF (NOT LUA_FOUND AND Lua_FIND_REQUIRED) | ||
MESSAGE(FATAL_ERROR "Could not find Lua") | ||
ENDIF (NOT LUA_FOUND AND Lua_FIND_REQUIRED) | ||
|
||
IF(NOT Lua_FIND_QUIETLY) | ||
IF(LUA_FOUND) | ||
MESSAGE(STATUS "Lua found ${LUA_EXECUTABLE}") | ||
ELSE(LUA_FOUND) | ||
MESSAGE(STATUS "Lua not found. Please specify location") | ||
ENDIF(LUA_FOUND) | ||
ENDIF(NOT Lua_FIND_QUIETLY) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
SET(QtLua_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}) | ||
|
||
SET(QtLua_INSTALL_BIN_SUBDIR "bin" CACHE PATH | ||
"Install dir for binaries (relative to QtLua_INSTALL_PREFIX)") | ||
|
||
SET(QtLua_INSTALL_LIB_SUBDIR "lib" CACHE PATH | ||
"Install dir for archives (relative to QtLua_INSTALL_PREFIX)") | ||
|
||
SET(QtLua_INSTALL_INCLUDE_SUBDIR "include" CACHE PATH | ||
"Install dir for include (relative to QtLua_INSTALL_PREFIX)") | ||
|
||
SET(QtLua_INSTALL_CMAKE_SUBDIR "share/lua/cmake" CACHE PATH | ||
"Install dir for .cmake files (relative to QtLua_INSTALL_PREFIX)") | ||
|
||
SET(QtLua_INSTALL_LUA_PATH_SUBDIR "share/lua/5.1" CACHE PATH | ||
"Install dir for QtLua packages files (relative to QtLua_INSTALL_PREFIX)") | ||
|
||
SET(QtLua_INSTALL_LUA_CPATH_SUBDIR "lib/lua/5.1" CACHE PATH | ||
"Install dir for QtLua C packages files (relative to QtLua_INSTALL_PREFIX)") | ||
|
||
SET(QtLua_INSTALL_FINDLUA_DIR "${QtLua_BINARY_DIR}/cmake") | ||
SET(QtLua_INSTALL_BIN "${QtLua_INSTALL_PREFIX}/${QtLua_INSTALL_BIN_SUBDIR}") | ||
SET(QtLua_INSTALL_LIB "${QtLua_INSTALL_PREFIX}/${QtLua_INSTALL_LIB_SUBDIR}") | ||
SET(QtLua_INSTALL_INCLUDE "${QtLua_INSTALL_PREFIX}/${QtLua_INSTALL_INCLUDE_SUBDIR}") | ||
SET(QtLua_INSTALL_CMAKE "${QtLua_INSTALL_PREFIX}/${QtLua_INSTALL_CMAKE_SUBDIR}") | ||
SET(QtLua_INSTALL_LUA_PATH "${QtLua_INSTALL_PREFIX}/${QtLua_INSTALL_LUA_PATH_SUBDIR}") | ||
SET(QtLua_INSTALL_LUA_CPATH "${QtLua_INSTALL_PREFIX}/${QtLua_INSTALL_LUA_CPATH_SUBDIR}") | ||
|
||
# reverse relative path to prefix (ridbus is the palindrom of subdir) | ||
FILE(RELATIVE_PATH QtLua_INSTALL_BIN_RIDBUS "${QtLua_INSTALL_BIN}" "${QtLua_INSTALL_PREFIX}/.") | ||
FILE(RELATIVE_PATH QtLua_INSTALL_CMAKE_RIDBUS "${QtLua_INSTALL_CMAKE}" "${QtLua_INSTALL_PREFIX}/.") | ||
GET_FILENAME_COMPONENT(QtLua_INSTALL_BIN_RIDBUS "${QtLua_INSTALL_BIN_RIDBUS}" PATH) | ||
GET_FILENAME_COMPONENT(QtLua_INSTALL_CMAKE_RIDBUS "${QtLua_INSTALL_CMAKE_RIDBUS}" PATH) | ||
|
||
IF(UNIX) | ||
OPTION(QtLua_BUILD_WITH_RPATH "Build libraries with rpaths" ON) | ||
|
||
IF(QtLua_BUILD_WITH_RPATH) | ||
SET(CMAKE_SKIP_BUILD_RPATH FALSE) | ||
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) | ||
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) | ||
FILE(RELATIVE_PATH QtLua_INSTALL_BIN2LIB | ||
"${QtLua_INSTALL_BIN}" "${QtLua_INSTALL_LIB}") | ||
FILE(RELATIVE_PATH QtLua_INSTALL_BIN2CPATH | ||
"${QtLua_INSTALL_BIN}" "${QtLua_INSTALL_LUA_CPATH}") | ||
IF(NOT APPLE) | ||
OPTION(WITH_DYNAMIC_RPATH | ||
"Build libraries with executable relative rpaths (\$ORIGIN)" ON ) | ||
ENDIF(NOT APPLE) | ||
IF (WITH_DYNAMIC_RPATH OR APPLE) | ||
SET(CMAKE_INSTALL_RPATH "\$ORIGIN/${QtLua_INSTALL_BIN2LIB}") | ||
ELSE (WITH_DYNAMIC_RPATH OR APPLE) | ||
SET(CMAKE_INSTALL_RPATH "${QtLua_INSTALL_LIB}") | ||
ENDIF (WITH_DYNAMIC_RPATH OR APPLE) | ||
SET(CMAKE_INSTALL_NAME_DIR "@executable_path/${QtLua_INSTALL_BIN2LIB}") | ||
ENDIF(QtLua_BUILD_WITH_RPATH) | ||
|
||
ENDIF(UNIX) | ||
|
||
IF (WIN32) | ||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") | ||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") | ||
ENDIF (WIN32) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,20 @@ | ||
# -*- cmake -*- | ||
|
||
INCLUDE_DIRECTORIES("${Torch_SOURCE_DIR}/lib/TH") | ||
INCLUDE_DIRECTORIES("${Torch_SOURCE_DIR}/lib/luaT") | ||
INCLUDE_DIRECTORIES(".") | ||
INCLUDE(${QT_USE_FILE}) | ||
IF(Torch_SOURCE_DIR) | ||
|
||
SET(qttorch_SRC qttorch.h qttorch.cpp) | ||
INCLUDE_DIRECTORIES("${Torch_SOURCE_DIR}/lib/TH") | ||
INCLUDE_DIRECTORIES("${Torch_SOURCE_DIR}/lib/luaT") | ||
INCLUDE_DIRECTORIES(".") | ||
INCLUDE(${QT_USE_FILE}) | ||
|
||
SET(qttorch_SRC qttorch.h qttorch.cpp) | ||
|
||
MACRO_INSTALL_QTLUA_FILES(qttorch init.lua) | ||
|
||
MACRO_ADD_QTLUA_MODULE(libqttorch ${qttorch_SRC}) | ||
|
||
TARGET_LINK_LIBRARIES(libqttorch luaT TH) | ||
|
||
ADD_TORCH_DOK(dok qttorch "QT Interface" "Torch Tensor interface" 6.) | ||
|
||
MACRO_INSTALL_QTLUA_FILES(qttorch init.lua) | ||
|
||
MACRO_ADD_QTLUA_MODULE(libqttorch ${qttorch_SRC}) | ||
|
||
TARGET_LINK_LIBRARIES(libqttorch luaT TH) | ||
|
||
ADD_TORCH_DOK(dok qttorch "QT Interface" "Torch Tensor interface" 6.) | ||
ENDIF(Torch_SOURCE_DIR) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.