2016-02-12 12:12:33 +00:00
|
|
|
if(ENABLE_THIRD_PARTY)
|
2018-11-23 11:44:36 +00:00
|
|
|
set(LIBLLHTTP_SOURCES
|
|
|
|
llhttp/src/api.c
|
|
|
|
llhttp/src/http.c
|
|
|
|
llhttp/src/llhttp.c
|
2016-02-12 12:12:33 +00:00
|
|
|
)
|
2018-11-23 11:44:36 +00:00
|
|
|
add_library(llhttp OBJECT ${LIBLLHTTP_SOURCES})
|
|
|
|
target_include_directories(llhttp PRIVATE
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/llhttp/include"
|
|
|
|
)
|
|
|
|
set_target_properties(llhttp PROPERTIES
|
|
|
|
POSITION_INDEPENDENT_CODE ON
|
|
|
|
)
|
|
|
|
|
|
|
|
set(LIBURL_PARSER_SOURCES
|
|
|
|
url-parser/url_parser.c
|
|
|
|
)
|
|
|
|
add_library(url-parser OBJECT ${LIBURL_PARSER_SOURCES})
|
|
|
|
set_target_properties(url-parser PROPERTIES
|
2016-02-16 13:09:10 +00:00
|
|
|
POSITION_INDEPENDENT_CODE ON)
|
2016-02-12 12:12:33 +00:00
|
|
|
|
|
|
|
if(HAVE_NEVERBLEED)
|
2016-02-15 09:50:31 +00:00
|
|
|
set(NEVERBLEED_SOURCES
|
2016-02-12 12:12:33 +00:00
|
|
|
neverbleed/neverbleed.c
|
|
|
|
)
|
2016-02-15 09:50:31 +00: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 12:12:33 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(HAVE_MRUBY)
|
2016-02-15 22:14:27 +00:00
|
|
|
# EXTRA_DIST = build_config.rb mruby/*
|
2016-02-12 12:12:33 +00:00
|
|
|
|
2016-02-15 22:14:27 +00: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 12:12:33 +00:00
|
|
|
|
2016-02-15 22:14:27 +00: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 12:12:33 +00:00
|
|
|
|
2016-02-15 22:14:27 +00: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 15:00:08 +00:00
|
|
|
add_dependencies(mruby-lib mruby)
|
2016-02-12 12:12:33 +00:00
|
|
|
|
2016-03-13 16:34:22 +00:00
|
|
|
set_directory_properties(PROPERTIES
|
|
|
|
ADDITIONAL_MAKE_CLEAN_FILES mruby/build
|
|
|
|
)
|
2016-02-12 12:12:33 +00:00
|
|
|
endif()
|
|
|
|
endif()
|