Skip to content

Commit

Permalink
A first attempt to fix #207.
Browse files Browse the repository at this point in the history
  • Loading branch information
eao197 committed Jan 12, 2024
1 parent 05bea25 commit f26c5f5
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 9 deletions.
28 changes: 26 additions & 2 deletions dev/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,18 @@ set_property(CACHE RESTINIO_DEP_EXPECTED_LITE PROPERTY STRINGS "system;find;loca
set(RESTINIO_DEP_CATCH2 "local" CACHE STRING "How to get Catch2 dependency)")
set_property(CACHE RESTINIO_DEP_CATCH2 PROPERTY STRINGS "find;local")

# By default we assume to use an embedded version of SObjectizer.
set(RESTINIO_DEP_SOBJECTIZER "local" CACHE STRING "How to get SObjectizer dependency)")
set_property(CACHE RESTINIO_DEP_SOBJECTIZER PROPERTY STRINGS "system;find;local")


message(STATUS "RESTINIO_DEP_STANDALONE_ASIO: ${RESTINIO_DEP_STANDALONE_ASIO}")
message(STATUS "RESTINIO_DEP_BOOST_ASIO: ${RESTINIO_DEP_BOOST_ASIO}")
message(STATUS "RESTINIO_DEP_LLHTTP: ${RESTINIO_DEP_LLHTTP}")
message(STATUS "RESTINIO_DEP_FMT: ${RESTINIO_DEP_FMT}")
message(STATUS "RESTINIO_DEP_EXPECTED_LITE: ${RESTINIO_DEP_EXPECTED_LITE}")
message(STATUS "RESTINIO_DEP_CATCH2: ${RESTINIO_DEP_CATCH2}")
message(STATUS "RESTINIO_DEP_SOBJECTIZER: ${RESTINIO_DEP_SOBJECTIZER}")

set(RESTINIO_ASIO_SOURCE "standalone" CACHE STRING "What source of ASIO to use (standalone, boost)")
set(RESTINIO_ASIO_SOURCE_VALUES "standalone;boost")
Expand Down Expand Up @@ -194,8 +200,24 @@ endif ()

if (RESTINIO_WITH_SOBJECTIZER)
message("========================================")
SET(SOBJECTIZER_BUILD_STATIC ON)
add_subdirectory(so_5)
if (RESTINIO_DEP_SOBJECTIZER STREQUAL "local")
message(STATUS "Add subdirectory so_5")
SET(SOBJECTIZER_BUILD_STATIC ON)
add_subdirectory(so_5)

set(RESTINIO_SOBJECTIZER_LIB_LINK_NAME "sobjectizer::StaticLib")
elseif (RESTINIO_DEP_SOBJECTIZER STREQUAL "find")
find_package(sobjectizer CONFIG REQUIRED)

set(RESTINIO_SOBJECTIZER_LIB_LINK_NAME "sobjectizer::StaticLib")
elseif (RESTINIO_DEP_SOBJECTIZER STREQUAL "system")
if (NOT RESTINIO_SOBJECTIZER_LIB_LINK_NAME)
message(FATAL_ERROR "The RESTINIO_SOBJECTIZER_LIB_LINK_NAME has to be "
"specified explicitly when RESTINIO_DEP_SOBJECTIZER is 'system'")
endif()
endif()

message(STATUS "RESTINIO_SOBJECTIZER_LIB_LINK_NAME: ${RESTINIO_SOBJECTIZER_LIB_LINK_NAME}")
message("========================================")
endif ()

Expand Down Expand Up @@ -340,3 +362,5 @@ if (RESTINIO_BENCHMARK)
include_directories("${CMAKE_SOURCE_DIR}/clara")
add_subdirectory(benches)
endif ()

# vim:ts=4:sts=4:sw=4:expandtab:
6 changes: 5 additions & 1 deletion dev/benches/single_handler_so5_timer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
set(BENCH _bench.restinio.single_handler_so5_timer)
include(${CMAKE_SOURCE_DIR}/cmake/bench.cmake)

target_link_libraries(${BENCH} PRIVATE sobjectizer::StaticLib)
if (RESTINIO_DEP_SOBJECTIZER STREQUAL "system")
target_compile_definitions(${BENCH} PRIVATE SO_5_STATIC_LIB)
endif()

target_link_libraries(${BENCH} PRIVATE ${RESTINIO_SOBJECTIZER_LIB_LINK_NAME})

target_link_libraries(${BENCH} PRIVATE restinio_helpers::cmd_line_args)

6 changes: 5 additions & 1 deletion dev/sample/async_chained_handlers/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
set(SAMPLE sample.async_chained_handlers)
include(${CMAKE_SOURCE_DIR}/cmake/sample.cmake)

target_link_libraries(${SAMPLE} PRIVATE sobjectizer::StaticLib)
if (RESTINIO_DEP_SOBJECTIZER STREQUAL "system")
target_compile_definitions(${SAMPLE} PRIVATE SO_5_STATIC_LIB)
endif()

target_link_libraries(${SAMPLE} PRIVATE ${RESTINIO_SOBJECTIZER_LIB_LINK_NAME})
6 changes: 5 additions & 1 deletion dev/sample/async_handling_with_sobjectizer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
set(SAMPLE sample.async_handling_with_sobjectizer)
include(${CMAKE_SOURCE_DIR}/cmake/sample.cmake)

TARGET_LINK_LIBRARIES(${SAMPLE} PRIVATE sobjectizer::StaticLib)
if (RESTINIO_DEP_SOBJECTIZER STREQUAL "system")
target_compile_definitions(${SAMPLE} PRIVATE SO_5_STATIC_LIB)
endif()

target_link_libraries(${SAMPLE} PRIVATE ${RESTINIO_SOBJECTIZER_LIB_LINK_NAME})
6 changes: 5 additions & 1 deletion dev/sample/notificators/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
set(SAMPLE sample.notificators)
include(${CMAKE_SOURCE_DIR}/cmake/sample.cmake)

TARGET_LINK_LIBRARIES(${SAMPLE} PRIVATE sobjectizer::StaticLib)
if (RESTINIO_DEP_SOBJECTIZER STREQUAL "system")
target_compile_definitions(${SAMPLE} PRIVATE SO_5_STATIC_LIB)
endif()

target_link_libraries(${SAMPLE} PRIVATE ${RESTINIO_SOBJECTIZER_LIB_LINK_NAME})
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
set(UNITTEST _unit.test.handle_requests.async_chained_handlers_2)
include(${CMAKE_SOURCE_DIR}/cmake/unittest.cmake)

target_link_libraries(${UNITTEST} PRIVATE sobjectizer::StaticLib)
if (RESTINIO_DEP_SOBJECTIZER STREQUAL "system")
target_compile_definitions(${UNITTEST} PRIVATE SO_5_STATIC_LIB)
endif()

target_link_libraries(${UNITTEST} PRIVATE ${RESTINIO_SOBJECTIZER_LIB_LINK_NAME})
6 changes: 5 additions & 1 deletion dev/test/websocket/notificators/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
set(UNITTEST _unit.test.notificators)
include(${CMAKE_SOURCE_DIR}/cmake/unittest.cmake)

TARGET_LINK_LIBRARIES(${UNITTEST} PRIVATE sobjectizer::StaticLib)
if (RESTINIO_DEP_SOBJECTIZER STREQUAL "system")
target_compile_definitions(${UNITTEST} PRIVATE SO_5_STATIC_LIB)
endif()

target_link_libraries(${UNITTEST} PRIVATE ${RESTINIO_SOBJECTIZER_LIB_LINK_NAME})
6 changes: 5 additions & 1 deletion dev/test/websocket/ws_connection/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
set(UNITTEST _unit.test.ws_connection)
include(${CMAKE_SOURCE_DIR}/cmake/unittest.cmake)

TARGET_LINK_LIBRARIES(${UNITTEST} PRIVATE sobjectizer::StaticLib)
if (RESTINIO_DEP_SOBJECTIZER STREQUAL "system")
target_compile_definitions(${UNITTEST} PRIVATE SO_5_STATIC_LIB)
endif()

target_link_libraries(${UNITTEST} PRIVATE ${RESTINIO_SOBJECTIZER_LIB_LINK_NAME})

0 comments on commit f26c5f5

Please sign in to comment.