Skip to content

Commit 37ec8e7

Browse files
authored
Merge pull request #1 from Fettpet/cmake
Added CMake and added more compiler support
2 parents f479b99 + 8cf32a7 commit 37ec8e7

89 files changed

Lines changed: 658 additions & 14 deletions

File tree

Some content is hidden

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

.github/workflows/cmake_tests.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: CMake-Tests
2+
3+
on: push
4+
5+
jobs:
6+
windows-msvc:
7+
name: "Windows MSVC"
8+
runs-on: windows-latest
9+
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v2
13+
14+
- name: Install Tools Ninja and mvsc
15+
uses: ilammy/msvc-dev-cmd@v1
16+
- uses: seanmiddleditch/gha-setup-ninja@master
17+
18+
- name: Config
19+
run: cmake -S . --preset Windows-MSVC
20+
21+
- name: Build
22+
run: |
23+
cmake --build --preset Windows-MSVC-Debug
24+
cmake --build --preset Windows-MSVC-Release
25+
26+
- name: Test
27+
run: |
28+
ctest --preset Test-Windows-MSVC-Debug
29+
ctest --preset Test-Windows-MSVC-Release
30+
31+
32+
Linux-Clang:
33+
name: "Linux-Clang"
34+
runs-on: ubuntu-latest
35+
36+
steps:
37+
- name: Checkout
38+
uses: actions/checkout@v2
39+
40+
- name: Install Ninja
41+
uses: seanmiddleditch/gha-setup-ninja@master
42+
43+
- name: Install clang 12
44+
run: |
45+
sudo apt-get update
46+
sudo apt-get install clang-12 llvm-12
47+
48+
- name: Config
49+
run: |
50+
cmake -S . --preset Linux-Clang
51+
52+
- name: Build
53+
run: |
54+
cmake --build --preset Linux-Clang-Debug
55+
cmake --build --preset Linux-Clang-Release
56+
57+
- name: Test
58+
run: |
59+
ctest --preset Test-Linux-Clang-Debug
60+
ctest --preset Test-Linux-Clang-Release
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Test Runner
1+
name: Qbs-Tests
22

33
on: push
44

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Static Analyse
2+
3+
on: push
4+
5+
jobs:
6+
Clang-Static-Analyse:
7+
name: "Linux-Clang-Static-Analyse"
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v2
13+
14+
- name: Install Ninja
15+
uses: seanmiddleditch/gha-setup-ninja@master
16+
17+
- name: Install clang 12
18+
run: |
19+
sudo apt-get update
20+
sudo apt-get install clang-12 llvm-12
21+
22+
- name: Config
23+
run: |
24+
cmake -S . --preset Clang-Static-Analyser
25+
26+
- name: Build
27+
run: |
28+
cmake --build --preset Clang-Static-Analyser

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ thirdparty/*/
99
.vagrant/
1010
.vscode/
1111
.vs/
12+
CMakeUserPresets.json

CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
cmake_minimum_required(VERSION 3.21 FATAL_ERROR)
2+
project (co-cpp19 LANGUAGES CXX)
3+
4+
set(CMAKE_CXX_STANDARD 20)
5+
6+
option(co-cpp19-enable-tests "Build the tests" OFF)
7+
add_subdirectory(third_party)
8+
add_subdirectory(cmake)
9+
if(${co-cpp19-enable-tests})
10+
enable_testing()
11+
endif()
12+
13+
add_subdirectory(src/)

CMakePresets.json

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
{
2+
"version": 3,
3+
"cmakeMinimumRequired": {
4+
"major": 3,
5+
"minor": 21,
6+
"patch": 0
7+
},
8+
"configurePresets": [
9+
{
10+
"name": "Base-Configure",
11+
"generator": "Ninja Multi-Config",
12+
"binaryDir": "${sourceDir}/build/${presetName}",
13+
"cacheVariables": {
14+
"co-cpp19-enable-tests": {
15+
"type": "BOOL",
16+
"value": "ON"
17+
},
18+
"CMAKE_CONFIGURATION_TYPES": "Debug;Release"
19+
},
20+
"hidden": true
21+
},
22+
{
23+
"name": "Windows-MSVC",
24+
"inherits": "Base-Configure",
25+
"displayName": "Tests on Windows",
26+
"description": "Used to configure the tests on Windows",
27+
"cacheVariables": {
28+
"CMAKE_CXX_COMPILER": "cl.exe",
29+
"CMAKE_CXX_FLAGS": "/permissive- /Zc:__cplusplus /Zc:externConstexpr /Zc:inline /Zc:preprocessor /Zc:throwingNew /diagnostics:caret /wd4068 /D_ENABLE_EXTENDED_ALIGNED_STORAGE"
30+
}
31+
},
32+
{
33+
"name": "Linux-Clang",
34+
"inherits": "Base-Configure",
35+
"displayName": "Tests on Linux",
36+
"description": "Used to configure the tests on Linux",
37+
"cacheVariables": {
38+
"CMAKE_CXX_COMPILER": "clang++-12",
39+
"CMAKE_CXX_FLAGS": "-fsized-deallocation -Wall -Wextra -Werror --pedantic -ftemplate-backtrace-limit=0 -Wno-gnu-zero-variadic-macro-arguments"
40+
}
41+
},
42+
{
43+
"name": "Clang-Static-Analyser",
44+
"inherits": "Base-Configure",
45+
"displayName": "Clang Static Analyser on Linux",
46+
"description": "Used to run clang static analyser",
47+
"cacheVariables": {
48+
"CMAKE_CXX_COMPILER": "clang++-12",
49+
"CMAKE_CXX_FLAGS": "-fsized-deallocation --analyze"
50+
}
51+
}
52+
],
53+
"buildPresets": [
54+
{
55+
"name": "Windows-MSVC-Debug",
56+
"displayName": "Tests on Windows in debug mode",
57+
"description": "Used to build the tests on windows. The cl compiler is used. It build in debug mode.",
58+
"configurePreset": "Windows-MSVC",
59+
"configuration": "Debug"
60+
},
61+
{
62+
"name": "Windows-MSVC-Release",
63+
"displayName": "Tests on Windows in release mode",
64+
"description": "Used to build the tests on windows. The cl compiler is used. It build in release mode.",
65+
"configurePreset": "Windows-MSVC",
66+
"configuration": "Release"
67+
},
68+
{
69+
"name": "Linux-Clang-Debug",
70+
"displayName": "Tests on Linux in debug mode",
71+
"description": "Used to build the tests on linux. The clang compiler is used. It build in debug mode.",
72+
"configurePreset": "Linux-Clang",
73+
"configuration": "Debug"
74+
},
75+
{
76+
"name": "Linux-Clang-Release",
77+
"displayName": "Tests on Linux in release mode",
78+
"description": "Used to build the tests on linux. The Clang compiler is used. It build in release mode.",
79+
"configurePreset": "Linux-Clang",
80+
"configuration": "Release"
81+
},
82+
{
83+
"name": "Clang-Static-Analyser",
84+
"displayName": "Analyse on linux",
85+
"description": "Used to build the tests on linux. The clang compiler is used. It is build with analyse",
86+
"configurePreset": "Clang-Static-Analyser",
87+
"configuration": "Debug"
88+
}
89+
],
90+
"testPresets": [
91+
{
92+
"name": "Base-Test",
93+
"output": {
94+
"outputOnFailure": true,
95+
"debug": false
96+
},
97+
"execution": {
98+
"noTestsAction": "error",
99+
"stopOnFailure": true
100+
},
101+
"hidden": true
102+
},
103+
104+
{
105+
"name": "Test-Windows-MSVC-Debug",
106+
"inherits": "Base-Test",
107+
"displayName": "Tests on Windows",
108+
"description": "Used to test on Windows",
109+
"configurePreset": "Windows-MSVC",
110+
"configuration": "Debug"
111+
},
112+
{
113+
"name": "Test-Windows-MSVC-Release",
114+
"inherits": "Base-Test",
115+
"displayName": "Tests on Windows",
116+
"description": "Used to test on Windows",
117+
"configurePreset": "Windows-MSVC",
118+
"configuration": "Release"
119+
},
120+
{
121+
"name": "Test-Linux-Clang-Debug",
122+
"inherits": "Base-Test",
123+
"displayName": "Tests on Linux",
124+
"description": "Used to test on Linux",
125+
"configurePreset": "Linux-Clang",
126+
"configuration": "Debug"
127+
},
128+
{
129+
"name": "Test-Linux-Clang-Release",
130+
"inherits": "Base-Test",
131+
"displayName": "Tests on Linux",
132+
"description": "Used to test on Linux",
133+
"configurePreset": "Linux-Clang",
134+
"configuration": "Release"
135+
}
136+
]
137+
}

cmake/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include(Clang.cmake)

cmake/Clang.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
message(INFO "CMAKE COMPILER: ${CMAKE_CXX_COMPILER_ID}")
2+
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
3+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsized-deallocation")
4+
endif()
5+
message(INFO "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")

co-cpp19.qbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Project {
6161
".clang-format",
6262
".clang-tidy",
6363
".editorconfig",
64-
".github/workflows/test_runner.yml",
64+
".github/workflows/qbs_tests.yml",
6565
".gitignore",
6666
"Readme.md",
6767
"helpers/array19.natvis",

src/CMakeLists.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
add_subdirectory(array19.lib/)
2+
add_subdirectory(coro19.lib/)
3+
add_subdirectory(enum19.lib/)
4+
add_subdirectory(lookup19.lib/)
5+
add_subdirectory(meta19.lib/)
6+
add_subdirectory(optional19.lib/)
7+
add_subdirectory(partial19.lib/)
8+
add_subdirectory(serialize19.lib/)
9+
add_subdirectory(signal19.lib/)
10+
add_subdirectory(string19.lib/)
11+
add_subdirectory(strong19.lib/)
12+
add_subdirectory(tuple19.lib/)
13+
add_subdirectory(variant19.lib/)
14+

0 commit comments

Comments
 (0)