Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split build production vs testing #29

Merged
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ jobs:
fail-fast: false
matrix:
config:
- {name: "Ubuntu Clang 17", os: ubuntu-24.04, toolchain: "clang-17-toolchain.cmake", clang_version: 17, installed_clang_version: 14, cmake_args: "-G \"Ninja Multi-Config\" -DCMAKE_CONFIGURATION_TYPES=\"RelWithDebInfo;Asan\" "}
- {name: "Ubuntu Clang 18", os: ubuntu-24.04, toolchain: "clang-18-toolchain.cmake", clang_version: 18, installed_clang_version: 14, cmake_args: "-G \"Ninja Multi-Config\" -DCMAKE_CONFIGURATION_TYPES=\"RelWithDebInfo;Asan\" "}
- {name: "Ubuntu Clang 17", os: ubuntu-24.04, toolchain: "clang-17-toolchain.cmake", clang_version: 17, installed_clang_version: 17, cmake_args: "-G \"Ninja Multi-Config\" -DCMAKE_CONFIGURATION_TYPES=\"RelWithDebInfo;Asan\" "}
neatudarius marked this conversation as resolved.
Show resolved Hide resolved
- {name: "Ubuntu Clang 18", os: ubuntu-24.04, toolchain: "clang-18-toolchain.cmake", clang_version: 18, installed_clang_version: 17, cmake_args: "-G \"Ninja Multi-Config\" -DCMAKE_CONFIGURATION_TYPES=\"RelWithDebInfo;Asan\" "}
# Note: clang-19 + Asan setup causes errors on some platforms. Temporary skip some checks via .asan_options.
- {name: "Ubuntu Clang 19", os: ubuntu-24.04, toolchain: "clang-19-toolchain.cmake", clang_version: 19, installed_clang_version: 14, cmake_args: "-G \"Ninja Multi-Config\" -DCMAKE_CONFIGURATION_TYPES=\"RelWithDebInfo;Asan\" ", asan_options: "new_delete_type_mismatch=0"}
- {name: "Ubuntu GCC 13", os: ubuntu-24.04, toolchain: "gcc-13-toolchain.cmake", clang_version: 17, installed_clang_version: 14, cmake_args: "-G \"Ninja Multi-Config\" -DCMAKE_CONFIGURATION_TYPES=\"RelWithDebInfo;Asan\" "}
- {name: "Ubuntu GCC 14", os: ubuntu-24.04, toolchain: "gcc-14-toolchain.cmake", clang_version: 17, installed_clang_version: 14, cmake_args: "-G \"Ninja Multi-Config\" -DCMAKE_CONFIGURATION_TYPES=\"RelWithDebInfo;Asan\" "}
- {name: "Ubuntu Clang 19", os: ubuntu-24.04, toolchain: "clang-19-toolchain.cmake", clang_version: 19, installed_clang_version: 17, cmake_args: "-G \"Ninja Multi-Config\" -DCMAKE_CONFIGURATION_TYPES=\"RelWithDebInfo;Asan\" ", asan_options: "new_delete_type_mismatch=0"}
- {name: "Ubuntu GCC 13", os: ubuntu-24.04, toolchain: "gcc-13-toolchain.cmake", clang_version: 17, installed_clang_version: 17, cmake_args: "-G \"Ninja Multi-Config\" -DCMAKE_CONFIGURATION_TYPES=\"RelWithDebInfo;Asan\" "}
- {name: "Ubuntu GCC 14", os: ubuntu-24.04, toolchain: "gcc-14-toolchain.cmake", clang_version: 17, installed_clang_version: 17, cmake_args: "-G \"Ninja Multi-Config\" -DCMAKE_CONFIGURATION_TYPES=\"RelWithDebInfo;Asan\" "}
steps:
- uses: actions/checkout@v3
with:
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "papers/wg21"]
path = papers/P2988/wg21
url = https://github.com/mpark/wg21.git
[submodule "extern/googletest"]
path = extern/googletest
url = https://github.com/google/googletest.git
24 changes: 20 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,35 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# cmake-format: on

cmake_minimum_required(VERSION 3.10)
cmake_minimum_required(VERSION 3.27)

project(
beman_optional26
VERSION 0.0.0
LANGUAGES CXX)

enable_testing()
cmake_policy(VERSION 3.27)
neatudarius marked this conversation as resolved.
Show resolved Hide resolved

set(TARGETS_EXPORT_NAME ${CMAKE_PROJECT_NAME}Targets)

add_subdirectory(extern)
add_subdirectory(src)
# Include the CTest module.
include(CTest)

# Build the tests only if enabled via the CLI flag: BUILD_TESTING.
if(BUILD_TESTING)
enable_testing()
neatudarius marked this conversation as resolved.
Show resolved Hide resolved

# Fetch GoogleTest
include(FetchContent)
neatudarius marked this conversation as resolved.
Show resolved Hide resolved
FetchContent_Declare(
neatudarius marked this conversation as resolved.
Show resolved Hide resolved
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG f8d7d77c06936315286eb55f8de22cd23c188571 # release-1.14.0
)
FetchContent_MakeAvailable(googletest)
endif()

add_subdirectory(src/Beman/Optional26)
add_subdirectory(examples)

include(GNUInstallDirs)
Expand Down
7 changes: 7 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,33 +68,40 @@
},
{
"name": "system",
"inherits": "common",
camio marked this conversation as resolved.
Show resolved Hide resolved
"configurePreset": "system"
},
{
"name": "gcc-14",
"inherits": "common",
"configurePreset": "gcc-14"
},
{
"name": "gcc-13",
"inherits": "common",
"configurePreset": "gcc-13"
},
{
"name": "clang-19",
"inherits": "common",
"configurePreset": "clang-19"
},
{
"name": "clang-18",
"inherits": "common",
"configurePreset": "clang-18"
},
{
"name": "clang-17",
"inherits": "common",
"configurePreset": "clang-17"
}
],
"testPresets": [
{
"name": "common",
"hidden": true,
"configuration": "Asan",
"output": {
"outputOnFailure": true
},
Expand Down
6 changes: 0 additions & 6 deletions extern/CMakeLists.txt

This file was deleted.

1 change: 0 additions & 1 deletion extern/googletest
Submodule googletest deleted from 305e5a
6 changes: 0 additions & 6 deletions src/Beman/CMakeLists.txt

This file was deleted.

21 changes: 3 additions & 18 deletions src/Beman/Optional26/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,6 @@ install(
target_link_libraries("${TARGET_LIBRARY}")

# Tests
add_executable(optional_test "")

target_sources(
optional_test
PRIVATE tests/optional.t.cpp tests/optional_ref.t.cpp
tests/optional_monadic.t.cpp tests/optional_range_support.t.cpp
tests/optional_ref_monadic.t.cpp tests/detail/iterator.t.cpp)

target_link_libraries(optional_test "${TARGET_LIBRARY}")
target_link_libraries(optional_test gtest)
target_link_libraries(optional_test gtest_main)

include(GoogleTest)

# Note: clang-19 + gtest_discover_tests + Asan setup causes errors on some platforms.
# Temporary switch to gtest_add_tests and skip some Asan checks.
enable_testing()
gtest_add_tests(optional_test "" AUTO)
if(BUILD_TESTING)
add_subdirectory(tests)
endif()
22 changes: 22 additions & 0 deletions src/Beman/Optional26/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# cmake-format: off
neatudarius marked this conversation as resolved.
Show resolved Hide resolved
# src/Beman/Optional26/tests/CMakeLists.txt -*-makefile-*-
neatudarius marked this conversation as resolved.
Show resolved Hide resolved
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# cmake-format: on

# Tests
add_executable(optional_test "")
neatudarius marked this conversation as resolved.
Show resolved Hide resolved

target_sources(
optional_test
PRIVATE optional.t.cpp optional_ref.t.cpp
optional_monadic.t.cpp optional_range_support.t.cpp
optional_ref_monadic.t.cpp detail/iterator.t.cpp)

target_link_libraries(optional_test "${TARGET_LIBRARY}" GTest::gtest GTest::gtest_main)
neatudarius marked this conversation as resolved.
Show resolved Hide resolved

include(GoogleTest)
neatudarius marked this conversation as resolved.
Show resolved Hide resolved

# Note: clang-19 + gtest_discover_tests + Asan setup causes errors on some platforms.
# Temporary switch to gtest_add_tests and skip some Asan checks.
neatudarius marked this conversation as resolved.
Show resolved Hide resolved
enable_testing()
neatudarius marked this conversation as resolved.
Show resolved Hide resolved
gtest_add_tests(optional_test "" AUTO)
neatudarius marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 0 additions & 6 deletions src/CMakeLists.txt

This file was deleted.

Loading