]> granicus.if.org Git - apache/commitdiff
Support mod_http2 in cmake-based build for Windows
authorJeff Trawick <trawick@apache.org>
Sat, 3 Oct 2015 21:01:49 +0000 (21:01 +0000)
committerJeff Trawick <trawick@apache.org>
Sat, 3 Oct 2015 21:01:49 +0000 (21:01 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1706627 13f79535-47bb-0310-9956-ffa450edef68

CMakeLists.txt
README.cmake

index 082241f699722a92fa16c72c5657e2e90459c154..4301090140f37bbe0e6698d08680b401d01b422d 100644 (file)
@@ -52,8 +52,16 @@ ELSE()
   SET(default_pcre_libraries ${CMAKE_INSTALL_PREFIX}/lib/pcre.lib)
 ENDIF()
 
+IF(EXISTS "${CMAKE_INSTALL_PREFIX}/lib/nghttp2d.lib")
+  SET(default_nghttp2_libraries "${CMAKE_INSTALL_PREFIX}/lib/nghttp2d.lib")
+ELSE()
+  SET(default_nghttp2_libraries "${CMAKE_INSTALL_PREFIX}/lib/nghttp2.lib")
+ENDIF()
+
 SET(APR_INCLUDE_DIR       "${CMAKE_INSTALL_PREFIX}/include" CACHE STRING "Directory with APR[-Util] include files")
 SET(APR_LIBRARIES         ${default_apr_libraries}       CACHE STRING "APR libraries to link with")
+SET(NGHTTP2_INCLUDE_DIR   "${CMAKE_INSTALL_PREFIX}/include" CACHE STRING "Directory with NGHTTP2 include files within nghttp2 subdirectory")
+SET(NGHTTP2_LIBRARIES     ${default_nghttp2_libraries}   CACHE STRING "NGHTTP2 libraries to link with")
 SET(PCRE_INCLUDE_DIR      "${CMAKE_INSTALL_PREFIX}/include" CACHE STRING "Directory with PCRE include files")
 SET(PCRE_LIBRARIES        ${default_pcre_libraries}      CACHE STRING "PCRE libraries to link with")
 SET(LIBXML2_ICONV_INCLUDE_DIR     ""                     CACHE STRING "Directory with iconv include files for libxml2")
@@ -170,11 +178,24 @@ IF(OPENSSL_FOUND)
   ENDIF()
 ENDIF()
 
+# See if nghttp2 exists in a configured or defaulted location
+SET(NGHTTP2_FOUND TRUE)
+IF(EXISTS "${NGHTTP2_INCLUDE_DIR}/nghttp2/nghttp2.h")
+  FOREACH(onelib ${NGHTTP2_LIBRARIES})
+    IF(NOT EXISTS ${onelib})
+      SET(NGHTTP2_FOUND FALSE)
+    ENDIF()
+  ENDFOREACH()
+ELSE()
+  SET(NGHTTP2_FOUND FALSE)
+ENDIF()
+
 MESSAGE(STATUS "")
 MESSAGE(STATUS "Summary of feature detection:")
 MESSAGE(STATUS "")
 MESSAGE(STATUS "LIBXML2_FOUND ............ : ${LIBXML2_FOUND}")
 MESSAGE(STATUS "LUA51_FOUND .............. : ${LUA51_FOUND}")
+MESSAGE(STATUS "NGHTTP2_FOUND ............ : ${NGHTTP2_FOUND}")
 MESSAGE(STATUS "OPENSSL_FOUND ............ : ${OPENSSL_FOUND}")
 MESSAGE(STATUS "ZLIB_FOUND ............... : ${ZLIB_FOUND}")
 MESSAGE(STATUS "APR_HAS_LDAP ............. : ${APR_HAS_LDAP}")
@@ -272,6 +293,7 @@ SET(MODULE_LIST
   "modules/generators/mod_info+I+server information"
   "modules/generators/mod_status+I+process/thread monitoring"
   "modules/http/mod_mime+A+mapping of file-extension to MIME.  Disabling this module is normally not recommended."
+  "modules/http2/mod_http2+a+HTTP/2 protocol support"
   "modules/ldap/mod_ldap+i+LDAP caching and connection pooling services"
   "modules/loggers/mod_log_config+A+logging configuration.  You won't be able to log requests to the server without this module."
   "modules/loggers/mod_log_debug+I+configurable debug logging"
@@ -371,6 +393,23 @@ IF(ZLIB_FOUND)
 ENDIF()
 SET(mod_firehose_requires            SOMEONE_TO_MAKE_IT_COMPILE_ON_WINDOWS)
 SET(mod_heartbeat_extra_libs         mod_watchdog)
+SET(mod_http2_requires               NGHTTP2_FOUND)
+SET(mod_http2_extra_defines          ssize_t=long)
+SET(mod_http2_extra_libs             ${NGHTTP2_LIBRARIES})
+SET(mod_http2_extra_sources
+  modules/http2/h2_alt_svc.c         modules/http2/h2_config.c
+  modules/http2/h2_conn.c            modules/http2/h2_conn_io.c
+  modules/http2/h2_ctx.c             modules/http2/h2_from_h1.c
+  modules/http2/h2_h2.c              modules/http2/h2_io.c
+  modules/http2/h2_io_set.c          modules/http2/h2_mplx.c
+  modules/http2/h2_request.c         modules/http2/h2_response.c
+  modules/http2/h2_session.c         modules/http2/h2_stream.c
+  modules/http2/h2_stream_set.c      modules/http2/h2_switch.c
+  modules/http2/h2_task.c            modules/http2/h2_task_input.c
+  modules/http2/h2_task_output.c     modules/http2/h2_task_queue.c
+  modules/http2/h2_to_h1.c           modules/http2/h2_util.c
+  modules/http2/h2_worker.c          modules/http2/h2_workers.c
+)
 SET(mod_ldap_extra_defines           LDAP_DECLARE_EXPORT)
 SET(mod_ldap_extra_libs              wldap32)
 SET(mod_ldap_extra_sources
index 35b6f72d813cb36ddca3f66ff879b5adc1c9d3e7..b0c3b041e607e553fa2ff0819af4aea48af270ae 100644 (file)
@@ -58,6 +58,7 @@ enabled:
 
 * libxml2 (e.g., mod_proxy_html)
 * lua 5.1 (mod_lua)
+* nghttp2 (mod_http2)
 * openssl (mod_ssl and https support for ab)
 * zlib (mod_deflate)
 
@@ -80,6 +81,17 @@ these libraries.
 To work around this issue, rename the well-known OpenSSL directory while
 building httpd.  Let us know if you find a better solution.
 
+nghttp2
+-------
+
+This is required for mod_http2.
+
+cmake-based build support for nghttp2 for Windows can be found at
+https://github.com/trawick/nghttp2-minimal-cmake.  That easily fits into
+a build system that already uses cmake for httpd, apr, and perhaps other
+packages.  A dynamic build of nghttp2 using its normal Windows build
+system should also be usable by nghttp2.
+
 How to build
 ------------
 
@@ -99,7 +111,8 @@ How to build
 
    Alternately, you can use the cmake-gui and update settings in the GUI.
 
-   PCRE_INCLUDE_DIR, PCRE_LIBRARIES, APR_INCLUDE_DIR, APR_LIBRARIES:
+   PCRE_INCLUDE_DIR, PCRE_LIBRARIES, APR_INCLUDE_DIR, APR_LIBRARIES,
+     NGHTTP2_INCLUDE_DIR, NGHTTP2_LIBRARIES:
 
        cmake doesn't bundle FindXXX for these packages, so the crucial
        information has to be specified in this manner if they aren't found
@@ -134,6 +147,12 @@ How to build
        APR-Util are found in the default location, the LDAP library will be
        included if it is present.
 
+     -DNGHTTP2_INCLUDE_DIR=d:/path/to/nghttp2inst/include  (which has nghttp2/*.h)
+     -DNGHTTP2_LIBRARIES=d:/path/to/nghttp2inst/lib/nghttp2.lib"
+
+       These will have to be specified if nghttp2 was installed to a different
+       directory than httpd.
+
    LIBXML2_ICONV_INCLUDE_DIR, LIBXML2_ICONV_LIBRARIES
 
       If using a module that requires libxml2 *and* the build of libxml2 requires