Refine folder structure; add rapidjson as submodule.

master
Adam Gu 7 years ago
parent 9abf8d99d5
commit 5bc988b093

3
.gitmodules vendored

@ -0,0 +1,3 @@
[submodule "third_party/rapidjson"]
path = third_party/rapidjson
url = https://github.com/Tencent/rapidjson

@ -1,15 +1,16 @@
cmake_minimum_required(VERSION 3.1.0)
project(webcc)
option(WEBCC_ENABLE_SOAP "Enable SOAP support (need PugiXml)?" ON)
option(WEBCC_ENABLE_UT "Enable unit test?" ON)
option(WEBCC_ENABLE_DEMO "Enable demo programs?" ON)
option(WEBCC_ENABLE_SOAP "Enable SOAP support (need pugixml)?" ON)
option(WEBCC_BUILD_UNITTEST "Build unit test?" ON)
option(WEBCC_BUILD_REST_EXAMPLE "Build REST example?" ON)
option(WEBCC_BUILD_SOAP_EXAMPLE "Build SOAP example?" ON)
if(WEBCC_ENABLE_SOAP)
add_definitions(-DWEBCC_ENABLE_SOAP)
endif()
if(WEBCC_ENABLE_UT)
if(WEBCC_BUILD_UNITTEST)
enable_testing()
endif()
@ -77,6 +78,35 @@ if(Boost_FOUND)
message(STATUS ${Boost_LIBRARIES})
endif()
# For including its own headers as "webcc/http_client.h".
include_directories(${PROJECT_SOURCE_DIR}/src)
add_subdirectory(src)
# SOAP support needs pugixml to parse and create XML.
if(WEBCC_ENABLE_SOAP)
add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/pugixml)
# For including pugixml as "pugixml/pugixml.hpp".
# TODO: Remove "pugixml" prefix?
include_directories(${PROJECT_SOURCE_DIR}/third_party)
endif()
add_subdirectory(src/webcc)
if(WEBCC_BUILD_REST_EXAMPLE)
# REST example needs rapidjson to parse and create JSON.
# rapidjson is included as a Git submodule.
include_directories(${PROJECT_SOURCE_DIR}/third_party/rapidjson/include)
add_subdirectory(${PROJECT_SOURCE_DIR}/example/rest_book_server)
add_subdirectory(${PROJECT_SOURCE_DIR}/example/rest_book_client)
endif()
if(WEBCC_BUILD_SOAP_EXAMPLE)
add_subdirectory(${PROJECT_SOURCE_DIR}/example/soap_calc_server)
add_subdirectory(${PROJECT_SOURCE_DIR}/example/soap_calc_client)
endif()
if(WEBCC_BUILD_UNITTEST)
add_subdirectory(third_party/gtest)
add_subdirectory(unittest)
endif()

@ -1,23 +0,0 @@
if(UNIX)
add_definitions(-std=c++11)
endif()
if(WEBCC_ENABLE_UT)
add_subdirectory(gtest)
add_subdirectory(webcc_unittest)
endif()
if(WEBCC_ENABLE_SOAP)
add_subdirectory(pugixml)
endif()
add_subdirectory(webcc)
if(WEBCC_ENABLE_DEMO)
if(WEBCC_ENABLE_SOAP)
add_subdirectory(demo/soap/calc_client)
add_subdirectory(demo/soap/calc_server)
endif()
add_subdirectory(demo/rest/book_client)
add_subdirectory(demo/rest/book_server)
endif()

@ -0,0 +1,4 @@
Rapidjson is included as a Git submodule because it's a header-only library and easy to integrate.
Pugixml is not a Git submodule because its Git repo is not well structured. It does have a CMakeLists.txt but it's difficult to integrate.
TODO: Use Git submodule for gtest?

@ -0,0 +1 @@
Subproject commit 8022a5f79c7490e2a9dd5934ac9c77b6d5555a6d
Loading…
Cancel
Save