From 36f4c1f4f80a5c741a90b93ccb1bb5da91fb660b Mon Sep 17 00:00:00 2001 From: mcbarton <150042563+mcbarton@users.noreply.github.com> Date: Mon, 13 May 2024 12:35:34 +0100 Subject: [PATCH] Fix Windows tests --- .github/workflows/main.yml | 20 +++++++++-- CMakeLists.txt | 35 ++++++++++++------- environment-dev.yml | 2 +- share/jupyter/kernels/xcpp11/kernel.json.in | 1 + share/jupyter/kernels/xcpp14/kernel.json.in | 2 +- .../jupyter/kernels/xcpp17-omp/kernel.json.in | 2 +- share/jupyter/kernels/xcpp17/kernel.json.in | 2 +- share/jupyter/kernels/xcpp20/kernel.json.in | 2 +- 8 files changed, 46 insertions(+), 20 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 53c49e29..597b0b70 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -117,7 +117,7 @@ jobs: cd build make install -j ${{ env.ncpus }} - - name: Test xeus-cpp C++ + - name: Test xeus-cpp C++ Unix Systems if: ${{ runner.os != 'windows' }} shell: bash -l {0} run: | @@ -125,12 +125,28 @@ jobs: ./test_xeus_cpp timeout-minutes: 4 - - name: test + - name: Test xeus-cpp C++ Windows Systems + if: ${{ runner.os == 'windows' }} + shell: cmd /C call {0} + run: | + call C:\Users\runneradmin\micromamba-root\condabin\micromamba.bat activate xeus-cpp + cd build\test + .\test_xeus_cpp.exe + + - name: Python tests Unix Systems if: ${{ runner.os != 'windows' }} shell: bash -l {0} run: | cd test pytest -sv . --reruns 5 + + - name: Python tests Windows Systems + if: ${{ runner.os == 'windows' }} + shell: cmd /C call {0} + run: | + call C:\Users\runneradmin\micromamba-root\condabin\micromamba.bat activate xeus-cpp + cd test + pytest -sv test_xcpp_kernel.py --reruns 5 - name: Prepare code coverage report if: ${{ success() && (matrix.coverage == true) }} diff --git a/CMakeLists.txt b/CMakeLists.txt index ba766f0f..4b7a7819 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -130,31 +130,40 @@ function(configure_kernel kernel) set(XEUS_CPP_PATH "$ENV{PATH}") set(XEUS_CPP_LD_LIBRARY_PATH "$ENV{LD_LIBRARY_PATH}") set(XEUS_CPP_RESOURCE_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/clang/${CPPINTEROP_LLVM_VERSION_MAJOR}) + set(XEUS_CPP_INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/include) + + if (WIN32) + string(REPLACE "\\" "/" kernel "${kernel}") + string(REPLACE "\\" "/" XEUS_CPP_PATH "${XEUS_CPP_PATH}") + string(REPLACE "\\" "/" XEUS_CPP_LD_LIBRARY_PATH "${XEUS_CPP_LD_LIBRARY_PATH}") + string(REPLACE "\\" "/" XEUS_CPP_RESOURCE_DIR "${XEUS_CPP_RESOURCE_DIR}") + string(REPLACE "\\" "/" XEUS_CPP_INCLUDE_DIR "${XEUS_CPP_INCLUDE_DIR}") + endif() configure_file ( - "${CMAKE_CURRENT_SOURCE_DIR}/${kernel}/kernel.json.in" - "${CMAKE_CURRENT_BINARY_DIR}/${kernel}/kernel.json") + "${CMAKE_CURRENT_SOURCE_DIR}${kernel}kernel.json.in" + "${CMAKE_CURRENT_BINARY_DIR}${kernel}kernel.json") configure_file ( - "${CMAKE_CURRENT_SOURCE_DIR}/${kernel}/logo-32x32.png" - "${CMAKE_CURRENT_BINARY_DIR}/${kernel}/" + "${CMAKE_CURRENT_SOURCE_DIR}${kernel}logo-32x32.png" + "${CMAKE_CURRENT_BINARY_DIR}${kernel}" COPYONLY) configure_file ( - "${CMAKE_CURRENT_SOURCE_DIR}/${kernel}/logo-64x64.png" - "${CMAKE_CURRENT_BINARY_DIR}/${kernel}/" + "${CMAKE_CURRENT_SOURCE_DIR}${kernel}logo-64x64.png" + "${CMAKE_CURRENT_BINARY_DIR}${kernel}" COPYONLY) configure_file ( - "${CMAKE_CURRENT_SOURCE_DIR}/${kernel}/logo-svg.svg" - "${CMAKE_CURRENT_BINARY_DIR}/${kernel}/" + "${CMAKE_CURRENT_SOURCE_DIR}${kernel}logo-svg.svg" + "${CMAKE_CURRENT_BINARY_DIR}${kernel}" COPYONLY) endfunction() message("Configure kernels: ...") -configure_kernel("share/jupyter/kernels/xcpp") -configure_kernel("share/jupyter/kernels/xcpp11") -configure_kernel("share/jupyter/kernels/xcpp14") -configure_kernel("share/jupyter/kernels/xcpp17") -configure_kernel("share/jupyter/kernels/xcpp20") +configure_kernel("/share/jupyter/kernels/xcpp/") +configure_kernel("/share/jupyter/kernels/xcpp11/") +configure_kernel("/share/jupyter/kernels/xcpp14/") +configure_kernel("/share/jupyter/kernels/xcpp17/") +configure_kernel("/share/jupyter/kernels/xcpp20/") # Source files # ============ diff --git a/environment-dev.yml b/environment-dev.yml index 34ce4434..ec9786d6 100644 --- a/environment-dev.yml +++ b/environment-dev.yml @@ -20,4 +20,4 @@ dependencies: - jupyter_kernel_test>=0.4.3 - nbval - pytest-rerunfailures - - doctest \ No newline at end of file + - doctest diff --git a/share/jupyter/kernels/xcpp11/kernel.json.in b/share/jupyter/kernels/xcpp11/kernel.json.in index 382ce12f..0b328265 100644 --- a/share/jupyter/kernels/xcpp11/kernel.json.in +++ b/share/jupyter/kernels/xcpp11/kernel.json.in @@ -9,6 +9,7 @@ "-f", "{connection_file}", "-resource-dir", "@XEUS_CPP_RESOURCE_DIR@", + "-I", "@XEUS_CPP_INCLUDE_DIR@", "-std=c++11"@XEUS_CPP_OMP@ ], "language": "cpp", diff --git a/share/jupyter/kernels/xcpp14/kernel.json.in b/share/jupyter/kernels/xcpp14/kernel.json.in index 356286aa..4374907c 100644 --- a/share/jupyter/kernels/xcpp14/kernel.json.in +++ b/share/jupyter/kernels/xcpp14/kernel.json.in @@ -9,7 +9,7 @@ "-f", "{connection_file}", "-resource-dir", "@XEUS_CPP_RESOURCE_DIR@", - "-I", "@CMAKE_INSTALL_PREFIX@/include", + "-I", "@XEUS_CPP_INCLUDE_DIR@", "-std=c++14", "-fno-exceptions", "-O2", diff --git a/share/jupyter/kernels/xcpp17-omp/kernel.json.in b/share/jupyter/kernels/xcpp17-omp/kernel.json.in index 4105e964..f74379f1 100644 --- a/share/jupyter/kernels/xcpp17-omp/kernel.json.in +++ b/share/jupyter/kernels/xcpp17-omp/kernel.json.in @@ -9,7 +9,7 @@ "-f", "{connection_file}", "-resource-dir", "@XEUS_CPP_RESOURCE_DIR@", - "-I", "@CMAKE_INSTALL_PREFIX@/include", + "-I", "@XEUS_CPP_INCLUDE_DIR@", "-std=c++17"@XEUS_CPP_OMP@ ], "language": "cpp", diff --git a/share/jupyter/kernels/xcpp17/kernel.json.in b/share/jupyter/kernels/xcpp17/kernel.json.in index b8e23d42..53bf6d60 100644 --- a/share/jupyter/kernels/xcpp17/kernel.json.in +++ b/share/jupyter/kernels/xcpp17/kernel.json.in @@ -9,7 +9,7 @@ "-f", "{connection_file}", "-resource-dir", "@XEUS_CPP_RESOURCE_DIR@", - "-I", "@CMAKE_INSTALL_PREFIX@/include", + "-I", "@XEUS_CPP_INCLUDE_DIR@", "-std=c++17"@XEUS_CPP_OMP@ ], "language": "cpp", diff --git a/share/jupyter/kernels/xcpp20/kernel.json.in b/share/jupyter/kernels/xcpp20/kernel.json.in index 35242c55..00cd8ed6 100644 --- a/share/jupyter/kernels/xcpp20/kernel.json.in +++ b/share/jupyter/kernels/xcpp20/kernel.json.in @@ -9,7 +9,7 @@ "-f", "{connection_file}", "-resource-dir", "@XEUS_CPP_RESOURCE_DIR@", - "-I", "@CMAKE_INSTALL_PREFIX@/include", + "-I", "@XEUS_CPP_INCLUDE_DIR@", "-std=c++20"@XEUS_CPP_OMP@ ], "language": "cpp",