Skip to content

Commit

Permalink
brought the cmake files more into line with beman
Browse files Browse the repository at this point in the history
  • Loading branch information
dietmarkuehl committed Sep 19, 2024
1 parent f5e63ac commit d10fcda
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 69 deletions.
20 changes: 13 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,28 +1,34 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# cmake-format: off
# /CMakeLists.txt -*-makefile-*-
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# cmake-format: on

cmake_minimum_required(VERSION 3.23)

project(beman_net29 VERSION 0.0.0 LANGUAGES CXX)

enable_testing()
set(TARGET_NAME net29)
set(TARGET_PREFIX beman.${TARGET_NAME})
set(TARGET_LIBRARY beman_${TARGET_NAME})
set(TARGET_ALIAS beman::${TARGET_NAME})
set(TARGETS_EXPORT_NAME ${CMAKE_PROJECT_NAME}Targets)

set(CMAKE_CXX_STANDARD 23)
set(TARGETS_EXPORT_NAME ${CMAKE_PROJECT_NAME}Targets)

include(FetchContent)
FetchContent_Declare(
execution26
# for local development, use SOURCE_DIR <path-to>/execution26
GIT_REPOSITORY https://github.com/beman-project/execution26
GIT_TAG 22affb6
GIT_TAG 81c58fe
)
FetchContent_MakeAvailable(execution26)

add_subdirectory(src)
include(CTest)
if(BUILD_TESTING)
add_subdirectory(src/beman/${TARGET_NAME}/tests)
enable_testing()
endif()

add_subdirectory(src/beman/net29)
add_subdirectory(examples)

include(GNUInstallDirs)
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ todo:
bin/mk-todo.py

clean:
$(RM) -r $(BUILD)
$(RM) mkerr olderr *~

distclean: clean
Expand Down
25 changes: 4 additions & 21 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,6 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# cmake-format: on

set(BEMAN_EXECUTION26_LIBRARY beman_execution26)
set(BEMAN_NET29_LIBRARY beman_net29)
set(LIBRARIES
${BEMAN_NET29_LIBRARY}
${BEMAN_EXECUTION26_LIBRARY}
)

include(GNUInstallDirs)

set(EXAMPLES
http-server
empty
Expand All @@ -21,17 +12,9 @@ set(EXAMPLES
cppcon-2024
)

set(DATA
index.html
favicon.ico
)

foreach(FILE ${DATA})
file(GENERATE OUTPUT data/${FILE} INPUT data/${FILE})
endforeach()

foreach(EXAMPLE ${EXAMPLES})
add_executable(${EXAMPLE})
target_sources(${EXAMPLE} PRIVATE ${EXAMPLE}.cpp)
target_link_libraries(${EXAMPLE} PRIVATE ${LIBRARIES})
set(EXAMPLE_TARGET ${TARGET_PREFIX}.examples.${EXAMPLE})
add_executable(${EXAMPLE_TARGET})
target_sources(${EXAMPLE_TARGET} PRIVATE ${EXAMPLE}.cpp)
target_link_libraries(${EXAMPLE_TARGET} PRIVATE ${TARGET_LIBRARY})
endforeach()
6 changes: 0 additions & 6 deletions src/CMakeLists.txt

This file was deleted.

6 changes: 0 additions & 6 deletions src/beman/CMakeLists.txt

This file was deleted.

49 changes: 24 additions & 25 deletions src/beman/net29/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# cmake-format: on

set(TARGET_LIBRARY beman_net29)

add_subdirectory(tests)
add_library(${TARGET_LIBRARY} STATIC)
add_library(${TARGET_ALIAS} ALIAS ${TARGET_LIBRARY})

target_sources(${TARGET_LIBRARY}
PRIVATE
Expand All @@ -15,32 +13,32 @@ target_sources(${TARGET_LIBRARY}
FILE_SET ${TARGET_LIBRARY}_public_headers TYPE HEADERS
BASE_DIRS ${PROJECT_SOURCE_DIR}/include
FILES
${PROJECT_SOURCE_DIR}/include/beman/net29/net.hpp
${PROJECT_SOURCE_DIR}/include/beman/${TARGET_NAME}/net.hpp
PUBLIC
FILE_SET ${TARGET_LIBRARY}_detail_headers TYPE HEADERS
BASE_DIRS ${PROJECT_SOURCE_DIR}/include
FILES
${PROJECT_SOURCE_DIR}/include/beman/net29/detail/basic_socket.hpp
${PROJECT_SOURCE_DIR}/include/beman/net29/detail/basic_socket_acceptor.hpp
${PROJECT_SOURCE_DIR}/include/beman/net29/detail/basic_stream_socket.hpp
${PROJECT_SOURCE_DIR}/include/beman/net29/detail/buffer.hpp
${PROJECT_SOURCE_DIR}/include/beman/net29/detail/container.hpp
${PROJECT_SOURCE_DIR}/include/beman/net29/detail/context_base.hpp
${PROJECT_SOURCE_DIR}/include/beman/net29/detail/endpoint.hpp
${PROJECT_SOURCE_DIR}/include/beman/net29/detail/execution.hpp
${PROJECT_SOURCE_DIR}/include/beman/net29/detail/internet.hpp
${PROJECT_SOURCE_DIR}/include/beman/net29/detail/io_base.hpp
${PROJECT_SOURCE_DIR}/include/beman/net29/detail/io_context.hpp
${PROJECT_SOURCE_DIR}/include/beman/net29/detail/io_context_scheduler.hpp
${PROJECT_SOURCE_DIR}/include/beman/net29/detail/netfwd.hpp
${PROJECT_SOURCE_DIR}/include/beman/net29/detail/operations.hpp
${PROJECT_SOURCE_DIR}/include/beman/net29/detail/poll_context.hpp
${PROJECT_SOURCE_DIR}/include/beman/net29/detail/sender.hpp
${PROJECT_SOURCE_DIR}/include/beman/net29/detail/socket_base.hpp
${PROJECT_SOURCE_DIR}/include/beman/net29/detail/socket_category.hpp
${PROJECT_SOURCE_DIR}/include/beman/net29/detail/sorted_list.hpp
${PROJECT_SOURCE_DIR}/include/beman/net29/detail/stop_token.hpp
${PROJECT_SOURCE_DIR}/include/beman/net29/detail/timer.hpp
${PROJECT_SOURCE_DIR}/include/beman/${TARGET_NAME}/detail/basic_socket.hpp
${PROJECT_SOURCE_DIR}/include/beman/${TARGET_NAME}/detail/basic_socket_acceptor.hpp
${PROJECT_SOURCE_DIR}/include/beman/${TARGET_NAME}/detail/basic_stream_socket.hpp
${PROJECT_SOURCE_DIR}/include/beman/${TARGET_NAME}/detail/buffer.hpp
${PROJECT_SOURCE_DIR}/include/beman/${TARGET_NAME}/detail/container.hpp
${PROJECT_SOURCE_DIR}/include/beman/${TARGET_NAME}/detail/context_base.hpp
${PROJECT_SOURCE_DIR}/include/beman/${TARGET_NAME}/detail/endpoint.hpp
${PROJECT_SOURCE_DIR}/include/beman/${TARGET_NAME}/detail/execution.hpp
${PROJECT_SOURCE_DIR}/include/beman/${TARGET_NAME}/detail/internet.hpp
${PROJECT_SOURCE_DIR}/include/beman/${TARGET_NAME}/detail/io_base.hpp
${PROJECT_SOURCE_DIR}/include/beman/${TARGET_NAME}/detail/io_context.hpp
${PROJECT_SOURCE_DIR}/include/beman/${TARGET_NAME}/detail/io_context_scheduler.hpp
${PROJECT_SOURCE_DIR}/include/beman/${TARGET_NAME}/detail/netfwd.hpp
${PROJECT_SOURCE_DIR}/include/beman/${TARGET_NAME}/detail/operations.hpp
${PROJECT_SOURCE_DIR}/include/beman/${TARGET_NAME}/detail/poll_context.hpp
${PROJECT_SOURCE_DIR}/include/beman/${TARGET_NAME}/detail/sender.hpp
${PROJECT_SOURCE_DIR}/include/beman/${TARGET_NAME}/detail/socket_base.hpp
${PROJECT_SOURCE_DIR}/include/beman/${TARGET_NAME}/detail/socket_category.hpp
${PROJECT_SOURCE_DIR}/include/beman/${TARGET_NAME}/detail/sorted_list.hpp
${PROJECT_SOURCE_DIR}/include/beman/${TARGET_NAME}/detail/stop_token.hpp
${PROJECT_SOURCE_DIR}/include/beman/${TARGET_NAME}/detail/timer.hpp
)
get_property(DETAIL_HEADER_FILES TARGET ${TARGET_LIBRARY} PROPERTY HEADER_SET_${TARGET_LIBRARY}_detail_headers)
source_group("Header Files\\detail" FILES ${DETAIL_HEADER_FILES})
Expand All @@ -58,6 +56,7 @@ install(
FILE_SET ${TARGET_LIBRARY}_detail_headers
)
target_include_directories(${TARGET_LIBRARY} PUBLIC $<INSTALL_INTERFACE:include>)
target_link_libraries(${TARGET_LIBRARY} PUBLIC beman::execution26)

install(EXPORT ${TARGETS_EXPORT_NAME}1
FILE ${TARGET_LIBRARY}-config.cmake
Expand Down
10 changes: 6 additions & 4 deletions src/beman/net29/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# src/beman/net29/tests/CMakeLists.txt
# cmake-format: off
# src/beman/net29/CMakeLists.txt -*-makefile-*-
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# cmake-format: on

list(APPEND execution_tests
list(APPEND tests
sorted_list.pass
)

foreach(test ${execution_tests})
foreach(test ${tests})
add_executable(${test} ${test}.cpp)
target_link_libraries(${test} PRIVATE ${TARGET_LIBRARY})
add_test(NAME ${test} COMMAND $<TARGET_FILE:${test}>)
endforeach()
endforeach()

0 comments on commit d10fcda

Please sign in to comment.