cmake: add lib, add versioning info, install lib
Also remove some headers which were not checked anyway and add macros to cmakeconfig.h.in (based on the headers list in the CMakeLists.txt file).
This commit is contained in:
parent
744e80d579
commit
5b21c39bb2
|
@ -26,12 +26,20 @@ cmake_minimum_required(VERSION 3.0)
|
||||||
# XXX using 1.7.90 instead of 1.8.0-DEV
|
# XXX using 1.7.90 instead of 1.8.0-DEV
|
||||||
project(nghttp2 VERSION 1.7.90)
|
project(nghttp2 VERSION 1.7.90)
|
||||||
|
|
||||||
|
# See versioning rule:
|
||||||
|
# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
|
||||||
|
set(LT_CURRENT 18)
|
||||||
|
set(LT_REVISION 1)
|
||||||
|
set(LT_AGE 4)
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
||||||
include(Version)
|
include(Version)
|
||||||
|
|
||||||
set(PACKAGE_VERSION "${PROJECT_VERSION}")
|
set(PACKAGE_VERSION "${PROJECT_VERSION}")
|
||||||
HexVersion(PACKAGE_VERSION_NUM ${PROJECT_VERSION_MAJOR} ${PROJECT_VERSION_MINOR} ${PROJECT_VERSION_PATCH})
|
HexVersion(PACKAGE_VERSION_NUM ${PROJECT_VERSION_MAJOR} ${PROJECT_VERSION_MINOR} ${PROJECT_VERSION_PATCH})
|
||||||
|
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
option(ENABLE_WERROR "Turn on compile time warnings")
|
option(ENABLE_WERROR "Turn on compile time warnings")
|
||||||
option(ENABLE_DEBUG "Turn on debug output")
|
option(ENABLE_DEBUG "Turn on debug output")
|
||||||
option(ENABLE_THREADS "Turn on threading in apps" ON)
|
option(ENABLE_THREADS "Turn on threading in apps" ON)
|
||||||
|
@ -321,10 +329,6 @@ check_include_file("limits.h" HAVE_LIMITS_H)
|
||||||
check_include_file("netdb.h" HAVE_NETDB_H)
|
check_include_file("netdb.h" HAVE_NETDB_H)
|
||||||
check_include_file("netinet/in.h" HAVE_NETINET_IN_H)
|
check_include_file("netinet/in.h" HAVE_NETINET_IN_H)
|
||||||
check_include_file("pwd.h" HAVE_PWD_H)
|
check_include_file("pwd.h" HAVE_PWD_H)
|
||||||
check_include_file("stddef.h" HAVE_STDDEF_H)
|
|
||||||
check_include_file("stdint.h" HAVE_STDINT_H)
|
|
||||||
check_include_file("stdlib.h" HAVE_STDLIB_H)
|
|
||||||
check_include_file("string.h" HAVE_STRING_H)
|
|
||||||
check_include_file("sys/socket.h" HAVE_SYS_SOCKET_H)
|
check_include_file("sys/socket.h" HAVE_SYS_SOCKET_H)
|
||||||
check_include_file("sys/time.h" HAVE_SYS_TIME_H)
|
check_include_file("sys/time.h" HAVE_SYS_TIME_H)
|
||||||
check_include_file("syslog.h" HAVE_SYSLOG_H)
|
check_include_file("syslog.h" HAVE_SYSLOG_H)
|
||||||
|
@ -456,6 +460,7 @@ endif()
|
||||||
# AC_SUBST([TESTLDADD])
|
# AC_SUBST([TESTLDADD])
|
||||||
# AC_SUBST([APPLDFLAGS])
|
# AC_SUBST([APPLDFLAGS])
|
||||||
|
|
||||||
|
add_definitions(-DHAVE_CONFIG_H)
|
||||||
configure_file(cmakeconfig.h.in config.h)
|
configure_file(cmakeconfig.h.in config.h)
|
||||||
# autotools-compatible names
|
# autotools-compatible names
|
||||||
set(top_srcdir "${CMAKE_SOURCE_DIR}")
|
set(top_srcdir "${CMAKE_SOURCE_DIR}")
|
||||||
|
@ -464,13 +469,13 @@ set(abs_top_srcdir "${CMAKE_SOURCE_DIR}")
|
||||||
set(abs_top_builddir "${CMAKE_BINARY_DIR}")
|
set(abs_top_builddir "${CMAKE_BINARY_DIR}")
|
||||||
# libnghttp2.pc (pkg-config file)
|
# libnghttp2.pc (pkg-config file)
|
||||||
set(prefix "${CMAKE_INSTALL_PREFIX}")
|
set(prefix "${CMAKE_INSTALL_PREFIX}")
|
||||||
set(exec_prefix "\${prefix}")
|
set(exec_prefix "${CMAKE_INSTALL_PREFIX}")
|
||||||
set(libdir "\${prefix}/lib")
|
set(libdir "${CMAKE_INSTALL_LIBDIR}")
|
||||||
set(includedir "\${prefix}/include")
|
set(includedir "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||||
set(VERSION "${PACKAGE_VERSION}")
|
set(VERSION "${PACKAGE_VERSION}")
|
||||||
# For init scripts and systemd service file
|
# For init scripts and systemd service file
|
||||||
set(bindir "${prefix}/bin")
|
set(bindir "${CMAKE_INSTALL_FULL_BINDIR}")
|
||||||
set(sbindir "${prefix}/sbin")
|
set(sbindir "${CMAKE_INSTALL_FULL_SBINDIR}")
|
||||||
foreach(name
|
foreach(name
|
||||||
lib/libnghttp2.pc
|
lib/libnghttp2.pc
|
||||||
lib/includes/nghttp2/nghttp2ver.h
|
lib/includes/nghttp2/nghttp2ver.h
|
||||||
|
@ -499,29 +504,29 @@ foreach(name
|
||||||
configure_file("${name}.in" "${name}" @ONLY)
|
configure_file("${name}.in" "${name}" @ONLY)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# AC_CONFIG_FILES([
|
|
||||||
# Makefile
|
add_subdirectory(lib)
|
||||||
# lib/Makefile
|
#add_subdirectory(lib/includes)
|
||||||
# lib/includes/Makefile
|
if(0)
|
||||||
# tests/Makefile
|
add_subdirectory(third-party)
|
||||||
# tests/testdata/Makefile
|
add_subdirectory(src)
|
||||||
# third-party/Makefile
|
#add_subdirectory(src/includes)
|
||||||
# src/Makefile
|
add_subdirectory(examples)
|
||||||
# src/includes/Makefile
|
add_subdirectory(python)
|
||||||
# examples/Makefile
|
add_subdirectory(tests)
|
||||||
# python/Makefile
|
#add_subdirectory(tests/testdata)
|
||||||
# integration-tests/Makefile
|
add_subdirectory(integration-tests)
|
||||||
# doc/Makefile
|
add_subdirectory(doc)
|
||||||
# contrib/Makefile
|
add_subdirectory(contrib)
|
||||||
# script/Makefile
|
add_subdirectory(script)
|
||||||
# ])
|
endif()
|
||||||
# AC_OUTPUT
|
|
||||||
|
|
||||||
# XXX - fix list of variables
|
# XXX - fix list of variables
|
||||||
message(STATUS "summary of build options:
|
message(STATUS "summary of build options:
|
||||||
|
|
||||||
Package version: ${VERSION}
|
Package version: ${VERSION}
|
||||||
Library version: $LT_CURRENT:$LT_REVISION:$LT_AGE
|
Library version: ${LT_CURRENT}:${LT_REVISION}:${LT_AGE}
|
||||||
Install prefix: ${prefix}
|
Install prefix: ${prefix}
|
||||||
System types:
|
System types:
|
||||||
Build: ${build}
|
Build: ${build}
|
||||||
|
|
|
@ -37,3 +37,39 @@
|
||||||
|
|
||||||
/* Define to 1 if you want to disable threads. */
|
/* Define to 1 if you want to disable threads. */
|
||||||
#cmakedefine NOTHREADS 1
|
#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
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
include_directories(
|
||||||
|
"${CMAKE_BINARY_DIR}" # for config.h
|
||||||
|
"${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
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(nghttp2 SHARED ${NGHTTP2_SOURCES})
|
||||||
|
#target_link_libraries(nghttp2 ...)
|
||||||
|
set_target_properties(nghttp2 PROPERTIES
|
||||||
|
COMPILE_FLAGS "${WARNCFLAGS} ${EXTRACFLAG}"
|
||||||
|
VERSION ${LT_CURRENT}.${LT_REVISION}.${LT_AGE}
|
||||||
|
SOVERSION ${LT_CURRENT})
|
||||||
|
|
||||||
|
install(TARGETS nghttp2
|
||||||
|
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
||||||
|
|
||||||
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libnghttp2.pc"
|
||||||
|
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
Loading…
Reference in New Issue