Skip to content

Commit 0ae2842

Browse files
committed
update build/install scripts (copy from meta.hpp)
1 parent 4743f74 commit 0ae2842

File tree

14 files changed

+197
-292
lines changed

14 files changed

+197
-292
lines changed

.github/workflows/darwin.yml

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,29 @@ jobs:
99
fail-fast: false
1010
matrix:
1111
config:
12-
# https://github.com/actions/virtual-environments/tree/main/images/macos
13-
- { os: "macos-10.15", xcode: "10.3", arch: "x64" }
14-
- { os: "macos-12", xcode: "14.2", arch: "x64" }
15-
name: "xcode-${{matrix.config.xcode}}"
12+
# https://github.com/actions/virtual-environments/tree/main/images/macos
13+
- { os: "macos-13", xcode: "14.3.1", arch: "x64" }
14+
- { os: "macos-13", xcode: "14.3.1", arch: "arm64" }
15+
- { os: "macos-14", xcode: "15.4", arch: "x64" }
16+
- { os: "macos-14", xcode: "15.4", arch: "arm64" }
17+
- { os: "macos-15", xcode: "16.2", arch: "x64" }
18+
- { os: "macos-15", xcode: "16.2", arch: "arm64" }
19+
name: "xcode-${{matrix.config.xcode}}-${{matrix.config.arch}}"
1620
steps:
17-
- name: Setup
18-
run: brew install cmake ninja
19-
- name: Checkout
20-
uses: actions/checkout@v3
21-
with:
22-
submodules: true
23-
- name: Select Xcode
24-
run: sudo xcode-select --switch "/Applications/Xcode_${{matrix.config.xcode}}.app"
25-
- name: Build
26-
run: |
27-
cmake --preset macos-${{matrix.config.arch}}
28-
cmake --build --preset macos-${{matrix.config.arch}}-release
29-
- name: Test
30-
run: |
31-
ctest --preset macos-${{matrix.config.arch}}-release
21+
- name: Setup
22+
run: |
23+
brew update
24+
brew install cmake ninja
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
with:
28+
submodules: true
29+
- name: Select Xcode
30+
run: sudo xcode-select --switch "/Applications/Xcode_${{matrix.config.xcode}}.app"
31+
- name: Build
32+
run: |
33+
cmake --preset macos-${{matrix.config.arch}}
34+
cmake --build --preset macos-${{matrix.config.arch}}-release
35+
- name: Test
36+
run: |
37+
ctest --preset macos-${{matrix.config.arch}}

.github/workflows/linux.yml

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,25 @@ jobs:
99
fail-fast: false
1010
matrix:
1111
config:
12-
# https://github.com/actions/virtual-environments/tree/main/images/linux
13-
- { os: "ubuntu-20.04", cc: "gcc-7", cxx: "g++-7" }
14-
- { os: "ubuntu-20.04", cc: "clang-7", cxx: "clang++-7" }
15-
- { os: "ubuntu-22.04", cc: "gcc-12", cxx: "g++-12" }
16-
- { os: "ubuntu-22.04", cc: "clang-14", cxx: "clang++-14" }
12+
# https://github.com/actions/runner-images/tree/main/images/ubuntu
13+
- { os: "ubuntu-20.04", cc: "gcc-10", cxx: "g++-10" }
14+
- { os: "ubuntu-20.04", cc: "clang-10", cxx: "clang++-10" }
15+
- { os: "ubuntu-24.04", cc: "gcc-14", cxx: "g++-14" }
16+
- { os: "ubuntu-24.04", cc: "clang-18", cxx: "clang++-18" }
1717
name: "${{matrix.config.cxx}}"
1818
steps:
19-
- name: Setup
20-
run: sudo apt-get -y install cmake ninja-build ${{matrix.config.cc}} ${{matrix.config.cxx}}
21-
- name: Checkout
22-
uses: actions/checkout@v3
23-
with:
24-
submodules: true
25-
- name: Build
26-
run: |
27-
cmake --preset linux-${{matrix.config.cc}}
28-
cmake --build --preset linux-${{matrix.config.cc}}-release
29-
- name: Test
30-
run: |
31-
ctest --preset linux-${{matrix.config.cc}}-release
19+
- name: Setup
20+
run: |
21+
sudo apt-get update -o Acquire::Retries=10
22+
sudo apt-get install -o Acquire::Retries=10 -y cmake ninja-build ${{matrix.config.cc}} ${{matrix.config.cxx}}
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
with:
26+
submodules: true
27+
- name: Build
28+
run: |
29+
cmake --preset linux-${{matrix.config.cc}}
30+
cmake --build --preset linux-${{matrix.config.cc}}-release
31+
- name: Test
32+
run: |
33+
ctest --preset linux-${{matrix.config.cc}}

.github/workflows/windows.yml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,25 @@ jobs:
99
fail-fast: false
1010
matrix:
1111
config:
12-
# https://github.com/actions/virtual-environments/tree/main/images/win
13-
- { os: "windows-2019", vc: "msvc2019", arch: "x86" }
14-
- { os: "windows-2019", vc: "msvc2019", arch: "x64" }
15-
- { os: "windows-2022", vc: "msvc2022", arch: "x86" }
16-
- { os: "windows-2022", vc: "msvc2022", arch: "x64" }
17-
name: "${{matrix.config.vc}} ${{matrix.config.arch}}"
12+
# https://github.com/actions/runner-images/tree/main/images/windows
13+
- { os: "windows-2019", vc: "msvc2019", arch: "x86" }
14+
- { os: "windows-2019", vc: "msvc2019", arch: "x64" }
15+
- { os: "windows-2022", vc: "msvc2022", arch: "x86" }
16+
- { os: "windows-2022", vc: "msvc2022", arch: "x64" }
17+
name: "${{matrix.config.vc}}-${{matrix.config.arch}}"
1818
steps:
19-
- name: Setup
20-
run: choco install cmake ninja
21-
- name: Checkout
22-
uses: actions/checkout@v3
23-
with:
24-
submodules: true
25-
- name: Select MSVC
26-
uses: ilammy/msvc-dev-cmd@v1
27-
- name: Build
28-
run: |
29-
cmake --preset windows-${{matrix.config.arch}}-${{matrix.config.vc}}
30-
cmake --build --preset windows-${{matrix.config.arch}}-${{matrix.config.vc}}-release
31-
- name: Test
32-
run: |
33-
ctest --preset windows-${{matrix.config.arch}}-${{matrix.config.vc}}-release
19+
- name: Setup
20+
run: choco install cmake ninja
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
with:
24+
submodules: true
25+
- name: Select MSVC
26+
uses: ilammy/msvc-dev-cmd@v1
27+
- name: Build
28+
run: |
29+
cmake --preset windows-${{matrix.config.arch}}-${{matrix.config.vc}}
30+
cmake --build --preset windows-${{matrix.config.arch}}-${{matrix.config.vc}}-release
31+
- name: Test
32+
run: |
33+
ctest --preset windows-${{matrix.config.arch}}-${{matrix.config.vc}}

.vscode/launch.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
"request": "launch",
77
"program": "${command:cmake.launchTargetPath}",
88
"args": [],
9-
"cwd": "${workspaceFolder}"
9+
"cwd": "${workspaceFolder}",
10+
"initCommands": [
11+
"settings set target.process.thread.step-avoid-regexp \"\""
12+
]
1013
}]
1114
}

.vscode/settings.json

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,13 @@
11
{
2-
"[cpp]": {
3-
"files.encoding": "utf8",
4-
"files.insertFinalNewline": true,
5-
"files.trimFinalNewlines": true,
6-
"files.trimTrailingWhitespace": true
7-
},
8-
"[cmake]": {
9-
"files.encoding": "utf8",
10-
"files.insertFinalNewline": true,
11-
"files.trimFinalNewlines": true,
12-
"files.trimTrailingWhitespace": true
13-
},
14-
"[python]": {
2+
"[c][cmake][cpp][json][jsonc][markdown][python][yaml]": {
153
"files.encoding": "utf8",
164
"files.insertFinalNewline": true,
175
"files.trimFinalNewlines": true,
186
"files.trimTrailingWhitespace": true
197
},
208
"clangd.arguments": [
21-
"--all-scopes-completion",
22-
"--background-index",
23-
"--clang-tidy",
24-
"--compile-commands-dir=${workspaceFolder}/.clangd",
25-
"--completion-style=detailed",
26-
"--header-insertion=never"
9+
"--header-insertion=never",
10+
"--compile-commands-dir=${workspaceFolder}/.clangd"
2711
],
2812
"cmake.copyCompileCommands": "${workspaceFolder}/.clangd/compile_commands.json"
2913
}

CMakeLists.txt

Lines changed: 25 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ cmake_minimum_required(VERSION 3.21 FATAL_ERROR)
33
project(kari.hpp
44
VERSION "0.0.1"
55
DESCRIPTION "Experimental library for currying in C++17"
6-
HOMEPAGE_URL "https://github.com/blackmatov/kari.hpp")
6+
HOMEPAGE_URL "https://github.com/blackmatov/kari.hpp"
7+
LANGUAGES CXX)
78

8-
#
9-
# LIBRARY
10-
#
9+
option(KARI_HPP_DEVELOP "Generate develop targets" OFF)
10+
option(KARI_HPP_INSTALL "Generate install targets" ${PROJECT_IS_TOP_LEVEL})
1111

1212
add_library(${PROJECT_NAME} INTERFACE)
1313
add_library(kari.hpp::kari.hpp ALIAS ${PROJECT_NAME})
@@ -19,43 +19,47 @@ target_include_directories(${PROJECT_NAME} INTERFACE
1919
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/headers>
2020
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
2121

22-
#
23-
# INSTALL
24-
#
22+
if(KARI_HPP_DEVELOP)
23+
enable_testing()
24+
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
25+
set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMake")
26+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
2527

26-
if(PROJECT_IS_TOP_LEVEL)
28+
add_subdirectory(vendors)
29+
add_subdirectory(untests)
30+
endif()
31+
32+
if(KARI_HPP_INSTALL)
2733
include(CMakePackageConfigHelpers)
2834
include(GNUInstallDirs)
2935

3036
set(KARI_HPP_INSTALL_CONFIG_DIR
3137
"${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
3238

3339
set(KARI_HPP_INSTALL_CONFIG_INPUT
34-
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Config.cmake.in")
40+
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/config.cmake.in")
3541

36-
set(KARI_HPP_INSTALL_GENERATED_CONFIG_CMAKE
37-
"${CMAKE_CURRENT_BINARY_DIR}/generated/${PROJECT_NAME}-config.cmake")
42+
set(KARI_HPP_INSTALL_CONFIG_CMAKE
43+
"${CMAKE_CURRENT_BINARY_DIR}/configs/${PROJECT_NAME}-config.cmake")
3844

39-
set(KARI_HPP_INSTALL_GENERATED_CONFIG_VERSION_CMAKE
40-
"${CMAKE_CURRENT_BINARY_DIR}/generated/${PROJECT_NAME}-config-version.cmake")
45+
set(KARI_HPP_INSTALL_CONFIG_VERSION_CMAKE
46+
"${CMAKE_CURRENT_BINARY_DIR}/configs/${PROJECT_NAME}-config-version.cmake")
4147

4248
configure_package_config_file(
4349
"${KARI_HPP_INSTALL_CONFIG_INPUT}"
44-
"${KARI_HPP_INSTALL_GENERATED_CONFIG_CMAKE}"
50+
"${KARI_HPP_INSTALL_CONFIG_CMAKE}"
4551
INSTALL_DESTINATION "${KARI_HPP_INSTALL_CONFIG_DIR}"
46-
NO_SET_AND_CHECK_MACRO
47-
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
52+
NO_SET_AND_CHECK_MACRO)
4853

4954
write_basic_package_version_file(
50-
"${KARI_HPP_INSTALL_GENERATED_CONFIG_VERSION_CMAKE}"
55+
"${KARI_HPP_INSTALL_CONFIG_VERSION_CMAKE}"
5156
VERSION ${PROJECT_VERSION}
5257
COMPATIBILITY AnyNewerVersion
5358
ARCH_INDEPENDENT)
5459

5560
install(
5661
TARGETS ${PROJECT_NAME}
57-
EXPORT ${PROJECT_NAME}-targets
58-
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
62+
EXPORT ${PROJECT_NAME}-targets)
5963

6064
install(
6165
DIRECTORY headers/${PROJECT_NAME}
@@ -68,28 +72,7 @@ if(PROJECT_IS_TOP_LEVEL)
6872
DESTINATION "${KARI_HPP_INSTALL_CONFIG_DIR}")
6973

7074
install(
71-
FILES "${KARI_HPP_INSTALL_GENERATED_CONFIG_CMAKE}"
72-
"${KARI_HPP_INSTALL_GENERATED_CONFIG_VERSION_CMAKE}"
75+
FILES "${KARI_HPP_INSTALL_CONFIG_CMAKE}"
76+
"${KARI_HPP_INSTALL_CONFIG_VERSION_CMAKE}"
7377
DESTINATION "${KARI_HPP_INSTALL_CONFIG_DIR}")
7478
endif()
75-
76-
#
77-
# DEVELOPER
78-
#
79-
80-
if(PROJECT_IS_TOP_LEVEL)
81-
option(BUILD_WITH_COVERAGE "Build with coverage" OFF)
82-
option(BUILD_WITH_SANITIZERS "Build with sanitizers" OFF)
83-
84-
enable_testing()
85-
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
86-
set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMake")
87-
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
88-
89-
include(EnableASan)
90-
include(EnableGCov)
91-
include(EnableUBSan)
92-
93-
add_subdirectory(vendors)
94-
add_subdirectory(untests)
95-
endif()

0 commit comments

Comments
 (0)