382
|
1 if (STATIC_BUILD OR NOT USE_DYNAMIC_LUA)
|
|
2 SET(LUA_SOURCES_DIR ${CMAKE_BINARY_DIR}/lua-5.1.5)
|
|
3 DownloadPackage("http://www.montefiore.ulg.ac.be/~jodogne/Orthanc/ThirdPartyDownloads/lua-5.1.5.tar.gz" "${LUA_SOURCES_DIR}" "" "")
|
|
4
|
|
5 add_definitions(
|
384
|
6 #-DLUA_LIB=1
|
|
7 #-Dluaall_c=1
|
|
8 #-DLUA_COMPAT_ALL=1 # Compile a generic version of Lua
|
382
|
9 )
|
|
10
|
|
11 include_directories(
|
|
12 ${LUA_SOURCES_DIR}/src
|
|
13 )
|
|
14
|
|
15 set(LUA_SOURCES
|
|
16 # Core Lua
|
|
17 ${LUA_SOURCES_DIR}/src/lapi.c
|
|
18 ${LUA_SOURCES_DIR}/src/lcode.c
|
|
19 ${LUA_SOURCES_DIR}/src/ldebug.c
|
|
20 ${LUA_SOURCES_DIR}/src/ldo.c
|
|
21 ${LUA_SOURCES_DIR}/src/ldump.c
|
|
22 ${LUA_SOURCES_DIR}/src/lfunc.c
|
|
23 ${LUA_SOURCES_DIR}/src/lgc.c
|
|
24 ${LUA_SOURCES_DIR}/src/llex.c
|
|
25 ${LUA_SOURCES_DIR}/src/lmem.c
|
|
26 ${LUA_SOURCES_DIR}/src/lobject.c
|
|
27 ${LUA_SOURCES_DIR}/src/lopcodes.c
|
|
28 ${LUA_SOURCES_DIR}/src/lparser.c
|
|
29 ${LUA_SOURCES_DIR}/src/lstate.c
|
|
30 ${LUA_SOURCES_DIR}/src/lstring.c
|
|
31 ${LUA_SOURCES_DIR}/src/ltable.c
|
|
32 ${LUA_SOURCES_DIR}/src/ltm.c
|
|
33 ${LUA_SOURCES_DIR}/src/lundump.c
|
|
34 ${LUA_SOURCES_DIR}/src/lvm.c
|
|
35 ${LUA_SOURCES_DIR}/src/lzio.c
|
|
36
|
384
|
37 # Base Lua modules
|
|
38 ${LUA_SOURCES_DIR}/src/lauxlib.c
|
|
39 ${LUA_SOURCES_DIR}/src/lbaselib.c
|
|
40 ${LUA_SOURCES_DIR}/src/ldblib.c
|
|
41 ${LUA_SOURCES_DIR}/src/liolib.c
|
|
42 ${LUA_SOURCES_DIR}/src/lmathlib.c
|
|
43 ${LUA_SOURCES_DIR}/src/loslib.c
|
|
44 ${LUA_SOURCES_DIR}/src/ltablib.c
|
382
|
45 ${LUA_SOURCES_DIR}/src/lstrlib.c
|
384
|
46 ${LUA_SOURCES_DIR}/src/loadlib.c
|
|
47 ${LUA_SOURCES_DIR}/src/linit.c
|
382
|
48 )
|
|
49
|
|
50 add_library(Lua STATIC ${LUA_SOURCES})
|
|
51 link_libraries(Lua)
|
|
52
|
|
53 source_group(ThirdParty\\Lua REGULAR_EXPRESSION ${LUA_SOURCES_DIR}/.*)
|
|
54
|
|
55 else()
|
|
56 CHECK_INCLUDE_FILE_CXX(lua.h HAVE_LUA_H)
|
|
57 if (NOT HAVE_LUA_H)
|
|
58 message(FATAL_ERROR "Please install the liblua-dev package")
|
|
59 endif()
|
|
60
|
|
61 CHECK_LIBRARY_EXISTS(lua "lua_pcall" HAVE_LUA_LIB)
|
|
62 if (NOT HAVE_LUA_LIB)
|
|
63 message(FATAL_ERROR "Please install the liblua-dev package")
|
|
64 endif()
|
|
65
|
|
66 link_libraries(lua)
|
|
67 endif()
|