Skip to content

Commit 7a4a195

Browse files
author
Vaughn
committed
Remove refs to older C++ versions, add param to add_test function
1 parent f988bfc commit 7a4a195

File tree

6 files changed

+23
-51
lines changed

6 files changed

+23
-51
lines changed

CMakeLists.txt

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ endif()
1919

2020
if (${CMAKE_PROJECT_NAME} STREQUAL coda-oss)
2121
# this is the top level project
22-
23-
# Only set std if not used as library
2422
set(CMAKE_CXX_STANDARD 23)
2523
set(CXX_STANDARD_REQUIRED true)
2624

@@ -39,24 +37,14 @@ if (${CMAKE_PROJECT_NAME} STREQUAL coda-oss)
3937
coda_initialize_build()
4038

4139
# install our cmake build modules for downstream use
42-
install(DIRECTORY "cmake/"
43-
DESTINATION "${CODA_STD_PROJECT_LIB_DIR}/cmake/"
44-
FILES_MATCHING PATTERN "*.cmake")
45-
46-
# If the package version is defined, write a version file for find_package
47-
set(version_file "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}ConfigVersion.cmake")
48-
include(CMakePackageConfigHelpers)
49-
write_basic_package_version_file(${version_file} VERSION ${CMAKE_PROJECT_VERSION} COMPATIBILITY SameMajorVersion)
50-
install(FILES ${version_file} DESTINATION "lib/cmake")
51-
52-
# As opposed to drivers, these are "required" third-party packages
53-
add_subdirectory(externals)
40+
install(DIRECTORY "cmake" DESTINATION "lib" FILES_MATCHING PATTERN "*.cmake")
5441

5542
endif()
5643

44+
# As opposed to drivers, these are "required" third-party packages
45+
add_subdirectory("externals")
5746
add_subdirectory("modules")
5847

5948
# generate package config, with the following paths exported
60-
set(JARS_DIR ${CODA_STD_PROJECT_LIB_DIR} CACHE INTERNAL
61-
"path to installed jars, needed by downstream projects")
49+
set(JARS_DIR lib CACHE INTERNAL "path to installed jars, needed by downstream projects")
6250
coda_generate_package_config(JARS_DIR)

cmake/CodaBuild.cmake

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,8 @@ endfunction()
368368
# the current source directory. All source files beneath
369369
# this directory will be used. Each source file is assumed
370370
# to create a separate executable.
371+
# TEST_LIB - If present, use this library to supply unit test macros,
372+
# otherwise default to Catch2WithMain from coda-oss externals
371373
#
372374
# Multi value arguments:
373375
# DEPS - Modules that the tests are dependent upon.
@@ -387,7 +389,7 @@ function(coda_add_tests)
387389
cmake_parse_arguments(
388390
ARG # prefix
389391
"UNITTEST" # options
390-
"MODULE_NAME;DIRECTORY" # single args
392+
"MODULE_NAME;DIRECTORY;TEST_LIB" # single args
391393
"DEPS;SOURCES;ARGS;FILTER_LIST" # multi args
392394
"${ARGN}"
393395
)
@@ -421,7 +423,12 @@ function(coda_add_tests)
421423
add_custom_target(${test_group_tgt})
422424
endif()
423425

424-
list(APPEND ARG_DEPS ${ARG_MODULE_NAME}-${TARGET_LANGUAGE} Catch2::Catch2WithMain)
426+
set(test_lib Catch2::Catch2WithMain)
427+
if(ARG_TEST_LIB)
428+
set(test_lib ${ARG_TEST_LIB})
429+
endif()
430+
431+
list(APPEND ARG_DEPS ${ARG_MODULE_NAME}-${TARGET_LANGUAGE} ${test_lib})
425432

426433
# get all interface libraries and include directories from the dependencies
427434
foreach(dep ${ARG_DEPS})

modules/c++/mt/include/mt/Algorithm.h

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,8 @@
2828

2929
#include "config/compiler_extensions.h"
3030
#include "config/CPlusPlus.h"
31-
#if CODA_OSS_cpp17
32-
// <execution> is broken with the older version of GCC we're using
33-
#if (__GNUC__ >= 10) || _MSC_VER
34-
#include <execution>
35-
#define CODA_OSS_mt_Algorithm_has_execution 1
36-
#endif
37-
#endif
31+
#include <execution>
32+
3833

3934
namespace mt
4035
{
@@ -83,17 +78,13 @@ template <typename InputIt, typename OutputIt, typename UnaryOperation>
8378
inline OutputIt Transform_par(InputIt first1, InputIt last1, OutputIt d_first, UnaryOperation unary_op,
8479
Transform_par_settings settings = Transform_par_settings{})
8580
{
86-
#if CODA_OSS_mt_Algorithm_has_execution
87-
#if __GNUC__
88-
// std::execution::par is dramatically slower w/GCC than using our own ... ???
89-
return Transform_par_(first1, last1, d_first, unary_op, settings); // TODO: std::execution::par
90-
#else
91-
CODA_OSS_mark_symbol_unused(settings);
92-
return std::transform(std::execution::par, first1, last1, d_first, unary_op);
93-
#endif // __GNUC__
81+
#if __GNUC__
82+
// std::execution::par is dramatically slower w/GCC than using our own ... ???
83+
return Transform_par_(first1, last1, d_first, unary_op, settings); // TODO: std::execution::par
9484
#else
95-
return Transform_par_(first1, last1, d_first, unary_op, settings);
96-
#endif // CODA_OSS_mt_Algorithm_has_execution
85+
CODA_OSS_mark_symbol_unused(settings);
86+
return std::transform(std::execution::par, first1, last1, d_first, unary_op);
87+
#endif // __GNUC__
9788
}
9889

9990
}

modules/c++/str/include/str/Manip.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,7 @@ CODA_OSS_disable_warning_push
4747
template<typename CharT>
4848
inline CharT* data(std::basic_string<CharT>& s) noexcept
4949
{
50-
#if CODA_OSS_cpp17
5150
return s.data();
52-
#else
53-
CODA_OSS_disable_warning_push
54-
#if _MSC_VER
55-
#pragma warning(disable : 26492) // Don't use const_cast to cast away const or volatile (type.3).
56-
#endif
57-
return const_cast <typename std::basic_string<CharT>::pointer>(s.data());
58-
CODA_OSS_disable_warning_pop
59-
#endif // CODA_OSS_cpp17
6051
}
6152
CODA_OSS_disable_warning_pop
6253
template <typename CharT>

modules/c++/sys/CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ coda_add_module(
77
VERSION 1.2
88
DEPS config-c++ except-c++ str-c++ GSL)
99

10+
add_compile_options($<$<CXX_COMPILER_ID:GNU,Clang,AppleClang>:-Wno-use-after-free>)
1011
coda_add_tests(
1112
MODULE_NAME ${MODULE_NAME}
1213
DIRECTORY "tests"
@@ -16,6 +17,3 @@ coda_add_tests(
1617
DIRECTORY "unittests"
1718
DEPS mt-c++
1819
UNITTEST)
19-
20-
# Aligned alloc test throws -Werror=use-after-free
21-
target_compile_options(sys_test_aligned_alloc PRIVATE $<$<CXX_COMPILER_ID:GNU,Clang,AppleClang>:-Wno-use-after-free>)

modules/c++/xml.lite/unittests/test_xmlelement.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,8 @@
3232
// C++20 changed the type of u8 to char8_t* https://en.cppreference.com/w/cpp/language/string_literal
3333
// Not putting this everywhere because (1) well, it's a macro, and (2) it's mostly
3434
// only test code that uses string literals.
35-
#if CODA_OSS_cpp20
3635
#define U8(s) u8##s
37-
#else
38-
#define U8(s) static_cast<const std::char8_t*>(static_cast<const void*>(s))
39-
#endif
36+
4037

4138
static const std::string& text()
4239
{

0 commit comments

Comments
 (0)