-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
64 lines (56 loc) · 1.87 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
cmake_minimum_required(VERSION 2.8)
project(tarantool-plugin C CXX)
find_program(GIT git)
find_program(ECHO echo)
#
# Set default build type to Debug. This is to ease a developer's
# life. Release binaries are built by BuildBot automatically anyway.
#
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE)
endif()
#
# Check submodules
#
function(update_submodules)
message(STATUS "Updating submodules")
execute_process(COMMAND ${GIT} submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
endfunction()
if(NOT EXISTS ${CMAKE_SOURCE_DIR}/third_party/luajit/CMakeLists.txt)
if (EXISTS "${CMAKE_SOURCE_DIR}/.git" AND GIT)
update_submodules()
else()
message(FATAL_ERROR "Failed to find submodules")
endif()
endif()
#
# LuaJIT
#
# Patched.
#
set(ENABLE_BUNDLED_LUAJIT ON)
set(LUAJIT_ENABLE_GC64_DEFAULT OFF)
if (TARGET_OS_DARWIN)
# LuaJIT is unusable on OS X without enabled GC64
# See https://github.com/tarantool/tarantool/issues/2643
set(LUAJIT_ENABLE_GC64_DEFAULT ON)
endif()
option(LUAJIT_ENABLE_GC64 "Use 64-bit GC objects by default."
${LUAJIT_ENABLE_GC64_DEFAULT})
add_subdirectory(third_party)
include(cmake/utils.cmake)
set(lua_sources)
lua_source(lua_sources src/lua/normalize_uri.lua)
add_custom_target(generate_lua_sources
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/lua
DEPENDS ${lua_sources})
set_property(DIRECTORY PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${lua_sources})
add_library(multilisten SHARED src/plugin.c ${lua_sources})
set_target_properties(multilisten PROPERTIES PREFIX "")
if(TARGET_OS_DARWIN)
set_target_properties(multilisten PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
endif(TARGET_OS_DARWIN)
add_dependencies(multilisten generate_lua_sources)