annotate Resources/CMake/LuaConfiguration.cmake @ 2505:a4f885670da7

fix Windows build
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 26 Mar 2018 11:09:19 +0200
parents 1e2d5e14b3d3
children 11f8d72f366f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
1 if (STATIC_BUILD OR NOT USE_SYSTEM_LUA)
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
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
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2383
diff changeset
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
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
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
amazy
parents: 2476
diff changeset
30 endif()
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
31
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
32 include_directories(
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
33 ${LUA_SOURCES_DIR}/src
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
34 )
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
35
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
36 set(LUA_SOURCES
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
37 # Core Lua
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
38 ${LUA_SOURCES_DIR}/src/lapi.c
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
39 ${LUA_SOURCES_DIR}/src/lcode.c
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
40 ${LUA_SOURCES_DIR}/src/ldebug.c
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
41 ${LUA_SOURCES_DIR}/src/ldo.c
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
42 ${LUA_SOURCES_DIR}/src/ldump.c
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
43 ${LUA_SOURCES_DIR}/src/lfunc.c
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
44 ${LUA_SOURCES_DIR}/src/lgc.c
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
45 ${LUA_SOURCES_DIR}/src/llex.c
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
46 ${LUA_SOURCES_DIR}/src/lmem.c
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
47 ${LUA_SOURCES_DIR}/src/lobject.c
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
48 ${LUA_SOURCES_DIR}/src/lopcodes.c
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
49 ${LUA_SOURCES_DIR}/src/lparser.c
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
50 ${LUA_SOURCES_DIR}/src/lstate.c
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
51 ${LUA_SOURCES_DIR}/src/lstring.c
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
52 ${LUA_SOURCES_DIR}/src/ltable.c
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
53 ${LUA_SOURCES_DIR}/src/ltm.c
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
54 ${LUA_SOURCES_DIR}/src/lundump.c
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
55 ${LUA_SOURCES_DIR}/src/lvm.c
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
56 ${LUA_SOURCES_DIR}/src/lzio.c
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
57
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
58 # Base Lua modules
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
59 ${LUA_SOURCES_DIR}/src/lauxlib.c
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
60 ${LUA_SOURCES_DIR}/src/lbaselib.c
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
61 ${LUA_SOURCES_DIR}/src/ldblib.c
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
62 ${LUA_SOURCES_DIR}/src/liolib.c
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
63 ${LUA_SOURCES_DIR}/src/lmathlib.c
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
64 ${LUA_SOURCES_DIR}/src/loslib.c
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
65 ${LUA_SOURCES_DIR}/src/ltablib.c
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
66 ${LUA_SOURCES_DIR}/src/lstrlib.c
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
67 ${LUA_SOURCES_DIR}/src/loadlib.c
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
68 ${LUA_SOURCES_DIR}/src/linit.c
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
69 )
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
70
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
71 source_group(ThirdParty\\Lua REGULAR_EXPRESSION ${LUA_SOURCES_DIR}/.*)
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
72
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
73 else()
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
74 include(FindLua51)
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
75
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
76 if (NOT LUA51_FOUND)
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
77 message(FATAL_ERROR "Please install the liblua-dev package")
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
78 endif()
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
79
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
80 include_directories(${LUA_INCLUDE_DIR})
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
81 link_libraries(${LUA_LIBRARIES})
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
82 endif()