Skip to content

Commit 962b8b8

Browse files
committed
cmake install and conan setup
* use components for each sub library * use cmake install * renamed preset for msvc * updated googletests to 1.11 * updated github actions
1 parent fd4ffe7 commit 962b8b8

File tree

98 files changed

+1033
-1250
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+1033
-1250
lines changed

.github/workflows/cmake_tests.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,25 @@ on: push
55
jobs:
66
windows:
77
name: "Windows"
8-
runs-on: windows-2019
8+
runs-on: ${{ matrix.os }}
99

1010
strategy:
1111
fail-fast: false
1212
matrix:
1313
include:
14-
- preset: "msvc2019"
14+
- os: windows-2019
15+
preset: "msvc"
16+
17+
- os: windows-2022
18+
preset: "msvc"
1519

1620
steps:
1721
- name: Checkout
18-
uses: actions/checkout@v2
22+
uses: actions/checkout@v3
1923

2024
- name: Install Tools Ninja and mvsc
2125
uses: ilammy/msvc-dev-cmd@v1
26+
2227
- uses: seanmiddleditch/gha-setup-ninja@master
2328

2429
- name: Build and Test Debug
@@ -35,20 +40,20 @@ jobs:
3540
fail-fast: false
3641
matrix:
3742
include:
38-
- image: "arbmind/cmake-clang:3.22.3-13"
43+
- image: "arbmind/cmake-clang:3.25.1-13"
3944
preset: "clang"
40-
- image: "arbmind/cmake-clang:3.22.3-14"
45+
- image: "arbmind/cmake-clang:3.25.1-14"
4146
preset: "clang"
4247
- image: "arbmind/cmake-clang-libstdcpp:3.25.1-15-12"
4348
preset: "clang-libstdcpp"
44-
- image: "arbmind/cmake-gcc:3.22.3-11"
49+
- image: "arbmind/cmake-gcc:3.25.1-11"
4550
preset: "gcc"
4651
- image: "arbmind/cmake-gcc:3.25.1-12"
4752
preset: "gcc"
4853

4954
steps:
5055
- name: Checkout
51-
uses: actions/checkout@v2
56+
uses: actions/checkout@v3
5257

5358
- name: Build and Test Debug
5459
run: >-

.github/workflows/conan.yml

Lines changed: 54 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -10,108 +10,72 @@ jobs:
1010
- name: Install Conan
1111
uses: turtlebrowser/get-conan@main
1212

13-
- name: install CMake
13+
- name: install CMake
1414
uses: lukka/get-cmake@latest
1515

1616
- name: Install MSVC
1717
uses: ilammy/msvc-dev-cmd@v1
1818

1919
- name: Checkout source
20-
uses: actions/checkout@v2
20+
uses: actions/checkout@v3
2121

22-
- name: Install packages
23-
shell: pwsh
22+
- name: Create conan package
2423
run: |
25-
Set-Location src
26-
[array]$folders=@('array19.lib','coro19.lib','meta19.lib','tuple19.lib', 'string19.lib', 'strong19.lib', 'variant19.lib', 'enum19.lib', 'lookup19.lib', 'optional19.lib', 'partial19.lib', 'serialize19.lib', 'signal19.lib')
27-
foreach ($folder in $folders) {
28-
Set-Location $folder
29-
conan create . ${{ matrix.ConanExtra }}
30-
Set-Location ..
31-
}
32-
Set-Location ../conan
33-
conan create . ${{ matrix.ConanExtra }}
34-
35-
- name: Test packages
36-
shell: pwsh
37-
run: |
38-
Set-Location conan/tests
39-
[array]$folders=Get-ChildItem -Path . -Directory
40-
foreach ($folder in $folders) {
41-
Set-Location $folder
42-
New-Item -Path . -Name "build" -ItemType "directory"
43-
Set-Location build
44-
conan install .. ${{ matrix.ConanExtra }}
45-
cmake .. -DCONAN_DISABLE_CHECK_COMPILER=true
46-
cmake --build . --config Release
47-
ctest
48-
Set-Location ..
49-
Remove-Item -Recurse -Force build
50-
Set-Location ..
51-
}
52-
53-
Conan-Tests-Linux:
54-
name: Conan-tests-linux
55-
runs-on: "ubuntu-latest"
56-
57-
strategy:
58-
fail-fast: false
59-
matrix:
60-
include:
61-
62-
- image: "ghcr.io/fettpet/clang-conan-cmake-dockercontainer:latest-clang11"
63-
ConanExtra: "-s compiler.libcxx=libc++"
64-
- image: "ghcr.io/fettpet/clang-conan-cmake-dockercontainer:latest-clang12"
65-
ConanExtra: "-s compiler.libcxx=libc++"
66-
- image: "ghcr.io/fettpet/clang-conan-cmake-dockercontainer:latest-clang13"
67-
ConanExtra: "-s compiler.libcxx=libc++"
68-
steps:
69-
70-
- name: Checkout source
71-
uses: actions/checkout@v2
72-
24+
cd conan
25+
conan create . --build=missing --profile profiles/msvc2022
7326
74-
- name: Create Conan home folder
27+
- name: Test package components
7528
shell: pwsh
7629
run: |
77-
$DIRECTORY_PATH= Join-Path ${Env:RUNNER_TEMP} conanserver
78-
echo "DIRECTORY_PATH=${DIRECTORY_PATH}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
79-
if(!(Test-Path -path $DIRECTORY_PATH))
80-
{
81-
New-Item -ItemType directory -Path $DIRECTORY_PATH
30+
foreach ($folder in (Get-ChildItem -Path ./conan/tests -Directory | Foreach-Object {$_.Name})) {
31+
echo "Running ${folder}"
32+
& script\test_conan.bat "${folder}" --profile "$pwd/conan/profiles/msvc2022"
33+
if ($LASTEXITCODE -ne 0) {
34+
exit(1)
35+
}
8236
}
8337
84-
- name: Debug
85-
shell: pwsh
86-
run: gci env:* | sort-object name
38+
# TODO: need new docker images - gcc12-ubuntu-22.04-cmake-3.25.2-conan-1.57
39+
# Conan-Tests-Linux:
40+
# name: Conan-tests-linux
41+
# runs-on: "ubuntu-latest"
8742

88-
- name: Install packages
89-
shell: pwsh
90-
run: |
91-
Set-Location src
92-
[array]$folders=@('array19.lib','coro19.lib','meta19.lib','tuple19.lib', 'string19.lib', 'strong19.lib', 'variant19.lib', 'enum19.lib', 'lookup19.lib', 'optional19.lib', 'partial19.lib', 'serialize19.lib', 'signal19.lib')
93-
foreach ($folder in $folders) {
94-
Set-Location $folder
95-
docker run --network="host" --rm -v ${PWD}:/project -v ${env:DIRECTORY_PATH}:/conan -w /project ${{ matrix.image }} conan create . ${{ matrix.ConanExtra }}
96-
Set-Location ..
97-
}
98-
Set-Location ../conan
99-
$Path = Get-Location
100-
Write-Output $Path
101-
docker run --network="host" --rm -v ${env:GITHUB_WORKSPACE}:/project -v ${env:DIRECTORY_PATH}:/conan -w /project/conan ${{ matrix.image }} conan create . ${{ matrix.ConanExtra }}
43+
# strategy:
44+
# fail-fast: false
45+
# matrix:
46+
# include:
47+
# # - image: "conanio/gcc12-ubuntu18.04:latest"
48+
# # - image: "ghcr.io/fettpet/clang-conan-cmake-dockercontainer:latest-clang11"
49+
# # ConanExtra: "-s compiler.libcxx=libc++"
50+
# # - image: "ghcr.io/fettpet/clang-conan-cmake-dockercontainer:latest-clang12"
51+
# # ConanExtra: "-s compiler.libcxx=libc++"
52+
# # - image: "ghcr.io/fettpet/clang-conan-cmake-dockercontainer:latest-clang13"
53+
# # ConanExtra: "-s compiler.libcxx=libc++"
54+
# steps:
55+
# - name: Checkout source
56+
# uses: actions/checkout@v3
10257

103-
- name: Test packages
104-
shell: pwsh
105-
run: |
106-
Set-Location conan/tests
107-
[array]$folders=Get-ChildItem -Path . -Directory -Name
108-
foreach ($folder in $folders) {
109-
New-Item -Path . -Name $folder"/build" -ItemType "directory"
110-
docker run --network="host" --rm -v ${env:GITHUB_WORKSPACE}:/project -v ${env:DIRECTORY_PATH}:/conan -w /project/conan/tests/${folder}/build ${{ matrix.image }} conan install .. --build=gtest ${{ matrix.ConanExtra }}
111-
docker run --network="host" --rm -v ${env:GITHUB_WORKSPACE}:/project -v ${env:DIRECTORY_PATH}:/conan -w /project/conan/tests/${folder}/build ${{ matrix.image }} cmake .. -DCONAN_DISABLE_CHECK_COMPILER=true
112-
docker run --network="host" --rm -v ${env:GITHUB_WORKSPACE}:/project -v ${env:DIRECTORY_PATH}:/conan -w /project/conan/tests/${folder}/build ${{ matrix.image }} cmake --build .
113-
docker run --network="host" --rm -v ${env:GITHUB_WORKSPACE}:/project -v ${env:DIRECTORY_PATH}:/conan -w /project/conan/tests/${folder}/build ${{ matrix.image }} ctest --no-tests=error
114-
if (!$?) {
115-
exit(1)
116-
}
117-
}
58+
# - name: Create Conan home folder
59+
# shell: pwsh
60+
# run: |
61+
# $DIRECTORY_PATH=Join-Path ${Env:RUNNER_TEMP} conanserver
62+
# echo "DIRECTORY_PATH=${DIRECTORY_PATH}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
63+
# if (!(Test-Path -path $DIRECTORY_PATH)) {
64+
# New-Item -ItemType directory -Path $DIRECTORY_PATH
65+
# }
66+
67+
# - name: Create conan package
68+
# shell: pwsh
69+
# run: |
70+
# docker run --network="host" --rm -v ${env:GITHUB_WORKSPACE}:/project -v ${env:DIRECTORY_PATH}:/conan -w /project/conan ${{ matrix.image }} conan create . --build=gtest --build=co-cpp19 ${{ matrix.ConanExtra }}
71+
72+
# - name: Test package components
73+
# shell: pwsh
74+
# run: |
75+
# [array]$folders=Get-ChildItem -Path conan/tests -Directory -Name
76+
# foreach ($folder in $folders) {
77+
# docker run --network="host" --rm -v ${env:GITHUB_WORKSPACE}:/project -v ${env:DIRECTORY_PATH}:/conan -w /project ${{ matrix.image }} script/test_conan.sh ${folder} ${{ matrix.ConanExtra }}
78+
# if (!$?) {
79+
# exit(1)
80+
# }
81+
# }

.github/workflows/qbs_tests.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- image: arbmind/qbs-gcc:1.24.0-12
2121

2222
steps:
23-
- uses: actions/checkout@v2
23+
- uses: actions/checkout@v3
2424

2525
- name: Get Googletest
2626
run: third_party/git_clone_googletest.sh
@@ -49,16 +49,17 @@ jobs:
4949

5050
- os: windows-2022
5151
vcvars: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
52-
experimental: true
52+
experimental: false
5353

5454
steps:
5555
- name: Install Qbs
5656
run: choco install qbs
57+
5758
- name: Setup Qbs
5859
run: |
5960
qbs setup-toolchains --type msvc $(cmd /c '"${{ matrix.vcvars }}" >nul & where cl') msvc
6061
61-
- uses: actions/checkout@v2
62+
- uses: actions/checkout@v3
6263

6364
- name: Get Googletest
6465
run: third_party/git_clone_googletest.sh

.github/workflows/static_analyse.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ jobs:
1111
fail-fast: false
1212
matrix:
1313
include:
14-
- image: arbmind/cmake-clang:3.22.3-14
14+
- image: arbmind/cmake-clang:3.25.1-15
1515
preset: clang-analyze
1616

1717
steps:
1818
- name: Checkout
19-
uses: actions/checkout@v2
19+
uses: actions/checkout@v3
2020

2121
- name: Build and Analyze
2222
run: >-

CMakeLists.txt

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,28 @@
1-
cmake_minimum_required(VERSION 3.21 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.25 FATAL_ERROR)
22
project (co-cpp19 LANGUAGES CXX)
3+
enable_testing()
34

4-
set(CMAKE_CXX_STANDARD 20)
5+
include(GNUInstallDirs)
6+
include(CMakePackageConfigHelpers)
7+
set(COCPP19_CMAKE_CONFIG_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/CoCpp19")
8+
9+
find_package(GTest QUIET)
510

6-
option(co-cpp19-enable-tests "Build the tests" OFF)
711
add_subdirectory(third_party)
8-
if(${co-cpp19-enable-tests})
9-
enable_testing()
10-
endif()
12+
add_subdirectory(src)
1113

12-
add_subdirectory(src/)
14+
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/CoCpp19Config.cmake.in
15+
"${CMAKE_CURRENT_BINARY_DIR}/CoCpp19Config.cmake"
16+
INSTALL_DESTINATION ${COCPP19_CMAKE_CONFIG_DESTINATION}
17+
)
18+
write_basic_package_version_file(
19+
"${CMAKE_CURRENT_BINARY_DIR}/CoCpp19ConfigVersion.cmake"
20+
VERSION "1.0.0"
21+
COMPATIBILITY AnyNewerVersion
22+
)
23+
install(FILES
24+
"${CMAKE_CURRENT_BINARY_DIR}/CoCpp19Config.cmake"
25+
"${CMAKE_CURRENT_BINARY_DIR}/CoCpp19ConfigVersion.cmake"
26+
DESTINATION ${COCPP19_CMAKE_CONFIG_DESTINATION}
27+
COMPONENT cocpp19
28+
)

CMakePresets.json

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,15 @@
1212
"generator": "Ninja Multi-Config",
1313
"binaryDir": "${sourceDir}/build/${presetName}",
1414
"cacheVariables": {
15-
"co-cpp19-enable-tests": true,
1615
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
1716
"CMAKE_CTEST_ARGUMENTS": "--output-on-failure",
1817
"CMAKE_CONFIGURATION_TYPES": "Debug;Release"
1918
}
2019
},
2120
{
22-
"name": "msvc2019",
21+
"name": "msvc",
2322
"inherits": "multi-config",
24-
"displayName": "Visual Studio 2019",
23+
"displayName": "Visual Studio 2019/2022",
2524
"description": "Recommended configuration for windows builds",
2625
"cacheVariables": {
2726
"CMAKE_CXX_FLAGS": "/EHsc /permissive- /Zc:__cplusplus /Zc:externConstexpr /Zc:inline /Zc:preprocessor /Zc:throwingNew /diagnostics:caret /experimental:external /external:anglebrackets /external:W0 /wd4068 /D_ENABLE_EXTENDED_ALIGNED_STORAGE"
@@ -72,15 +71,15 @@
7271
],
7372
"buildPresets": [
7473
{
75-
"name": "msvc2019-debug",
76-
"displayName": "Visual Studio 2019 Debug Build",
77-
"configurePreset": "msvc2019",
74+
"name": "msvc-debug",
75+
"displayName": "Visual Studio 2019/2022 Debug Build",
76+
"configurePreset": "msvc",
7877
"configuration": "Debug"
7978
},
8079
{
81-
"name": "msvc2019-release",
82-
"displayName": "Visual Studio 2019 Release Build",
83-
"configurePreset": "msvc2019",
80+
"name": "msvc-release",
81+
"displayName": "Visual Studio 2019/2022 Release Build",
82+
"configurePreset": "msvc",
8483
"configuration": "Release"
8584
},
8685
{
@@ -140,17 +139,17 @@
140139
}
141140
},
142141
{
143-
"name": "test-msvc2019-debug",
142+
"name": "test-msvc-debug",
144143
"inherits": "test-base",
145-
"displayName": "Test Visual Studio 2019 Debug Build",
146-
"configurePreset": "msvc2019",
144+
"displayName": "Test Visual Studio 2019/2022 Debug Build",
145+
"configurePreset": "msvc",
147146
"configuration": "Debug"
148147
},
149148
{
150-
"name": "test-msvc2019-release",
149+
"name": "test-msvc-release",
151150
"inherits": "test-base",
152-
"displayName": "Test Visual Studio 2019 Release Build",
153-
"configurePreset": "msvc2019",
151+
"displayName": "Test Visual Studio 2019/2022 Release Build",
152+
"configurePreset": "msvc",
154153
"configuration": "Release"
155154
},
156155
{

CoCpp19Config.cmake.in

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
@PACKAGE_INIT@
2+
3+
set(_CoCpp19_supported_components
4+
array19
5+
coro19
6+
enum19
7+
lookup19
8+
meta19
9+
optional19
10+
partial19
11+
serialize19
12+
serialize19
13+
string19
14+
strong19
15+
tuple19
16+
variant19
17+
)
18+
19+
foreach(_comp ${CoCpp19_FIND_COMPONENTS})
20+
if (NOT _comp IN_LIST _CoCpp19_supported_components)
21+
set(CoCpp19_FOUND False)
22+
set(CoCpp19_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}")
23+
endif()
24+
include("${CMAKE_CURRENT_LIST_DIR}/CoCpp19-${_comp}-targets.cmake")
25+
endforeach()

conan/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)