Mercurial > hg > orthanc
annotate Resources/CMake/LuaConfiguration.cmake @ 2833:afb581263e1d Orthanc-1.4.2
set version
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 20 Sep 2018 13:28:18 +0200 |
parents | 1e2d5e14b3d3 |
children | 11f8d72f366f |
rev | line source |
---|---|
735 | 1 if (STATIC_BUILD OR NOT USE_SYSTEM_LUA) |
2 SET(LUA_SOURCES_DIR ${CMAKE_BINARY_DIR}/lua-5.1.5) | |
1537
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1487
diff
changeset
|
3 SET(LUA_MD5 "2e115fe26e435e33b0d5c022e4490567") |
2384 | 4 SET(LUA_URL "http://www.orthanc-server.com/downloads/third-party/lua-5.1.5.tar.gz") |
1537
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1487
diff
changeset
|
5 |
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1487
diff
changeset
|
6 DownloadPackage(${LUA_MD5} ${LUA_URL} "${LUA_SOURCES_DIR}") |
735 | 7 |
2478
1e2d5e14b3d3
New CMake option: ENABLE_LUA_MODULES to enable Lua modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2477
diff
changeset
|
8 if (ENABLE_LUA_MODULES) |
1e2d5e14b3d3
New CMake option: ENABLE_LUA_MODULES to enable Lua modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2477
diff
changeset
|
9 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR |
1e2d5e14b3d3
New CMake option: ENABLE_LUA_MODULES to enable Lua modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2477
diff
changeset
|
10 ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD" OR |
1e2d5e14b3d3
New CMake option: ENABLE_LUA_MODULES to enable Lua modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2477
diff
changeset
|
11 ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR |
1e2d5e14b3d3
New CMake option: ENABLE_LUA_MODULES to enable Lua modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2477
diff
changeset
|
12 ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD") |
1e2d5e14b3d3
New CMake option: ENABLE_LUA_MODULES to enable Lua modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2477
diff
changeset
|
13 # Enable loading of shared libraries (for UNIX-like) |
1e2d5e14b3d3
New CMake option: ENABLE_LUA_MODULES to enable Lua modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2477
diff
changeset
|
14 add_definitions(-DLUA_USE_DLOPEN=1) |
1e2d5e14b3d3
New CMake option: ENABLE_LUA_MODULES to enable Lua modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2477
diff
changeset
|
15 |
1e2d5e14b3d3
New CMake option: ENABLE_LUA_MODULES to enable Lua modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2477
diff
changeset
|
16 # Publish the functions of the Lua engine (that are built within |
1e2d5e14b3d3
New CMake option: ENABLE_LUA_MODULES to enable Lua modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2477
diff
changeset
|
17 # the Orthanc binary) as global symbols, so that the external |
1e2d5e14b3d3
New CMake option: ENABLE_LUA_MODULES to enable Lua modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2477
diff
changeset
|
18 # shared libraries can call them |
1e2d5e14b3d3
New CMake option: ENABLE_LUA_MODULES to enable Lua modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2477
diff
changeset
|
19 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--export-dynamic") |
1e2d5e14b3d3
New CMake option: ENABLE_LUA_MODULES to enable Lua modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2477
diff
changeset
|
20 |
1e2d5e14b3d3
New CMake option: ENABLE_LUA_MODULES to enable Lua modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2477
diff
changeset
|
21 elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") |
1e2d5e14b3d3
New CMake option: ENABLE_LUA_MODULES to enable Lua modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2477
diff
changeset
|
22 add_definitions(-DLUA_DL_DLL=1) # Enable loading of shared libraries (for Microsoft Windows) |
1e2d5e14b3d3
New CMake option: ENABLE_LUA_MODULES to enable Lua modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2477
diff
changeset
|
23 |
1e2d5e14b3d3
New CMake option: ENABLE_LUA_MODULES to enable Lua modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2477
diff
changeset
|
24 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") |
1e2d5e14b3d3
New CMake option: ENABLE_LUA_MODULES to enable Lua modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2477
diff
changeset
|
25 add_definitions(-LUA_DL_DYLD=1) # Enable loading of shared libraries (for Apple OS X) |
1e2d5e14b3d3
New CMake option: ENABLE_LUA_MODULES to enable Lua modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2477
diff
changeset
|
26 |
1e2d5e14b3d3
New CMake option: ENABLE_LUA_MODULES to enable Lua modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2477
diff
changeset
|
27 else() |
1e2d5e14b3d3
New CMake option: ENABLE_LUA_MODULES to enable Lua modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2477
diff
changeset
|
28 message(FATAL_ERROR "Support your platform here") |
1e2d5e14b3d3
New CMake option: ENABLE_LUA_MODULES to enable Lua modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2477
diff
changeset
|
29 endif() |
2477 | 30 endif() |
735 | 31 |
32 include_directories( | |
33 ${LUA_SOURCES_DIR}/src | |
34 ) | |
35 | |
36 set(LUA_SOURCES | |
37 # Core Lua | |
38 ${LUA_SOURCES_DIR}/src/lapi.c | |
39 ${LUA_SOURCES_DIR}/src/lcode.c | |
40 ${LUA_SOURCES_DIR}/src/ldebug.c | |
41 ${LUA_SOURCES_DIR}/src/ldo.c | |
42 ${LUA_SOURCES_DIR}/src/ldump.c | |
43 ${LUA_SOURCES_DIR}/src/lfunc.c | |
44 ${LUA_SOURCES_DIR}/src/lgc.c | |
45 ${LUA_SOURCES_DIR}/src/llex.c | |
46 ${LUA_SOURCES_DIR}/src/lmem.c | |
47 ${LUA_SOURCES_DIR}/src/lobject.c | |
48 ${LUA_SOURCES_DIR}/src/lopcodes.c | |
49 ${LUA_SOURCES_DIR}/src/lparser.c | |
50 ${LUA_SOURCES_DIR}/src/lstate.c | |
51 ${LUA_SOURCES_DIR}/src/lstring.c | |
52 ${LUA_SOURCES_DIR}/src/ltable.c | |
53 ${LUA_SOURCES_DIR}/src/ltm.c | |
54 ${LUA_SOURCES_DIR}/src/lundump.c | |
55 ${LUA_SOURCES_DIR}/src/lvm.c | |
56 ${LUA_SOURCES_DIR}/src/lzio.c | |
57 | |
58 # Base Lua modules | |
59 ${LUA_SOURCES_DIR}/src/lauxlib.c | |
60 ${LUA_SOURCES_DIR}/src/lbaselib.c | |
61 ${LUA_SOURCES_DIR}/src/ldblib.c | |
62 ${LUA_SOURCES_DIR}/src/liolib.c | |
63 ${LUA_SOURCES_DIR}/src/lmathlib.c | |
64 ${LUA_SOURCES_DIR}/src/loslib.c | |
65 ${LUA_SOURCES_DIR}/src/ltablib.c | |
66 ${LUA_SOURCES_DIR}/src/lstrlib.c | |
67 ${LUA_SOURCES_DIR}/src/loadlib.c | |
68 ${LUA_SOURCES_DIR}/src/linit.c | |
69 ) | |
70 | |
71 source_group(ThirdParty\\Lua REGULAR_EXPRESSION ${LUA_SOURCES_DIR}/.*) | |
72 | |
73 else() | |
74 include(FindLua51) | |
75 | |
76 if (NOT LUA51_FOUND) | |
77 message(FATAL_ERROR "Please install the liblua-dev package") | |
78 endif() | |
79 | |
80 include_directories(${LUA_INCLUDE_DIR}) | |
81 link_libraries(${LUA_LIBRARIES}) | |
82 endif() |