File tree Expand file tree Collapse file tree 5 files changed +48
-15
lines changed
.github/actions/cmake-build Expand file tree Collapse file tree 5 files changed +48
-15
lines changed Original file line number Diff line number Diff line change @@ -25,21 +25,23 @@ runs:
2525 using : composite
2626 steps :
2727 - name : Configure CMake
28- if : ${{ inputs.library-type }} == "Static"
29- working-directory : ${{ inputs.build-dir }}
30- run : cmake .. -DCMAKE_BUILD_TYPE=${{ inputs.build-type }} -DCMAKE_TOOLCHAIN_FILE:STRING="${{ inputs.toolchain }}" -DBUILD_TESTS:BOOL=true -DBUILD_EXAMPLES:BOOL=true ${{ inputs.args }}
31- shell : pwsh
32-
33- - name : Configure CMake
34- if : ${{ inputs.library-type }} == "Shared"
35- working-directory : ${{ inputs.build-dir }}
36- run : cmake .. -DCMAKE_BUILD_TYPE=${{ inputs.build-type }} -DSEVEN_BIT_DI_BUILD_SHARED=ON -DCMAKE_TOOLCHAIN_FILE:STRING="${{ inputs.toolchain }}" -DBUILD_TESTS:BOOL=true -DBUILD_EXAMPLES:BOOL=true ${{ inputs.args }}
37- shell : pwsh
38-
39- - name : Configure CMake
40- if : ${{ inputs.library-type }} == "HeaderOnly"
41- working-directory : ${{ inputs.build-dir }}
42- run : cmake .. -DCMAKE_BUILD_TYPE=${{ inputs.build-type }} -DCMAKE_TOOLCHAIN_FILE:STRING="${{ inputs.toolchain }}" -DSEVEN_BIT_DI_BUILD_TESTS_HO:BOOL=ON -DSEVEN_BIT_DI_BUILD_EXAMPLES_HO:BOOL=ON -DBUILD_TESTS:BOOL=true -DBUILD_EXAMPLES:BOOL=true ${{ inputs.args }}
28+ working-directory : ${{ inputs.library-type }}
29+ with :
30+ key : " ${{ inputs.build-type }}"
31+ map : |
32+ {
33+ "Static": {
34+ "args": ""
35+ },
36+ "Shared": {
37+ "args": "-DSEVEN_BIT_DI_BUILD_SHARED=ON"
38+ },
39+ "HeaderOnly": {
40+ "args": "-DSEVEN_BIT_DI_BUILD_TESTS_HO:BOOL=ON -DSEVEN_BIT_DI_BUILD_EXAMPLES_HO:BOOL=ON"
41+ }
42+ }
43+ export_to : env
44+ run : cmake .. -DCMAKE_BUILD_TYPE=${{ inputs.build-type }} .env.$args -DCMAKE_TOOLCHAIN_FILE:STRING="${{ inputs.toolchain }}" -DBUILD_TESTS:BOOL=true -DBUILD_EXAMPLES:BOOL=true ${{ inputs.args }}
4345 shell : pwsh
4446
4547 - name : Build
Original file line number Diff line number Diff line change @@ -27,3 +27,16 @@ if(SEVEN_BIT_DI_BUILD_EXAMPLES OR SEVEN_BIT_DI_BUILD_EXAMPLE_HO)
2727endif ()
2828
2929install (DIRECTORY ${SEVEN_BIT_DI_HEADERS_DIR} / DESTINATION include )
30+
31+ export (
32+ TARGETS 7BitDI
33+ NAMESPACE 7BitDI::
34+ FILE ${CMAKE_CURRENT_BINARY_DIR} /${CONFIG_TARGETS_FILE} )
35+ install (EXPORT 7BitDI DESTINATION ${EXPORT_DEST_DIR} NAMESPACE 7BitDI:: FILE ${CONFIG_TARGETS_FILE} )
36+
37+ include (CMakePackageConfigHelpers)
38+ configure_package_config_file(${PROJECT_CONFIG_IN} ${PROJECT_CONFIG_OUT}
39+ INSTALL_DESTINATION ${EXPORT_DEST_DIR} )
40+
41+ write_basic_package_version_file(${VERSIONS_CONFIG_FILE} COMPATIBILITY SameMajorVersion)
42+ install (FILES ${PROJECT_CONFIG_OUT} ${VERSIONS_CONFIG_FILE} DESTINATION ${EXPORT_DEST_DIR} )
Original file line number Diff line number Diff line change 1+ @PACKAGE_INIT@
2+
3+ include ("${CMAKE_CURRENT_LIST_DIR} /${config_targets_file} " )
4+
5+ check_required_components(spdlog)
Original file line number Diff line number Diff line change @@ -8,6 +8,10 @@ set(SEVEN_BIT_DI_VERSION_PATCH 0)
88
99set (SEVEN_BIT_DI_VERSION ${SEVEN_BIT_DI_VERSION_MAJOR} .${SEVEN_BIT_DI_VERSION_MINOR} .${SEVEN_BIT_DI_VERSION_PATCH} )
1010
11+ if (NOT CMAKE_BUILD_TYPE )
12+ set (CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose Release or Debug" FORCE)
13+ endif ()
14+
1115set (CMAKE_CXX_STANDARD 17)
1216set (CMAKE_CXX_STANDARD_REQUIRED ON )
1317
@@ -60,6 +64,12 @@ if(SEVEN_BIT_DI_BUILD_PIC)
6064 set (CMAKE_POSITION_INDEPENDENT_CODE ON )
6165endif ()
6266
67+ set (PROJECT_CONFIG_IN ${CMAKE_SOURCE_DIR} /Cmake/7bitDIConfig.cmake.in)
68+ set (PROJECT_CONFIG_OUT ${CMAKE_BINARY_DIR} /7bitDIConfig.cmake)
69+ set (CONFIG_TARGETS_FILE 7bitDIConfigTargets.cmake)
70+ set (VERSIONS_CONFIG_FILE ${CMAKE_BINARY_DIR} /7bitDIConfigVersion.cmake)
71+ set (EXPORT_DEST_DIR ${CMAKE_INSTALL_LIBDIR} /cmake/7bitDI)
72+
6373configure_file (${CMAKE_SOURCE_DIR} /Include /SevenBit/DI/Version .hpp.input ${CMAKE_SOURCE_DIR} /Include /SevenBit/DI/Version .hpp)
6474
6575set (INFOS
Original file line number Diff line number Diff line change 1010 )
1111endif ()
1212
13+ add_library (7BitDI::7BitDI ALIAS 7BitDI)
14+
1315target_compile_definitions (7BitDI PUBLIC SEVEN_BIT_DI_COMPILED_LIB)
1416
1517target_include_directories (7BitDI INTERFACE "$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR} /Include>"
@@ -19,6 +21,7 @@ set_target_properties(7BitDI PROPERTIES VERSION ${SEVEN_BIT_DI_VERSION})
1921set_target_properties (7BitDI PROPERTIES DEBUG_POSTFIX d)
2022
2123add_library (7BitDI_header_only INTERFACE )
24+ add_library (7BitDI::7BitDI_header_only ALIAS 7BitDI_header_only)
2225
2326target_include_directories (7BitDI_header_only INTERFACE "$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR} /Include>"
2427 "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR} >" )
You can’t perform that action at this time.
0 commit comments