From 8f0bbffaae0ba2f5f7626ada603d2c6985cbe55f Mon Sep 17 00:00:00 2001 From: Vlad Gheorghiu Date: Wed, 1 May 2024 17:47:47 -0400 Subject: [PATCH] Fix Signed-off-by: Vlad Gheorghiu --- .github/workflows/cmake.yml | 138 +++++++++++++++++----------------- cmake/staq_uninstall.cmake.in | 6 +- 2 files changed, 69 insertions(+), 75 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index ced7bee..5049d32 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -13,40 +13,39 @@ jobs: build: strategy: matrix: - # os: [ubuntu-latest, macos-latest, windows-latest] - os: [windows-latest] + os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 - # - name: Install vcpkg (Windows) - # if: runner.os == 'Windows' - # run: | - # git clone https://github.com/microsoft/vcpkg - # .\vcpkg\bootstrap-vcpkg.bat - # .\vcpkg\vcpkg install pkgconf:x64-windows - # - # - name: Install gmp - # shell: bash - # run: | - # if [ "$RUNNER_OS" == "Windows" ]; then - # ./vcpkg/vcpkg install gmp:x64-windows - # elif [ "$RUNNER_OS" == "Linux" ]; then - # sudo apt-get install -y libgmp-dev - # elif [ "$RUNNER_OS" == "macOS" ]; then - # brew install gmp - # else - # echo "$RUNNER_OS not supported" - # exit 1 - # fi - - # -DCMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake \ + - name: Install vcpkg (Windows) + if: runner.os == 'Windows' + run: | + git clone https://github.com/microsoft/vcpkg + .\vcpkg\bootstrap-vcpkg.bat + .\vcpkg\vcpkg install pkgconf:x64-windows + + - name: Install gmp + shell: bash + run: | + if [ "$RUNNER_OS" == "Windows" ]; then + ./vcpkg/vcpkg install gmp:x64-windows + elif [ "$RUNNER_OS" == "Linux" ]; then + sudo apt-get install -y libgmp-dev + elif [ "$RUNNER_OS" == "macOS" ]; then + brew install gmp + else + echo "$RUNNER_OS not supported" + exit 1 + fi + - name: Configure staq shell: bash run: | if [ "$RUNNER_OS" == "Windows" ]; then cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ + -DCMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake \ -DINSTALL_SOURCES=ON else cmake -B build -DINSTALL_SOURCES=ON -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} @@ -71,54 +70,53 @@ jobs: sudo cmake --install build fi - # - name: Configure standalone example - # run: | - # cmake -S examples/standalone -B examples/standalone/build - # - # - name: Build standalone example - # run: | - # cmake --build examples/standalone/build --target standalone - # - # - name: Run standalone example - # shell: bash - # run: | - # if [ "$RUNNER_OS" == "Windows" ]; then - # ./examples/standalone/build/${{env.BUILD_TYPE}}/standalone.exe --version - # else - # ./examples/standalone/build/standalone --version - # fi - # - # - name: Build unit tests - # shell: bash - # run: | - # if [ "$RUNNER_OS" == "macOS" ]; then - # # Required for libgmp headers - # export CPATH=$LIBRARY_PATH:/opt/homebrew/include - # export LIBRARY_PATH=$LIBRARY_PATH:/opt/homebrew/lib - # fi - # cmake --build build/unit_tests --target unit_tests - # - # - name: Run unit tests - # run: ctest --test-dir build + - name: Configure standalone example + run: | + cmake -S examples/standalone -B examples/standalone/build + + - name: Build standalone example + run: | + cmake --build examples/standalone/build --target standalone + + - name: Run standalone example + shell: bash + run: | + if [ "$RUNNER_OS" == "Windows" ]; then + ./examples/standalone/build/${{env.BUILD_TYPE}}/standalone.exe --version + else + ./examples/standalone/build/standalone --version + fi + + - name: Build unit tests + shell: bash + run: | + if [ "$RUNNER_OS" == "macOS" ]; then + # Required for libgmp headers + export CPATH=$LIBRARY_PATH:/opt/homebrew/include + export LIBRARY_PATH=$LIBRARY_PATH:/opt/homebrew/lib + fi + cmake --build build/unit_tests --target unit_tests + + - name: Run unit tests + run: ctest --test-dir build - name: Uninstall run: | cmake --build build --target uninstall dir 'C:/Program Files (x86)/staq/bin/' - dir 'C:/Program Files (x86)/staq/bin/staq_circ.exe' - - # - name: Install pystaq - # shell: bash - # run: | - # if [ "$RUNNER_OS" == "macOS" ]; then - # # Required for libgmp headers - # export CPATH=$LIBRARY_PATH:/opt/homebrew/include - # export LIBRARY_PATH=$LIBRARY_PATH:/opt/homebrew/lib - # fi - # python3 -m venv venv - # if [ "$RUNNER_OS" == "Windows" ]; then - # .\venv\Scripts\activate - # else - # . venv/bin/activate - # fi - # pip install . + + - name: Install pystaq + shell: bash + run: | + if [ "$RUNNER_OS" == "macOS" ]; then + # Required for libgmp headers + export CPATH=$LIBRARY_PATH:/opt/homebrew/include + export LIBRARY_PATH=$LIBRARY_PATH:/opt/homebrew/lib + fi + python3 -m venv venv + if [ "$RUNNER_OS" == "Windows" ]; then + .\venv\Scripts\activate + else + . venv/bin/activate + fi + pip install . diff --git a/cmake/staq_uninstall.cmake.in b/cmake/staq_uninstall.cmake.in index b8406a9..947149d 100644 --- a/cmake/staq_uninstall.cmake.in +++ b/cmake/staq_uninstall.cmake.in @@ -14,13 +14,9 @@ foreach(file ${files}) message(STATUS "Uninstalling ${file}") if(IS_SYMLINK "${file}" OR EXISTS "${file}") execute_process( - COMMAND "@CMAKE_COMMAND@" -E rm -f "${file}" + COMMAND @CMAKE_COMMAND@ -E rm -f "${file}" OUTPUT_VARIABLE rm_out RESULT_VARIABLE rm_retval) - message(STATUS "ENVDESTDIR: $ENV{DESTDIR}") - message(STATUS "file: ${file}") - message(STATUS "rm_out: ${rm_out}") - message(STATUS "rm_retval: ${rm_retval}") if(${rm_retval}) message(FATAL_ERROR "Problem when removing ${file}") endif()