From 37e125c7aed2fa62931d606fe7d3d172ef564f34 Mon Sep 17 00:00:00 2001 From: Gulin7 Date: Wed, 27 Nov 2024 12:39:13 +0200 Subject: [PATCH 01/36] Modified dependencies to add Catch2 --- conanfile.py | 1 + environment-dev.yml | 29 +++++++++++++++-------------- vcpkg.json | 24 ++++++++++++++---------- 3 files changed, 30 insertions(+), 24 deletions(-) diff --git a/conanfile.py b/conanfile.py index 6f9219f17..80dbb201b 100644 --- a/conanfile.py +++ b/conanfile.py @@ -33,6 +33,7 @@ def requirements(self): if self.options.get_safe("use_date_polyfill"): self.requires("date/3.0.1#032e24ad8bd1fd136dd33c932563d3d1") self.test_requires("doctest/2.4.11") + self.test_requires("catch2/3.7.0") def build_requirements(self): if self.options.get_safe("generate_documentation"): diff --git a/environment-dev.yml b/environment-dev.yml index 6c5cb4835..8fd6ba38c 100644 --- a/environment-dev.yml +++ b/environment-dev.yml @@ -1,17 +1,18 @@ name: sparrow channels: - - conda-forge + - conda-forge dependencies: - # Build - - cmake - - ninja - # Tests - - doctest - # P0355R7 (Extending chrono to Calendars and Time Zones) has not been entirely implemented in libc++ yet. - # See: https://libcxx.llvm.org/Status/Cxx20.html#note-p0355 - # For now, we use HowardHinnant/date as a replacement if we are compiling with libc++. - # TODO: remove this once libc++ has full support for P0355R7. - - howardhinnant_date - # Documentation - - doxygen - - graphviz + # Build + - cmake + - ninja + # Tests + - doctest + - catch2 + # P0355R7 (Extending chrono to Calendars and Time Zones) has not been entirely implemented in libc++ yet. + # See: https://libcxx.llvm.org/Status/Cxx20.html#note-p0355 + # For now, we use HowardHinnant/date as a replacement if we are compiling with libc++. + # TODO: remove this once libc++ has full support for P0355R7. + - howardhinnant_date + # Documentation + - doxygen + - graphviz diff --git a/vcpkg.json b/vcpkg.json index 775f6984f..7a2743925 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,11 +1,15 @@ { - "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", - "dependencies": [ - "doctest", - "date", - { - "name": "vcpkg-tool-ninja", - "host": true - } - ] - } + "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", + "dependencies": [ + "doctest", + "date", + { + "name": "catch2", + "version>=": "3.7.0" + }, + { + "name": "vcpkg-tool-ninja", + "host": true + } + ] +} From fcbdb8e478eb355bfeab8e2edbc5be98fa1a9248 Mon Sep 17 00:00:00 2001 From: Gulin7 Date: Wed, 27 Nov 2024 12:54:06 +0200 Subject: [PATCH 02/36] Modified CMake to use Catch2 lib and added new Catch2 target --- test/CMakeLists.txt | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a708c77c0..75233f36f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -24,6 +24,7 @@ endif() find_package(doctest REQUIRED) find_package(nanoarrow REQUIRED) +find_package(Catch2 REQUIRED) # find_package(Threads) if(NOT CMAKE_BUILD_TYPE) @@ -108,6 +109,17 @@ target_link_libraries(${test_target} include(doctest) doctest_discover_tests(${test_target}) +set(test_target_catch2 "test_sparrow_lib_catch2") + +add_executable(${test_target_catch2} ${SPARROW_TESTS_SOURCES}) +target_link_libraries(${test_target_catch2} + PRIVATE + sparrow Catch2::Catch2 $<$:${SANITIZER_LINK_LIBRARIES}>) + +include(Catch) +catch_discover_tests(${test_target_catch2}) + + if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") set(compiles_options /bigobj @@ -184,6 +196,8 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "C if (NOT "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC") target_compile_options(${test_target} PRIVATE "-ftemplate-backtrace-limit=0") target_compile_options(${test_target} PRIVATE "-pedantic")# Warn on language extensions + target_compile_options(${test_target_catch2} PRIVATE "-ftemplate-backtrace-limit=0") + target_compile_options(${test_target_catch2} PRIVATE "-pedantic")# Warn on language extensions endif() endif() @@ -203,10 +217,22 @@ target_link_options(${test_target} set_target_properties(${test_target} PROPERTIES CMAKE_CXX_EXTENSIONS OFF) target_compile_features(${test_target} PRIVATE cxx_std_20) +target_compile_options(${test_target_catch2} + PRIVATE + ${compiles_options} + $<$:${SANITIZER_COMPILE_OPTIONS}> + ) +target_link_options(${test_target_catch2} + PRIVATE + $<$:${SANITIZER_LINK_OPTIONS}>) +# We do not use non-standard C++ +set_target_properties(${test_target_catch2} PROPERTIES CMAKE_CXX_EXTENSIONS OFF) +target_compile_features(${test_target_catch2} PRIVATE cxx_std_20) + add_custom_target(run_tests - COMMAND ${test_target} - DEPENDS ${test_target} - COMMENT "Running tests" + COMMAND ${test_target} && ${test_target_catch2} + DEPENDS ${test_target} ${test_target_catch2} + COMMENT "Running tests for Doctest and Catch2" USES_TERMINAL ) @@ -215,9 +241,10 @@ set_target_properties(run_tests PROPERTIES FOLDER "Tests utilities") set(JUNIT_REPORT_FILE ${CMAKE_CURRENT_BINARY_DIR}/test_sparrow_lib_report.xml) add_custom_target(run_tests_with_junit_report - COMMAND ${test_target} --reporters=better_junit --out=${JUNIT_REPORT_FILE} --no-path-filenames=true - DEPENDS ${test_target} - COMMENT "Running tests with JUnit report saved to: ${JUNIT_REPORT_FILE}" + COMMAND ${test_target} --reporters=better_junit --out=${JUNIT_REPORT_FILE_DOCTEST} --no-path-filenames=true + COMMAND ${test_target_catch2} --reporters=better_junit --out=${JUNIT_REPORT_FILE_CATCH2} --no-path-filenames=true + DEPENDS ${test_target} ${test_target_catch2} + COMMENT "Running tests with JUnit reports saved to: ${JUNIT_REPORT_FILE_DOCTEST} and ${JUNIT_REPORT_FILE_CATCH2}" USES_TERMINAL ) From 77beaf247332b47a67fd95c614350cf8925c36a4 Mon Sep 17 00:00:00 2001 From: Gulin7 Date: Wed, 27 Nov 2024 13:06:11 +0200 Subject: [PATCH 03/36] Modified the CI github action files --- .github/workflows/linux.yml | 4 +++- .github/workflows/osx.yml | 4 +++- .github/workflows/qemu.yaml | 10 ++++++---- .github/workflows/windows.yml | 4 +++- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index e0d460ce9..70e32335c 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -125,7 +125,9 @@ jobs: if: success() || failure() with: name: test_sparrow_lib_report_Linux_${{ matrix.sys.compiler }}_${{ matrix.sys.version }}_${{ matrix.sys.stdlib }}_${{ matrix.config.name }}_date-polyfill_${{ matrix.sys.date-polyfill}} - path: '**/test_sparrow_lib_report.xml' + path: | + '**/test_sparrow_lib_report.xml' # Doctest report + '**/test_sparrow_lib_report_catch2.xml' # Catch2 report - name: Run all examples working-directory: build diff --git a/.github/workflows/osx.yml b/.github/workflows/osx.yml index 34387049c..f53e0a2cc 100644 --- a/.github/workflows/osx.yml +++ b/.github/workflows/osx.yml @@ -114,7 +114,9 @@ jobs: if: success() || failure() with: name: test_sparrow_lib_report_OSX_${{ matrix.os }}_${{ matrix.config.name }}_${{ matrix.compiler }} - path: '**/test_sparrow_lib_report.xml' + path: | + '**/test_sparrow_lib_report.xml' # Doctest report + '**/test_sparrow_lib_report_catch2.xml' # Catch2 report'**/ - name: Run all examples working-directory: build diff --git a/.github/workflows/qemu.yaml b/.github/workflows/qemu.yaml index 89e63d505..32e90a713 100644 --- a/.github/workflows/qemu.yaml +++ b/.github/workflows/qemu.yaml @@ -83,16 +83,16 @@ jobs: case "${{matrix.target.distro}}" in ubuntu*|bookworm) apt-get update -q -y - apt-get install -q -y git cmake make doctest-dev libhowardhinnant-date-dev tzdata g++ ninja-build build-essential ccache + apt-get install -q -y git cmake make doctest-dev libhowardhinnant-date-dev tzdata g++ ninja-build build-essential ccache catch2 ;; fedora*) dnf -y update dnf -y groupinstall "Development Tools" - dnf -y install git which cmake make doctest-devel date date-devel tzdata gcc-c++ ninja-build ccache + dnf -y install git which cmake make doctest-devel date date-devel tzdata gcc-c++ ninja-build ccache catch2 ;; alpine*) apk update - apk add git cmake make doctest-dev date-dev tzdata g++ samurai ccache + apk add git cmake make doctest-dev date-dev tzdata g++ samurai catch2 ccache ;; esac @@ -143,4 +143,6 @@ jobs: if: success() || failure() with: name: test_sparrow_lib_report_Linux_${{matrix.target.distro}}_${{matrix.target.arch}}_${{matrix.config.name}}_date-polyfill_${{matrix.target.date-polyfill}} - path: '**/test_sparrow_lib_report.xml' + path: | + '**/test_sparrow_lib_report.xml' # Doctest report + '**/test_sparrow_lib_report_catch2.xml' # Catch2 report diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 01a0f5143..ec5e7c8f9 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -205,7 +205,9 @@ jobs: if: success() || failure() with: name: test_sparrow_lib_report_Windows_${{ matrix.toolchain.compiler }}_${{ matrix.build-system.name }}_${{ matrix.config.name }}_${{ matrix.target-arch.name }}_date-polyfill_${{ matrix.toolchain.date-polyfill}} - path: '**/test_sparrow_lib_report.xml' + path: | + '**/test_sparrow_lib_report.xml' # Doctest report + '**/test_sparrow_lib_report_catch2.xml' # Catch2 report - name: Run all examples working-directory: build From afa5943aec46c426889f86d9d061faaad921bb0d Mon Sep 17 00:00:00 2001 From: Gulin7 Date: Wed, 27 Nov 2024 13:09:47 +0200 Subject: [PATCH 04/36] Port test_algorithm.cpp from Doctest to Catch2 --- test/test_algorithm.cpp | 49 ++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 27 deletions(-) diff --git a/test/test_algorithm.cpp b/test/test_algorithm.cpp index 107ac1858..1774c25b6 100644 --- a/test/test_algorithm.cpp +++ b/test/test_algorithm.cpp @@ -17,31 +17,26 @@ #include "sparrow/utils/algorithm.hpp" -#include "doctest/doctest.h" - -TEST_SUITE("algorithm") -{ - TEST_CASE("lexicographical_compare_three_way") - { - const std::vector v1 = {1, 2, 3}; - std::vector v2 = {1, 2, 3}; - CHECK_EQ(sparrow::lexicographical_compare_three_way(v1, v2), std::strong_ordering::equal); - - v2 = {1, 2, 4}; - CHECK_EQ(sparrow::lexicographical_compare_three_way(v1, v2), std::strong_ordering::less); - - v2 = {1, 2, 2}; - CHECK_EQ(sparrow::lexicographical_compare_three_way(v1, v2), std::strong_ordering::greater); - } - - TEST_CASE("lexicographical_compare_three_way with empty ranges") - { - const std::vector v1 = {1, 2, 3}; - const std::vector v2 = {}; - CHECK_EQ(sparrow::lexicographical_compare_three_way(v1, v2), std::strong_ordering::greater); - CHECK_EQ(sparrow::lexicographical_compare_three_way(v2, v1), std::strong_ordering::less); - - const std::vector v3 = {}; - CHECK_EQ(sparrow::lexicographical_compare_three_way(v2, v3), std::strong_ordering::equal); - } +#include // Include Catch2 header + +TEST_CASE("lexicographical_compare_three_way", "[algorithm]") { + const std::vector v1 = {1, 2, 3}; + std::vector v2 = {1, 2, 3}; + CHECK(sparrow::lexicographical_compare_three_way(v1, v2) == std::strong_ordering::equal); + + v2 = {1, 2, 4}; + CHECK(sparrow::lexicographical_compare_three_way(v1, v2) == std::strong_ordering::less); + + v2 = {1, 2, 2}; + CHECK(sparrow::lexicographical_compare_three_way(v1, v2) == std::strong_ordering::greater); +} + +TEST_CASE("lexicographical_compare_three_way with empty ranges", "[algorithm]") { + const std::vector v1 = {1, 2, 3}; + const std::vector v2 = {}; + CHECK(sparrow::lexicographical_compare_three_way(v1, v2) == std::strong_ordering::greater); + CHECK(sparrow::lexicographical_compare_three_way(v2, v1) == std::strong_ordering::less); + + const std::vector v3 = {}; + CHECK(sparrow::lexicographical_compare_three_way(v2, v3) == std::strong_ordering::equal); } From 3f06a720fec9e30eebfcf6cea52ea830bc090fbd Mon Sep 17 00:00:00 2001 From: Gulin7 Date: Wed, 27 Nov 2024 16:50:07 +0200 Subject: [PATCH 05/36] Fixed according to comments --- test/CMakeLists.txt | 6 +++--- test/test_algorithm.cpp | 2 +- vcpkg.json | 7 ++----- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 75233f36f..15f8cdee7 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -24,7 +24,7 @@ endif() find_package(doctest REQUIRED) find_package(nanoarrow REQUIRED) -find_package(Catch2 REQUIRED) +find_package(Catch2 3 REQUIRED) # find_package(Threads) if(NOT CMAKE_BUILD_TYPE) @@ -111,7 +111,7 @@ doctest_discover_tests(${test_target}) set(test_target_catch2 "test_sparrow_lib_catch2") -add_executable(${test_target_catch2} ${SPARROW_TESTS_SOURCES}) +add_executable(${test_target_catch2} "test_algorithm.cpp") target_link_libraries(${test_target_catch2} PRIVATE sparrow Catch2::Catch2 $<$:${SANITIZER_LINK_LIBRARIES}>) @@ -242,7 +242,7 @@ set(JUNIT_REPORT_FILE ${CMAKE_CURRENT_BINARY_DIR}/test_sparrow_lib_report.xml) add_custom_target(run_tests_with_junit_report COMMAND ${test_target} --reporters=better_junit --out=${JUNIT_REPORT_FILE_DOCTEST} --no-path-filenames=true - COMMAND ${test_target_catch2} --reporters=better_junit --out=${JUNIT_REPORT_FILE_CATCH2} --no-path-filenames=true + COMMAND ${test_target_catch2} --reporter junit --out ${JUNIT_REPORT_FILE_CATCH2} --no-path-filenames DEPENDS ${test_target} ${test_target_catch2} COMMENT "Running tests with JUnit reports saved to: ${JUNIT_REPORT_FILE_DOCTEST} and ${JUNIT_REPORT_FILE_CATCH2}" USES_TERMINAL diff --git a/test/test_algorithm.cpp b/test/test_algorithm.cpp index 1774c25b6..5c2733d44 100644 --- a/test/test_algorithm.cpp +++ b/test/test_algorithm.cpp @@ -17,7 +17,7 @@ #include "sparrow/utils/algorithm.hpp" -#include // Include Catch2 header +#include // Include Catch2 header TEST_CASE("lexicographical_compare_three_way", "[algorithm]") { const std::vector v1 = {1, 2, 3}; diff --git a/vcpkg.json b/vcpkg.json index 7a2743925..d5e61955e 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -3,13 +3,10 @@ "dependencies": [ "doctest", "date", - { - "name": "catch2", - "version>=": "3.7.0" - }, + "catch2", { "name": "vcpkg-tool-ninja", "host": true } ] -} +} \ No newline at end of file From 1aaf1663adb5717b26423a7b8619e9d2dc82f8ad Mon Sep 17 00:00:00 2001 From: Gulin7 Date: Wed, 27 Nov 2024 18:24:39 +0200 Subject: [PATCH 06/36] Fix build --- test/CMakeLists.txt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 15f8cdee7..d0f5eb59c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -52,7 +52,6 @@ else() junit.hpp junit_xml_writer.hpp main.cpp - test_algorithm.cpp test_allocator.cpp test_array_wrapper.cpp test_array.cpp @@ -114,7 +113,7 @@ set(test_target_catch2 "test_sparrow_lib_catch2") add_executable(${test_target_catch2} "test_algorithm.cpp") target_link_libraries(${test_target_catch2} PRIVATE - sparrow Catch2::Catch2 $<$:${SANITIZER_LINK_LIBRARIES}>) + sparrow Catch2::Catch2WithMain $<$:${SANITIZER_LINK_LIBRARIES}>) include(Catch) catch_discover_tests(${test_target_catch2}) @@ -230,7 +229,8 @@ set_target_properties(${test_target_catch2} PROPERTIES CMAKE_CXX_EXTENSIONS OFF) target_compile_features(${test_target_catch2} PRIVATE cxx_std_20) add_custom_target(run_tests - COMMAND ${test_target} && ${test_target_catch2} + COMMAND ${test_target} + COMMAND ${test_target_catch2} -v high DEPENDS ${test_target} ${test_target_catch2} COMMENT "Running tests for Doctest and Catch2" USES_TERMINAL @@ -238,11 +238,12 @@ add_custom_target(run_tests set_target_properties(run_tests PROPERTIES FOLDER "Tests utilities") -set(JUNIT_REPORT_FILE ${CMAKE_CURRENT_BINARY_DIR}/test_sparrow_lib_report.xml) +set(JUNIT_REPORT_FILE_DOCTEST ${CMAKE_CURRENT_BINARY_DIR}/test_sparrow_lib_report_doctest.xml) +set(JUNIT_REPORT_FILE_CATCH2 ${CMAKE_CURRENT_BINARY_DIR}/test_sparrow_lib_report_catch2.xml) add_custom_target(run_tests_with_junit_report COMMAND ${test_target} --reporters=better_junit --out=${JUNIT_REPORT_FILE_DOCTEST} --no-path-filenames=true - COMMAND ${test_target_catch2} --reporter junit --out ${JUNIT_REPORT_FILE_CATCH2} --no-path-filenames + COMMAND ${test_target_catch2} --reporter JUnit -o ${JUNIT_REPORT_FILE_CATCH2} DEPENDS ${test_target} ${test_target_catch2} COMMENT "Running tests with JUnit reports saved to: ${JUNIT_REPORT_FILE_DOCTEST} and ${JUNIT_REPORT_FILE_CATCH2}" USES_TERMINAL From 661ee393a46f7c037e04a5d8b3b10502f726efa8 Mon Sep 17 00:00:00 2001 From: Gulin7 Date: Wed, 27 Nov 2024 19:26:38 +0200 Subject: [PATCH 07/36] Change target_link_libraries for Catch2 --- test/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d0f5eb59c..149dbf4a2 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -118,6 +118,7 @@ target_link_libraries(${test_target_catch2} include(Catch) catch_discover_tests(${test_target_catch2}) +target_compile_definitions(test_sparrow_lib_catch2 PRIVATE _ITERATOR_DEBUG_LEVEL=2) if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") set(compiles_options From 882391fae7f1b97b4b6a2911e31fbd70585580e7 Mon Sep 17 00:00:00 2001 From: Gulin7 Date: Wed, 27 Nov 2024 19:37:31 +0200 Subject: [PATCH 08/36] Remove target_compile_definitions --- test/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 149dbf4a2..d0f5eb59c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -118,7 +118,6 @@ target_link_libraries(${test_target_catch2} include(Catch) catch_discover_tests(${test_target_catch2}) -target_compile_definitions(test_sparrow_lib_catch2 PRIVATE _ITERATOR_DEBUG_LEVEL=2) if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") set(compiles_options From 39981ffc8db2323a65f2417e25d9b83b72194630 Mon Sep 17 00:00:00 2001 From: Gulin7 Date: Thu, 28 Nov 2024 11:44:12 +0200 Subject: [PATCH 09/36] Fix MSCV compiler issue --- test/CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d0f5eb59c..1276df0c1 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -146,7 +146,8 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") /we4906 # string literal cast to 'LPWSTR' /we4928 # illegal copy-initialization; more than one user-defined conversion has been implicitly applied /we5038 # data member 'member1' will be initialized after data member 'member2' - /Zc:__cplusplus) + /Zc:__cplusplus + /MD) elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") set(compiles_options -Wall # reasonable and standard @@ -224,6 +225,10 @@ target_compile_options(${test_target_catch2} target_link_options(${test_target_catch2} PRIVATE $<$:${SANITIZER_LINK_OPTIONS}>) +target_compile_definitions(${test_target_catch2} + PRIVATE + _ITERATOR_DEBUG_LEVEL=0 +) # We do not use non-standard C++ set_target_properties(${test_target_catch2} PROPERTIES CMAKE_CXX_EXTENSIONS OFF) target_compile_features(${test_target_catch2} PRIVATE cxx_std_20) From d9fd4a86dfb08e9a1dc6c2663966b70d0d4df6d4 Mon Sep 17 00:00:00 2001 From: Gulin7 Date: Thu, 28 Nov 2024 16:30:17 +0200 Subject: [PATCH 10/36] Force build type to release --- .github/workflows/windows.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index ec5e7c8f9..71c93bbb1 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -133,6 +133,7 @@ jobs: echo "SPARROW_DEPS_PREFIX=$VCPKG_INSTALLED_DIR" >> $GITHUB_ENV echo "SPARROW_INSTALL_PREFIX=${{ github.workspace }}/install" >> $GITHUB_ENV echo "VCPKG_TARGET_TRIPLET='x86-windows'" >> $GITHUB_ENV + echo "VCPKG_BUILD_TYPE='Release'" >> $GITHUB_ENV echo "CMAKE_TOOLCHAIN_FILE=$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" >> $GITHUB_ENV echo "SPARROW_ADDITIONAL_OPTIONS=-DSPARROW_TARGET_32BIT=ON" >> $GITHUB_ENV choco install ninja From 14d17393d73736861903691d19ea491ca781c6c8 Mon Sep 17 00:00:00 2001 From: Gulin7 Date: Thu, 28 Nov 2024 23:16:06 +0200 Subject: [PATCH 11/36] Modified test CMakeList --- test/CMakeLists.txt | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 1276df0c1..2fd9a1fb9 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -146,8 +146,15 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") /we4906 # string literal cast to 'LPWSTR' /we4928 # illegal copy-initialization; more than one user-defined conversion has been implicitly applied /we5038 # data member 'member1' will be initialized after data member 'member2' - /Zc:__cplusplus - /MD) + /Zc:__cplusplus) + target_compile_options(${test_target} + PRIVATE + $<$:/DMSVC_RUNTIME_LIBRARY=MultiThreadedDLL> + ) + target_compile_options(${test_target_catch2} + PRIVATE + $<$:/DMSVC_RUNTIME_LIBRARY=MultiThreadedDLL> + ) elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") set(compiles_options -Wall # reasonable and standard @@ -225,10 +232,6 @@ target_compile_options(${test_target_catch2} target_link_options(${test_target_catch2} PRIVATE $<$:${SANITIZER_LINK_OPTIONS}>) -target_compile_definitions(${test_target_catch2} - PRIVATE - _ITERATOR_DEBUG_LEVEL=0 -) # We do not use non-standard C++ set_target_properties(${test_target_catch2} PROPERTIES CMAKE_CXX_EXTENSIONS OFF) target_compile_features(${test_target_catch2} PRIVATE cxx_std_20) From 727bfd4e2efdd090787d8241da3605d3afc54235 Mon Sep 17 00:00:00 2001 From: Gulin7 Date: Wed, 4 Dec 2024 10:30:45 +0200 Subject: [PATCH 12/36] Enforce Catch2 version and apply ITERATOR_DEBUG_LEVEL --- vcpkg.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vcpkg.json b/vcpkg.json index d5e61955e..74456b4fc 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -3,7 +3,10 @@ "dependencies": [ "doctest", "date", - "catch2", + { + "name": "catch2", + "version>=": "3.2.0" + }, { "name": "vcpkg-tool-ninja", "host": true From fd56cf739275c3367063e2110bc1796465d3cb8d Mon Sep 17 00:00:00 2001 From: Gulin7 Date: Wed, 4 Dec 2024 10:43:46 +0200 Subject: [PATCH 13/36] Add builtin-baseline to vcpkg.json --- vcpkg.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vcpkg.json b/vcpkg.json index 74456b4fc..165d4c150 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -11,5 +11,6 @@ "name": "vcpkg-tool-ninja", "host": true } - ] + ], + "builtin-baseline": "26abb5b33f976246a5f2cdc45cdd073d51caff06" } \ No newline at end of file From 211ccefb835b393e18c951ca911e99296e20cee4 Mon Sep 17 00:00:00 2001 From: Alexis Placet Date: Tue, 10 Dec 2024 15:13:22 +0100 Subject: [PATCH 14/36] Fetch catch2 repository for exotic architectures --- .github/workflows/qemu.yaml | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/.github/workflows/qemu.yaml b/.github/workflows/qemu.yaml index 32e90a713..317ab2a1f 100644 --- a/.github/workflows/qemu.yaml +++ b/.github/workflows/qemu.yaml @@ -37,6 +37,12 @@ jobs: repository: apache/arrow-nanoarrow path: dependencies/tests/nanoarrow + - name: Checkout Catch2 + uses: actions/checkout@v4 + with: + repository: catchorg/Catch2 + path: dependencies/tests/Catch2 + - name: Get current date id: date uses: Kaven-Universe/github-action-current-date-time@v1 @@ -83,16 +89,16 @@ jobs: case "${{matrix.target.distro}}" in ubuntu*|bookworm) apt-get update -q -y - apt-get install -q -y git cmake make doctest-dev libhowardhinnant-date-dev tzdata g++ ninja-build build-essential ccache catch2 + apt-get install -q -y git cmake make doctest-dev libhowardhinnant-date-dev tzdata g++ ninja-build build-essential ccache ;; fedora*) dnf -y update dnf -y groupinstall "Development Tools" - dnf -y install git which cmake make doctest-devel date date-devel tzdata gcc-c++ ninja-build ccache catch2 + dnf -y install git which cmake make doctest-devel date date-devel tzdata gcc-c++ ninja-build ccache ;; alpine*) apk update - apk add git cmake make doctest-dev date-dev tzdata g++ samurai catch2 ccache + apk add git cmake make doctest-dev date-dev tzdata g++ samurai ccache ;; esac @@ -116,6 +122,16 @@ jobs: -DCMAKE_C_STANDARD=17 echo "Build nanoarrow" cmake --build ./build --target install + cd $ROOT_DIR + echo "Configure Catch2" + cd dependencies/tests/Catch2 + cmake -G Ninja -B ./build \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DCMAKE_BUILD_TYPE:STRING=Release \ + -DCMAKE_COMPILE_WARNING_AS_ERROR=FALSE \ + echo "Build Catch2" + cmake --build ./build --target install echo "Configuring sparrow" cd $ROOT_DIR cmake -G Ninja -Bbuild \ @@ -136,7 +152,6 @@ jobs: echo "Running sparrow tests" cmake --build . --config ${{matrix.config.name}} --target run_tests_with_junit_report ccache --show-stats - - name: Upload test results uses: actions/upload-artifact@v4 From 6566ae7f3ed33c90209ffc6b4aece5f78a46dec3 Mon Sep 17 00:00:00 2001 From: Alexis Placet Date: Tue, 10 Dec 2024 15:16:27 +0100 Subject: [PATCH 15/36] Reformat conda environment-dev.yml --- environment-dev.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/environment-dev.yml b/environment-dev.yml index 8fd6ba38c..719b6e72d 100644 --- a/environment-dev.yml +++ b/environment-dev.yml @@ -1,18 +1,18 @@ name: sparrow channels: - - conda-forge + - conda-forge dependencies: - # Build - - cmake - - ninja - # Tests - - doctest - - catch2 - # P0355R7 (Extending chrono to Calendars and Time Zones) has not been entirely implemented in libc++ yet. - # See: https://libcxx.llvm.org/Status/Cxx20.html#note-p0355 - # For now, we use HowardHinnant/date as a replacement if we are compiling with libc++. - # TODO: remove this once libc++ has full support for P0355R7. - - howardhinnant_date - # Documentation - - doxygen - - graphviz + # Build + - cmake + - ninja + # Tests + - doctest + - catch2 + # P0355R7 (Extending chrono to Calendars and Time Zones) has not been entirely implemented in libc++ yet. + # See: https://libcxx.llvm.org/Status/Cxx20.html#note-p0355 + # For now, we use HowardHinnant/date as a replacement if we are compiling with libc++. + # TODO: remove this once libc++ has full support for P0355R7. + - howardhinnant_date + # Documentation + - doxygen + - graphviz From 268d2f04dd73b315fa7dffaf048efc4d6c83cc79 Mon Sep 17 00:00:00 2001 From: Alexis Placet Date: Tue, 10 Dec 2024 15:27:30 +0100 Subject: [PATCH 16/36] Try fix vcpkg --- vcpkg.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/vcpkg.json b/vcpkg.json index 165d4c150..74456b4fc 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -11,6 +11,5 @@ "name": "vcpkg-tool-ninja", "host": true } - ], - "builtin-baseline": "26abb5b33f976246a5f2cdc45cdd073d51caff06" + ] } \ No newline at end of file From a60d50c1ac89d0f886ff5e9f7e57e6dc0477e755 Mon Sep 17 00:00:00 2001 From: Alexis Placet Date: Tue, 10 Dec 2024 15:31:46 +0100 Subject: [PATCH 17/36] Try fix vcpkg --- vcpkg.json | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/vcpkg.json b/vcpkg.json index 74456b4fc..9675ac3f3 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,12 +1,9 @@ { "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", "dependencies": [ + "catch2", "doctest", "date", - { - "name": "catch2", - "version>=": "3.2.0" - }, { "name": "vcpkg-tool-ninja", "host": true From 3065411a05f19b31b270f49bafd42dd419853d71 Mon Sep 17 00:00:00 2001 From: Alexis Placet Date: Tue, 10 Dec 2024 15:52:39 +0100 Subject: [PATCH 18/36] Try fix --- test/CMakeLists.txt | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 2fd9a1fb9..b11b14e29 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -110,15 +110,15 @@ doctest_discover_tests(${test_target}) set(test_target_catch2 "test_sparrow_lib_catch2") -add_executable(${test_target_catch2} "test_algorithm.cpp") +add_executable(${test_target_catch2} test_algorithm.cpp) target_link_libraries(${test_target_catch2} PRIVATE - sparrow Catch2::Catch2WithMain $<$:${SANITIZER_LINK_LIBRARIES}>) + sparrow Catch2::Catch2WithMain + $<$:${SANITIZER_LINK_LIBRARIES}>) include(Catch) catch_discover_tests(${test_target_catch2}) - if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") set(compiles_options /bigobj @@ -147,13 +147,13 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") /we4928 # illegal copy-initialization; more than one user-defined conversion has been implicitly applied /we5038 # data member 'member1' will be initialized after data member 'member2' /Zc:__cplusplus) - target_compile_options(${test_target} - PRIVATE - $<$:/DMSVC_RUNTIME_LIBRARY=MultiThreadedDLL> + target_compile_definitions(${test_target} + MSVC_RUNTIME_LIBRARY=MultiThreadedDLL + _ITERATOR_DEBUG_LEVEL=0 ) - target_compile_options(${test_target_catch2} - PRIVATE - $<$:/DMSVC_RUNTIME_LIBRARY=MultiThreadedDLL> + target_compile_definitions(${test_target_catch2} + MSVC_RUNTIME_LIBRARY=MultiThreadedDLL + _ITERATOR_DEBUG_LEVEL=0 ) elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") set(compiles_options @@ -200,18 +200,26 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "C $<$:-Wlogical-op> # warn about logical operations being used where bitwise were probably wanted $<$:-Wno-subobject-linkage> # suppress warnings about subobject linkage ) + if (NOT "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC") target_compile_options(${test_target} PRIVATE "-ftemplate-backtrace-limit=0") target_compile_options(${test_target} PRIVATE "-pedantic")# Warn on language extensions target_compile_options(${test_target_catch2} PRIVATE "-ftemplate-backtrace-limit=0") target_compile_options(${test_target_catch2} PRIVATE "-pedantic")# Warn on language extensions + else() + set_target_properties(${test_target} PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreadedDLL") + target_compile_definitions(${test_target} + PRIVATE + _ITERATOR_DEBUG_LEVEL=0 + ) + set_target_properties(${test_target_catch2} PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreadedDLL") + target_compile_definitions(${test_target_catch2} + PRIVATE + _ITERATOR_DEBUG_LEVEL=0 + ) endif() endif() -if (MSVC_RUNTIME_LIBRARY MATCHES "MultiThreadedDLL") - list(APPEND compiles_options /D_ITERATOR_DEBUG_LEVEL=0) -endif() - target_compile_options(${test_target} PRIVATE ${compiles_options} From 83cc0c1697f4f4f4707bf282a30d5a55a1202acb Mon Sep 17 00:00:00 2001 From: Alexis Placet Date: Tue, 10 Dec 2024 15:56:41 +0100 Subject: [PATCH 19/36] Fix --- test/CMakeLists.txt | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index b11b14e29..d8ca6ac1d 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -113,7 +113,8 @@ set(test_target_catch2 "test_sparrow_lib_catch2") add_executable(${test_target_catch2} test_algorithm.cpp) target_link_libraries(${test_target_catch2} PRIVATE - sparrow Catch2::Catch2WithMain + sparrow + Catch2::Catch2WithMain $<$:${SANITIZER_LINK_LIBRARIES}>) include(Catch) @@ -147,14 +148,6 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") /we4928 # illegal copy-initialization; more than one user-defined conversion has been implicitly applied /we5038 # data member 'member1' will be initialized after data member 'member2' /Zc:__cplusplus) - target_compile_definitions(${test_target} - MSVC_RUNTIME_LIBRARY=MultiThreadedDLL - _ITERATOR_DEBUG_LEVEL=0 - ) - target_compile_definitions(${test_target_catch2} - MSVC_RUNTIME_LIBRARY=MultiThreadedDLL - _ITERATOR_DEBUG_LEVEL=0 - ) elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") set(compiles_options -Wall # reasonable and standard From 22a7e78511543bb6c245db5d683d0f4c6c01077d Mon Sep 17 00:00:00 2001 From: Alexis Placet Date: Wed, 11 Dec 2024 09:13:30 +0100 Subject: [PATCH 20/36] Try fix --- test/CMakeLists.txt | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d8ca6ac1d..60eaa360c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -199,20 +199,20 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "C target_compile_options(${test_target} PRIVATE "-pedantic")# Warn on language extensions target_compile_options(${test_target_catch2} PRIVATE "-ftemplate-backtrace-limit=0") target_compile_options(${test_target_catch2} PRIVATE "-pedantic")# Warn on language extensions - else() - set_target_properties(${test_target} PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreadedDLL") - target_compile_definitions(${test_target} - PRIVATE - _ITERATOR_DEBUG_LEVEL=0 - ) - set_target_properties(${test_target_catch2} PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreadedDLL") - target_compile_definitions(${test_target_catch2} - PRIVATE - _ITERATOR_DEBUG_LEVEL=0 - ) endif() endif() +set_target_properties(${test_target} PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreadedDLL") +target_compile_definitions(${test_target} + PRIVATE + _ITERATOR_DEBUG_LEVEL=0 +) +set_target_properties(${test_target_catch2} PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreadedDLL") +target_compile_definitions(${test_target_catch2} + PRIVATE + _ITERATOR_DEBUG_LEVEL=0 +) + target_compile_options(${test_target} PRIVATE ${compiles_options} From 8b44df8f4da39f28aae99b94e03cfe8e85002363 Mon Sep 17 00:00:00 2001 From: Alexis Placet Date: Wed, 11 Dec 2024 09:46:07 +0100 Subject: [PATCH 21/36] Try fix --- .github/workflows/windows.yml | 3 +-- test/CMakeLists.txt | 22 ++++++++++++---------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 71c93bbb1..76d48876f 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -182,8 +182,7 @@ jobs: $SPARROW_CHECKS \ $SPARROW_ADDITIONAL_OPTIONS \ -DCMAKE_C_COMPILER_LAUNCHER=ccache \ - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ - -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache - name: Build library working-directory: build diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 60eaa360c..16e0486f2 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -202,16 +202,18 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "C endif() endif() -set_target_properties(${test_target} PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreadedDLL") -target_compile_definitions(${test_target} - PRIVATE - _ITERATOR_DEBUG_LEVEL=0 -) -set_target_properties(${test_target_catch2} PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreadedDLL") -target_compile_definitions(${test_target_catch2} - PRIVATE - _ITERATOR_DEBUG_LEVEL=0 -) +if(VCPKG_TARGET_TRIPLET) + set_target_properties(${test_target} PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreadedDLL") + target_compile_definitions(${test_target} + PRIVATE + _ITERATOR_DEBUG_LEVEL=0 + ) + set_target_properties(${test_target_catch2} PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreadedDLL") + target_compile_definitions(${test_target_catch2} + PRIVATE + _ITERATOR_DEBUG_LEVEL=0 + ) +endif() target_compile_options(${test_target} PRIVATE From 11c48c8fe3299df7ccecf62a3957e548d0c397e8 Mon Sep 17 00:00:00 2001 From: Alexis Placet Date: Wed, 11 Dec 2024 09:52:02 +0100 Subject: [PATCH 22/36] WIP --- .github/workflows/windows.yml | 3 ++- test/CMakeLists.txt | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 76d48876f..71c93bbb1 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -182,7 +182,8 @@ jobs: $SPARROW_CHECKS \ $SPARROW_ADDITIONAL_OPTIONS \ -DCMAKE_C_COMPILER_LAUNCHER=ccache \ - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL - name: Build library working-directory: build diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 16e0486f2..ed2cfaf47 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -203,6 +203,7 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "C endif() if(VCPKG_TARGET_TRIPLET) + message(STATUS "VCPKG is used") set_target_properties(${test_target} PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreadedDLL") target_compile_definitions(${test_target} PRIVATE From 9d63af9d4fc3bf0b0c894806df2753b0f947b572 Mon Sep 17 00:00:00 2001 From: Alexis Placet Date: Wed, 11 Dec 2024 09:59:11 +0100 Subject: [PATCH 23/36] Fix --- .github/workflows/windows.yml | 3 +-- test/CMakeLists.txt | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 71c93bbb1..76d48876f 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -182,8 +182,7 @@ jobs: $SPARROW_CHECKS \ $SPARROW_ADDITIONAL_OPTIONS \ -DCMAKE_C_COMPILER_LAUNCHER=ccache \ - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ - -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache - name: Build library working-directory: build diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index ed2cfaf47..5c3402f87 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -202,8 +202,7 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "C endif() endif() -if(VCPKG_TARGET_TRIPLET) - message(STATUS "VCPKG is used") +if(NOT VCPKG_TARGET_TRIPLET) set_target_properties(${test_target} PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreadedDLL") target_compile_definitions(${test_target} PRIVATE From ba97333ad7cf6c4eea4466481b10174b5dd1a40e Mon Sep 17 00:00:00 2001 From: Alexis Placet Date: Wed, 11 Dec 2024 11:21:33 +0100 Subject: [PATCH 24/36] Fix test report paths for upload --- .github/workflows/linux.yml | 3 ++- .github/workflows/osx.yml | 3 ++- .github/workflows/qemu.yaml | 3 ++- .github/workflows/windows.yml | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 70e32335c..26cfc89ab 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -126,8 +126,9 @@ jobs: with: name: test_sparrow_lib_report_Linux_${{ matrix.sys.compiler }}_${{ matrix.sys.version }}_${{ matrix.sys.stdlib }}_${{ matrix.config.name }}_date-polyfill_${{ matrix.sys.date-polyfill}} path: | - '**/test_sparrow_lib_report.xml' # Doctest report + '**/test_sparrow_lib_report_doctest.xml' # Doctest report '**/test_sparrow_lib_report_catch2.xml' # Catch2 report + if-no-files-found: error - name: Run all examples working-directory: build diff --git a/.github/workflows/osx.yml b/.github/workflows/osx.yml index f53e0a2cc..36c41af52 100644 --- a/.github/workflows/osx.yml +++ b/.github/workflows/osx.yml @@ -115,8 +115,9 @@ jobs: with: name: test_sparrow_lib_report_OSX_${{ matrix.os }}_${{ matrix.config.name }}_${{ matrix.compiler }} path: | - '**/test_sparrow_lib_report.xml' # Doctest report + '**/test_sparrow_lib_report_doctest.xml' # Doctest report '**/test_sparrow_lib_report_catch2.xml' # Catch2 report'**/ + if-no-files-found: error - name: Run all examples working-directory: build diff --git a/.github/workflows/qemu.yaml b/.github/workflows/qemu.yaml index 317ab2a1f..eaa5a224c 100644 --- a/.github/workflows/qemu.yaml +++ b/.github/workflows/qemu.yaml @@ -159,5 +159,6 @@ jobs: with: name: test_sparrow_lib_report_Linux_${{matrix.target.distro}}_${{matrix.target.arch}}_${{matrix.config.name}}_date-polyfill_${{matrix.target.date-polyfill}} path: | - '**/test_sparrow_lib_report.xml' # Doctest report + '**/test_sparrow_lib_report_doctest.xml' # Doctest report '**/test_sparrow_lib_report_catch2.xml' # Catch2 report + if-no-files-found: error diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 76d48876f..db5a0c26d 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -206,8 +206,9 @@ jobs: with: name: test_sparrow_lib_report_Windows_${{ matrix.toolchain.compiler }}_${{ matrix.build-system.name }}_${{ matrix.config.name }}_${{ matrix.target-arch.name }}_date-polyfill_${{ matrix.toolchain.date-polyfill}} path: | - '**/test_sparrow_lib_report.xml' # Doctest report + '**/test_sparrow_lib_report_doctest.xml' # Doctest report '**/test_sparrow_lib_report_catch2.xml' # Catch2 report + if-no-files-found: error - name: Run all examples working-directory: build From 2989f09e3423c1ca14f90d65cf8997a312c66c5b Mon Sep 17 00:00:00 2001 From: Alexis Placet Date: Wed, 11 Dec 2024 11:41:37 +0100 Subject: [PATCH 25/36] Fix --- .github/workflows/linux.yml | 4 ++-- .github/workflows/osx.yml | 4 ++-- .github/workflows/qemu.yaml | 4 ++-- .github/workflows/windows.yml | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 26cfc89ab..48db0e683 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -126,8 +126,8 @@ jobs: with: name: test_sparrow_lib_report_Linux_${{ matrix.sys.compiler }}_${{ matrix.sys.version }}_${{ matrix.sys.stdlib }}_${{ matrix.config.name }}_date-polyfill_${{ matrix.sys.date-polyfill}} path: | - '**/test_sparrow_lib_report_doctest.xml' # Doctest report - '**/test_sparrow_lib_report_catch2.xml' # Catch2 report + build/test/test_sparrow_lib_report_doctest.xml + build/test/test_sparrow_lib_report_catch2.xml if-no-files-found: error - name: Run all examples diff --git a/.github/workflows/osx.yml b/.github/workflows/osx.yml index 36c41af52..c5567f724 100644 --- a/.github/workflows/osx.yml +++ b/.github/workflows/osx.yml @@ -115,8 +115,8 @@ jobs: with: name: test_sparrow_lib_report_OSX_${{ matrix.os }}_${{ matrix.config.name }}_${{ matrix.compiler }} path: | - '**/test_sparrow_lib_report_doctest.xml' # Doctest report - '**/test_sparrow_lib_report_catch2.xml' # Catch2 report'**/ + build/test/test_sparrow_lib_report_doctest.xml + build/test/test_sparrow_lib_report_catch2.xml if-no-files-found: error - name: Run all examples diff --git a/.github/workflows/qemu.yaml b/.github/workflows/qemu.yaml index eaa5a224c..7de4c65d8 100644 --- a/.github/workflows/qemu.yaml +++ b/.github/workflows/qemu.yaml @@ -159,6 +159,6 @@ jobs: with: name: test_sparrow_lib_report_Linux_${{matrix.target.distro}}_${{matrix.target.arch}}_${{matrix.config.name}}_date-polyfill_${{matrix.target.date-polyfill}} path: | - '**/test_sparrow_lib_report_doctest.xml' # Doctest report - '**/test_sparrow_lib_report_catch2.xml' # Catch2 report + build/test/test_sparrow_lib_report_doctest.xml + build/test/test_sparrow_lib_report_catch2.xml if-no-files-found: error diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index db5a0c26d..6ecc478bb 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -206,8 +206,8 @@ jobs: with: name: test_sparrow_lib_report_Windows_${{ matrix.toolchain.compiler }}_${{ matrix.build-system.name }}_${{ matrix.config.name }}_${{ matrix.target-arch.name }}_date-polyfill_${{ matrix.toolchain.date-polyfill}} path: | - '**/test_sparrow_lib_report_doctest.xml' # Doctest report - '**/test_sparrow_lib_report_catch2.xml' # Catch2 report + build/test/test_sparrow_lib_report_doctest.xml + build/test/test_sparrow_lib_report_catch2.xml if-no-files-found: error - name: Run all examples From 440154c62cb932cddbe72891f76166232ce4a257 Mon Sep 17 00:00:00 2001 From: Alexis Placet Date: Wed, 11 Dec 2024 11:51:28 +0100 Subject: [PATCH 26/36] Fix --- .github/workflows/qemu.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/qemu.yaml b/.github/workflows/qemu.yaml index 7de4c65d8..ec684eeed 100644 --- a/.github/workflows/qemu.yaml +++ b/.github/workflows/qemu.yaml @@ -161,4 +161,4 @@ jobs: path: | build/test/test_sparrow_lib_report_doctest.xml build/test/test_sparrow_lib_report_catch2.xml - if-no-files-found: error + if-no-files-found: error From b3a1827437496035514b0532d963f4895f6d9237 Mon Sep 17 00:00:00 2001 From: Alexis Placet Date: Wed, 11 Dec 2024 16:28:28 +0100 Subject: [PATCH 27/36] Add CMake option to get dependencies --- .github/workflows/linux.yml | 24 +----------- .github/workflows/osx.yml | 17 +-------- .github/workflows/qemu.yaml | 36 +----------------- .github/workflows/windows.yml | 26 +------------ CMakeLists.txt | 2 + test/CMakeLists.txt | 69 ++++++++++++++++++++++++----------- 6 files changed, 58 insertions(+), 116 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 48db0e683..eb39cbba2 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -59,12 +59,6 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Checkout nanoarrow - uses: actions/checkout@v4 - with: - repository: apache/arrow-nanoarrow - path: dependencies/tests/nanoarrow - - name: Set conda environment uses: mamba-org/setup-micromamba@main with: @@ -73,21 +67,6 @@ jobs: init-shell: bash cache-downloads: true - - name: Configure nanoarrow - working-directory: dependencies/tests/nanoarrow - run: | - cmake -G Ninja \ - -Bbuild \ - ${{matrix.sys.config-flags}} \ - -DCMAKE_BUILD_TYPE:STRING=${{matrix.config.name}} \ - -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \ - -DCMAKE_C_COMPILER_LAUNCHER=sccache \ - -DCMAKE_CXX_COMPILER_LAUNCHER=sccache - - - name: Build nanoarrow - working-directory: dependencies/tests/nanoarrow/build - run: cmake --build . --config ${{matrix.config.name}} --target install - - name: Configure using CMake run: | cmake -G Ninja \ @@ -98,7 +77,8 @@ jobs: -DBUILD_TESTS=ON \ -DBUILD_EXAMPLES=ON \ -DCMAKE_C_COMPILER_LAUNCHER=sccache \ - -DCMAKE_CXX_COMPILER_LAUNCHER=sccache + -DCMAKE_CXX_COMPILER_LAUNCHER=sccache \ + -DFETCH_DEPENDENCIES_WITH_CMAKE=ON - name: Build library working-directory: build diff --git a/.github/workflows/osx.yml b/.github/workflows/osx.yml index c5567f724..896520739 100644 --- a/.github/workflows/osx.yml +++ b/.github/workflows/osx.yml @@ -38,12 +38,6 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Checkout nanoarrow - uses: actions/checkout@v4 - with: - repository: apache/arrow-nanoarrow - path: dependencies/tests/nanoarrow - - name: ccache uses: hendrikmuhs/ccache-action@v1.2 with: @@ -74,14 +68,6 @@ jobs: echo "CXX=/usr/bin/clang++" >> $GITHUB_ENV echo "CMAKE_CXX_COMPILER=/usr/bin/clang++" >> $GITHUB_ENV - - name: Configure nanoarrow - working-directory: dependencies/tests/nanoarrow - run: cmake -Bbuild -DCMAKE_BUILD_TYPE:STRING=${{matrix.config.name}} -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX - - - name: Build nanoarrow - working-directory: dependencies/tests/nanoarrow/build - run: cmake --build . --config ${{matrix.config.name}} --target install - - name: Configure using CMake run: | cmake -Bbuild \ @@ -91,7 +77,8 @@ jobs: -DBUILD_EXAMPLES=ON \ -DCMAKE_C_COMPILER_LAUNCHER=ccache \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ - -Dnanoarrow_DIR=dependencies/tests/nanoarrow/build + -Dnanoarrow_DIR=dependencies/tests/nanoarrow/build \ + -DFETCH_DEPENDENCIES_WITH_CMAKE=ON - name: Build working-directory: build diff --git a/.github/workflows/qemu.yaml b/.github/workflows/qemu.yaml index ec684eeed..5c4903023 100644 --- a/.github/workflows/qemu.yaml +++ b/.github/workflows/qemu.yaml @@ -31,18 +31,6 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Checkout nanoarrow - uses: actions/checkout@v4 - with: - repository: apache/arrow-nanoarrow - path: dependencies/tests/nanoarrow - - - name: Checkout Catch2 - uses: actions/checkout@v4 - with: - repository: catchorg/Catch2 - path: dependencies/tests/Catch2 - - name: Get current date id: date uses: Kaven-Universe/github-action-current-date-time@v1 @@ -111,27 +99,6 @@ jobs: CXX=g++ export CXX ROOT_DIR="${PWD}" - export ROOT_DIR - echo "Configure nanoarrow" - cd dependencies/tests/nanoarrow - cmake -G Ninja -B ./build \ - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ - -DCMAKE_C_COMPILER_LAUNCHER=ccache \ - -DCMAKE_BUILD_TYPE:STRING=Release \ - -DCMAKE_COMPILE_WARNING_AS_ERROR=FALSE \ - -DCMAKE_C_STANDARD=17 - echo "Build nanoarrow" - cmake --build ./build --target install - cd $ROOT_DIR - echo "Configure Catch2" - cd dependencies/tests/Catch2 - cmake -G Ninja -B ./build \ - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ - -DCMAKE_C_COMPILER_LAUNCHER=ccache \ - -DCMAKE_BUILD_TYPE:STRING=Release \ - -DCMAKE_COMPILE_WARNING_AS_ERROR=FALSE \ - echo "Build Catch2" - cmake --build ./build --target install echo "Configuring sparrow" cd $ROOT_DIR cmake -G Ninja -Bbuild \ @@ -141,7 +108,8 @@ jobs: -DBUILD_EXAMPLES=ON \ -DUSE_LARGE_INT_PLACEHOLDERS=ON \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ - -DCMAKE_C_COMPILER_LAUNCHER=ccache + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DFETCH_DEPENDENCIES_WITH_CMAKE=ON cd build echo "Building sparrow library" cmake --build . --config ${{matrix.config.name}} --target sparrow diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 6ecc478bb..39764d74f 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -92,12 +92,6 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Checkout nanoarrow - uses: actions/checkout@v4 - with: - repository: apache/arrow-nanoarrow - path: dependencies/tests/nanoarrow - - name: ccache uses: hendrikmuhs/ccache-action@v1.2 with: @@ -151,23 +145,6 @@ jobs: run: | echo "CMAKE_GENERATOR=${{ matrix.build-system.name }}" >> $GITHUB_ENV - - name: Configure nanoarrow - working-directory: dependencies/tests/nanoarrow - run: | - cmake -S ./ \ - -B ./build \ - $GENERATOR_EXTRA_FLAGS \ - -DCMAKE_C_COMPILER_LAUNCHER=ccache \ - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ - -DCMAKE_BUILD_TYPE:STRING=Release \ - -DCMAKE_PREFIX_PATH=$SPARROW_DEPS_PREFIX \ - -DCMAKE_INSTALL_PREFIX=$SPARROW_INSTALL_PREFIX \ - -DCMAKE_COMPILE_WARNING_AS_ERROR=FALSE - - - name: Build nanoarrow - working-directory: dependencies/tests/nanoarrow/build - run: cmake --build . --config Release --target install - - name: Configure using CMake run: | cmake -S ./ -B ./build \ @@ -182,7 +159,8 @@ jobs: $SPARROW_CHECKS \ $SPARROW_ADDITIONAL_OPTIONS \ -DCMAKE_C_COMPILER_LAUNCHER=ccache \ - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DFETCH_DEPENDENCIES_WITH_CMAKE=ON - name: Build library working-directory: build diff --git a/CMakeLists.txt b/CMakeLists.txt index 68a3f663c..31f17a1bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,6 +87,8 @@ OPTION(BUILD_DOCS "Build sparrow documentation" OFF) OPTION(BUILD_EXAMPLES "Build sparrow examples" OFF) OPTION(USE_DATE_POLYFILL "Use date polyfill implementation" ON) OPTION(USE_LARGE_INT_PLACEHOLDERS "use types without api for big integers" OFF) +set(DEPENDENCIES_CMAKE_FOLDER "External dependencies") +OPTION(FETCH_DEPENDENCIES_WITH_CMAKE "Fetch dependencies with CMake: Can be OFF, ON, or MISSING, in this case CMake donwload only dependencies which are not previously found." OFF) OPTION(SPARROW_TARGET_32BIT "Test 32bit support" OFF) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 5c3402f87..5a96ccee7 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.22) enable_testing() @@ -22,11 +22,54 @@ if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) set(SPARROW_INCLUDE_DIR ${sparrow_INCLUDE_DIRS}) endif() -find_package(doctest REQUIRED) -find_package(nanoarrow REQUIRED) -find_package(Catch2 3 REQUIRED) +if(FETCH_DEPENDENCIES_WITH_CMAKE STREQUAL "ON") + set(FIND_PACKAGE_OPTIONS REQUIRED) +else() + set(FIND_PACKAGE_OPTIONS QUIET) +endif() + +find_package(doctest ${FIND_PACKAGE_OPTIONS}) +find_package(Catch2 3 ${FIND_PACKAGE_OPTIONS}) +find_package(nanoarrow ${FIND_PACKAGE_OPTIONS}) + +if(FETCH_DEPENDENCIES_WITH_CMAKE) + include(FetchContent) + + if(NOT doctest_FOUND) + FetchContent_Declare( + doctest + GIT_SHALLOW TRUE + GIT_REPOSITORY https://github.com/doctest/doctest.git + GIT_TAG v2.4.11 + SYSTEM) + FetchContent_MakeAvailable(doctest) + set_target_properties(doctest PROPERTIES FOLDER ${DEPENDENCIES_CMAKE_FOLDER}) + endif() + + if(NOT Catch2_FOUND) + FetchContent_Declare( + Catch2 + GIT_SHALLOW TRUE + GIT_REPOSITORY https://github.com/catchorg/Catch2.git + GIT_TAG v3.7.1 + SYSTEM) + FetchContent_MakeAvailable(Catch2) + set_target_properties(Catch2 PROPERTIES FOLDER ${DEPENDENCIES_CMAKE_FOLDER}) + set_target_properties(Catch2WithMain PROPERTIES FOLDER ${DEPENDENCIES_CMAKE_FOLDER}) + endif() + + if(NOT nanoarrow_FOUND) + FetchContent_Declare( + nanoarrow + GIT_SHALLOW TRUE + GIT_REPOSITORY https://github.com/apache/arrow-nanoarrow.git + GIT_TAG apache-arrow-nanoarrow-0.6.0 + SYSTEM) + FetchContent_MakeAvailable(nanoarrow) + set_target_properties(nanoarrow PROPERTIES FOLDER ${DEPENDENCIES_CMAKE_FOLDER}) + endif() +endif() -# find_package(Threads) if(NOT CMAKE_BUILD_TYPE) message(STATUS "Setting tests build type to Release") set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE) @@ -105,9 +148,6 @@ target_link_libraries(${test_target} nanoarrow::nanoarrow $<$:${SANITIZER_LINK_LIBRARIES}>) -include(doctest) -doctest_discover_tests(${test_target}) - set(test_target_catch2 "test_sparrow_lib_catch2") add_executable(${test_target_catch2} test_algorithm.cpp) @@ -202,19 +242,6 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "C endif() endif() -if(NOT VCPKG_TARGET_TRIPLET) - set_target_properties(${test_target} PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreadedDLL") - target_compile_definitions(${test_target} - PRIVATE - _ITERATOR_DEBUG_LEVEL=0 - ) - set_target_properties(${test_target_catch2} PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreadedDLL") - target_compile_definitions(${test_target_catch2} - PRIVATE - _ITERATOR_DEBUG_LEVEL=0 - ) -endif() - target_compile_options(${test_target} PRIVATE ${compiles_options} From 45d0765c265e856fea7f9c67044bd337adcc7acf Mon Sep 17 00:00:00 2001 From: Alexis Placet Date: Wed, 11 Dec 2024 16:32:43 +0100 Subject: [PATCH 28/36] Try fix --- .github/workflows/linux.yml | 2 +- .github/workflows/osx.yml | 2 +- .github/workflows/qemu.yaml | 2 +- .github/workflows/windows.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index eb39cbba2..362080677 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -78,7 +78,7 @@ jobs: -DBUILD_EXAMPLES=ON \ -DCMAKE_C_COMPILER_LAUNCHER=sccache \ -DCMAKE_CXX_COMPILER_LAUNCHER=sccache \ - -DFETCH_DEPENDENCIES_WITH_CMAKE=ON + -DFETCH_DEPENDENCIES_WITH_CMAKE=MISSING - name: Build library working-directory: build diff --git a/.github/workflows/osx.yml b/.github/workflows/osx.yml index 896520739..f3e2468fd 100644 --- a/.github/workflows/osx.yml +++ b/.github/workflows/osx.yml @@ -78,7 +78,7 @@ jobs: -DCMAKE_C_COMPILER_LAUNCHER=ccache \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -Dnanoarrow_DIR=dependencies/tests/nanoarrow/build \ - -DFETCH_DEPENDENCIES_WITH_CMAKE=ON + -DFETCH_DEPENDENCIES_WITH_CMAKE=MISSING - name: Build working-directory: build diff --git a/.github/workflows/qemu.yaml b/.github/workflows/qemu.yaml index 5c4903023..268a11571 100644 --- a/.github/workflows/qemu.yaml +++ b/.github/workflows/qemu.yaml @@ -109,7 +109,7 @@ jobs: -DUSE_LARGE_INT_PLACEHOLDERS=ON \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DCMAKE_C_COMPILER_LAUNCHER=ccache \ - -DFETCH_DEPENDENCIES_WITH_CMAKE=ON + -DFETCH_DEPENDENCIES_WITH_CMAKE=MISSING cd build echo "Building sparrow library" cmake --build . --config ${{matrix.config.name}} --target sparrow diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 39764d74f..2a33205ce 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -160,7 +160,7 @@ jobs: $SPARROW_ADDITIONAL_OPTIONS \ -DCMAKE_C_COMPILER_LAUNCHER=ccache \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ - -DFETCH_DEPENDENCIES_WITH_CMAKE=ON + -DFETCH_DEPENDENCIES_WITH_CMAKE=MISSING - name: Build library working-directory: build From b883e4d31a3f08b4ebaf8209af220fcd0a8f28ba Mon Sep 17 00:00:00 2001 From: Alexis Placet Date: Wed, 11 Dec 2024 16:50:12 +0100 Subject: [PATCH 29/36] Try fix install --- test/CMakeLists.txt | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 5a96ccee7..863a4de37 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 3.22) +cmake_minimum_required(VERSION 3.28) enable_testing() @@ -41,9 +41,9 @@ if(FETCH_DEPENDENCIES_WITH_CMAKE) GIT_SHALLOW TRUE GIT_REPOSITORY https://github.com/doctest/doctest.git GIT_TAG v2.4.11 - SYSTEM) + SYSTEM + EXCLUDE_FROM_ALL) FetchContent_MakeAvailable(doctest) - set_target_properties(doctest PROPERTIES FOLDER ${DEPENDENCIES_CMAKE_FOLDER}) endif() if(NOT Catch2_FOUND) @@ -52,10 +52,9 @@ if(FETCH_DEPENDENCIES_WITH_CMAKE) GIT_SHALLOW TRUE GIT_REPOSITORY https://github.com/catchorg/Catch2.git GIT_TAG v3.7.1 - SYSTEM) + SYSTEM + EXCLUDE_FROM_ALL) FetchContent_MakeAvailable(Catch2) - set_target_properties(Catch2 PROPERTIES FOLDER ${DEPENDENCIES_CMAKE_FOLDER}) - set_target_properties(Catch2WithMain PROPERTIES FOLDER ${DEPENDENCIES_CMAKE_FOLDER}) endif() if(NOT nanoarrow_FOUND) @@ -64,9 +63,9 @@ if(FETCH_DEPENDENCIES_WITH_CMAKE) GIT_SHALLOW TRUE GIT_REPOSITORY https://github.com/apache/arrow-nanoarrow.git GIT_TAG apache-arrow-nanoarrow-0.6.0 - SYSTEM) + SYSTEM + EXCLUDE_FROM_ALL) FetchContent_MakeAvailable(nanoarrow) - set_target_properties(nanoarrow PROPERTIES FOLDER ${DEPENDENCIES_CMAKE_FOLDER}) endif() endif() From 9968218f0f36e81c49fcde7e58a10c7eae79f6a8 Mon Sep 17 00:00:00 2001 From: Alexis Placet Date: Wed, 11 Dec 2024 17:07:20 +0100 Subject: [PATCH 30/36] Try fix --- .github/workflows/analysis.yaml | 26 +++++++------------------- .github/workflows/osx.yml | 1 - 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/.github/workflows/analysis.yaml b/.github/workflows/analysis.yaml index e2c53c8b5..dd3e66551 100644 --- a/.github/workflows/analysis.yaml +++ b/.github/workflows/analysis.yaml @@ -19,12 +19,6 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Checkout nanoarrow - uses: actions/checkout@v4 - with: - repository: apache/arrow-nanoarrow - path: dependencies/tests/nanoarrow - - name: Set conda environment uses: mamba-org/setup-micromamba@main with: @@ -33,21 +27,15 @@ jobs: init-shell: bash cache-downloads: true - - name: Configure nanoarrow - working-directory: dependencies/tests/nanoarrow + - name: Configure using CMake run: | cmake -G Ninja \ - -Bbuild \ - ${{matrix.sys.config-flags}} \ - -DCMAKE_BUILD_TYPE:STRING=Release \ - -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX - - - name: Build nanoarrow - working-directory: dependencies/tests/nanoarrow/build - run: cmake --build . --config Release --target install - - - name: Configure using CMake - run: cmake -G Ninja -Bbuild -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DBUILD_TESTS=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + -Bbuild \ + -DCMAKE_BUILD_TYPE:STRING=Release \ + -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \ + -DBUILD_TESTS=ON \ + -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ + -DFETCH_DEPENDENCIES_WITH_CMAKE=MISSING - name: Run C++ analysis uses: cpp-linter/cpp-linter-action@v2 diff --git a/.github/workflows/osx.yml b/.github/workflows/osx.yml index f3e2468fd..608128ade 100644 --- a/.github/workflows/osx.yml +++ b/.github/workflows/osx.yml @@ -77,7 +77,6 @@ jobs: -DBUILD_EXAMPLES=ON \ -DCMAKE_C_COMPILER_LAUNCHER=ccache \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ - -Dnanoarrow_DIR=dependencies/tests/nanoarrow/build \ -DFETCH_DEPENDENCIES_WITH_CMAKE=MISSING - name: Build From 1230b91337ce7a4fba1bd742b1a442fc9f28b6d3 Mon Sep 17 00:00:00 2001 From: Alexis Placet Date: Wed, 11 Dec 2024 17:20:05 +0100 Subject: [PATCH 31/36] Try fix --- .github/workflows/qemu.yaml | 2 -- CMakeLists.txt | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/qemu.yaml b/.github/workflows/qemu.yaml index 268a11571..136206179 100644 --- a/.github/workflows/qemu.yaml +++ b/.github/workflows/qemu.yaml @@ -98,9 +98,7 @@ jobs: export CC CXX=g++ export CXX - ROOT_DIR="${PWD}" echo "Configuring sparrow" - cd $ROOT_DIR cmake -G Ninja -Bbuild \ -DCMAKE_BUILD_TYPE:STRING=${{matrix.config.name}} \ -DUSE_DATE_POLYFILL=${{matrix.target.date-polyfill}} \ diff --git a/CMakeLists.txt b/CMakeLists.txt index 31f17a1bc..6d589a188 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 3.22) +cmake_minimum_required(VERSION 3.28) # This is better specified per target, but cmake keeps ignoring these language version # specification when building this project by itself, in particular the gnu extensions, From 2016b8641d5b4427dba41008a80ece72c3262bc4 Mon Sep 17 00:00:00 2001 From: Alexis Placet Date: Wed, 11 Dec 2024 17:31:46 +0100 Subject: [PATCH 32/36] Try fix --- test/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 863a4de37..d7432d68c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -66,6 +66,7 @@ if(FETCH_DEPENDENCIES_WITH_CMAKE) SYSTEM EXCLUDE_FROM_ALL) FetchContent_MakeAvailable(nanoarrow) + target_compile_options(nanoarrow PRIVATE -w) endif() endif() From c6558b898037bcdb53a658eb7baca2b73bb744e5 Mon Sep 17 00:00:00 2001 From: Alexis Placet Date: Wed, 11 Dec 2024 18:12:58 +0100 Subject: [PATCH 33/36] Fix --- .github/workflows/analysis.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/analysis.yaml b/.github/workflows/analysis.yaml index dd3e66551..215af8bc9 100644 --- a/.github/workflows/analysis.yaml +++ b/.github/workflows/analysis.yaml @@ -7,7 +7,7 @@ defaults: shell: bash -e -l {0} jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - name: Install LLVM and Clang From 1a71f393e71247d9c68e56a6426f8fa88eaae4a8 Mon Sep 17 00:00:00 2001 From: Alexis Placet Date: Thu, 12 Dec 2024 14:19:21 +0100 Subject: [PATCH 34/36] Improvements --- CMakeLists.txt | 2 +- test/CMakeLists.txt | 20 +++++++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6d589a188..8dc7fbefd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -88,7 +88,7 @@ OPTION(BUILD_EXAMPLES "Build sparrow examples" OFF) OPTION(USE_DATE_POLYFILL "Use date polyfill implementation" ON) OPTION(USE_LARGE_INT_PLACEHOLDERS "use types without api for big integers" OFF) set(DEPENDENCIES_CMAKE_FOLDER "External dependencies") -OPTION(FETCH_DEPENDENCIES_WITH_CMAKE "Fetch dependencies with CMake: Can be OFF, ON, or MISSING, in this case CMake donwload only dependencies which are not previously found." OFF) +OPTION(FETCH_DEPENDENCIES_WITH_CMAKE "Fetch dependencies with CMake: Can be OFF, ON, or MISSING, in this case CMake download only dependencies which are not previously found." OFF) OPTION(SPARROW_TARGET_32BIT "Test 32bit support" OFF) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d7432d68c..41e906d37 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -22,47 +22,57 @@ if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) set(SPARROW_INCLUDE_DIR ${sparrow_INCLUDE_DIRS}) endif() -if(FETCH_DEPENDENCIES_WITH_CMAKE STREQUAL "ON") +if(FETCH_DEPENDENCIES_WITH_CMAKE STREQUAL "OFF") set(FIND_PACKAGE_OPTIONS REQUIRED) else() set(FIND_PACKAGE_OPTIONS QUIET) endif() -find_package(doctest ${FIND_PACKAGE_OPTIONS}) -find_package(Catch2 3 ${FIND_PACKAGE_OPTIONS}) -find_package(nanoarrow ${FIND_PACKAGE_OPTIONS}) +if(NOT FETCH_DEPENDENCIES_WITH_CMAKE STREQUAL "ON") + find_package(doctest ${FIND_PACKAGE_OPTIONS}) + find_package(Catch2 3 ${FIND_PACKAGE_OPTIONS}) + find_package(nanoarrow ${FIND_PACKAGE_OPTIONS}) +endif() + +Set(FETCHCONTENT_QUIET FALSE) -if(FETCH_DEPENDENCIES_WITH_CMAKE) +if(FETCH_DEPENDENCIES_WITH_CMAKE STREQUAL "ON" OR FETCH_DEPENDENCIES_WITH_CMAKE STREQUAL "MISSING") include(FetchContent) if(NOT doctest_FOUND) + message(STATUS "📦 Fetching doctest v2.4.11") FetchContent_Declare( doctest GIT_SHALLOW TRUE GIT_REPOSITORY https://github.com/doctest/doctest.git GIT_TAG v2.4.11 + GIT_PROGRESS TRUE SYSTEM EXCLUDE_FROM_ALL) FetchContent_MakeAvailable(doctest) endif() if(NOT Catch2_FOUND) + message(STATUS "📦 Fetching Catch2 v3.7.1") FetchContent_Declare( Catch2 GIT_SHALLOW TRUE GIT_REPOSITORY https://github.com/catchorg/Catch2.git GIT_TAG v3.7.1 + GIT_PROGRESS TRUE SYSTEM EXCLUDE_FROM_ALL) FetchContent_MakeAvailable(Catch2) endif() if(NOT nanoarrow_FOUND) + message(STATUS "📦 Fetching nanoarrow 0.6") FetchContent_Declare( nanoarrow GIT_SHALLOW TRUE GIT_REPOSITORY https://github.com/apache/arrow-nanoarrow.git GIT_TAG apache-arrow-nanoarrow-0.6.0 + GIT_PROGRESS TRUE SYSTEM EXCLUDE_FROM_ALL) FetchContent_MakeAvailable(nanoarrow) From aff830357b5712741c4b534ef29f730b1e52cb4c Mon Sep 17 00:00:00 2001 From: Alexis Placet Date: Tue, 17 Dec 2024 14:13:32 +0100 Subject: [PATCH 35/36] Move FETCH_DEPENDENCIES_WITH_CMAKE option to test CmakeLists.txt --- CMakeLists.txt | 3 --- test/CMakeLists.txt | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8dc7fbefd..a38c2bb34 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,9 +87,6 @@ OPTION(BUILD_DOCS "Build sparrow documentation" OFF) OPTION(BUILD_EXAMPLES "Build sparrow examples" OFF) OPTION(USE_DATE_POLYFILL "Use date polyfill implementation" ON) OPTION(USE_LARGE_INT_PLACEHOLDERS "use types without api for big integers" OFF) -set(DEPENDENCIES_CMAKE_FOLDER "External dependencies") -OPTION(FETCH_DEPENDENCIES_WITH_CMAKE "Fetch dependencies with CMake: Can be OFF, ON, or MISSING, in this case CMake download only dependencies which are not previously found." OFF) - OPTION(SPARROW_TARGET_32BIT "Test 32bit support" OFF) include(CheckCXXSymbolExists) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 41e906d37..cc058a7fe 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -14,6 +14,8 @@ cmake_minimum_required(VERSION 3.28) +OPTION(FETCH_DEPENDENCIES_WITH_CMAKE "Fetch dependencies with CMake: Can be OFF, ON, or MISSING, in this case CMake download only dependencies which are not previously found." OFF) + enable_testing() if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) From 2683b29bc8575e5d1d6eec6bc230c156c5459ae7 Mon Sep 17 00:00:00 2001 From: Alexis Placet Date: Tue, 17 Dec 2024 14:57:08 +0100 Subject: [PATCH 36/36] Fix --- .github/workflows/windows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 2a33205ce..be12e4100 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -118,7 +118,7 @@ jobs: run: | echo "SPARROW_DEPS_PREFIX=$CONDA_PREFIX" >> $GITHUB_ENV echo "SPARROW_INSTALL_PREFIX=$CONDA_PREFIX" >> $GITHUB_ENV - echo "SPARROW_ADDITIONAL_OPTIONS=-DSPARROW_TARGET_32BIT=OFF" >> $GITHUB_ENV + echo "SPARROW_ADDITIONAL_OPTIONS=-DSPARROW_TARGET_32BIT=OFF -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL" >> $GITHUB_ENV - name: Set dependencies install prefix dir for 32bit