Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Refactor library build configuration
- Loading branch information
Showing
13 changed files
with
841 additions
and
727 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,187 @@ | ||
add_subdirectory(common) | ||
add_subdirectory(std) | ||
add_subdirectory(zlib) | ||
if (WITH_MYSQL) | ||
add_subdirectory(mysql) | ||
endif() | ||
if (WITH_REGEXP) | ||
add_subdirectory(regexp) | ||
endif() | ||
if (WITH_SQLITE) | ||
add_subdirectory(sqlite) | ||
endif() | ||
if (WITH_SSL) | ||
add_subdirectory(ssl) | ||
endif() | ||
if (WITH_UI) | ||
add_subdirectory(ui) | ||
endif() | ||
|
||
if (WITH_APACHE) | ||
# Locate Apache | ||
if (STATIC_APACHE) | ||
if (STATIC_OPENSSL) | ||
set(OPENSSL_CONF --with-openssl=${CMAKE_BINARY_DIR}/libs/src/install-prefix) | ||
set(OPENSSL_DEP OpenSSL) | ||
elseif() | ||
set(OPENSSL_CONF "") | ||
set(OPENSSL_DEP "") | ||
endif() | ||
if (STATIC_APR) | ||
set(APR_CONF --with-apr=${CMAKE_BINARY_DIR}/libs/src/install-prefix) | ||
set(APR_DEP APR) | ||
elseif() | ||
set(APR_CONF "") | ||
set(APR_DEP "") | ||
endif() | ||
if (STATIC_APRUTIL) | ||
set(APRUTIL_CONF --with-apr-util=${CMAKE_BINARY_DIR}/libs/src/install-prefix) | ||
set(APRUTIL_DEP APRutil) | ||
elseif() | ||
set(APRUTIL_CONF "") | ||
set(APRUTIL_DEP "") | ||
endif() | ||
if (STATIC_PCRE) | ||
set(PCRE_CONF --with-pcre=${CMAKE_BINARY_DIR}/libs/src/install-prefix) | ||
set(PCRE_DEP PCRE) | ||
elseif() | ||
set(PCRE_CONF "") | ||
set(PCRE_DEP "") | ||
endif() | ||
if (STATIC_ZLIB) | ||
set(ZLIB_CONF --with-z=${CMAKE_BINARY_DIR}/libs/src/install-prefix) | ||
set(ZLIB_DEP Zlib) | ||
elseif() | ||
set(ZLIB_CONF "") | ||
set(ZLIB_DEP "") | ||
endif() | ||
|
||
if(WIN32) | ||
set(APR_CONFIGS | ||
CMAKE_ARGS | ||
-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/libs/src/install-prefix | ||
-Wno-dev | ||
-DAPR_INSTALL_PRIVATE_H=ON | ||
-DINSTALL_PDB=OFF | ||
) | ||
else() | ||
set(APR_CONFIGS | ||
CONFIGURE_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/APR && | ||
./configure --prefix=${CMAKE_BINARY_DIR}/libs/src/install-prefix | ||
--enable-shared=no | ||
--enable-static=yes | ||
--silent | ||
BUILD_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/APR && | ||
make CFLAGS=-w | ||
INSTALL_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/APR && | ||
make install | ||
) | ||
endif() | ||
ExternalProject_Add(APR | ||
${EP_CONFIGS} | ||
URL http://archive.apache.org/dist/apr/apr-1.5.2.tar.gz | ||
URL_MD5 98492e965963f852ab29f9e61b2ad700 | ||
${APR_CONFIGS} | ||
) | ||
set_target_properties(APR PROPERTIES ${EP_PROPS}) | ||
|
||
|
||
if(WIN32) | ||
set(APRutil_CONFIGS | ||
CMAKE_ARGS | ||
-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/libs/src/install-prefix | ||
-Wno-dev | ||
-DOPENSSL_ROOT_DIR=${CMAKE_BINARY_DIR}/libs/src/install-prefix | ||
-DINSTALL_PDB=OFF | ||
) | ||
else() | ||
set(APRutil_CONFIGS | ||
CONFIGURE_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/APRutil && | ||
./configure | ||
--prefix=${CMAKE_BINARY_DIR}/libs/src/install-prefix | ||
--silent | ||
${APR_CONF} | ||
${OPENSSL_CONF} | ||
BUILD_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/APRutil && | ||
make CFLAGS=-w | ||
INSTALL_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/APRutil && | ||
make install | ||
) | ||
endif() | ||
ExternalProject_Add(APRutil | ||
${EP_CONFIGS} | ||
DEPENDS ${APR_DEP} ${OPENSSL_DEP} | ||
URL http://archive.apache.org/dist/apr/apr-util-1.5.4.tar.gz | ||
URL_MD5 866825c04da827c6e5f53daff5569f42 | ||
${APRutil_CONFIGS} | ||
) | ||
set_target_properties(APRutil PROPERTIES ${EP_PROPS}) | ||
|
||
|
||
if(WIN32) | ||
set(Apache_CONFIGS | ||
CMAKE_ARGS | ||
-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/libs/src/install-prefix | ||
-Wno-dev | ||
-DOPENSSL_ROOT_DIR=${CMAKE_BINARY_DIR}/libs/src/install-prefix | ||
"-DEXTRA_COMPILE_FLAGS=/D PCRE_STATIC" | ||
-DEXTRA_LIBS=Ws2_32 | ||
BUILD_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/Apache-build && | ||
${CMAKE_COMMAND} --build . --target libhttpd --config ${CMAKE_CFG_INTDIR} | ||
INSTALL_COMMAND echo skip install | ||
) | ||
set(APACHE_INCLUDE_DIRS | ||
${CMAKE_BINARY_DIR}/libs/src/install-prefix/include | ||
${CMAKE_BINARY_DIR}/libs/src/Apache/include | ||
${CMAKE_BINARY_DIR}/libs/src/Apache/os/win32 | ||
${CMAKE_BINARY_DIR}/libs/src/Apache-build | ||
) | ||
set(APACHE_LIBRARIES | ||
${CMAKE_BINARY_DIR}/libs/src/install-prefix/lib/libapr-1.lib | ||
${CMAKE_BINARY_DIR}/libs/src/Apache-build/${CMAKE_CFG_INTDIR}/libhttpd.lib | ||
) | ||
else() | ||
set(Apache_CONFIGS | ||
CONFIGURE_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/Apache && | ||
./configure | ||
--prefix=${CMAKE_BINARY_DIR}/libs/src/Apache-build | ||
--silent | ||
${APR_CONF} | ||
${APRUTIL_CONF} | ||
${OPENSSL_CONF} | ||
${PCRE_CONF} | ||
${ZLIB_CONF} | ||
BUILD_COMMAND echo skip build | ||
INSTALL_COMMAND echo skip install | ||
) | ||
set(APACHE_INCLUDE_DIRS | ||
${CMAKE_BINARY_DIR}/libs/src/install-prefix/include/apr-1 | ||
${CMAKE_BINARY_DIR}/libs/src/Apache/include | ||
${CMAKE_BINARY_DIR}/libs/src/Apache/os/unix | ||
) | ||
set(APACHE_LIBRARIES | ||
|
||
) | ||
endif() | ||
ExternalProject_Add(Apache | ||
${EP_CONFIGS} | ||
DEPENDS ${APR_DEP} ${APRUTIL_DEP} ${OPENSSL_DEP} ${PCRE_DEP} | ||
URL http://archive.apache.org/dist/httpd/httpd-2.4.20.tar.gz | ||
URL_MD5 e725c268624737a163dc844e28f720d1 | ||
${Apache_CONFIGS} | ||
) | ||
set_target_properties(Apache PROPERTIES ${EP_PROPS}) | ||
# Download sources for fat source archive | ||
add_dependencies(download_static_deps Apache-download) | ||
add_dependencies(download_static_deps APR-download) | ||
add_dependencies(download_static_deps APRutil-download) | ||
else() | ||
find_package(APACHE REQUIRED) | ||
find_package(APR REQUIRED) | ||
set(APACHE_LIBRARIES ${APR_LIBRARIES} ${APRUTIL_LIBRARIES}) | ||
set(APACHE_INCLUDE_DIRS ${APACHE_INCLUDE_DIR} ${APR_INCLUDE_DIR} ${APRUTIL_INCLUDE_DIR}) | ||
endif() | ||
|
||
add_subdirectory(mod_neko) | ||
add_subdirectory(mod_tora) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,5 @@ configure_file ( | |
"${CMAKE_BINARY_DIR}/osdef.h" | ||
) | ||
|
||
add_library(socket socket.c) | ||
add_library(sha1 sha1.c) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
|
||
###################### | ||
# mod_neko2.ndll | ||
|
||
add_library(mod_neko2.ndll MODULE | ||
../../vm/stats.c # FIXME | ||
mod_neko.c | ||
cgi.c | ||
) | ||
|
||
target_include_directories(mod_neko2.ndll | ||
PRIVATE | ||
${APACHE_INCLUDE_DIRS} | ||
) | ||
|
||
target_link_libraries(mod_neko2.ndll libneko ${APACHE_LIBRARIES}) | ||
|
||
# In static Apache case build dependencies first | ||
if (STATIC_APACHE) | ||
add_dependencies(mod_neko2.ndll Apache APR APRutil) | ||
endif() | ||
|
||
set_target_properties(mod_neko2.ndll | ||
PROPERTIES | ||
PREFIX "" | ||
OUTPUT_NAME mod_neko2 | ||
SUFFIX .ndll | ||
) | ||
|
||
if(APPLE) | ||
set_target_properties(mod_neko2.ndll | ||
PROPERTIES | ||
LINK_FLAGS "-undefined dynamic_lookup ${LINK_FLAGS}" | ||
) | ||
endif(APPLE) | ||
|
||
install ( | ||
TARGETS mod_neko2.ndll | ||
DESTINATION ${DEST_NDLL} | ||
) | ||
|
||
install(SCRIPT ${NEKO_FLATTEN_SCRIPT}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
|
||
###################### | ||
# mod_tora2.ndll | ||
|
||
add_library(mod_tora2.ndll MODULE | ||
protocol.c | ||
mod_tora.c | ||
) | ||
|
||
add_dependencies(mod_tora2.ndll | ||
mod_neko2.ndll | ||
socket | ||
) | ||
|
||
target_include_directories(mod_tora2.ndll | ||
PRIVATE | ||
${APACHE_INCLUDE_DIRS} | ||
) | ||
|
||
target_link_libraries(mod_tora2.ndll | ||
socket | ||
${APACHE_LIBRARIES} | ||
) | ||
|
||
if (WIN32) | ||
target_link_libraries(mod_tora2.ndll ws2_32) | ||
endif() | ||
|
||
set_target_properties(mod_tora2.ndll | ||
PROPERTIES | ||
PREFIX "" | ||
OUTPUT_NAME mod_tora2 | ||
SUFFIX .ndll | ||
) | ||
|
||
####################### | ||
|
||
if(APPLE) | ||
set_target_properties(mod_tora2.ndll | ||
PROPERTIES | ||
LINK_FLAGS "-undefined dynamic_lookup ${LINK_FLAGS}" | ||
) | ||
endif(APPLE) | ||
|
||
install ( | ||
TARGETS mod_tora2.ndll | ||
DESTINATION ${DEST_NDLL} | ||
) | ||
|
||
install(SCRIPT ${NEKO_FLATTEN_SCRIPT}) |
Oops, something went wrong.