From 55c1db272003e14ede328ee9ca55d7c979733451 Mon Sep 17 00:00:00 2001 From: Sayan Date: Sat, 4 Oct 2025 14:04:19 -0400 Subject: [PATCH 1/9] improve cmake --- .github/workflows/action.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index 61c92db..504e669 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -23,10 +23,10 @@ jobs: c_compiler: clang cpp_compiler: clang++ - #- os: windows-latest - # build_type: Release - # c_compiler: cl - # cpp_compiler: cl + - os: windows-latest + build_type: Release + c_compiler: cl + cpp_compiler: cl steps: - uses: actions/checkout@v4 From 6e167105ab4d109e8371ca6ed0c92b4cecb5b90d Mon Sep 17 00:00:00 2001 From: Sayan Date: Sat, 4 Oct 2025 14:14:39 -0400 Subject: [PATCH 2/9] improve cmake --- .github/workflows/action.yml | 69 ++++++++++++++++++++++-------------- 1 file changed, 42 insertions(+), 27 deletions(-) diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index 504e669..634a84b 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -31,21 +31,18 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Cache apt packages - uses: actions/cache@v3 - with: - path: /var/cache/apt/archives - key: ${{ runner.os }}-apt-${{ hashFiles('**/CMakeLists.txt') }} - restore-keys: | - ${{ runner.os }}-apt- - - - name: Install dependencies (Linux) - if: runner.os == 'Linux' + - name: Install dependencies + shell: bash run: | - sudo apt-get update - sudo apt-get install -y cmake ninja-build build-essential - if [[ "${{ matrix.c_compiler }}" == "clang" ]]; then - sudo apt-get install -y clang lld + if [[ "${{ runner.os }}" == "Linux" ]]; then + sudo apt-get update + sudo apt-get install -y cmake ninja-build build-essential + if [[ "${{ matrix.c_compiler }}" == "clang" ]]; then + sudo apt-get install -y clang lld + fi + elif [[ "${{ runner.os }}" == "Windows" ]]; then + choco install cmake --installargs '"ADD_CMAKE_TO_PATH=System"' -y + choco install ninja -y fi - name: Cache CMake files @@ -68,16 +65,24 @@ jobs: - name: Create build directory run: cmake -E make_directory ${{ steps.strings.outputs.build-output-dir }} - - name: Configure CMake (Linux) - if: runner.os == 'Linux' + - name: Configure CMake + shell: bash run: | - cmake -B ${{ steps.strings.outputs.build-output-dir }} \ - -DCMAKE_CXX_STANDARD=20 \ - -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} \ - -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} \ - -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ - -G Ninja \ - -S ${{ github.workspace }} + if [[ "${{ runner.os }}" == "Linux" ]]; then + cmake -B "${{ steps.strings.outputs.build-output-dir }}" \ + -DCMAKE_CXX_STANDARD=20 \ + -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} \ + -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} \ + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ + -G Ninja \ + -S ${{ github.workspace }} + elif [[ "${{ runner.os }}" == "Windows" ]]; then + cmake -B "${{ steps.strings.outputs.build-output-dir }}" ` + -DCMAKE_CXX_STANDARD=20 ` + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ` + -G "Visual Studio 17 2022" ` + -A x64 ` + -S ${{ github.workspace }} - name: Cache build uses: actions/cache@v3 @@ -96,14 +101,24 @@ jobs: - name: Run tests working-directory: ${{ steps.strings.outputs.build-output-dir }} - run: ./tests + run: | + if [[ "${{ runner.os }}" == "Windows" ]]; then + .\tests.exe + else + ./tests + fi - name: Run benchmarks working-directory: ${{ steps.strings.outputs.build-output-dir }} - run: ./measure --benchmark_format=console --benchmark_out=benchmark_results.json + run: | + if [[ "${{ runner.os }}" == "Windows" ]]; then + .\measure.exe --benchmark_format=console --benchmark_out=benchmark_results.json + else + ./measure --benchmark_format=console --benchmark_out=benchmark_results.json + fi - name: Upload benchmark results uses: actions/upload-artifact@v4 with: - name: benchmark-results - path: benchmark_results.json + name: benchmark-results + path: benchmark_results.json \ No newline at end of file From 2f96a5627e08a22290503c2924041a680f84e756 Mon Sep 17 00:00:00 2001 From: Sayan Date: Sat, 4 Oct 2025 14:17:32 -0400 Subject: [PATCH 3/9] improve cmake --- .github/workflows/action.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index 634a84b..9701ab1 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -77,12 +77,13 @@ jobs: -G Ninja \ -S ${{ github.workspace }} elif [[ "${{ runner.os }}" == "Windows" ]]; then - cmake -B "${{ steps.strings.outputs.build-output-dir }}" ` - -DCMAKE_CXX_STANDARD=20 ` - -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ` - -G "Visual Studio 17 2022" ` - -A x64 ` + cmake -B "${{ steps.strings.outputs.build-output-dir }}" \ + -DCMAKE_CXX_STANDARD=20 \ + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ + -G "Visual Studio 17 2022" \ + -A x64 \ -S ${{ github.workspace }} + fi - name: Cache build uses: actions/cache@v3 From 86f83da1a4584f54f27191d12abb7b1e9ca3eaba Mon Sep 17 00:00:00 2001 From: Sayan Date: Sat, 4 Oct 2025 14:27:18 -0400 Subject: [PATCH 4/9] improve cmake --- .github/workflows/action.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index 9701ab1..20d4e1f 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -60,7 +60,7 @@ jobs: id: strings shell: bash run: | - echo "build-output-dir=${GITHUB_WORKSPACE}/build" >> "$GITHUB_OUTPUT" + echo "BUILD_DIR=${GITHUB_WORKSPACE}/build" >> $GITHUB_OUTPUT - name: Create build directory run: cmake -E make_directory ${{ steps.strings.outputs.build-output-dir }} @@ -69,7 +69,7 @@ jobs: shell: bash run: | if [[ "${{ runner.os }}" == "Linux" ]]; then - cmake -B "${{ steps.strings.outputs.build-output-dir }}" \ + cmake -B "${{ steps.strings.outputs.BUILD_DIR }}" \ -DCMAKE_CXX_STANDARD=20 \ -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} \ -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} \ @@ -77,7 +77,7 @@ jobs: -G Ninja \ -S ${{ github.workspace }} elif [[ "${{ runner.os }}" == "Windows" ]]; then - cmake -B "${{ steps.strings.outputs.build-output-dir }}" \ + cmake -B "${{ steps.strings.outputs.BUILD_DIR }}" \ -DCMAKE_CXX_STANDARD=20 \ -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ -G "Visual Studio 17 2022" \ @@ -94,14 +94,14 @@ jobs: ${{ runner.os }}-build- - name: Build - run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} + run: cmake --build ${{ steps.strings.outputs.BUILD_DIR }} --config ${{ matrix.build_type }} - name: Test - working-directory: ${{ steps.strings.outputs.build-output-dir }} + working-directory: ${{ steps.strings.outputs.BUILD_DIR }} run: ctest --build-config ${{ matrix.build_type }} - name: Run tests - working-directory: ${{ steps.strings.outputs.build-output-dir }} + working-directory: ${{ steps.strings.outputs.BUILD_DIR }} run: | if [[ "${{ runner.os }}" == "Windows" ]]; then .\tests.exe @@ -110,7 +110,7 @@ jobs: fi - name: Run benchmarks - working-directory: ${{ steps.strings.outputs.build-output-dir }} + working-directory: ${{ steps.strings.outputs.BUILD_DIR }} run: | if [[ "${{ runner.os }}" == "Windows" ]]; then .\measure.exe --benchmark_format=console --benchmark_out=benchmark_results.json From ef0eb760c6d5a618aceb780ad00abc551e58dac0 Mon Sep 17 00:00:00 2001 From: Sayan Date: Sat, 4 Oct 2025 14:31:45 -0400 Subject: [PATCH 5/9] improve cmake --- fastcast.hpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fastcast.hpp b/fastcast.hpp index c5c27df..1f6db60 100644 --- a/fastcast.hpp +++ b/fastcast.hpp @@ -18,11 +18,9 @@ #define CONSTEXPR #endif - namespace fastcast { -// Core implementation for pointer types -template CONSTEXPR inline To cast_impl(From *ptr) { +template CONSTEXPR inline To fast_cast_impl(From *ptr) { using v_table_ptr = const uintptr_t *; if constexpr (std::is_same_v, std::remove_pointer_t>) { @@ -76,7 +74,7 @@ constexpr inline To fast_cast(From *ptr) { using ToNonPtr = std::remove_pointer_t; using ToPtr = std::conditional_t, const ToNonPtr *, ToNonPtr *>; - return cast_impl(ptr); + return fast_cast_impl(ptr); } // Reference overload From 5c17fa0ca604bdacc6ce9dbdedf5554b3d381305 Mon Sep 17 00:00:00 2001 From: Sayan Date: Sat, 4 Oct 2025 14:31:55 -0400 Subject: [PATCH 6/9] Revert "improve cmake" This reverts commit 86f83da1a4584f54f27191d12abb7b1e9ca3eaba. --- .github/workflows/action.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index 20d4e1f..9701ab1 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -60,7 +60,7 @@ jobs: id: strings shell: bash run: | - echo "BUILD_DIR=${GITHUB_WORKSPACE}/build" >> $GITHUB_OUTPUT + echo "build-output-dir=${GITHUB_WORKSPACE}/build" >> "$GITHUB_OUTPUT" - name: Create build directory run: cmake -E make_directory ${{ steps.strings.outputs.build-output-dir }} @@ -69,7 +69,7 @@ jobs: shell: bash run: | if [[ "${{ runner.os }}" == "Linux" ]]; then - cmake -B "${{ steps.strings.outputs.BUILD_DIR }}" \ + cmake -B "${{ steps.strings.outputs.build-output-dir }}" \ -DCMAKE_CXX_STANDARD=20 \ -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} \ -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} \ @@ -77,7 +77,7 @@ jobs: -G Ninja \ -S ${{ github.workspace }} elif [[ "${{ runner.os }}" == "Windows" ]]; then - cmake -B "${{ steps.strings.outputs.BUILD_DIR }}" \ + cmake -B "${{ steps.strings.outputs.build-output-dir }}" \ -DCMAKE_CXX_STANDARD=20 \ -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ -G "Visual Studio 17 2022" \ @@ -94,14 +94,14 @@ jobs: ${{ runner.os }}-build- - name: Build - run: cmake --build ${{ steps.strings.outputs.BUILD_DIR }} --config ${{ matrix.build_type }} + run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} - name: Test - working-directory: ${{ steps.strings.outputs.BUILD_DIR }} + working-directory: ${{ steps.strings.outputs.build-output-dir }} run: ctest --build-config ${{ matrix.build_type }} - name: Run tests - working-directory: ${{ steps.strings.outputs.BUILD_DIR }} + working-directory: ${{ steps.strings.outputs.build-output-dir }} run: | if [[ "${{ runner.os }}" == "Windows" ]]; then .\tests.exe @@ -110,7 +110,7 @@ jobs: fi - name: Run benchmarks - working-directory: ${{ steps.strings.outputs.BUILD_DIR }} + working-directory: ${{ steps.strings.outputs.build-output-dir }} run: | if [[ "${{ runner.os }}" == "Windows" ]]; then .\measure.exe --benchmark_format=console --benchmark_out=benchmark_results.json From d6f1cf7318bb0ff441482cd6e4ecbc3e1b431853 Mon Sep 17 00:00:00 2001 From: Sayan Date: Sat, 4 Oct 2025 14:40:23 -0400 Subject: [PATCH 7/9] improve cmake --- .github/workflows/action.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index 9701ab1..74571f8 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -60,7 +60,11 @@ jobs: id: strings shell: bash run: | - echo "build-output-dir=${GITHUB_WORKSPACE}/build" >> "$GITHUB_OUTPUT" + if [[ "${{ runner.os }}" == "Linux" ]]; then + echo "build-output-dir=${GITHUB_WORKSPACE}/build" >> "$GITHUB_OUTPUT" + elif [[ "${{ runner.os }}" == "Windows" ]]; then + echo "build-output-dir=${GITHUB_WORKSPACE}\build" >> "$GITHUB_OUTPUT" + fi - name: Create build directory run: cmake -E make_directory ${{ steps.strings.outputs.build-output-dir }} From 2868aeb414ccd560f5516dddb87f94fc850bd513 Mon Sep 17 00:00:00 2001 From: Sayan Date: Sat, 4 Oct 2025 14:43:53 -0400 Subject: [PATCH 8/9] improve cmake --- .github/workflows/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index 74571f8..2511d74 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -84,7 +84,7 @@ jobs: cmake -B "${{ steps.strings.outputs.build-output-dir }}" \ -DCMAKE_CXX_STANDARD=20 \ -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ - -G "Visual Studio 17 2022" \ + -G Ninja \ -A x64 \ -S ${{ github.workspace }} fi From acfbed6b63bea5d7b2749c1d58500378279790c6 Mon Sep 17 00:00:00 2001 From: Sayan Date: Sat, 4 Oct 2025 14:46:51 -0400 Subject: [PATCH 9/9] improve cmake --- .github/workflows/action.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index 2511d74..9c4260d 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -23,10 +23,10 @@ jobs: c_compiler: clang cpp_compiler: clang++ - - os: windows-latest - build_type: Release - c_compiler: cl - cpp_compiler: cl + #- os: windows-latest + # build_type: Release + # c_compiler: cl + # cpp_compiler: cl steps: - uses: actions/checkout@v4 @@ -90,7 +90,7 @@ jobs: fi - name: Cache build - uses: actions/cache@v3 + uses: actions/cache@v31 with: path: ${{ github.workspace }}/build key: ${{ runner.os }}-build-${{ hashFiles('**/*.cpp', '**/*.hpp', '**/*.h') }}