Permalink
Browse files

provide install paths through require 'torch.paths'

  • Loading branch information...
1 parent afed565 commit eabbc20e9349e8ab6074e8a07c08e51dcf63bb89 @andresy andresy committed Jan 10, 2017
Showing with 14 additions and 1 deletion.
  1. +3 −1 CMakeLists.txt
  2. +11 −0 paths.lua.in
View
@@ -64,14 +64,16 @@ INCLUDE(TorchExports)
# Torch libraries
ADD_SUBDIRECTORY(lib)
+CONFIGURE_FILE(paths.lua.in "${CMAKE_CURRENT_BINARY_DIR}/paths.lua")
+
INCLUDE_DIRECTORIES(BEFORE "${LUA_INCDIR}")
INCLUDE_DIRECTORIES(BEFORE "${CMAKE_CURRENT_SOURCE_DIR}/lib/TH")
INCLUDE_DIRECTORIES(BEFORE "${CMAKE_CURRENT_BINARY_DIR}/lib/TH")
INCLUDE_DIRECTORIES(BEFORE "${CMAKE_CURRENT_SOURCE_DIR}/lib/luaT")
LINK_DIRECTORIES("${LUA_LIBDIR}")
SET(src DiskFile.c File.c MemoryFile.c PipeFile.c Storage.c Tensor.c Timer.c utils.c init.c TensorOperator.c TensorMath.c random.c Generator.c)
-SET(luasrc init.lua File.lua Tensor.lua CmdLine.lua FFI.lua Tester.lua TestSuite.lua test/test.lua)
+SET(luasrc init.lua File.lua Tensor.lua CmdLine.lua FFI.lua Tester.lua TestSuite.lua ${CMAKE_CURRENT_BINARY_DIR}/paths.lua test/test.lua)
# Necessary do generate wrapper
ADD_TORCH_WRAP(tensormathwrap TensorMath.lua)
View
@@ -0,0 +1,11 @@
+local paths = {}
+
+paths.install_prefix = [[@Torch_INSTALL_PREFIX@]]
+paths.install_bin = [[@Torch_INSTALL_BIN@]]
+paths.install_man = [[@Torch_INSTALL_MAN@]]
+paths.install_lib = [[@Torch_INSTALL_LIB@]]
+paths.install_share = [[@Torch_INSTALL_SHARE@]]
+paths.install_include = [[@Torch_INSTALL_INCLUDE@]]
+paths.install_cmake = [[@Torch_INSTALL_CMAKE@]]
+
+return paths

0 comments on commit eabbc20

Please sign in to comment.