Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
11 changes: 9 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,12 @@ if(BUILD_TESTING AND YSTDLIB_CPP_BUILD_TESTING)
set(YSTDLIB_CPP_ENABLE_TESTS ON)
endif()

# Import CMake helper functions
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/CMake)
find_package(outcome REQUIRED)
if(outcome_FOUND)
message(STATUS "Found outcome.")
else()
message(FATAL_ERROR "Could not find libraries for outcome.")
endif()

if(YSTDLIB_CPP_ENABLE_TESTS)
find_package(Catch2 3.8.0 REQUIRED)
Expand All @@ -77,6 +81,9 @@ if(YSTDLIB_CPP_ENABLE_TESTS)
catch_discover_tests(${UNIFIED_UNIT_TEST_TARGET} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/testbin)
endif()

# Import CMake helper functions
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/CMake)

include(ystdlib-cpp-helpers)

add_subdirectory(src/ystdlib)
79 changes: 75 additions & 4 deletions taskfiles/deps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,47 @@ version: "3"
vars:
G_CATCH2_LIB_NAME: "Catch2"
G_CATCH2_WORK_DIR: "{{.G_DEPS_DIR}}/{{.G_CATCH2_LIB_NAME}}"
G_OUTCOME_LIB_NAME: "outcome"
G_OUTCOME_WORK_DIR: "{{.G_DEPS_DIR}}/{{.G_OUTCOME_LIB_NAME}}"
G_QUICKCPPLIB_LIB_NAME: "quickcpplib"
G_QUICKCPPLIB_WORK_DIR: "{{.G_DEPS_DIR}}/{{.G_QUICKCPPLIB_LIB_NAME}}"

tasks:
install-all:
desc: "Install all dependencies required by ystdlib-cpp."
cmds:
- task: "install-all-init"
- task: "install-all-run"

install-all-init:
internal: true
cmds:
- "mkdir -p {{.G_DEPS_DIR}}"
- "rm -f '{{.G_DEPS_CMAKE_SETTINGS_FILE}}'"
# Enable CMP0074 to ensure Cmake versions prior to 3.12 does not ignore <PackageName>_ROOT.
- >-
echo "set(CMAKE_POLICY_DEFAULT_CMP0074 NEW CACHE STRING \"Enable <PackageName>_ROOT
flags\")" >> "{{.G_DEPS_CMAKE_SETTINGS_FILE}}"

install-all-run:
internal: true
deps:
- "install-Catch2"
- "install-outcome"
- "install-quickcpplib"

add-package-root-to-settings:
internal: true
requires:
vars:
- "NAME"
- "INSTALL_PREFIX"
cmds:
- "rm -f '{{.G_DEPS_CMAKE_SETTINGS_FILE}}'"
# POSIX-compliant OS ensures that writes with sizes less than `PIPE_BUF` must be atomic.
# See also: https://man7.org/linux/man-pages/man7/pipe.7.html
- >-
echo "set(
{{.G_CATCH2_LIB_NAME}}_ROOT \"{{.G_CATCH2_WORK_DIR}}/{{.G_CATCH2_LIB_NAME}}-install\"
)" >> "{{.G_DEPS_CMAKE_SETTINGS_FILE}}"
echo "set({{.NAME}}_ROOT \"{{.INSTALL_PREFIX}}\" CACHE PATH \"Path to {{.NAME}}\")" >>
"{{.G_DEPS_CMAKE_SETTINGS_FILE}}"

install-Catch2:
internal: true
Expand All @@ -26,3 +55,45 @@ tasks:
WORK_DIR: "{{.G_CATCH2_WORK_DIR}}"
FILE_SHA256: "1ab2de20460d4641553addfdfe6acd4109d871d5531f8f519a52ea4926303087"
URL: "https://github.com/catchorg/Catch2/archive/refs/tags/v3.8.0.tar.gz"
- task: "add-package-root-to-settings"
vars:
NAME: "{{.G_CATCH2_LIB_NAME}}"
INSTALL_PREFIX: "{{.G_CATCH2_WORK_DIR}}/{{.G_CATCH2_LIB_NAME}}-install"

install-outcome:
internal: true
run: "once"
deps:
- "install-quickcpplib"
cmds:
- task: ":utils:cmake-install-remote-tar"
vars:
NAME: "{{.G_OUTCOME_LIB_NAME}}"
WORK_DIR: "{{.G_OUTCOME_WORK_DIR}}"
FILE_SHA256: "0382248cbb00806ce4b5f3ce6939797dc3b597c85fd3531614959e31ef488b39"
URL: "https://github.com/ned14/outcome/archive/refs/tags/v2.2.11.tar.gz"
GEN_ARGS:
- "-C {{.G_DEPS_CMAKE_SETTINGS_FILE}}"
- "-DCMAKE_BUILD_TYPE=Release"
JOBS: 8
- task: "add-package-root-to-settings"
vars:
NAME: "{{.G_OUTCOME_LIB_NAME}}"
INSTALL_PREFIX: "{{.G_OUTCOME_WORK_DIR}}/{{.G_OUTCOME_LIB_NAME}}-install"

install-quickcpplib:
internal: true
run: "once"
cmds:
- task: ":utils:cmake-install-remote-tar"
vars:
NAME: "{{.G_QUICKCPPLIB_LIB_NAME}}"
WORK_DIR: "{{.G_QUICKCPPLIB_WORK_DIR}}"
FILE_SHA256: "cd1f4cd5e9580957bd9e9fabf5b9133ffe3594071a1eed6fe685d9143b961294"
URL: "https://github.com/ned14/quickcpplib/archive/master.tar.gz"
GEN_ARGS:
- "-DCMAKE_BUILD_TYPE=Release"
- task: "add-package-root-to-settings"
vars:
NAME: "{{.G_QUICKCPPLIB_LIB_NAME}}"
INSTALL_PREFIX: "{{.G_QUICKCPPLIB_WORK_DIR}}/{{.G_QUICKCPPLIB_LIB_NAME}}-install"