Commit 8da0d649 authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

Merge branch 'cmake' of https://github.com/Lekensteyn/nghttp2 into Lekensteyn-cmake

parents e84755eb 08c7656e
......@@ -29,6 +29,22 @@ missing
stamp-h1
test-driver
# cmake
CMakeCache.txt
CMakeFiles/
cmake_install.cmake
install_manifest.txt
CTestTestfile.cmake
build.ninja
rules.ninja
.ninja_deps
.ninja_log
lib*.so
lib*.so.*
lib*.a
# generated by "make test" with cmake
Testing/
# test logs generated by `make check`
*.log
*.trs
......
env:
matrix:
- CI_BUILD=cmake
- CI_BUILD=autotools
language: cpp
compiler:
- clang
......@@ -7,6 +11,7 @@ addons:
apt:
sources:
- ubuntu-toolchain-r-test
- george-edison55-precise-backports
packages:
- g++-4.9
- libstdc++-4.9-dev
......@@ -23,11 +28,14 @@ addons:
- libevent-dev
- libjansson-dev
- libjemalloc-dev
- cmake
- cmake-data
before_install:
- $CC --version
- if [ "$CXX" = "g++" ]; then export CXX="g++-4.9" CC="gcc-4.9"; fi
- $CC --version
- go version
- cmake --version
before_script:
# First build spdylay, since integration tests require it.
# spdylay is going to be built under third-party/spdylay
......@@ -40,9 +48,10 @@ before_script:
- export SPDYLAY_HOME=$PWD
- cd ../..
# Now build nghttp2
- autoreconf -i
- if [ "$CI_BUILD" = "autotools" ]; then autoreconf -i; fi
- git submodule update --init
- ./configure --enable-werror --with-mruby --with-neverbleed LIBSPDYLAY_CFLAGS="-I$SPDYLAY_HOME/lib/includes" LIBSPDYLAY_LIBS="-L$SPDYLAY_HOME/lib/.libs -lspdylay"
- if [ "$CI_BUILD" = "autotools" ]; then ./configure --enable-werror --with-mruby --with-neverbleed LIBSPDYLAY_CFLAGS="-I$SPDYLAY_HOME/lib/includes" LIBSPDYLAY_LIBS="-L$SPDYLAY_HOME/lib/.libs -lspdylay"; fi
- if [ "$CI_BUILD" = "cmake" ]; then cmake -DENABLE_WERROR=1 -DWITH_MRUBY=1 -DWITH_NEVERBLEED=1 -DSPDYLAY_INCLUDE_DIR="$SPDYLAY_HOME/lib/includes" -DSPDYLAY_LIBRARY="$SPDYLAY_HOME/lib/.libs/libspdylay.so"; fi
script:
- make
- make check
......
This diff is collapsed.
# Features that can be enabled for cmake (see CMakeLists.txt)
option(ENABLE_WERROR "Turn on compile time warnings")
option(ENABLE_DEBUG "Turn on debug output")
option(ENABLE_THREADS "Turn on threading in apps" ON)
option(ENABLE_APP "Build applications (nghttp, nghttpd, nghttpx and h2load)"
${ENABLE_APP_DEFAULT})
option(ENABLE_HPACK_TOOLS "Build HPACK tools"
${ENABLE_HPACK_TOOLS_DEFAULT})
option(ENABLE_ASIO_LIB "Build C++ libnghttp2_asio library")
option(ENABLE_EXAMPLES "Build examples"
${ENABLE_EXAMPLES_DEFAULT})
option(ENABLE_PYTHON_BINDINGS "Build Python bindings"
${ENABLE_PYTHON_BINDINGS_DEFAULT})
option(ENABLE_FAILMALLOC "Build failmalloc test program" ON)
option(ENABLE_LIB_ONLY "Build libnghttp2 only. This is a short hand for -DENABLE_APP=0 -DENABLE_EXAMPLES=0 -DENABLE_HPACK_TOOLS=0 -DENABLE_PYTHON_BINDINGS=0")
option(WITH_LIBXML2 "Use libxml2"
${WITH_LIBXML2_DEFAULT})
option(WITH_JEMALLOC "Use jemalloc"
${WITH_JEMALLOC_DEFAULT})
option(WITH_SPDYLAY "Use spdylay"
${WITH_SPDYLAY_DEFAULT})
option(WITH_MRUBY "Use mruby")
option(WITH_NEVERBLEED "Use neverbleed")
# vim: ft=cmake:
......@@ -33,7 +33,19 @@ ACLOCAL_AMFLAGS = -I m4
dist_doc_DATA = README.rst
EXTRA_DIST = nghttpx.conf.sample proxy.pac.sample android-config android-make \
Dockerfile.android
Dockerfile.android \
cmakeconfig.h.in \
CMakeLists.txt \
CMakeOptions.txt \
cmake/FindSpdylay.cmake \
cmake/ExtractValidFlags.cmake \
cmake/FindJemalloc.cmake \
cmake/FindLibev.cmake \
cmake/FindCUnit.cmake \
cmake/Version.cmake \
cmake/FindCython.cmake \
cmake/FindLibevent.cmake \
cmake/FindJansson.cmake
.PHONY: clang-format
......
......@@ -63,7 +63,7 @@ To build and run the application programs (``nghttp``, ``nghttpd``,
are required:
* OpenSSL >= 1.0.1
* libev >= 4.15
* libev >= 4.11
* zlib >= 1.2.3
ALPN support requires OpenSSL >= 1.0.2 (released 22 January 2015).
......
# Convenience function that checks the availability of certain
# C or C++ compiler flags and returns valid ones as a string.
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
function(extract_valid_c_flags varname)
set(valid_flags)
foreach(flag IN LISTS ARGN)
string(REGEX REPLACE "[^a-zA-Z0-9_]+" "_" flag_var ${flag})
set(flag_var "C_FLAG_${flag_var}")
check_c_compiler_flag("${flag}" "${flag_var}")
if(${flag_var})
set(valid_flags "${valid_flags} ${flag}")
endif()
endforeach()
set(${varname} "${valid_flags}" PARENT_SCOPE)
endfunction()
function(extract_valid_cxx_flags varname)
set(valid_flags)
foreach(flag IN LISTS ARGN)
string(REGEX REPLACE "[^a-zA-Z0-9_]+" "_" flag_var ${flag})
set(flag_var "CXX_FLAG_${flag_var}")
check_cxx_compiler_flag("${flag}" "${flag_var}")
if(${flag_var})
set(valid_flags "${valid_flags} ${flag}")
endif()
endforeach()
set(${varname} "${valid_flags}" PARENT_SCOPE)
endfunction()
# - Try to find cunit
# Once done this will define
# CUNIT_FOUND - System has cunit
# CUNIT_INCLUDE_DIRS - The cunit include directories
# CUNIT_LIBRARIES - The libraries needed to use cunit
find_package(PkgConfig QUIET)
pkg_check_modules(PC_CUNIT QUIET cunit)
find_path(CUNIT_INCLUDE_DIR
NAMES CUnit/CUnit.h
HINTS ${PC_CUNIT_INCLUDE_DIRS}
)
find_library(CUNIT_LIBRARY
NAMES cunit
HINTS ${PC_CUNIT_LIBRARY_DIRS}
)
if(CUNIT_INCLUDE_DIR)
set(_version_regex "^#define[ \t]+CU_VERSION[ \t]+\"([^\"]+)\".*")
file(STRINGS "${CUNIT_INCLUDE_DIR}/CUnit/CUnit.h"
CUNIT_VERSION REGEX "${_version_regex}")
string(REGEX REPLACE "${_version_regex}" "\\1"
CUNIT_VERSION "${CUNIT_VERSION}")
unset(_version_regex)
endif()
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set CUNIT_FOUND to TRUE
# if all listed variables are TRUE and the requested version matches.
find_package_handle_standard_args(CUnit REQUIRED_VARS
CUNIT_LIBRARY CUNIT_INCLUDE_DIR
VERSION_VAR CUNIT_VERSION)
if(CUNIT_FOUND)
set(CUNIT_LIBRARIES ${CUNIT_LIBRARY})
set(CUNIT_INCLUDE_DIRS ${CUNIT_INCLUDE_DIR})
endif()
mark_as_advanced(CUNIT_INCLUDE_DIR CUNIT_LIBRARY)
# Find the Cython compiler.
#
# This code sets the following variables:
#
# CYTHON_EXECUTABLE
#
# See also UseCython.cmake
#=============================================================================
# Copyright 2011 Kitware, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#=============================================================================
# Use the Cython executable that lives next to the Python executable
# if it is a local installation.
find_package( PythonInterp )
if( PYTHONINTERP_FOUND )
get_filename_component( _python_path ${PYTHON_EXECUTABLE} PATH )
find_program( CYTHON_EXECUTABLE
NAMES cython cython.bat cython3
HINTS ${_python_path}
)
else()
find_program( CYTHON_EXECUTABLE
NAMES cython cython.bat cython3
)
endif()
include( FindPackageHandleStandardArgs )
FIND_PACKAGE_HANDLE_STANDARD_ARGS( Cython REQUIRED_VARS CYTHON_EXECUTABLE )
mark_as_advanced( CYTHON_EXECUTABLE )
# - Try to find jansson
# Once done this will define
# JANSSON_FOUND - System has jansson
# JANSSON_INCLUDE_DIRS - The jansson include directories
# JANSSON_LIBRARIES - The libraries needed to use jansson
find_package(PkgConfig QUIET)
pkg_check_modules(PC_JANSSON QUIET jansson)
find_path(JANSSON_INCLUDE_DIR
NAMES jansson.h
HINTS ${PC_JANSSON_INCLUDE_DIRS}
)
find_library(JANSSON_LIBRARY
NAMES jansson
HINTS ${PC_JANSSON_LIBRARY_DIRS}
)
if(JANSSON_INCLUDE_DIR)
set(_version_regex "^#define[ \t]+JANSSON_VERSION[ \t]+\"([^\"]+)\".*")
file(STRINGS "${JANSSON_INCLUDE_DIR}/jansson.h"
JANSSON_VERSION REGEX "${_version_regex}")
string(REGEX REPLACE "${_version_regex}" "\\1"
JANSSON_VERSION "${JANSSON_VERSION}")
unset(_version_regex)
endif()
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set JANSSON_FOUND to TRUE
# if all listed variables are TRUE and the requested version matches.
find_package_handle_standard_args(Jansson REQUIRED_VARS
JANSSON_LIBRARY JANSSON_INCLUDE_DIR
VERSION_VAR JANSSON_VERSION)
if(JANSSON_FOUND)
set(JANSSON_LIBRARIES ${JANSSON_LIBRARY})
set(JANSSON_INCLUDE_DIRS ${JANSSON_INCLUDE_DIR})
endif()
mark_as_advanced(JANSSON_INCLUDE_DIR JANSSON_LIBRARY)
# - Try to find jemalloc
# Once done this will define
# JEMALLOC_FOUND - System has jemalloc
# JEMALLOC_INCLUDE_DIRS - The jemalloc include directories
# JEMALLOC_LIBRARIES - The libraries needed to use jemalloc
find_package(PkgConfig QUIET)
pkg_check_modules(PC_JEMALLOC QUIET jemalloc)
find_path(JEMALLOC_INCLUDE_DIR
NAMES jemalloc/jemalloc.h
HINTS ${PC_JEMALLOC_INCLUDE_DIRS}
)
find_library(JEMALLOC_LIBRARY
NAMES jemalloc
HINTS ${PC_JEMALLOC_LIBRARY_DIRS}
)
if(JEMALLOC_INCLUDE_DIR)
set(_version_regex "^#define[ \t]+JEMALLOC_VERSION[ \t]+\"([^\"]+)\".*")
file(STRINGS "${JEMALLOC_INCLUDE_DIR}/jemalloc/jemalloc.h"
JEMALLOC_VERSION REGEX "${_version_regex}")
string(REGEX REPLACE "${_version_regex}" "\\1"
JEMALLOC_VERSION "${JEMALLOC_VERSION}")
unset(_version_regex)
endif()
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set JEMALLOC_FOUND to TRUE
# if all listed variables are TRUE and the requested version matches.
find_package_handle_standard_args(Jemalloc REQUIRED_VARS
JEMALLOC_LIBRARY JEMALLOC_INCLUDE_DIR
VERSION_VAR JEMALLOC_VERSION)
if(JEMALLOC_FOUND)
set(JEMALLOC_LIBRARIES ${JEMALLOC_LIBRARY})
set(JEMALLOC_INCLUDE_DIRS ${JEMALLOC_INCLUDE_DIR})
endif()
mark_as_advanced(JEMALLOC_INCLUDE_DIR JEMALLOC_LIBRARY)
# - Try to find libev
# Once done this will define
# LIBEV_FOUND - System has libev
# LIBEV_INCLUDE_DIRS - The libev include directories
# LIBEV_LIBRARIES - The libraries needed to use libev
find_path(LIBEV_INCLUDE_DIR
NAMES ev.h
)
find_library(LIBEV_LIBRARY
NAMES ev
)
if(LIBEV_INCLUDE_DIR)
file(STRINGS "${LIBEV_INCLUDE_DIR}/ev.h"
LIBEV_VERSION_MAJOR REGEX "^#define[ \t]+EV_VERSION_MAJOR[ \t]+[0-9]+")
file(STRINGS "${LIBEV_INCLUDE_DIR}/ev.h"
LIBEV_VERSION_MINOR REGEX "^#define[ \t]+EV_VERSION_MINOR[ \t]+[0-9]+")
string(REGEX REPLACE "[^0-9]+" "" LIBEV_VERSION_MAJOR "${LIBEV_VERSION_MAJOR}")
string(REGEX REPLACE "[^0-9]+" "" LIBEV_VERSION_MINOR "${LIBEV_VERSION_MINOR}")
set(LIBEV_VERSION "${LIBEV_VERSION_MAJOR}.${LIBEV_VERSION_MINOR}")
unset(LIBEV_VERSION_MINOR)
unset(LIBEV_VERSION_MAJOR)
endif()
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LIBEV_FOUND to TRUE
# if all listed variables are TRUE and the requested version matches.
find_package_handle_standard_args(Libev REQUIRED_VARS
LIBEV_LIBRARY LIBEV_INCLUDE_DIR
VERSION_VAR LIBEV_VERSION)
if(LIBEV_FOUND)
set(LIBEV_LIBRARIES ${LIBEV_LIBRARY})
set(LIBEV_INCLUDE_DIRS ${LIBEV_INCLUDE_DIR})
endif()
mark_as_advanced(LIBEV_INCLUDE_DIR LIBEV_LIBRARY)
# - Try to find libevent
#.rst
# FindLibevent
# ------------
#
# Find Libevent include directories and libraries. Invoke as::
#
# find_package(Libevent
# [version] [EXACT] # Minimum or exact version
# [REQUIRED] # Fail if Libevent is not found
# [COMPONENT <C>...]) # Libraries to look for
#
# Valid components are one or more of:: libevent core extra pthreads openssl.
# Note that 'libevent' contains both core and extra. You must specify one of
# them for the other components.
#
# This module will define the following variables::
#
# LIBEVENT_FOUND - True if headers and requested libraries were found
# LIBEVENT_INCLUDE_DIRS - Libevent include directories
# LIBEVENT_LIBRARIES - Libevent libraries to be linked
# LIBEVENT_<C>_FOUND - Component <C> was found (<C> is uppercase)
# LIBEVENT_<C>_LIBRARY - Library to be linked for Libevent component <C>.
find_package(PkgConfig QUIET)
pkg_check_modules(PC_LIBEVENT QUIET libevent)
# Look for the Libevent 2.0 or 1.4 headers
find_path(LIBEVENT_INCLUDE_DIR
NAMES
event2/event-config.h
event-config.h
HINTS
${PC_LIBEVENT_INCLUDE_DIRS}
)
if(LIBEVENT_INCLUDE_DIR)
set(_version_regex "^#define[ \t]+_EVENT_VERSION[ \t]+\"([^\"]+)\".*")
if(EXISTS "${LIBEVENT_INCLUDE_DIR}/event2/event-config.h")
# Libevent 2.0
file(STRINGS "${LIBEVENT_INCLUDE_DIR}/event2/event-config.h"
LIBEVENT_VERSION REGEX "${_version_regex}")
else()
# Libevent 1.4
file(STRINGS "${LIBEVENT_INCLUDE_DIR}/event-config.h"
LIBEVENT_VERSION REGEX "${_version_regex}")
endif()
string(REGEX REPLACE "${_version_regex}" "\\1"
LIBEVENT_VERSION "${LIBEVENT_VERSION}")
unset(_version_regex)
endif()
set(_LIBEVENT_REQUIRED_VARS)
foreach(COMPONENT ${Libevent_FIND_COMPONENTS})
set(_LIBEVENT_LIBNAME libevent)
# Note: compare two variables to avoid a CMP0054 policy warning
if(COMPONENT STREQUAL _LIBEVENT_LIBNAME)
set(_LIBEVENT_LIBNAME event)
else()
set(_LIBEVENT_LIBNAME "event_${COMPONENT}")
endif()
string(TOUPPER "${COMPONENT}" COMPONENT_UPPER)
find_library(LIBEVENT_${COMPONENT_UPPER}_LIBRARY
NAMES ${_LIBEVENT_LIBNAME}
HINTS ${PC_LIBEVENT_LIBRARY_DIRS}
)
if(LIBEVENT_${COMPONENT_UPPER}_LIBRARY)
set(Libevent_${COMPONENT}_FOUND 1)
endif()
list(APPEND _LIBEVENT_REQUIRED_VARS LIBEVENT_${COMPONENT_UPPER}_LIBRARY)
endforeach()
unset(_LIBEVENT_LIBNAME)
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LIBEVENT_FOUND to TRUE
# if all listed variables are TRUE and the requested version matches.
find_package_handle_standard_args(Libevent REQUIRED_VARS
${_LIBEVENT_REQUIRED_VARS}
LIBEVENT_INCLUDE_DIR
VERSION_VAR LIBEVENT_VERSION
HANDLE_COMPONENTS)
if(LIBEVENT_FOUND)
set(LIBEVENT_INCLUDE_DIRS ${LIBEVENT_INCLUDE_DIR})
set(LIBEVENT_LIBRARIES)
foreach(COMPONENT ${Libevent_FIND_COMPONENTS})
string(TOUPPER "${COMPONENT}" COMPONENT_UPPER)
list(APPEND LIBEVENT_LIBRARIES ${LIBEVENT_${COMPONENT_UPPER}_LIBRARY})
set(LIBEVENT_${COMPONENT_UPPER}_FOUND ${Libevent_${COMPONENT}_FOUND})
endforeach()
endif()
mark_as_advanced(LIBEVENT_INCLUDE_DIR ${_LIBEVENT_REQUIRED_VARS})
unset(_LIBEVENT_REQUIRED_VARS)
# - Try to find spdylay
# Once done this will define
# SPDYLAY_FOUND - System has spdylay
# SPDYLAY_INCLUDE_DIRS - The spdylay include directories
# SPDYLAY_LIBRARIES - The libraries needed to use spdylay
find_package(PkgConfig QUIET)
pkg_check_modules(PC_SPDYLAY QUIET libspdylay)
find_path(SPDYLAY_INCLUDE_DIR
NAMES spdylay/spdylay.h
HINTS ${PC_SPDYLAY_INCLUDE_DIRS}
)
find_library(SPDYLAY_LIBRARY
NAMES spdylay
HINTS ${PC_SPDYLAY_LIBRARY_DIRS}
)
if(SPDYLAY_INCLUDE_DIR)
set(_version_regex "^#define[ \t]+SPDYLAY_VERSION[ \t]+\"([^\"]+)\".*")
file(STRINGS "${SPDYLAY_INCLUDE_DIR}/spdylay/spdylayver.h"
SPDYLAY_VERSION REGEX "${_version_regex}")
string(REGEX REPLACE "${_version_regex}" "\\1"
SPDYLAY_VERSION "${SPDYLAY_VERSION}")
unset(_version_regex)
endif()
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set SPDYLAY_FOUND to TRUE
# if all listed variables are TRUE and the requested version matches.
find_package_handle_standard_args(Spdylay REQUIRED_VARS
SPDYLAY_LIBRARY SPDYLAY_INCLUDE_DIR
VERSION_VAR SPDYLAY_VERSION)
if(SPDYLAY_FOUND)
set(SPDYLAY_LIBRARIES ${SPDYLAY_LIBRARY})
set(SPDYLAY_INCLUDE_DIRS ${SPDYLAY_INCLUDE_DIR})
endif()
mark_as_advanced(SPDYLAY_INCLUDE_DIR SPDYLAY_LIBRARY)
# Converts a version such as 1.2.255 to 0x0102ff
function(HexVersion version_hex_var major minor patch)
math(EXPR version_dec "${major} * 256 * 256 + ${minor} * 256 + ${patch}")
set(version_hex "0x")
foreach(i RANGE 5 0 -1)
math(EXPR num "(${version_dec} >> (4 * ${i})) & 15")
string(SUBSTRING "0123456789abcdef" ${num} 1 num_hex)
set(version_hex "${version_hex}${num_hex}")
endforeach()
set(${version_hex_var} "${version_hex}" PARENT_SCOPE)
endfunction()
/* Hint to the compiler that a function parameter is not used */
#define _U_ @HINT_UNUSED_PARAM@
/* Hint to the compiler that a function never returns */
#define NGHTTP2_NORETURN @HINT_NORETURN@
/* Define to `int' if <sys/types.h> does not define. */
#cmakedefine ssize_t @ssize_t@
/* Define to 1 if you have the `std::map::emplace`. */
#cmakedefine HAVE_STD_MAP_EMPLACE 1
/* Define to 1 if you have `libjansson` library. */
#cmakedefine HAVE_JANSSON 1
/* Define to 1 if you have `libxml2` library. */
#cmakedefine HAVE_LIBXML2 1
/* Define to 1 if you have `spdylay` library. */
#cmakedefine HAVE_SPDYLAY 1
/* Define to 1 if you have `mruby` library. */
#cmakedefine HAVE_MRUBY 1
/* Define to 1 if you have `neverbleed` library. */
#cmakedefine HAVE_NEVERBLEED 1
/* sizeof(int *) */
#cmakedefine SIZEOF_INT_P @SIZEOF_INT_P@
/* sizeof(time_t) */
#cmakedefine SIZEOF_TIME_T @SIZEOF_TIME_T@
/* Define to 1 if you have the `_Exit` function. */
#cmakedefine HAVE__EXIT 1
/* Define to 1 if you have the `accept4` function. */
#cmakedefine HAVE_ACCEPT4 1
/* Define to 1 if you have the `initgroups` function. */
#cmakedefine01 HAVE_DECL_INITGROUPS
/* Define to 1 to enable debug output. */
#cmakedefine DEBUGBUILD 1
/* Define to 1 if you want to disable threads. */
#cmakedefine NOTHREADS 1
/* Define to 1 if you have the <arpa/inet.h> header file. */
#cmakedefine HAVE_ARPA_INET_H 1
/* Define to 1 if you have the <fcntl.h> header file. */
#cmakedefine HAVE_FCNTL_H 1
/* Define to 1 if you have the <inttypes.h> header file. */
#cmakedefine HAVE_INTTYPES_H 1
/* Define to 1 if you have the <limits.h> header file. */
#cmakedefine HAVE_LIMITS_H 1
/* Define to 1 if you have the <netdb.h> header file. */
#cmakedefine HAVE_NETDB_H 1
/* Define to 1 if you have the <netinet/in.h> header file. */
#cmakedefine HAVE_NETINET_IN_H 1
/* Define to 1 if you have the <pwd.h> header file. */
#cmakedefine HAVE_PWD_H 1
/* Define to 1 if you have the <sys/socket.h> header file. */
#cmakedefine HAVE_SYS_SOCKET_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#cmakedefine HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <syslog.h> header file. */
#cmakedefine HAVE_SYSLOG_H 1
/* Define to 1 if you have the <time.h> header file. */
#cmakedefine HAVE_TIME_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#cmakedefine HAVE_UNISTD_H 1
set(CONFIGFILES
nghttpx-init
nghttpx.service
nghttpx-upstart.conf
)
# Note that the execute permissions of nghttpx-init is preserved
foreach(name IN LISTS CONFIGFILES)
configure_file("${name}.in" "${name}" @ONLY)
endforeach()
# set(EXTRA_DIST ${CONFIGFILES} nghttpx-logrotate tlsticketupdate.go)
......@@ -23,7 +23,11 @@
configfiles = nghttpx-init nghttpx.service nghttpx-upstart.conf
EXTRA_DIST = $(configfiles:%=%.in) nghttpx-logrotate tlsticketupdate.go
EXTRA_DIST = \
CMakeLists.txt \
$(configfiles:%=%.in) \
nghttpx-logrotate \
tlsticketupdate.go
edit = sed -e 's|@bindir[@]|$(bindir)|g'
......
This diff is collapsed.
......@@ -166,6 +166,7 @@ RST_FILES = \
h2load.1.rst
EXTRA_DIST = \
CMakeLists.txt \
mkapiref.py \
$(RST_FILES) \
$(APIDOCS) \
......
if(ENABLE_EXAMPLES)
file(GLOB c_sources *.c)
set_source_files_properties(${c_sources} PROPERTIES
COMPILE_FLAGS "${WARNCFLAGS}")
file(GLOB cxx_sources *.cc)
set_source_files_properties(${cxx_sources} PROPERTIES
COMPILE_FLAGS "${WARNCXXFLAGS} ${CXX1XCXXFLAGS}")
include_directories(
${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/lib/includes
${CMAKE_BINARY_DIR}/lib/includes
${CMAKE_SOURCE_DIR}/src/includes
${CMAKE_SOURCE_DIR}/third-party
${LIBEVENT_INCLUDE_DIRS}
${OPENSSL_INCLUDE_DIRS}
)
link_libraries(
nghttp2
${LIBEVENT_OPENSSL_LIBRARIES}
${OPENSSL_LIBRARIES}
${APP_LIBRARIES}
)
add_executable(client client.c $<TARGET_OBJECTS:http-parser>)
add_executable(libevent-client libevent-client.c $<TARGET_OBJECTS:http-parser>)
add_executable(libevent-server libevent-server.c $<TARGET_OBJECTS:http-parser>)
add_executable(deflate deflate.c $<TARGET_OBJECTS:http-parser>)
if(ENABLE_TINY_NGHTTPD)
add_executable(tiny-nghttpd tiny-nghttpd.c $<TARGET_OBJECTS:http-parser>)
endif()
if(ENABLE_ASIO_LIB)
foreach(name asio-sv asio-sv2 asio-cl asio-cl2)
add_executable(${name} ${name}.cc $<TARGET_OBJECTS:http-parser>)
target_include_directories(${name} PRIVATE
${OPENSSL_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
)
target_link_libraries(${name}
nghttp2
nghttp2_asio
${JEMALLOC_LIBRARIES}
${OPENSSL_LIBRARIES}
${Boost_LIBRARIES}
${APP_LIBRARIES}
)
endforeach()
endif()
endif()
......@@ -21,6 +21,8 @@
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
EXTRA_DIST = CMakeLists.txt
if ENABLE_EXAMPLES
AM_CFLAGS = $(WARNCFLAGS)
......
# generated files
config.go
setenv
set(GO_FILES
nghttpx_http1_test.go
nghttpx_http2_test.go
nghttpx_spdy_test.go
server_tester.go
)
# XXX unused
set(EXTRA_DIST
${GO_FILES}
server.key
server.crt
alt-server.key
alt-server.crt
setenv
req-set-header.rb
resp-set-header.rb
req-return.rb
resp-return.rb
)
add_custom_target(itprep
COMMAND go get -d -v golang.org/x/net/http2
COMMAND go get -d -v github.com/tatsuhiro-t/go-nghttp2
COMMAND go get -d -v github.com/tatsuhiro-t/spdy
COMMAND go get -d -v golang.org/x/net/websocket
)
# 'go test' requires both config.go and the test files in the same directory.
# For out-of-tree builds, config.go is normally not placed next to the source
# files, so copy the tests to the build directory as a workaround.
set(GO_BUILD_FILES)
if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
foreach(gofile IN LISTS GO_FILES)
set(outfile "${CMAKE_CURRENT_BINARY_DIR}/${gofile}")
add_custom_command(OUTPUT "${outfile}"
COMMAND ${CMAKE_COMMAND} -E copy
"${CMAKE_CURRENT_SOURCE_DIR}/${gofile}" "${outfile}"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${gofile}"
)
list(APPEND GO_BUILD_FILES "${outfile}")
endforeach()
endif()
add_custom_target(it
COMMAND sh setenv go test -v
DEPENDS ${GO_BUILD_FILES}
)
......@@ -28,6 +28,7 @@ GO_FILES = \
server_tester.go
EXTRA_DIST = \
CMakeLists.txt \
$(GO_FILES) \
server.key \
server.crt \
......
#!/bin/sh -e
libdir="@abs_top_builddir@/lib"
if [ -d "$libdir/.libs" ]; then
libdir="$libdir/.libs"
fi
export CGO_CFLAGS="-I@abs_top_srcdir@/lib/includes -I@abs_top_builddir@/lib/includes"
export CGO_LDFLAGS="-L@abs_top_builddir@/lib/.libs"
export LD_LIBRARY_PATH="@abs_top_builddir@/lib/.libs"
export CGO_LDFLAGS="-L$libdir"
export LD_LIBRARY_PATH="$libdir"
"$@"
add_subdirectory(includes)
include_directories(
"${CMAKE_CURRENT_SOURCE_DIR}/includes"
"${CMAKE_CURRENT_BINARY_DIR}/includes"
)
add_definitions(-DBUILDING_NGHTTP2)
set(NGHTTP2_SOURCES
nghttp2_pq.c nghttp2_map.c nghttp2_queue.c
nghttp2_frame.c
nghttp2_buf.c
nghttp2_stream.c nghttp2_outbound_item.c
nghttp2_session.c nghttp2_submit.c
nghttp2_helper.c
nghttp2_npn.c
nghttp2_hd.c nghttp2_hd_huffman.c nghttp2_hd_huffman_data.c
nghttp2_version.c
nghttp2_priority_spec.c
nghttp2_option.c
nghttp2_callbacks.c
nghttp2_mem.c
nghttp2_http.c
nghttp2_rcbuf.c
)
# Public shared library
add_library(nghttp2 SHARED ${NGHTTP2_SOURCES})
set_target_properties(nghttp2 PROPERTIES
COMPILE_FLAGS "${WARNCFLAGS}"
VERSION ${LT_VERSION} SOVERSION ${LT_SOVERSION}
C_VISIBILITY_PRESET hidden
)
if(HAVE_CUNIT)
# Static library (for unittests because of symbol visibility)
add_library(nghttp2_static STATIC ${NGHTTP2_SOURCES})
set_target_properties(nghttp2_static PROPERTIES
COMPILE_FLAGS "${WARNCFLAGS}"
VERSION ${LT_VERSION} SOVERSION ${LT_SOVERSION}
ARCHIVE_OUTPUT_NAME nghttp2
)
target_compile_definitions(nghttp2_static PUBLIC "-DNGHTTP2_STATICLIB")
endif()
install(TARGETS nghttp2
DESTINATION "${CMAKE_INSTALL_LIBDIR}")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libnghttp2.pc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
......@@ -22,7 +22,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
SUBDIRS = includes
EXTRA_DIST = Makefile.msvc
EXTRA_DIST = Makefile.msvc CMakeLists.txt
AM_CFLAGS = $(WARNCFLAGS) $(EXTRACFLAG)
AM_CPPFLAGS = -I$(srcdir)/includes -I$(builddir)/includes -DBUILDING_NGHTTP2 \
......
install(FILES
nghttp2/nghttp2.h
"${CMAKE_CURRENT_BINARY_DIR}/nghttp2/nghttp2ver.h"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/nghttp2")
......@@ -20,4 +20,7 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
EXTRA_DIST = CMakeLists.txt
nobase_include_HEADERS = nghttp2/nghttp2.h nghttp2/nghttp2ver.h
# EXTRA_DIST = cnghttp2.pxd nghttp2.pyx
if(ENABLE_PYTHON_BINDINGS)
add_custom_target(python ALL
COMMAND "${PYTHON_EXECUTABLE}" setup.py build
VERBATIM
DEPENDS nghttp2.c nghttp2
)
configure_file(install-python.cmake.in install-python.cmake ESCAPE_QUOTES @ONLY)
install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/install-python.cmake")
add_custom_command(OUTPUT nghttp2.c
COMMAND "${CYTHON_EXECUTABLE}" -o nghttp2.c
"${CMAKE_CURRENT_SOURCE_DIR}/nghttp2.pyx"
VERBATIM
DEPENDS nghttp2.pyx
)
# Instead of calling "setup.py clean --all", this should do...
set_directory_properties(PROPERTIES
ADDITIONAL_MAKE_CLEAN_FILES "build;python_nghttp2.egg-info"
)
## This works also, except that the installation target is missing...
# include(UseCython)
# cython_add_module(python_nghttp2 nghttp2.pyx)
# set_target_properties(python_nghttp2 PROPERTIES
# OUTPUT_NAME nghttp2
# )
# target_include_directories(python_nghttp2 PRIVATE
# "${CMAKE_SOURCE_DIR}/lib"
# "${CMAKE_SOURCE_DIR}/lib/includes"
# "${CMAKE_BINARY_DIR}/lib/includes"
# )
# target_link_libraries(python_nghttp2
# nghttp2
# )
endif()
......@@ -25,7 +25,7 @@
# clean-local in parallel build.
.NOTPARALLEL:
EXTRA_DIST = cnghttp2.pxd nghttp2.pyx
EXTRA_DIST = cnghttp2.pxd nghttp2.pyx CMakeLists.txt install-python.cmake.in
if ENABLE_PYTHON_BINDINGS
......
get_filename_component(rootdir "$ENV{DESTDIR}" ABSOLUTE)
if(rootdir STREQUAL "")
set(rootdir /)
endif()
execute_process(
COMMAND "@PYTHON_EXECUTABLE@" setup.py install
--skip-build
--root=${rootdir} --prefix=${CMAKE_INSTALL_PREFIX}
WORKING_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@"
)
......@@ -39,6 +39,7 @@ setup(
'@top_srcdir@/lib/includes',
'@top_builddir@/lib/includes'],
library_dirs=['@top_builddir@/lib/.libs',
'@top_builddir@/lib',
'@top_builddir@'],
libraries=LIBS)],
long_description='TBD'
......
# EXTRA_DIST = README.rst
install(
PROGRAMS fetch-ocsp-response
DESTINATION "${CMAKE_INSTALL_DATADIR}/${CMAKE_PROJECT_NAME}"
)
......@@ -21,5 +21,5 @@
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
EXTRA_DIST = README.rst
EXTRA_DIST = README.rst CMakeLists.txt
dist_pkgdata_SCRIPTS = fetch-ocsp-response
add_subdirectory(includes)
file(GLOB c_sources *.c)
set_source_files_properties(${c_sources} PROPERTIES
COMPILE_FLAGS "${WARNCFLAGS}")
file(GLOB cxx_sources *.cc)
set_source_files_properties(${cxx_sources} PROPERTIES
COMPILE_FLAGS "${WARNCXXFLAGS} ${CXX1XCXXFLAGS}")
include_directories(
"${CMAKE_SOURCE_DIR}/lib/includes"
"${CMAKE_BINARY_DIR}/lib/includes"
"${CMAKE_SOURCE_DIR}/lib"
"${CMAKE_SOURCE_DIR}/src/includes"
"${CMAKE_SOURCE_DIR}/third-party"
${JEMALLOC_INCLUDE_DIRS}
${SPDYLAY_INCLUDE_DIRS}
${LIBXML2_INCLUDE_DIRS}
${LIBEV_INCLUDE_DIRS}
${OPENSSL_INCLUDE_DIRS}
${JANSSON_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIRS}
)
# XXX per-target?
link_libraries(
nghttp2
${JEMALLOC_LIBRARIES}
${SPDYLAY_LIBRARIES}
${LIBXML2_LIBRARIES}
${LIBEV_LIBRARIES}
${OPENSSL_LIBRARIES}
${JANSSON_LIBRARIES}
${ZLIB_LIBRARIES}
${APP_LIBRARIES}
)
if(ENABLE_APP)
set(HELPER_OBJECTS
util.cc
http2.cc timegm.c app_helper.cc nghttp2_gzip.c
)
# nghttp client
set(NGHTTP_SOURCES
${HELPER_OBJECTS}
nghttp.cc
ssl.cc
)
if(HAVE_LIBXML2)
list(APPEND NGHTTP_SOURCES HtmlParser.cc)
endif()
# nghttpd
set(NGHTTPD_SOURCES
${HELPER_OBJECTS}
nghttpd.cc
ssl.cc
HttpServer.cc
)
# h2load
set(H2LOAD_SOURCES
util.cc
http2.cc h2load.cc
timegm.c
ssl.cc
h2load_http2_session.cc
h2load_http1_session.cc
)
if(HAVE_SPDYLAY)
list(APPEND H2LOAD_SOURCES
h2load_spdy_session.cc
)
endif()
# Common libnhttpx sources (used for nghttpx and unit tests)
set(NGHTTPX_SRCS
util.cc http2.cc timegm.c
app_helper.cc
ssl.cc
shrpx_config.cc
shrpx_accept_handler.cc
shrpx_connection_handler.cc
shrpx_client_handler.cc
shrpx_http2_upstream.cc
shrpx_https_upstream.cc
shrpx_downstream.cc
shrpx_downstream_connection.cc
shrpx_http_downstream_connection.cc
shrpx_http2_downstream_connection.cc
shrpx_http2_session.cc
shrpx_downstream_queue.cc
shrpx_log.cc
shrpx_http.cc
shrpx_io_control.cc
shrpx_ssl.cc
shrpx_worker.cc
shrpx_log_config.cc
shrpx_connect_blocker.cc
shrpx_downstream_connection_pool.cc
shrpx_rate_limit.cc
shrpx_connection.cc
shrpx_memcached_dispatcher.cc
shrpx_memcached_connection.cc
shrpx_worker_process.cc
shrpx_signal.cc
shrpx_router.cc
)
if(HAVE_SPDYLAY)
list(APPEND NGHTTPX_SRCS
shrpx_spdy_upstream.cc
)
endif()
if(HAVE_MRUBY)
list(APPEND NGHTTPX_SRCS
shrpx_mruby.cc
shrpx_mruby_module.cc
shrpx_mruby_module_env.cc
shrpx_mruby_module_request.cc
shrpx_mruby_module_response.cc
)
endif()
add_library(nghttpx_static STATIC ${NGHTTPX_SRCS})
set_target_properties(nghttpx_static PROPERTIES ARCHIVE_OUTPUT_NAME nghttpx)
set(NGHTTPX-bin_SOURCES
shrpx.cc
)
if(HAVE_MRUBY)
target_link_libraries(nghttpx_static mruby-lib)
endif()
if(HAVE_NEVERBLEED)
target_link_libraries(nghttpx_static neverbleed)
endif()
if(HAVE_CUNIT)
set(NGHTTPX_UNITTEST_SOURCES
shrpx-unittest.cc
shrpx_ssl_test.cc
shrpx_downstream_test.cc
shrpx_config_test.cc
shrpx_worker_test.cc
shrpx_http_test.cc
http2_test.cc
util_test.cc
nghttp2_gzip_test.c
nghttp2_gzip.c
buffer_test.cc
memchunk_test.cc
template_test.cc
base64_test.cc
)
add_executable(nghttpx-unittest EXCLUDE_FROM_ALL
${NGHTTPX_UNITTEST_SOURCES}
$<TARGET_OBJECTS:http-parser>
)
target_include_directories(nghttpx-unittest PRIVATE ${CUNIT_INCLUDE_DIRS})
target_compile_definitions(nghttpx-unittest
PRIVATE "-DNGHTTP2_TESTS_DIR=\"${CMAKE_SOURCE_DIR}/tests\""
)
target_link_libraries(nghttpx-unittest nghttpx_static ${CUNIT_LIBRARIES})
if(HAVE_MRUBY)
target_link_libraries(nghttpx-unittest mruby-lib)
endif()
if(HAVE_NEVERBLEED)
target_link_libraries(nghttpx-unittest neverbleed)
endif()
add_test(nghttpx-unittest nghttpx-unittest)
add_dependencies(check nghttpx-unittest)
endif()
add_executable(nghttp ${NGHTTP_SOURCES} $<TARGET_OBJECTS:http-parser>)
add_executable(nghttpd ${NGHTTPD_SOURCES} $<TARGET_OBJECTS:http-parser>)
add_executable(nghttpx ${NGHTTPX-bin_SOURCES} $<TARGET_OBJECTS:http-parser>)
target_compile_definitions(nghttpx PRIVATE "-DPKGDATADIR=\"${PKGDATADIR}\"")
target_link_libraries(nghttpx nghttpx_static)
add_executable(h2load ${H2LOAD_SOURCES} $<TARGET_OBJECTS:http-parser>)
install(TARGETS nghttp nghttpd nghttpx h2load
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
endif()
if(ENABLE_HPACK_TOOLS)
set(inflatehd_SOURCES
inflatehd.cc
comp_helper.c
)
set(deflatehd_SOURCES
deflatehd.cc
comp_helper.c
)
add_executable(inflatehd ${inflatehd_SOURCES})
add_executable(deflatehd ${deflatehd_SOURCES})
install(TARGETS inflatehd deflatehd
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
endif()
if(ENABLE_ASIO_LIB)
set(NGHTTP2_ASIO_SOURCES
util.cc http2.cc
ssl.cc
timegm.c
asio_common.cc
asio_io_service_pool.cc
asio_server_http2.cc
asio_server_http2_impl.cc
asio_server.cc
asio_server_http2_handler.cc
asio_server_request.cc
asio_server_request_impl.cc
asio_server_response.cc
asio_server_response_impl.cc
asio_server_stream.cc
asio_server_serve_mux.cc
asio_server_request_handler.cc
asio_server_tls_context.cc
asio_client_session.cc
asio_client_session_impl.cc
asio_client_session_tcp_impl.cc
asio_client_session_tls_impl.cc
asio_client_response.cc
asio_client_response_impl.cc
asio_client_request.cc
asio_client_request_impl.cc
asio_client_stream.cc
asio_client_tls_context.cc
)
add_library(nghttp2_asio SHARED
${NGHTTP2_ASIO_SOURCES}
$<TARGET_OBJECTS:http-parser>
)
target_include_directories(nghttp2_asio PRIVATE
${OPENSSL_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
)
target_link_libraries(nghttp2_asio
nghttp2
${OPENSSL_LIBRARIES}
${Boost_LIBRARIES}
)
set_target_properties(nghttp2_asio PROPERTIES
VERSION 1.0.0 SOVERSION 1)
install(TARGETS nghttp2_asio
DESTINATION "${CMAKE_INSTALL_LIBDIR}")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libnghttp2_asio.pc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
endif()
......@@ -22,6 +22,8 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
SUBDIRS = includes
EXTRA_DIST = CMakeLists.txt
bin_PROGRAMS =
check_PROGRAMS =
TESTS =
......
if(ENABLE_ASIO_LIB)
install(FILES
nghttp2/asio_http2.h
nghttp2/asio_http2_client.h
nghttp2/asio_http2_server.h
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/nghttp2")
endif()
......@@ -21,6 +21,8 @@
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
EXTRA_DIST = CMakeLists.txt
if ENABLE_ASIO_LIB
nobase_include_HEADERS = nghttp2/asio_http2.h nghttp2/asio_http2_client.h \
nghttp2/asio_http2_server.h
......
# XXX testdata/: EXTRA_DIST = cacert.pem index.html privkey.pem
if(HAVE_CUNIT)
string(REPLACE " " ";" c_flags "${WARNCFLAGS}")
add_compile_options(${c_flags})
include_directories(
"${CMAKE_SOURCE_DIR}/lib/includes"
"${CMAKE_SOURCE_DIR}/lib"
"${CMAKE_SOURCE_DIR}/src/includes"
"${CMAKE_BINARY_DIR}/lib/includes"
${CUNIT_INCLUDE_DIRS}
)
set(MAIN_SOURCES
main.c nghttp2_pq_test.c nghttp2_map_test.c nghttp2_queue_test.c
nghttp2_test_helper.c
nghttp2_frame_test.c
nghttp2_stream_test.c
nghttp2_session_test.c
nghttp2_hd_test.c
nghttp2_npn_test.c
nghttp2_helper_test.c
nghttp2_buf_test.c
)
add_executable(main EXCLUDE_FROM_ALL
${MAIN_SOURCES}
)
target_include_directories(main PRIVATE ${CUNIT_INCLUDE_DIRS})
target_link_libraries(main
nghttp2_static
${CUNIT_LIBRARIES}
)
add_test(main main)
add_dependencies(check main)
if(ENABLE_FAILMALLOC)
set(FAILMALLOC_SOURCES
failmalloc.c failmalloc_test.c
malloc_wrapper.c
nghttp2_test_helper.c
)
add_executable(failmalloc EXCLUDE_FROM_ALL
${FAILMALLOC_SOURCES}
)
target_link_libraries(failmalloc
nghttp2_static
${CUNIT_LIBRARIES}
)
add_test(failmalloc failmalloc)
add_dependencies(check failmalloc)
endif()
if(ENABLE_APP)
# EXTRA_DIST = end_to_end.py
# TESTS += end_to_end.py
endif()
endif()
......@@ -22,6 +22,8 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
SUBDIRS = testdata
EXTRA_DIST = CMakeLists.txt
if HAVE_CUNIT
check_PROGRAMS = main
......
......@@ -22,6 +22,9 @@
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif /* HAVE_CONFIG_H */
#include "nghttp2_npn_test.h"
#include <string.h>
......
if(ENABLE_THIRD_PARTY)
set(LIBHTTP_PARSER_SOURCES
http-parser/http_parser.c
)
add_library(http-parser OBJECT ${LIBHTTP_PARSER_SOURCES})
set_target_properties(http-parser PROPERTIES
POSITION_INDEPENDENT_CODE ON)
if(HAVE_NEVERBLEED)
set(NEVERBLEED_SOURCES
neverbleed/neverbleed.c
)
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})
endif()
if(HAVE_MRUBY)
# EXTRA_DIST = build_config.rb mruby/*
set(MRUBY_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/mruby/build")
set(MRUBY_LIBRARY
"${CMAKE_STATIC_LIBRARY_PREFIX}mruby${CMAKE_STATIC_LIBRARY_SUFFIX}"
)
# 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
)
# 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"
)
add_dependencies(mruby-lib mruby)
set_directory_properties(PROPERTIES
ADDITIONAL_MAKE_CLEAN_FILES mruby/build
)
endif()
endif()
......@@ -23,6 +23,8 @@
AM_CPPFLAGS = @DEFS@
EXTRA_DIST = CMakeLists.txt
if ENABLE_THIRD_PARTY
noinst_LTLIBRARIES = libhttp-parser.la
......@@ -39,7 +41,7 @@ endif # HAVE_NEVERBLEED
if HAVE_MRUBY
EXTRA_DIST = build_config.rb mruby/*
EXTRA_DIST += build_config.rb mruby/*
.PHONY: all-local clean mruby
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment