annotate OrthancFramework/Resources/CMake/LuaConfiguration.cmake @ 5651:c4e33e0f907b

merge
author Alain Mazy <am@orthanc.team>
date Wed, 05 Jun 2024 11:04:37 +0200
parents f7adfb22e20e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4120
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
1 # Orthanc - A Lightweight, RESTful DICOM Store
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
2 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
3 # Department, University Hospital of Liege, Belgium
5640
f7adfb22e20e updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5485
diff changeset
4 # Copyright (C) 2017-2023 Osimis S.A., Belgium
f7adfb22e20e updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5485
diff changeset
5 # Copyright (C) 2024-2024 Orthanc Team SRL, Belgium
5485
48b8dae6dc77 upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5434
diff changeset
6 # Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
4120
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
7 #
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
8 # This program is free software: you can redistribute it and/or
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
9 # modify it under the terms of the GNU Lesser General Public License
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
10 # as published by the Free Software Foundation, either version 3 of
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
11 # the License, or (at your option) any later version.
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
12 #
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
13 # This program is distributed in the hope that it will be useful, but
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
16 # Lesser General Public License for more details.
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
17 #
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
18 # You should have received a copy of the GNU Lesser General Public
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
19 # License along with this program. If not, see
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
20 # <http://www.gnu.org/licenses/>.
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
21
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
22
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
23 if (STATIC_BUILD OR NOT USE_SYSTEM_LUA)
2947
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
24 SET(LUA_SOURCES_DIR ${CMAKE_BINARY_DIR}/lua-5.3.5)
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
25 SET(LUA_MD5 "4f4b4f323fd3514a68e0ab3da8ce3455")
5434
aa1c09fa6632 changed location of third-party downloads
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5271
diff changeset
26 SET(LUA_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/lua-5.3.5.tar.gz")
1537
fbf763bb1fa3 error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1487
diff changeset
27
fbf763bb1fa3 error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1487
diff changeset
28 DownloadPackage(${LUA_MD5} ${LUA_URL} "${LUA_SOURCES_DIR}")
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
29
2478
1e2d5e14b3d3 New CMake option: ENABLE_LUA_MODULES to enable Lua modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2477
diff changeset
30 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
31 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
32 ${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
33 ${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
34 ${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
35 # 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
36 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
37
1e2d5e14b3d3 New CMake option: ENABLE_LUA_MODULES to enable Lua modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2477
diff changeset
38 # 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
39 # 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
40 # 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
41 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
42
2947
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
43 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
44 ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD")
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
45 add_definitions(-DLUA_USE_LINUX=1)
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
46 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
47 add_definitions(
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
48 -DLUA_USE_LINUX=1
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
49 -DLUA_USE_READLINE=1
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
50 )
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
51 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
52 add_definitions(-DLUA_USE_POSIX=1)
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
53 endif()
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
54
2478
1e2d5e14b3d3 New CMake option: ENABLE_LUA_MODULES to enable Lua modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2477
diff changeset
55 elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
2947
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
56 add_definitions(
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
57 -DLUA_DL_DLL=1 # Enable loading of shared libraries (for Microsoft Windows)
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
58 )
2478
1e2d5e14b3d3 New CMake option: ENABLE_LUA_MODULES to enable Lua modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2477
diff changeset
59
1e2d5e14b3d3 New CMake option: ENABLE_LUA_MODULES to enable Lua modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2477
diff changeset
60 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
2947
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
61 add_definitions(
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
62 -DLUA_USE_MACOSX=1
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
63 -DLUA_DL_DYLD=1 # Enable loading of shared libraries (for Apple OS X)
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
64 )
2478
1e2d5e14b3d3 New CMake option: ENABLE_LUA_MODULES to enable Lua modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2477
diff changeset
65
1e2d5e14b3d3 New CMake option: ENABLE_LUA_MODULES to enable Lua modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2477
diff changeset
66 else()
1e2d5e14b3d3 New CMake option: ENABLE_LUA_MODULES to enable Lua modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2477
diff changeset
67 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
68 endif()
2477
amazy
parents: 2476
diff changeset
69 endif()
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
70
2947
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
71 add_definitions(
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
72 -DLUA_COMPAT_5_2=1
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
73 )
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
74
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
75 include_directories(
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
76 ${LUA_SOURCES_DIR}/src
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
77 )
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
78
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
79 set(LUA_SOURCES
2947
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
80 # Don't compile the Lua command-line
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
81 #${LUA_SOURCES_DIR}/src/lua.c
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
82 #${LUA_SOURCES_DIR}/src/luac.c
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
83
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
84 # Core Lua
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
85 ${LUA_SOURCES_DIR}/src/lapi.c
2947
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
86 ${LUA_SOURCES_DIR}/src/lcode.c
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
87 ${LUA_SOURCES_DIR}/src/lctype.c
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
88 ${LUA_SOURCES_DIR}/src/ldebug.c
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
89 ${LUA_SOURCES_DIR}/src/ldo.c
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
90 ${LUA_SOURCES_DIR}/src/ldump.c
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
91 ${LUA_SOURCES_DIR}/src/lfunc.c
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
92 ${LUA_SOURCES_DIR}/src/lgc.c
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
93 ${LUA_SOURCES_DIR}/src/llex.c
2947
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
94 ${LUA_SOURCES_DIR}/src/lmem.c
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
95 ${LUA_SOURCES_DIR}/src/lobject.c
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
96 ${LUA_SOURCES_DIR}/src/lopcodes.c
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
97 ${LUA_SOURCES_DIR}/src/lparser.c
2947
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
98 ${LUA_SOURCES_DIR}/src/lstate.c
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
99 ${LUA_SOURCES_DIR}/src/lstring.c
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
100 ${LUA_SOURCES_DIR}/src/ltable.c
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
101 ${LUA_SOURCES_DIR}/src/ltm.c
2947
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
102 ${LUA_SOURCES_DIR}/src/lundump.c
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
103 ${LUA_SOURCES_DIR}/src/lvm.c
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
104 ${LUA_SOURCES_DIR}/src/lzio.c
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
105
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
106 # Base Lua modules
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
107 ${LUA_SOURCES_DIR}/src/lauxlib.c
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
108 ${LUA_SOURCES_DIR}/src/lbaselib.c
2947
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
109 ${LUA_SOURCES_DIR}/src/lbitlib.c
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
110 ${LUA_SOURCES_DIR}/src/lcorolib.c
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
111 ${LUA_SOURCES_DIR}/src/ldblib.c
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
112 ${LUA_SOURCES_DIR}/src/liolib.c
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
113 ${LUA_SOURCES_DIR}/src/lmathlib.c
2947
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
114 ${LUA_SOURCES_DIR}/src/loadlib.c
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
115 ${LUA_SOURCES_DIR}/src/loslib.c
2947
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
116 ${LUA_SOURCES_DIR}/src/lstrlib.c
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
117 ${LUA_SOURCES_DIR}/src/ltablib.c
2947
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
118 ${LUA_SOURCES_DIR}/src/lutf8lib.c
11f8d72f366f Lua 5.3.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2478
diff changeset
119
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
120 ${LUA_SOURCES_DIR}/src/linit.c
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
121 )
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
122
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
123 source_group(ThirdParty\\Lua REGULAR_EXPRESSION ${LUA_SOURCES_DIR}/.*)
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
124
4649
e915102093de New CMake option: "ORTHANC_LUA_VERSION" to use a specific version of system-wide Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
125 elseif ((CMAKE_CROSSCOMPILING AND
e915102093de New CMake option: "ORTHANC_LUA_VERSION" to use a specific version of system-wide Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
126 "${CMAKE_SYSTEM_VERSION}" STREQUAL "CrossToolNg") OR
e915102093de New CMake option: "ORTHANC_LUA_VERSION" to use a specific version of system-wide Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
127 NOT "${ORTHANC_LUA_VERSION}" STREQUAL "")
3833
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3336
diff changeset
128
4649
e915102093de New CMake option: "ORTHANC_LUA_VERSION" to use a specific version of system-wide Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
129 if ("${ORTHANC_LUA_VERSION}" STREQUAL "")
e915102093de New CMake option: "ORTHANC_LUA_VERSION" to use a specific version of system-wide Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
130 set(LUA_VERSIONS 5.3 5.2 5.1)
e915102093de New CMake option: "ORTHANC_LUA_VERSION" to use a specific version of system-wide Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
131 else()
e915102093de New CMake option: "ORTHANC_LUA_VERSION" to use a specific version of system-wide Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
132 # New in Orthanc 1.9.3
e915102093de New CMake option: "ORTHANC_LUA_VERSION" to use a specific version of system-wide Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
133 set(LUA_VERSIONS ${ORTHANC_LUA_VERSION})
e915102093de New CMake option: "ORTHANC_LUA_VERSION" to use a specific version of system-wide Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
134 endif()
3833
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3336
diff changeset
135
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3336
diff changeset
136 unset(LUA_VERSION)
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3336
diff changeset
137 foreach(version IN ITEMS ${LUA_VERSIONS})
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3336
diff changeset
138 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
139 if (HAVE_LUA${version}_H)
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3336
diff changeset
140 set(LUA_VERSION ${version})
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3336
diff changeset
141 break()
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3336
diff changeset
142 endif()
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3336
diff changeset
143 endforeach()
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3336
diff changeset
144
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3336
diff changeset
145 if (NOT LUA_VERSION)
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3336
diff changeset
146 message(FATAL_ERROR "Please install the liblua-dev package")
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3336
diff changeset
147 endif()
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3336
diff changeset
148
4649
e915102093de New CMake option: "ORTHANC_LUA_VERSION" to use a specific version of system-wide Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
149 if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "CrossToolNg")
e915102093de New CMake option: "ORTHANC_LUA_VERSION" to use a specific version of system-wide Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
150 set(LUA_INCLUDE_DIR ${CROSSTOOL_NG_IMAGE}/usr/include/lua${LUA_VERSION})
e915102093de New CMake option: "ORTHANC_LUA_VERSION" to use a specific version of system-wide Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
151 else()
e915102093de New CMake option: "ORTHANC_LUA_VERSION" to use a specific version of system-wide Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
152 # New in Orthanc 1.9.3
e915102093de New CMake option: "ORTHANC_LUA_VERSION" to use a specific version of system-wide Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
153 find_path(LUA_INCLUDE_DIR
e915102093de New CMake option: "ORTHANC_LUA_VERSION" to use a specific version of system-wide Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
154 NAMES lua.h
e915102093de New CMake option: "ORTHANC_LUA_VERSION" to use a specific version of system-wide Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
155 PATHS
e915102093de New CMake option: "ORTHANC_LUA_VERSION" to use a specific version of system-wide Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
156 /usr/include/lua${LUA_VERSION}
e915102093de New CMake option: "ORTHANC_LUA_VERSION" to use a specific version of system-wide Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
157 /usr/local/include/lua${LUA_VERSION}
e915102093de New CMake option: "ORTHANC_LUA_VERSION" to use a specific version of system-wide Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
158 )
e915102093de New CMake option: "ORTHANC_LUA_VERSION" to use a specific version of system-wide Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
159 endif()
e915102093de New CMake option: "ORTHANC_LUA_VERSION" to use a specific version of system-wide Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
160
e915102093de New CMake option: "ORTHANC_LUA_VERSION" to use a specific version of system-wide Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
161 message("Lua include dir: ${LUA_INCLUDE_DIR}")
e915102093de New CMake option: "ORTHANC_LUA_VERSION" to use a specific version of system-wide Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
162 include_directories(${LUA_INCLUDE_DIR})
e915102093de New CMake option: "ORTHANC_LUA_VERSION" to use a specific version of system-wide Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
163
e915102093de New CMake option: "ORTHANC_LUA_VERSION" to use a specific version of system-wide Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
164 CHECK_LIBRARY_EXISTS(lua${LUA_VERSION} "lua_call" "${LUA_LIB_DIR}" HAVE_LUA_LIB_1) # Lua 5.1
e915102093de New CMake option: "ORTHANC_LUA_VERSION" to use a specific version of system-wide Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
165 CHECK_LIBRARY_EXISTS(lua${LUA_VERSION} "lua_callk" "${LUA_LIB_DIR}" HAVE_LUA_LIB_2) # Lua 5.3
e915102093de New CMake option: "ORTHANC_LUA_VERSION" to use a specific version of system-wide Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
166 if (NOT HAVE_LUA_LIB_1 AND NOT HAVE_LUA_LIB_2)
3833
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3336
diff changeset
167 message(FATAL_ERROR "Please install the liblua package")
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3336
diff changeset
168 endif()
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3336
diff changeset
169
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3336
diff changeset
170 link_libraries(lua${LUA_VERSION})
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3336
diff changeset
171
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
172 else()
3336
01905b67f8b5 drop specific version of lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3133
diff changeset
173 include(FindLua)
4649
e915102093de New CMake option: "ORTHANC_LUA_VERSION" to use a specific version of system-wide Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
174
3336
01905b67f8b5 drop specific version of lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3133
diff changeset
175 if (NOT LUA_FOUND)
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
176 message(FATAL_ERROR "Please install the liblua-dev package")
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
177 endif()
4649
e915102093de New CMake option: "ORTHANC_LUA_VERSION" to use a specific version of system-wide Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
178
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
179 include_directories(${LUA_INCLUDE_DIR})
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
180 link_libraries(${LUA_LIBRARIES})
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
181 endif()