Mercurial > hg > orthanc
annotate Resources/CMake/LuaConfiguration.cmake @ 4033:0763630a42ef
removing HAS_EMBEDDED_RESOURCES
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 09 Jun 2020 21:45:54 +0200 |
parents | a3e38994d95a |
children |
rev | line source |
---|---|
735 | 1 if (STATIC_BUILD OR NOT USE_SYSTEM_LUA) |
2947 | 2 SET(LUA_SOURCES_DIR ${CMAKE_BINARY_DIR}/lua-5.3.5) |
3 SET(LUA_MD5 "4f4b4f323fd3514a68e0ab3da8ce3455") | |
3133
0c2a8d5e0097
moving third-party dependencies to another server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2947
diff
changeset
|
4 SET(LUA_URL "http://orthanc.osimis.io/ThirdPartyDownloads/lua-5.3.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 |
2947 | 21 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR |
22 ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD") | |
23 add_definitions(-DLUA_USE_LINUX=1) | |
24 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") | |
25 add_definitions( | |
26 -DLUA_USE_LINUX=1 | |
27 -DLUA_USE_READLINE=1 | |
28 ) | |
29 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD") | |
30 add_definitions(-DLUA_USE_POSIX=1) | |
31 endif() | |
32 | |
2478
1e2d5e14b3d3
New CMake option: ENABLE_LUA_MODULES to enable Lua modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2477
diff
changeset
|
33 elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") |
2947 | 34 add_definitions( |
35 -DLUA_DL_DLL=1 # Enable loading of shared libraries (for Microsoft Windows) | |
36 ) | |
2478
1e2d5e14b3d3
New CMake option: ENABLE_LUA_MODULES to enable Lua modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2477
diff
changeset
|
37 |
1e2d5e14b3d3
New CMake option: ENABLE_LUA_MODULES to enable Lua modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2477
diff
changeset
|
38 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") |
2947 | 39 add_definitions( |
40 -DLUA_USE_MACOSX=1 | |
41 -DLUA_DL_DYLD=1 # Enable loading of shared libraries (for Apple OS X) | |
42 ) | |
2478
1e2d5e14b3d3
New CMake option: ENABLE_LUA_MODULES to enable Lua modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2477
diff
changeset
|
43 |
1e2d5e14b3d3
New CMake option: ENABLE_LUA_MODULES to enable Lua modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2477
diff
changeset
|
44 else() |
1e2d5e14b3d3
New CMake option: ENABLE_LUA_MODULES to enable Lua modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2477
diff
changeset
|
45 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
|
46 endif() |
2477 | 47 endif() |
735 | 48 |
2947 | 49 add_definitions( |
50 -DLUA_COMPAT_5_2=1 | |
51 ) | |
52 | |
735 | 53 include_directories( |
54 ${LUA_SOURCES_DIR}/src | |
55 ) | |
56 | |
57 set(LUA_SOURCES | |
2947 | 58 # Don't compile the Lua command-line |
59 #${LUA_SOURCES_DIR}/src/lua.c | |
60 #${LUA_SOURCES_DIR}/src/luac.c | |
61 | |
735 | 62 # Core Lua |
63 ${LUA_SOURCES_DIR}/src/lapi.c | |
2947 | 64 ${LUA_SOURCES_DIR}/src/lcode.c |
65 ${LUA_SOURCES_DIR}/src/lctype.c | |
66 ${LUA_SOURCES_DIR}/src/ldebug.c | |
67 ${LUA_SOURCES_DIR}/src/ldo.c | |
68 ${LUA_SOURCES_DIR}/src/ldump.c | |
69 ${LUA_SOURCES_DIR}/src/lfunc.c | |
735 | 70 ${LUA_SOURCES_DIR}/src/lgc.c |
71 ${LUA_SOURCES_DIR}/src/llex.c | |
2947 | 72 ${LUA_SOURCES_DIR}/src/lmem.c |
73 ${LUA_SOURCES_DIR}/src/lobject.c | |
74 ${LUA_SOURCES_DIR}/src/lopcodes.c | |
735 | 75 ${LUA_SOURCES_DIR}/src/lparser.c |
2947 | 76 ${LUA_SOURCES_DIR}/src/lstate.c |
735 | 77 ${LUA_SOURCES_DIR}/src/lstring.c |
78 ${LUA_SOURCES_DIR}/src/ltable.c | |
79 ${LUA_SOURCES_DIR}/src/ltm.c | |
2947 | 80 ${LUA_SOURCES_DIR}/src/lundump.c |
81 ${LUA_SOURCES_DIR}/src/lvm.c | |
735 | 82 ${LUA_SOURCES_DIR}/src/lzio.c |
83 | |
84 # Base Lua modules | |
85 ${LUA_SOURCES_DIR}/src/lauxlib.c | |
86 ${LUA_SOURCES_DIR}/src/lbaselib.c | |
2947 | 87 ${LUA_SOURCES_DIR}/src/lbitlib.c |
88 ${LUA_SOURCES_DIR}/src/lcorolib.c | |
735 | 89 ${LUA_SOURCES_DIR}/src/ldblib.c |
90 ${LUA_SOURCES_DIR}/src/liolib.c | |
91 ${LUA_SOURCES_DIR}/src/lmathlib.c | |
2947 | 92 ${LUA_SOURCES_DIR}/src/loadlib.c |
735 | 93 ${LUA_SOURCES_DIR}/src/loslib.c |
2947 | 94 ${LUA_SOURCES_DIR}/src/lstrlib.c |
735 | 95 ${LUA_SOURCES_DIR}/src/ltablib.c |
2947 | 96 ${LUA_SOURCES_DIR}/src/lutf8lib.c |
97 | |
735 | 98 ${LUA_SOURCES_DIR}/src/linit.c |
99 ) | |
100 | |
101 source_group(ThirdParty\\Lua REGULAR_EXPRESSION ${LUA_SOURCES_DIR}/.*) | |
102 | |
3833
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3336
diff
changeset
|
103 elseif (CMAKE_CROSSCOMPILING AND |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3336
diff
changeset
|
104 "${CMAKE_SYSTEM_VERSION}" STREQUAL "CrossToolNg") |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3336
diff
changeset
|
105 |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3336
diff
changeset
|
106 set(LUA_VERSIONS 5.3 5.2 5.1) |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3336
diff
changeset
|
107 |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3336
diff
changeset
|
108 unset(LUA_VERSION) |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3336
diff
changeset
|
109 foreach(version IN ITEMS ${LUA_VERSIONS}) |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3336
diff
changeset
|
110 CHECK_INCLUDE_FILE(lua${version}/lua.h HAVE_LUA${version}_H) |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3336
diff
changeset
|
111 if (HAVE_LUA${version}_H) |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3336
diff
changeset
|
112 set(LUA_VERSION ${version}) |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3336
diff
changeset
|
113 break() |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3336
diff
changeset
|
114 endif() |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3336
diff
changeset
|
115 endforeach() |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3336
diff
changeset
|
116 |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3336
diff
changeset
|
117 if (NOT LUA_VERSION) |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3336
diff
changeset
|
118 message(FATAL_ERROR "Please install the liblua-dev package") |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3336
diff
changeset
|
119 endif() |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3336
diff
changeset
|
120 |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3336
diff
changeset
|
121 CHECK_LIBRARY_EXISTS(lua${LUA_VERSION} "lua_call" "${LUA_LIB_DIR}" HAVE_LUA_LIB) |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3336
diff
changeset
|
122 if (NOT HAVE_LUA_LIB) |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3336
diff
changeset
|
123 message(FATAL_ERROR "Please install the liblua package") |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3336
diff
changeset
|
124 endif() |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3336
diff
changeset
|
125 |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3336
diff
changeset
|
126 include_directories(${CROSSTOOL_NG_IMAGE}/usr/include/lua${LUA_VERSION}) |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3336
diff
changeset
|
127 link_libraries(lua${LUA_VERSION}) |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3336
diff
changeset
|
128 |
735 | 129 else() |
3336
01905b67f8b5
drop specific version of lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
130 include(FindLua) |
735 | 131 |
3336
01905b67f8b5
drop specific version of lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
132 if (NOT LUA_FOUND) |
735 | 133 message(FATAL_ERROR "Please install the liblua-dev package") |
134 endif() | |
135 | |
136 include_directories(${LUA_INCLUDE_DIR}) | |
137 link_libraries(${LUA_LIBRARIES}) | |
138 endif() |