From 0deb9148d958381a64b476aa9ce4e5dc3ed1cfe0 Mon Sep 17 00:00:00 2001 From: Simon Vidanovic Date: Wed, 16 Oct 2024 10:09:00 -0700 Subject: [PATCH 01/14] Reference to test directory is now using target_compile_definition which simplifies testing run. --- CMakeLists.txt | 4 ++++ test/CMakeLists.txt | 4 ++-- test/main.cpp | 5 ----- test/paths.h | 8 -------- test/read_cma_example.cpp | 27 +++++++-------------------- test/read_cs_03.unit.cpp | 24 +++++++----------------- 6 files changed, 20 insertions(+), 52 deletions(-) delete mode 100644 test/paths.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 543a8b9..da2dd48 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,6 +50,10 @@ Option(BUILD_THMX_Parser_Tests "Build tests for thmx file parsing." ON) if(BUILD_THMX_Parser_Tests) enable_testing() add_subdirectory( test ) + + # Set the path to the test directory + set(TEST_DATA_DIR "${CMAKE_CURRENT_SOURCE_DIR}/test") + target_compile_definitions(THMXParser-test PRIVATE TEST_DATA_DIR="${TEST_DATA_DIR}") endif() diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 9e3989b..32ad12f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -32,8 +32,8 @@ endif() add_executable(${PROJECT_TEST_NAME} read_cs_03.unit.cpp read_cma_example.cpp - main.cpp - paths.h ) + main.cpp +) include_directories(${PROJECT_SOURCE_DIR}/src) diff --git a/test/main.cpp b/test/main.cpp index 00632d6..2c539a5 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -1,16 +1,11 @@ #include -#include "paths.h" - -std::string test_dir; - int main( int argc, char* argv[] ) { #ifdef ENABLE_GTEST_DEBUG_MODE ::testing::GTEST_FLAG(break_on_failure) = true; ::testing::GTEST_FLAG(catch_exceptions) = false; #endif ::testing::InitGoogleTest( &argc, argv ); - test_dir = argv[1]; return RUN_ALL_TESTS(); } diff --git a/test/paths.h b/test/paths.h deleted file mode 100644 index 5553bee..0000000 --- a/test/paths.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef WINCALC_TESTS_PATHS_H_ -#define WINCALC_TESTS_PATHS_H_ - -#include - -extern std::string test_dir; - -#endif diff --git a/test/read_cma_example.cpp b/test/read_cma_example.cpp index b9bb9c7..7fe011f 100644 --- a/test/read_cma_example.cpp +++ b/test/read_cma_example.cpp @@ -1,32 +1,19 @@ #include #include -#include -#include #include #include "thmxParser.hpp" -#include "paths.h" - -extern std::string test_dir; - -class TestLoadCMA : public testing::Test -{ -protected: - virtual void SetUp() - {} -}; - -TEST_F(TestLoadCMA, TestLoadCMAFromDisk) +TEST(TestLoadCMA, TestLoadCMAFromDisk) { - std::filesystem::path product_path(test_dir); + std::filesystem::path product_path(TEST_DATA_DIR); product_path /= "files"; product_path /= "cma_example.thmx"; auto contents = thmxParser::parseFile(product_path.string()); - EXPECT_EQ(contents.fileVersion, "1"); - EXPECT_EQ(contents.materials.size(), 5); - EXPECT_EQ(contents.boundaryConditions.size(), 4); - EXPECT_EQ(contents.polygons.size(), 5); - EXPECT_EQ(contents.boundaryConditionPolygons.size(), 11); + EXPECT_EQ(contents.fileVersion, "1"); + EXPECT_EQ(contents.materials.size(), 5); + EXPECT_EQ(contents.boundaryConditions.size(), 4); + EXPECT_EQ(contents.polygons.size(), 5); + EXPECT_EQ(contents.boundaryConditionPolygons.size(), 11); } diff --git a/test/read_cs_03.unit.cpp b/test/read_cs_03.unit.cpp index 8298cc9..8bfb192 100644 --- a/test/read_cs_03.unit.cpp +++ b/test/read_cs_03.unit.cpp @@ -1,28 +1,18 @@ #include #include -#include -#include #include #include "thmxParser.hpp" -#include "paths.h" - -extern std::string test_dir; - -class TestLoadCS03 : public testing::Test -{ -protected: - virtual void SetUp() - {} -}; - -TEST_F(TestLoadCS03, TestLoadCS03FromDisk) +TEST(TestLoadCS03, TestLoadCS03FromDisk) { - std::filesystem::path product_path(test_dir); + std::filesystem::path product_path(TEST_DATA_DIR); product_path /= "files"; product_path /= "CS03.thmx"; - //thmxParser::parseFile(product_path.string()); - + auto contents = thmxParser::parseFile(product_path.string()); + EXPECT_EQ(contents.fileVersion, "1"); + EXPECT_EQ(contents.boundaryConditions.size(), 4u); + EXPECT_EQ(contents.materials.size(), 13u); + EXPECT_EQ(contents.polygons.size(), 99u); } From 838d1260c0c9c96bdc5a79256805ec910f9d8394 Mon Sep 17 00:00:00 2001 From: Simon Vidanovic Date: Wed, 16 Oct 2024 10:14:57 -0700 Subject: [PATCH 02/14] FetchContent_Declare introduced when downloading xmlParser. --- CMakeLists-xmlParser.txt | 18 ------------------ CMakeLists-xmlParser.txt.in | 19 ------------------- CMakeLists.txt | 14 ++++++++++++-- 3 files changed, 12 insertions(+), 39 deletions(-) delete mode 100644 CMakeLists-xmlParser.txt delete mode 100644 CMakeLists-xmlParser.txt.in diff --git a/CMakeLists-xmlParser.txt b/CMakeLists-xmlParser.txt deleted file mode 100644 index 7f09c93..0000000 --- a/CMakeLists-xmlParser.txt +++ /dev/null @@ -1,18 +0,0 @@ -cmake_minimum_required( VERSION 2.8.7 ) - -# Create include directories that will connect to library itself. This must be created before downloading -# xmlParser library or otherwise connections will not be created - -set(xmlParser_INCLUDE_DIRS "${CMAKE_BINARY_DIR}/xmlParser-src/include") - -include_directories(${xmlParser_INCLUDE_DIRS}) - -# Download and create Windows Calculation Engine library -configure_file(CMakeLists-xmlParser.txt.in ${CMAKE_BINARY_DIR}/xmlParser-download/CMakeLists.txt) -execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/xmlParser-download) -execute_process(COMMAND ${CMAKE_COMMAND} --build . - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/xmlParser-download) - -add_subdirectory(${CMAKE_BINARY_DIR}/xmlParser-src "${CMAKE_CURRENT_BINARY_DIR}/xmlParser-src") -set(xmlParser_LIB "${CMAKE_SHARED_LIBRARY_PREFIX}xmlParser${CMAKE_SHARED_LIBRARY_SUFFIX}") diff --git a/CMakeLists-xmlParser.txt.in b/CMakeLists-xmlParser.txt.in deleted file mode 100644 index e7289e3..0000000 --- a/CMakeLists-xmlParser.txt.in +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required( VERSION 2.8.7 ) - -include(ExternalProject) - -ExternalProject_Add(xmlParser - GIT_REPOSITORY https://github.com/LBNL-ETA/XMLParser.git - GIT_TAG "v1.0.1" - - UPDATE_COMMAND "" - PATCH_COMMAND "" - - SOURCE_DIR "${CMAKE_BINARY_DIR}/xmlParser-src" - BINARY_DIR "${CMAKE_BINARY_DIR}/xmlParser-build" - - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - TEST_COMMAND "" - INSTALL_COMMAND "" -) diff --git a/CMakeLists.txt b/CMakeLists.txt index da2dd48..e8eb1a0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.11) project( THMXParser VERSION 1.1.0 LANGUAGES CXX ) set(LIB_NAME ${PROJECT_NAME}) @@ -33,7 +33,17 @@ else() set(DOWNLOAD_GTEST OFF) endif() -include(CMakeLists-xmlParser.txt) +include(FetchContent) + +if(NOT TARGET xmlParser) + FetchContent_Declare( + xmlParser + GIT_REPOSITORY https://github.com/LBNL-ETA/XMLParser.git + GIT_TAG "v1.0.1" + ) + + FetchContent_MakeAvailable(xmlParser) +endif() add_subdirectory( src ) From b0596285646ad5fa7d5462f4fed03756ba66b55f Mon Sep 17 00:00:00 2001 From: Simon Vidanovic Date: Wed, 16 Oct 2024 10:19:05 -0700 Subject: [PATCH 03/14] Updated ci testing. --- .github/workflows/build.yml | 37 ------------------------ .github/workflows/ci.yml | 56 +++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 37 deletions(-) delete mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index dfb4b73..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Build and test - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -env: - # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) - BUILD_TYPE: Release - -jobs: - build: - name: ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [windows-2019, macos-10.15, ubuntu-latest] - #arch: [x86, x64] - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Configure CMake - # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. - # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type - run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} - - - name: Build - # Build your program with the given configuration - run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} - - - name: Test - working-directory: ${{github.workspace}}/build - run: ctest -C RELEASE -V \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ce14484 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,56 @@ +name: CI + +on: + push: + branches: [ '**' ] + pull_request: + branches: [ '**' ] + +jobs: + build-and-test: + name: ${{ matrix.os }} Build and Test + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + # For more specific OS versions, you can specify them explicitly: + # os: [ubuntu-20.04, windows-2019, macos-11] + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up CMake + uses: jwlawson/actions-setup-cmake@v1 + with: + cmake-version: "3.20.0" # Specify the minimum version you need + + - name: Install dependencies (Windows) + if: runner.os == 'Windows' + run: | + choco install -y ninja + choco install -y llvm # Clang on Windows if needed + # choco install -y visualstudio2019community + shell: pwsh + + - name: Install dependencies (Ubuntu) + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y ninja-build clang + - name: Install dependencies (macOS) + if: runner.os == 'macOS' + run: | + brew update + brew install ninja + brew install llvm + + - name: Configure CMake + run: | + cmake -S . -B build -G Ninja -DCMAKE_CXX_COMPILER=clang++ + # Or specify other options as needed + - name: Build + run: cmake --build build + + - name: Run tests + run: ctest --test-dir build --output-on-failure From 9974c9ab496ff1439c5f74aa96f0c0cd5c8a97b4 Mon Sep 17 00:00:00 2001 From: Simon Vidanovic Date: Wed, 16 Oct 2024 10:25:23 -0700 Subject: [PATCH 04/14] Trying to supress Clang warnings. --- CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index e8eb1a0..748f1d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,6 +43,13 @@ if(NOT TARGET xmlParser) ) FetchContent_MakeAvailable(xmlParser) + + # xmlParser is an old component and uses deprecated functions. This is to disable compiler warnings + if (MSVC) + target_compile_definitions(xmlParser PRIVATE _CRT_SECURE_NO_WARNINGS) + else() + target_compile_options(xmlParser PRIVATE -Wno-deprecated-declarations) + endif() endif() add_subdirectory( src ) From 0d503975e8501c904b45a6420f6a97e6777fef3d Mon Sep 17 00:00:00 2001 From: Simon Vidanovic Date: Wed, 16 Oct 2024 10:31:00 -0700 Subject: [PATCH 05/14] Warings check removed for Clang only. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 748f1d2..9b61ff4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,7 +45,7 @@ if(NOT TARGET xmlParser) FetchContent_MakeAvailable(xmlParser) # xmlParser is an old component and uses deprecated functions. This is to disable compiler warnings - if (MSVC) + if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") target_compile_definitions(xmlParser PRIVATE _CRT_SECURE_NO_WARNINGS) else() target_compile_options(xmlParser PRIVATE -Wno-deprecated-declarations) From 0531c988b2b819ac268cd59f654ce976f06035f9 Mon Sep 17 00:00:00 2001 From: Simon Vidanovic Date: Wed, 16 Oct 2024 10:33:50 -0700 Subject: [PATCH 06/14] MSVC added. --- .github/workflows/ci.yml | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ce14484..85048f5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,8 +13,12 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] - # For more specific OS versions, you can specify them explicitly: - # os: [ubuntu-20.04, windows-2019, macos-11] + compiler: [msvc, clang] # Test with both MSVC and Clang on Windows + include: + - os: ubuntu-latest + compiler: clang + - os: macos-latest + compiler: clang steps: - name: Checkout code @@ -29,8 +33,11 @@ jobs: if: runner.os == 'Windows' run: | choco install -y ninja - choco install -y llvm # Clang on Windows if needed - # choco install -y visualstudio2019community + if (${{ matrix.compiler }} == 'clang') { + choco install -y llvm # Install Clang on Windows if needed + } else { + choco install -y visualstudio2022community --package-parameters "--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64" + } shell: pwsh - name: Install dependencies (Ubuntu) @@ -47,8 +54,11 @@ jobs: - name: Configure CMake run: | - cmake -S . -B build -G Ninja -DCMAKE_CXX_COMPILER=clang++ - # Or specify other options as needed + if (runner.os == 'Windows' && ${{ matrix.compiler }} == 'msvc') { + cmake -S . -B build -G Ninja -A x64 -T host=x64 -DCMAKE_CXX_COMPILER=cl + } else { + cmake -S . -B build -G Ninja -DCMAKE_CXX_COMPILER=clang++ + } - name: Build run: cmake --build build From e4511b10bcee862f0c196fa45f486b40ead59e42 Mon Sep 17 00:00:00 2001 From: Simon Vidanovic Date: Wed, 16 Oct 2024 10:44:18 -0700 Subject: [PATCH 07/14] sscanf is now guarded in THMXParser.cpp file. --- .github/workflows/ci.yml | 24 +++++++----------------- CMakeLists.txt | 7 ------- src/thmxParser.cpp | 4 ++++ 3 files changed, 11 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 85048f5..b00897e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,12 +13,8 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] - compiler: [msvc, clang] # Test with both MSVC and Clang on Windows - include: - - os: ubuntu-latest - compiler: clang - - os: macos-latest - compiler: clang + # For more specific OS versions, you can specify them explicitly: + # os: [ubuntu-20.04, windows-2019, macos-11] steps: - name: Checkout code @@ -33,11 +29,8 @@ jobs: if: runner.os == 'Windows' run: | choco install -y ninja - if (${{ matrix.compiler }} == 'clang') { - choco install -y llvm # Install Clang on Windows if needed - } else { - choco install -y visualstudio2022community --package-parameters "--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64" - } + choco install -y llvm # Clang on Windows if needed + # choco install -y visualstudio2019community shell: pwsh - name: Install dependencies (Ubuntu) @@ -54,13 +47,10 @@ jobs: - name: Configure CMake run: | - if (runner.os == 'Windows' && ${{ matrix.compiler }} == 'msvc') { - cmake -S . -B build -G Ninja -A x64 -T host=x64 -DCMAKE_CXX_COMPILER=cl - } else { - cmake -S . -B build -G Ninja -DCMAKE_CXX_COMPILER=clang++ - } + cmake -S . -B build -G Ninja -DCMAKE_CXX_COMPILER=clang++ + # Or specify other options as needed - name: Build run: cmake --build build - name: Run tests - run: ctest --test-dir build --output-on-failure + run: ctest --test-dir build --output-on-failure \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b61ff4..e8eb1a0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,13 +43,6 @@ if(NOT TARGET xmlParser) ) FetchContent_MakeAvailable(xmlParser) - - # xmlParser is an old component and uses deprecated functions. This is to disable compiler warnings - if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - target_compile_definitions(xmlParser PRIVATE _CRT_SECURE_NO_WARNINGS) - else() - target_compile_options(xmlParser PRIVATE -Wno-deprecated-declarations) - endif() endif() add_subdirectory( src ) diff --git a/src/thmxParser.cpp b/src/thmxParser.cpp index c8a536d..1773e39 100644 --- a/src/thmxParser.cpp +++ b/src/thmxParser.cpp @@ -97,7 +97,11 @@ namespace thmxParser // int shadeID = std::stoi( str ); str = getAttribute(materialNode, "RGBColor"); unsigned int red, green, blue; +#ifdef _MSC_VER + sscanf_s(str.c_str(), "0x%02x%02x%02x", &red, &green, &blue); +#else std::sscanf(str.c_str(), "0x%02x%02x%02x", &red, &green, &blue); +#endif ColorRGB color{red, green, blue}; int cavityModel = 0; str = getAttribute(materialNode, "CavityModel"); From 631fb1e28f0ee20362b84dcbc7545a6370fe5e6d Mon Sep 17 00:00:00 2001 From: Simon Vidanovic Date: Wed, 16 Oct 2024 10:49:41 -0700 Subject: [PATCH 08/14] Additional sscanf found and code update. --- src/thmxParser.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/thmxParser.cpp b/src/thmxParser.cpp index 1773e39..f865d56 100644 --- a/src/thmxParser.cpp +++ b/src/thmxParser.cpp @@ -176,7 +176,11 @@ namespace thmxParser float temperature = std::stof(str); str = getAttribute(bcondNode, "RGBColor"); unsigned int red, green, blue; +#ifdef _MSC_VER + sscanf_s(str.c_str(), "0x%02x%02x%02x", &red, &green, &blue); +#else std::sscanf(str.c_str(), "0x%02x%02x%02x", &red, &green, &blue); +#endif ColorRGB color{red, green, blue}; str = getAttribute(bcondNode, "Tr"); From 319d41874dc4bc48c63e206d6a86752c93242bf3 Mon Sep 17 00:00:00 2001 From: Simon Vidanovic Date: Wed, 16 Oct 2024 10:57:27 -0700 Subject: [PATCH 09/14] Adding VS2019 community for testing. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b00897e..29963e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,7 +30,7 @@ jobs: run: | choco install -y ninja choco install -y llvm # Clang on Windows if needed - # choco install -y visualstudio2019community + choco install -y visualstudio2019community shell: pwsh - name: Install dependencies (Ubuntu) From 99e293999eeb77d0ea33e632b346d1ab9426f52b Mon Sep 17 00:00:00 2001 From: Simon Vidanovic Date: Wed, 16 Oct 2024 11:01:21 -0700 Subject: [PATCH 10/14] Adding visual studio community into test matrix. --- .github/workflows/ci.yml | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 29963e9..ab91cbb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,8 +29,7 @@ jobs: if: runner.os == 'Windows' run: | choco install -y ninja - choco install -y llvm # Clang on Windows if needed - choco install -y visualstudio2019community + choco install -y visualstudio2022community --package-parameters "--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.VC.CMake.Project" shell: pwsh - name: Install dependencies (Ubuntu) @@ -38,6 +37,7 @@ jobs: run: | sudo apt-get update sudo apt-get install -y ninja-build clang + - name: Install dependencies (macOS) if: runner.os == 'macOS' run: | @@ -47,10 +47,24 @@ jobs: - name: Configure CMake run: | - cmake -S . -B build -G Ninja -DCMAKE_CXX_COMPILER=clang++ - # Or specify other options as needed + if [ "${{ matrix.os }}" == "windows-latest" ]; then + cmake -S . -B build -G "Visual Studio 17 2022" -A x64 + else + cmake -S . -B build -G Ninja -DCMAKE_CXX_COMPILER=clang++ + fi + - name: Build - run: cmake --build build + run: | + if [ "${{ matrix.os }}" == "windows-latest" ]; then + cmake --build build --config Debug + else + cmake --build build + fi - name: Run tests - run: ctest --test-dir build --output-on-failure \ No newline at end of file + run: | + if [ "${{ matrix.os }}" == "windows-latest" ]; then + ctest --test-dir build --output-on-failure --config Debug + else + ctest --test-dir build --output-on-failure + fi From abebfd9dd3e1307dd60577268107db5b3fe0986f Mon Sep 17 00:00:00 2001 From: Simon Vidanovic Date: Wed, 16 Oct 2024 12:00:04 -0700 Subject: [PATCH 11/14] Adding visual studio build tools. --- .github/workflows/ci.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ab91cbb..f634982 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,8 +13,6 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] - # For more specific OS versions, you can specify them explicitly: - # os: [ubuntu-20.04, windows-2019, macos-11] steps: - name: Checkout code @@ -28,8 +26,8 @@ jobs: - name: Install dependencies (Windows) if: runner.os == 'Windows' run: | + choco install -y visualstudio2022buildtools --package-parameters "--add Microsoft.VisualStudio.Workload.VCTools --includeRecommended --includeOptional" choco install -y ninja - choco install -y visualstudio2022community --package-parameters "--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.VC.CMake.Project" shell: pwsh - name: Install dependencies (Ubuntu) From 99f015ba955fba0a290eb8ab92340b62b9182232 Mon Sep 17 00:00:00 2001 From: Simon Vidanovic Date: Wed, 16 Oct 2024 12:26:04 -0700 Subject: [PATCH 12/14] Trying bash script. --- .github/workflows/ci.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f634982..70bdcab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,13 +28,14 @@ jobs: run: | choco install -y visualstudio2022buildtools --package-parameters "--add Microsoft.VisualStudio.Workload.VCTools --includeRecommended --includeOptional" choco install -y ninja - shell: pwsh + shell: bash - name: Install dependencies (Ubuntu) if: runner.os == 'Linux' run: | sudo apt-get update sudo apt-get install -y ninja-build clang + shell: bash - name: Install dependencies (macOS) if: runner.os == 'macOS' @@ -42,6 +43,7 @@ jobs: brew update brew install ninja brew install llvm + shell: bash - name: Configure CMake run: | @@ -50,6 +52,7 @@ jobs: else cmake -S . -B build -G Ninja -DCMAKE_CXX_COMPILER=clang++ fi + shell: bash - name: Build run: | @@ -58,6 +61,7 @@ jobs: else cmake --build build fi + shell: bash - name: Run tests run: | @@ -66,3 +70,4 @@ jobs: else ctest --test-dir build --output-on-failure fi + shell: bash From e84fac7b44e2cd9b2845317d2067343d279ec4fb Mon Sep 17 00:00:00 2001 From: Simon Vidanovic Date: Wed, 16 Oct 2024 12:44:43 -0700 Subject: [PATCH 13/14] Removing vs build tools because of long installation. --- .github/workflows/ci.yml | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 70bdcab..29963e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,8 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] + # For more specific OS versions, you can specify them explicitly: + # os: [ubuntu-20.04, windows-2019, macos-11] steps: - name: Checkout code @@ -26,48 +28,29 @@ jobs: - name: Install dependencies (Windows) if: runner.os == 'Windows' run: | - choco install -y visualstudio2022buildtools --package-parameters "--add Microsoft.VisualStudio.Workload.VCTools --includeRecommended --includeOptional" choco install -y ninja - shell: bash + choco install -y llvm # Clang on Windows if needed + choco install -y visualstudio2019community + shell: pwsh - name: Install dependencies (Ubuntu) if: runner.os == 'Linux' run: | sudo apt-get update sudo apt-get install -y ninja-build clang - shell: bash - - name: Install dependencies (macOS) if: runner.os == 'macOS' run: | brew update brew install ninja brew install llvm - shell: bash - name: Configure CMake run: | - if [ "${{ matrix.os }}" == "windows-latest" ]; then - cmake -S . -B build -G "Visual Studio 17 2022" -A x64 - else - cmake -S . -B build -G Ninja -DCMAKE_CXX_COMPILER=clang++ - fi - shell: bash - + cmake -S . -B build -G Ninja -DCMAKE_CXX_COMPILER=clang++ + # Or specify other options as needed - name: Build - run: | - if [ "${{ matrix.os }}" == "windows-latest" ]; then - cmake --build build --config Debug - else - cmake --build build - fi - shell: bash + run: cmake --build build - name: Run tests - run: | - if [ "${{ matrix.os }}" == "windows-latest" ]; then - ctest --test-dir build --output-on-failure --config Debug - else - ctest --test-dir build --output-on-failure - fi - shell: bash + run: ctest --test-dir build --output-on-failure \ No newline at end of file From d2104f8e8759e9a7ba0e65a4ff1ee98bcac3baeb Mon Sep 17 00:00:00 2001 From: Simon Vidanovic Date: Wed, 16 Oct 2024 12:47:10 -0700 Subject: [PATCH 14/14] Did not disable installation of VS community. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 29963e9..b00897e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,7 +30,7 @@ jobs: run: | choco install -y ninja choco install -y llvm # Clang on Windows if needed - choco install -y visualstudio2019community + # choco install -y visualstudio2019community shell: pwsh - name: Install dependencies (Ubuntu)