Skip to content

Commit 596ffc4

Browse files
committed
Support mod_http2 in cmake-based build for Windows
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1706627 13f79535-47bb-0310-9956-ffa450edef68
1 parent 2af10a9 commit 596ffc4

2 files changed

Lines changed: 59 additions & 1 deletion

File tree

CMakeLists.txt

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,16 @@ ELSE()
5252
SET(default_pcre_libraries ${CMAKE_INSTALL_PREFIX}/lib/pcre.lib)
5353
ENDIF()
5454

55+
IF(EXISTS "${CMAKE_INSTALL_PREFIX}/lib/nghttp2d.lib")
56+
SET(default_nghttp2_libraries "${CMAKE_INSTALL_PREFIX}/lib/nghttp2d.lib")
57+
ELSE()
58+
SET(default_nghttp2_libraries "${CMAKE_INSTALL_PREFIX}/lib/nghttp2.lib")
59+
ENDIF()
60+
5561
SET(APR_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE STRING "Directory with APR[-Util] include files")
5662
SET(APR_LIBRARIES ${default_apr_libraries} CACHE STRING "APR libraries to link with")
63+
SET(NGHTTP2_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE STRING "Directory with NGHTTP2 include files within nghttp2 subdirectory")
64+
SET(NGHTTP2_LIBRARIES ${default_nghttp2_libraries} CACHE STRING "NGHTTP2 libraries to link with")
5765
SET(PCRE_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE STRING "Directory with PCRE include files")
5866
SET(PCRE_LIBRARIES ${default_pcre_libraries} CACHE STRING "PCRE libraries to link with")
5967
SET(LIBXML2_ICONV_INCLUDE_DIR "" CACHE STRING "Directory with iconv include files for libxml2")
@@ -170,11 +178,24 @@ IF(OPENSSL_FOUND)
170178
ENDIF()
171179
ENDIF()
172180

181+
# See if nghttp2 exists in a configured or defaulted location
182+
SET(NGHTTP2_FOUND TRUE)
183+
IF(EXISTS "${NGHTTP2_INCLUDE_DIR}/nghttp2/nghttp2.h")
184+
FOREACH(onelib ${NGHTTP2_LIBRARIES})
185+
IF(NOT EXISTS ${onelib})
186+
SET(NGHTTP2_FOUND FALSE)
187+
ENDIF()
188+
ENDFOREACH()
189+
ELSE()
190+
SET(NGHTTP2_FOUND FALSE)
191+
ENDIF()
192+
173193
MESSAGE(STATUS "")
174194
MESSAGE(STATUS "Summary of feature detection:")
175195
MESSAGE(STATUS "")
176196
MESSAGE(STATUS "LIBXML2_FOUND ............ : ${LIBXML2_FOUND}")
177197
MESSAGE(STATUS "LUA51_FOUND .............. : ${LUA51_FOUND}")
198+
MESSAGE(STATUS "NGHTTP2_FOUND ............ : ${NGHTTP2_FOUND}")
178199
MESSAGE(STATUS "OPENSSL_FOUND ............ : ${OPENSSL_FOUND}")
179200
MESSAGE(STATUS "ZLIB_FOUND ............... : ${ZLIB_FOUND}")
180201
MESSAGE(STATUS "APR_HAS_LDAP ............. : ${APR_HAS_LDAP}")
@@ -272,6 +293,7 @@ SET(MODULE_LIST
272293
"modules/generators/mod_info+I+server information"
273294
"modules/generators/mod_status+I+process/thread monitoring"
274295
"modules/http/mod_mime+A+mapping of file-extension to MIME. Disabling this module is normally not recommended."
296+
"modules/http2/mod_http2+a+HTTP/2 protocol support"
275297
"modules/ldap/mod_ldap+i+LDAP caching and connection pooling services"
276298
"modules/loggers/mod_log_config+A+logging configuration. You won't be able to log requests to the server without this module."
277299
"modules/loggers/mod_log_debug+I+configurable debug logging"
@@ -371,6 +393,23 @@ IF(ZLIB_FOUND)
371393
ENDIF()
372394
SET(mod_firehose_requires SOMEONE_TO_MAKE_IT_COMPILE_ON_WINDOWS)
373395
SET(mod_heartbeat_extra_libs mod_watchdog)
396+
SET(mod_http2_requires NGHTTP2_FOUND)
397+
SET(mod_http2_extra_defines ssize_t=long)
398+
SET(mod_http2_extra_libs ${NGHTTP2_LIBRARIES})
399+
SET(mod_http2_extra_sources
400+
modules/http2/h2_alt_svc.c modules/http2/h2_config.c
401+
modules/http2/h2_conn.c modules/http2/h2_conn_io.c
402+
modules/http2/h2_ctx.c modules/http2/h2_from_h1.c
403+
modules/http2/h2_h2.c modules/http2/h2_io.c
404+
modules/http2/h2_io_set.c modules/http2/h2_mplx.c
405+
modules/http2/h2_request.c modules/http2/h2_response.c
406+
modules/http2/h2_session.c modules/http2/h2_stream.c
407+
modules/http2/h2_stream_set.c modules/http2/h2_switch.c
408+
modules/http2/h2_task.c modules/http2/h2_task_input.c
409+
modules/http2/h2_task_output.c modules/http2/h2_task_queue.c
410+
modules/http2/h2_to_h1.c modules/http2/h2_util.c
411+
modules/http2/h2_worker.c modules/http2/h2_workers.c
412+
)
374413
SET(mod_ldap_extra_defines LDAP_DECLARE_EXPORT)
375414
SET(mod_ldap_extra_libs wldap32)
376415
SET(mod_ldap_extra_sources

README.cmake

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ enabled:
5858

5959
* libxml2 (e.g., mod_proxy_html)
6060
* lua 5.1 (mod_lua)
61+
* nghttp2 (mod_http2)
6162
* openssl (mod_ssl and https support for ab)
6263
* zlib (mod_deflate)
6364

@@ -80,6 +81,17 @@ these libraries.
8081
To work around this issue, rename the well-known OpenSSL directory while
8182
building httpd. Let us know if you find a better solution.
8283

84+
nghttp2
85+
-------
86+
87+
This is required for mod_http2.
88+
89+
cmake-based build support for nghttp2 for Windows can be found at
90+
https://github.com/trawick/nghttp2-minimal-cmake. That easily fits into
91+
a build system that already uses cmake for httpd, apr, and perhaps other
92+
packages. A dynamic build of nghttp2 using its normal Windows build
93+
system should also be usable by nghttp2.
94+
8395
How to build
8496
------------
8597

@@ -99,7 +111,8 @@ How to build
99111

100112
Alternately, you can use the cmake-gui and update settings in the GUI.
101113

102-
PCRE_INCLUDE_DIR, PCRE_LIBRARIES, APR_INCLUDE_DIR, APR_LIBRARIES:
114+
PCRE_INCLUDE_DIR, PCRE_LIBRARIES, APR_INCLUDE_DIR, APR_LIBRARIES,
115+
NGHTTP2_INCLUDE_DIR, NGHTTP2_LIBRARIES:
103116

104117
cmake doesn't bundle FindXXX for these packages, so the crucial
105118
information has to be specified in this manner if they aren't found
@@ -134,6 +147,12 @@ How to build
134147
APR-Util are found in the default location, the LDAP library will be
135148
included if it is present.
136149

150+
-DNGHTTP2_INCLUDE_DIR=d:/path/to/nghttp2inst/include (which has nghttp2/*.h)
151+
-DNGHTTP2_LIBRARIES=d:/path/to/nghttp2inst/lib/nghttp2.lib"
152+
153+
These will have to be specified if nghttp2 was installed to a different
154+
directory than httpd.
155+
137156
LIBXML2_ICONV_INCLUDE_DIR, LIBXML2_ICONV_LIBRARIES
138157
139158
If using a module that requires libxml2 *and* the build of libxml2 requires

0 commit comments

Comments
 (0)