2016-02-12 13:12:33 +01:00
|
|
|
if(ENABLE_THIRD_PARTY)
|
|
|
|
set(LIBHTTP_PARSER_SOURCES
|
|
|
|
http-parser/http_parser.c
|
|
|
|
)
|
|
|
|
add_library(http-parser OBJECT ${LIBHTTP_PARSER_SOURCES})
|
2016-02-16 14:09:10 +01:00
|
|
|
set_target_properties(http-parser PROPERTIES
|
|
|
|
POSITION_INDEPENDENT_CODE ON)
|
2016-02-12 13:12:33 +01:00
|
|
|
|
|
|
|
if(HAVE_NEVERBLEED)
|
2016-02-15 10:50:31 +01:00
|
|
|
set(NEVERBLEED_SOURCES
|
2016-02-12 13:12:33 +01:00
|
|
|
neverbleed/neverbleed.c
|
|
|
|
)
|
2016-02-15 10:50:31 +01:00
|
|
|
add_library(neverbleed ${NEVERBLEED_SOURCES})
|
|
|
|
target_include_directories(neverbleed PRIVATE ${OPENSSL_INCLUDE_DIRS})
|
|
|
|
target_include_directories(neverbleed INTERFACE
|
|
|
|
"${CMAKE_SOURCE_DIR}/third-party/neverbleed"
|
|
|
|
)
|
|
|
|
target_link_libraries(neverbleed ${OPENSSL_LIBRARIES})
|
2016-02-12 13:12:33 +01:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(HAVE_MRUBY)
|
2016-02-15 23:14:27 +01:00
|
|
|
# EXTRA_DIST = build_config.rb mruby/*
|
2016-02-12 13:12:33 +01:00
|
|
|
|
2016-02-15 23:14:27 +01:00
|
|
|
set(MRUBY_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/mruby/build")
|
|
|
|
set(MRUBY_LIBRARY
|
|
|
|
"${CMAKE_STATIC_LIBRARY_PREFIX}mruby${CMAKE_STATIC_LIBRARY_SUFFIX}"
|
|
|
|
)
|
2016-02-12 13:12:33 +01:00
|
|
|
|
2016-02-15 23:14:27 +01:00
|
|
|
# The mruby build needs some env vars. Alternatively, look at cmake -P
|
|
|
|
if(CMAKE_VERSION VERSION_LESS "3.1")
|
|
|
|
# XXX works only for Unixes?
|
|
|
|
set(ENV_COMMAND env)
|
|
|
|
else()
|
|
|
|
set(ENV_COMMAND ${CMAKE_COMMAND} -E env)
|
|
|
|
endif()
|
|
|
|
# Required for the Ninja generator. For older CMake, you first have to
|
|
|
|
# invoke 'ninja mruby' before building dependents.
|
|
|
|
if(CMAKE_VERSION VERSION_LESS "3.2")
|
|
|
|
set(_byproducts)
|
|
|
|
else()
|
|
|
|
set(_byproducts BYPRODUCTS "mruby/build/lib/${MRUBY_LIBRARY}")
|
|
|
|
endif()
|
|
|
|
add_custom_target(mruby
|
|
|
|
COMMAND ${ENV_COMMAND}
|
|
|
|
"MRUBY_CONFIG=${CMAKE_CURRENT_SOURCE_DIR}/build_config.rb"
|
|
|
|
"BUILD_DIR=${MRUBY_BUILD_DIR}"
|
|
|
|
"INSTALL_DIR=${MRUBY_BUILD_DIR}/install/bin"
|
|
|
|
"CC=${CMAKE_C_COMPILER}" "CXX=${CMAKE_CXX_COMPILER}"
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/mruby/minirake"
|
|
|
|
-f "${CMAKE_CURRENT_SOURCE_DIR}/mruby/Rakefile"
|
|
|
|
${_byproducts}
|
|
|
|
VERBATIM
|
|
|
|
)
|
2016-02-12 13:12:33 +01:00
|
|
|
|
2016-02-15 23:14:27 +01:00
|
|
|
# Make the mruby library available to others in this project without them
|
|
|
|
# having to worry about include dirs and the mruby location.
|
|
|
|
add_library(mruby-lib STATIC IMPORTED GLOBAL)
|
|
|
|
set_target_properties(mruby-lib PROPERTIES
|
|
|
|
IMPORTED_LOCATION "${MRUBY_BUILD_DIR}/lib/${MRUBY_LIBRARY}"
|
|
|
|
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/mruby/include"
|
|
|
|
)
|
2016-02-29 16:00:08 +01:00
|
|
|
add_dependencies(mruby-lib mruby)
|
2016-02-12 13:12:33 +01:00
|
|
|
|
2016-03-13 17:34:22 +01:00
|
|
|
set_directory_properties(PROPERTIES
|
|
|
|
ADDITIONAL_MAKE_CLEAN_FILES mruby/build
|
|
|
|
)
|
2016-02-12 13:12:33 +01:00
|
|
|
endif()
|
|
|
|
endif()
|