-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from JadeMatrix/v0.8.6
v0.8.6
- Loading branch information
Showing
17 changed files
with
401 additions
and
224 deletions.
There are no files selected for viewing
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +1,71 @@ | ||
CMAKE_MINIMUM_REQUIRED( VERSION 3.6 ) | ||
|
||
SET( CMAKE_CXX_STANDARD 11 ) | ||
SET( CMAKE_CXX_STANDARD_REQUIRED ON ) | ||
SET( CMAKE_CXX_STANDARD 11 ) | ||
SET( CMAKE_CXX_STANDARD_REQUIRED ON ) | ||
SET( CMAKE_CXX_EXTENSIONS OFF ) | ||
|
||
PROJECT( | ||
"SHOW Tests & Examples" | ||
VERSION 0.8.5 | ||
"Simple Header-Only Webserver" | ||
VERSION 0.8.6 | ||
LANGUAGES CXX | ||
) | ||
|
||
FIND_LIBRARY( UNITTEST_LIBRARY UnitTest++ ) | ||
LIST( APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMakeModules/" ) | ||
|
||
INCLUDE_DIRECTORIES( | ||
src | ||
INCLUDE( CTest ) | ||
INCLUDE( GNUInstallDirs ) | ||
|
||
STRING( REPLACE "${PROJECT_NAME}" "show" | ||
CMAKE_INSTALL_DOCDIR | ||
"${CMAKE_INSTALL_DOCDIR}" | ||
) | ||
|
||
|
||
# Tests ######################################################################## | ||
ADD_LIBRARY( show INTERFACE ) | ||
TARGET_INCLUDE_DIRECTORIES( | ||
show | ||
INTERFACE | ||
"$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/>" | ||
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>" | ||
) | ||
INSTALL( | ||
TARGETS show | ||
EXPORT "show-config" | ||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" | ||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" | ||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" | ||
) | ||
INSTALL( | ||
DIRECTORY "src/" | ||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" | ||
) | ||
|
||
if( UNITTEST_LIBRARY ) | ||
FIND_LIBRARY( CURL_LIBRARY curl ) | ||
ADD_EXECUTABLE( tests | ||
../tests/async_utils.cpp | ||
../tests/base64_tests.cpp | ||
../tests/connection_tests.cpp | ||
../tests/multipart_tests.cpp | ||
../tests/request_tests.cpp | ||
../tests/response_tests.cpp | ||
../tests/server_tests.cpp | ||
../tests/tests.cpp | ||
../tests/type_tests.cpp | ||
../tests/url_encode_tests.cpp | ||
) | ||
TARGET_LINK_LIBRARIES( tests | ||
${UNITTEST_LIBRARY} | ||
${CURL_LIBRARY} | ||
) | ||
endif( UNITTEST_LIBRARY ) | ||
|
||
# CTest sets `BUILD_TESTING` to "on" by default | ||
IF( BUILD_TESTING ) | ||
ADD_SUBDIRECTORY( "tests/" ) | ||
ENDIF() | ||
|
||
# Examples ##################################################################### | ||
# All examples are excluded from `ALL` but can be built manually | ||
ADD_SUBDIRECTORY( "examples/" ) | ||
|
||
ADD_EXECUTABLE( echo | ||
../examples/echo.cpp | ||
) | ||
ADD_EXECUTABLE( fileserve | ||
../examples/fileserve.cpp | ||
) | ||
ADD_EXECUTABLE( hello_world | ||
../examples/hello_world.cpp | ||
) | ||
ADD_EXECUTABLE( http_1_1 | ||
../examples/http_1_1.cpp | ||
) | ||
ADD_EXECUTABLE( | ||
multipart_form_handling | ||
../examples/multipart_form_handling.cpp | ||
) | ||
ADD_EXECUTABLE( multiple_clients | ||
../examples/multiple_clients.cpp | ||
ADD_SUBDIRECTORY( "doc/" ) | ||
|
||
|
||
INCLUDE( CMakePackageConfigHelpers ) | ||
WRITE_BASIC_PACKAGE_VERSION_FILE( | ||
"${CMAKE_BINARY_DIR}/show-config-version.cmake" | ||
COMPATIBILITY SameMinorVersion | ||
) | ||
ADD_EXECUTABLE( streaming_echo | ||
../examples/streaming_echo.cpp | ||
INSTALL( | ||
FILES "${CMAKE_BINARY_DIR}/show-config-version.cmake" | ||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/show/" | ||
) | ||
|
||
ADD_CUSTOM_TARGET( examples ) | ||
ADD_DEPENDENCIES( examples | ||
echo | ||
fileserve | ||
hello_world | ||
http_1_1 | ||
multipart_form_handling | ||
multiple_clients | ||
streaming_echo | ||
INSTALL( | ||
EXPORT "show-config" | ||
NAMESPACE "SHOW::" | ||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/show/" | ||
) | ||
|
||
EXPORT( EXPORT "show-config" FILE "show-config.cmake" ) |
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,34 @@ | ||
INCLUDE( FindPackageHandleStandardArgs ) | ||
|
||
FOREACH( PROGRAM | ||
"apidoc" | ||
"autogen" | ||
"build" | ||
"quickstart" | ||
) | ||
FIND_PROGRAM( | ||
SPHINX_${PROGRAM}_LOCATION | ||
NAMES "sphinx-${PROGRAM}" | ||
HINTS "${SPHINX_DIR}" "$ENV{SPHINX_DIR}" | ||
PATH_SUFFIXES "bin/" | ||
DOC "Sphinx executable sphinx-${PROGRAM}" | ||
) | ||
MARK_AS_ADVANCED( SPHINX_${PROGRAM}_LOCATION ) | ||
IF( SPHINX_${PROGRAM}_LOCATION ) | ||
ADD_EXECUTABLE( Sphinx::${PROGRAM} IMPORTED ) | ||
SET_TARGET_PROPERTIES( | ||
Sphinx::${PROGRAM} | ||
PROPERTIES | ||
IMPORTED_LOCATION "${SPHINX_${PROGRAM}_LOCATION}" | ||
) | ||
SET(Sphinx_${PROGRAM}_FOUND TRUE) | ||
ENDIF () | ||
ENDFOREACH() | ||
|
||
# FPHSA will set this to false if it wasn't actually found | ||
SET( Sphinx_FOUND TRUE ) | ||
FIND_PACKAGE_HANDLE_STANDARD_ARGS( | ||
Sphinx | ||
HANDLE_COMPONENTS | ||
REQUIRED_VARS Sphinx_FOUND | ||
) |
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,26 @@ | ||
FIND_PACKAGE( Sphinx COMPONENTS build ) | ||
|
||
IF( TARGET Sphinx::build ) | ||
SET(SHOW_DOC_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/show/") | ||
ADD_CUSTOM_TARGET( doc ALL ) | ||
|
||
FOREACH( BUILDER "html" ) | ||
FILE(MAKE_DIRECTORY "${SHOW_DOC_OUTPUT_DIR}/${BUILDER}/") | ||
ADD_CUSTOM_TARGET( | ||
doc_${BUILDER} | ||
Sphinx::build | ||
-b "${BUILDER}" | ||
-d "${CMAKE_CURRENT_BINARY_DIR}" | ||
"${CMAKE_CURRENT_SOURCE_DIR}" | ||
"${SHOW_DOC_OUTPUT_DIR}/${BUILDER}/" | ||
) | ||
ADD_DEPENDENCIES( doc doc_${BUILDER} ) | ||
ENDFOREACH() | ||
|
||
INSTALL( | ||
DIRECTORY "${SHOW_DOC_OUTPUT_DIR}" | ||
DESTINATION "${CMAKE_INSTALL_DOCDIR}" | ||
) | ||
ELSE () | ||
MESSAGE( WARNING "Sphinx not found, not building documentation" ) | ||
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
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
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
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,18 @@ | ||
SET( | ||
SHOW_EXAMPLES | ||
echo | ||
fileserve | ||
hello_world | ||
http_1_1 | ||
multipart_form_handling | ||
multiple_clients | ||
streaming_echo | ||
) | ||
|
||
FOREACH( EXAMPLE IN LISTS SHOW_EXAMPLES ) | ||
ADD_EXECUTABLE( ${EXAMPLE} EXCLUDE_FROM_ALL "${EXAMPLE}.cpp" ) | ||
TARGET_LINK_LIBRARIES( ${EXAMPLE} show ) | ||
ENDFOREACH() | ||
|
||
ADD_CUSTOM_TARGET( examples ) | ||
ADD_DEPENDENCIES( examples ${SHOW_EXAMPLES} ) |
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
Oops, something went wrong.