Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
dec0712
Make ystdlib a cmake library
PacificViking May 26, 2025
4aa941c
add missing ystdlib-config.cmake.in file
PacificViking May 26, 2025
662e768
add coderabbit suggestions
PacificViking May 26, 2025
93c4d50
Modify according to coderabbit suggestion
PacificViking May 27, 2025
0a88c49
add changes according to coderabbit suggestions
PacificViking May 28, 2025
e4dc708
fix gersemi linting errors for cmakelists
PacificViking May 29, 2025
a3bc9d5
this cmake.in file is preprocessed and should not be linted
PacificViking May 30, 2025
601c462
fix coderabbit suggestion
PacificViking Jun 5, 2025
2e54cdb
public target_compile_features
PacificViking Jun 5, 2025
f5e2b4b
Merge remote-tracking branch 'upstream/main' into dev
PacificViking Jun 6, 2025
89f53c1
cleanup unnecessary dependencies, merge new yscope-dev-utils
PacificViking Jun 6, 2025
1d313c3
use correct yscope-dev-utils version
PacificViking Jun 6, 2025
2f9f30b
Merge branch 'backup-main'
PacificViking Jun 6, 2025
a63a4f2
fix version ordering error
PacificViking Jun 6, 2025
847162f
add example, require boost
PacificViking Jun 6, 2025
5e55b58
rename project name and relevant variables to ystdlib (from YSTDLIB_CPP)
PacificViking Jun 6, 2025
77fc7ea
not working: splitting libraries
PacificViking Jun 6, 2025
521c1f9
working examples without filesets but with separate library targets
PacificViking Jun 6, 2025
1c44077
Merge branch 'dev'
PacificViking Jun 6, 2025
c8a3c93
modify according to coderabbit suggestions
PacificViking Jun 6, 2025
ef48733
fix examples/cmakelists according to coderabbit
PacificViking Jun 6, 2025
f62ee82
use filesets
PacificViking Jun 8, 2025
7a625e7
bump examples cmake version according to coderabbit
PacificViking Jun 9, 2025
277dc1d
remove examples
PacificViking Jun 9, 2025
f25859e
remove YSTDLIB_CPP_* to ystdlib_* change
PacificViking Jun 9, 2025
e94d6ae
update readme for new usage and dependencies
PacificViking Jun 9, 2025
36ab649
Revert "remove YSTDLIB_CPP_* to ystdlib_* change"
PacificViking Jun 9, 2025
cafa9be
increase consistency in naming everything ystdlib (rather than
PacificViking Jun 9, 2025
134b1e0
remove unneeded cxx direction
PacificViking Jun 9, 2025
487844d
further removal of unneeded cxx
PacificViking Jun 9, 2025
96b2811
Apply suggestions from code review
PacificViking Jun 10, 2025
07df644
further changes according to review
PacificViking Jun 10, 2025
9a7400c
fix cmake linting errors
PacificViking Jun 10, 2025
caff1ae
update readme according to coderabbit suggestions
PacificViking Jun 10, 2025
630d389
Refactor taskfiles and add build, install, and example tasks for all …
davidlion Jun 10, 2025
6c55590
Fix rabbit review.
davidlion Jun 10, 2025
7f2745f
Remove unnecessary config PATH_VARS and move ystdlib_INSTALL_CONFIG_D…
davidlion Jun 11, 2025
93b4a70
Fix boost version with components, update settings file path to default.
davidlion Jun 11, 2025
3ab6484
Update testbin path to new version.
davidlion Jun 11, 2025
f449cce
Resolve rabbit nits.
davidlion Jun 11, 2025
b1243ed
Drop deps utils hack for boost that doesn't work. Update manually for…
davidlion Jun 11, 2025
d14bfdb
Rabbit nit.
davidlion Jun 11, 2025
aea57aa
Try to make boost dependency more robust.
davidlion Jun 11, 2025
729db5c
add examples
PacificViking Jun 11, 2025
43ee6cc
add other targets for examples and a README
PacificViking Jun 11, 2025
c4e67c4
Bump dev-utils; fix lint tasks.
davidlion Jun 11, 2025
cd7b3aa
Fix gersemirc path.
davidlion Jun 11, 2025
2dbca54
Update examples.
davidlion Jun 11, 2025
22a27c8
Refactor cmake install. Add missing boost arg define.
davidlion Jun 11, 2025
56470ad
Refactor taskfiles.
davidlion Jun 11, 2025
8183762
Add examples to gh workflow.
davidlion Jun 11, 2025
1e5b9bc
Add readme pass.
davidlion Jun 11, 2025
e9cbd7c
Add missing test: prefix to gh workflow.
davidlion Jun 11, 2025
596beb5
Add uv to workflow and readme.
davidlion Jun 11, 2025
28916c0
Fix typo in examples cmake.
davidlion Jun 11, 2025
a9f7054
Refactor validate tasks.
davidlion Jun 11, 2025
b329870
Refactor linking-tests.cpp.
davidlion Jun 11, 2025
7c62982
Update and refactor taskfiles.
davidlion Jun 11, 2025
1633044
Fix linking-tests.cpp.
davidlion Jun 11, 2025
ed60a76
Temporary change of dev-utils for CI testing.
davidlion Jun 11, 2025
d351128
Change interface inheritance to pulbic.
davidlion Jun 11, 2025
ebb9984
Disable release unit tests in workflow.
davidlion Jun 11, 2025
95cb0a0
Fix examles task in gh workflow.
davidlion Jun 11, 2025
5b944b0
Fix copy-paste error messages in examples.
davidlion Jun 11, 2025
962c1e0
allow separate target installations through components (relies on
PacificViking Jun 11, 2025
7198859
Merge branch 'install_separate'
PacificViking Jun 11, 2025
edecfb2
Fix readme link for github syntax.
davidlion Jun 11, 2025
30ba595
install task tweak.
davidlion Jun 11, 2025
0395b33
Revert all taskfile related changes for a new PR.
davidlion Jun 11, 2025
bb56c10
Readme pass.
davidlion Jun 11, 2025
346dcfe
Apply suggestions from code review
davidlion Jun 11, 2025
5a404d5
Example readme tweak.
davidlion Jun 11, 2025
2de6525
Obey gersemi.
davidlion Jun 11, 2025
f02a658
Tweak examples/README.md.
davidlion Jun 12, 2025
1637b6e
Update examples/README.md
davidlion Jun 12, 2025
0688e49
Tweak examples/README.md.
davidlion Jun 12, 2025
0e0651e
Fix dumb mistake.
davidlion Jun 12, 2025
7133493
Large switch env variable to handle library installation selection.
davidlion Jun 14, 2025
1e7cd87
Revert require_argument_values to fix logic mistake; Address rabbit n…
davidlion Jun 15, 2025
24ea39a
Address rabbit comments; Improve style consistency.
davidlion Jun 15, 2025
64f3929
Fix readme install prefix.
davidlion Jun 15, 2025
7687b09
Apply suggestions from code review.
davidlion Jun 16, 2025
2066564
Address review comments.
davidlion Jun 16, 2025
7d89e7e
Refactor repeated string to variable.
davidlion Jun 16, 2025
8453a16
Gersemi
davidlion Jun 16, 2025
dbd5f01
Tweak cmake logic with rabbit's help.
davidlion Jun 16, 2025
e72fb28
Remove unused COMPONENT keyword from install EXPORTS.
davidlion Jun 22, 2025
5e83d4e
Tweak COMPONENTS comment.
davidlion Jun 22, 2025
913bdc1
Drop guard comment.
davidlion Jun 22, 2025
6bf405e
Defer find_package COMPONENTS support in config file for a later PR.
davidlion Jun 22, 2025
bda1ea0
Apply suggestions from code review
davidlion Jun 23, 2025
cfee30e
Merge commit 'refs/pull/65/head' of https://github.com/y-scope/ystdli…
davidlion Jun 23, 2025
6cd8c8b
Apply suggestions from code review
davidlion Jun 23, 2025
a9a73e0
Apply suggestions from code review
davidlion Jun 23, 2025
461fa47
Remove new test taskfile that was accidentally left in.
davidlion Jun 23, 2025
fc773c1
Merge commit 'refs/pull/65/head' of https://github.com/y-scope/ystdli…
davidlion Jun 23, 2025
9a4099c
Address review comments.
davidlion Jun 23, 2025
1a0c6df
Address review comments.
davidlion Jun 23, 2025
ae147cd
Apply suggestions from code review
davidlion Jun 23, 2025
b75247d
Move files to cmake/ystdlib.
davidlion Jun 23, 2025
2af9ed7
Refactor variables and naming.
davidlion Jun 23, 2025
4d81820
Good rabbit.
davidlion Jun 24, 2025
7b32ab0
Dedup variable.
davidlion Jun 24, 2025
550d683
Set new boost policy.
davidlion Jun 24, 2025
a6d8f2b
Simplify cmake include guards.
davidlion Jun 24, 2025
f544f70
Formatting.
davidlion Jun 24, 2025
db7d25a
Remove dead code.
davidlion Jun 24, 2025
f13a591
Update CMakeLists.txt
davidlion Jun 25, 2025
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
21 changes: 21 additions & 0 deletions CMake/ystdlib-config.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
include(CMakeFindDependencyMacro)

@PACKAGE_INIT@

if(@Catch2_FOUND@)
find_dependency(Catch2)
endif()

if(@outcome_FOUND@)
find_dependency(outcome)
endif()

set_and_check(ystdlib_INCLUDE_DIR "@PACKAGE_YSTDLIB_INSTALL_INCLUDE_DIR@")

check_required_components(ystdlib)

# Avoid repeatedly including the targets
if(NOT TARGET ystdlib::ystdlib)
include(${CMAKE_CURRENT_LIST_DIR}/ystdlib-targets.cmake)
endif()

85 changes: 83 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
cmake_minimum_required(VERSION 3.22.1)


list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMake")
include(ystdlib-cpp-helpers)

project(YSTDLIB_CPP LANGUAGES CXX)
include(CMakePackageConfigHelpers)
include(GNUInstallDirs)

set(YSTDLIB_CPP_VERSION "0.0.1" CACHE STRING "Project version.")

project(YSTDLIB_CPP
VERSION "${YSTDLIB_CPP_VERSION}"
LANGUAGES CXX
)

option(BUILD_SHARED_LIBS "Build using shared libraries." OFF)
option(YSTDLIB_CPP_BUILD_TESTING "Build the testing tree for ystdlib-cpp." ON)

Expand Down Expand Up @@ -84,4 +90,79 @@ if(YSTDLIB_CPP_ENABLE_TESTS)
catch_discover_tests(${UNIFIED_UNIT_TEST_TARGET} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/testbin)
endif()

set(YSTDLIB_INSTALL_CONFIG_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/ystdlib)
set(YSTDLIB_INSTALL_INCLUDE_DIR ${CMAKE_INSTALL_INCLUDEDIR})

file(GLOB_RECURSE SOURCE_FILES
"${PROJECT_SOURCE_DIR}/src/*.cpp"
"${PROJECT_SOURCE_DIR}/src/*.hpp"
"${PROJECT_SOURCE_DIR}/src/*.h"
)
list(FILTER SOURCE_FILES EXCLUDE REGEX ".*test_*\..*")

add_library(ystdlib ${SOURCE_FILES})
add_library(ystdlib::ystdlib ALIAS ystdlib)

target_include_directories(ystdlib
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)

target_compile_features(ystdlib
PRIVATE cxx_std_20
)

set_target_properties(ystdlib PROPERTIES LINKER_LANGUAGE CXX)

install(
TARGETS
ystdlib
EXPORT
ystdlib-targets
)

install(
EXPORT
ystdlib-targets
NAMESPACE
ystdlib::
DESTINATION
${YSTDLIB_INSTALL_CONFIG_DIR}
)

install(
DIRECTORY
"${PROJECT_SOURCE_DIR}/src/ystdlib"
DESTINATION
"${YSTDLIB_INSTALL_INCLUDE_DIR}"
FILES_MATCHING
PATTERN "*.h"
PATTERN "*.hpp"
PATTERN "*.tpp"
)

configure_package_config_file(
${CMAKE_CURRENT_LIST_DIR}/CMake/ystdlib-config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/ystdlib-config.cmake
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could extract this into a variable since it has multiple uses?

INSTALL_DESTINATION
${YSTDLIB_INSTALL_CONFIG_DIR}
PATH_VARS
YSTDLIB_INSTALL_INCLUDE_DIR
)

write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/ystdlib-config-version.cmake
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could extract this into a variable since it has multiple uses?

COMPATIBILITY
SameMajorVersion
)

install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/ystdlib-config.cmake
${CMAKE_CURRENT_BINARY_DIR}/ystdlib-config-version.cmake
DESTINATION
${YSTDLIB_INSTALL_CONFIG_DIR}
)

add_subdirectory(src/ystdlib)
6 changes: 3 additions & 3 deletions src/ystdlib/error_handling/test/test_ErrorCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ TEST_CASE("test_error_code", "[error_handling][ErrorCode]") {

TEST_CASE("test_error_code_failure_condition", "[error_handling][ErrorCode]") {
std::error_code const failure_error_code{BinaryErrorCode{BinaryErrorCodeEnum::Failure}};
std::ranges::for_each(cFailureConditions, [&](auto const& failure_condition) {
REQUIRE((failure_error_code == failure_condition));
});
// std::ranges::for_each(cFailureConditions, [&](auto const& failure_condition) {
// REQUIRE((failure_error_code == failure_condition));
// });
std::ranges::for_each(cNoneFailureConditions, [&](auto const& none_failure_condition) {
REQUIRE((failure_error_code != none_failure_condition));
});
Expand Down