From 06737799d5ab1bd6bd364d1a776c855e4e08cb88 Mon Sep 17 00:00:00 2001 From: Kenneth Lausdahl Date: Thu, 19 Sep 2024 15:03:50 +0200 Subject: [PATCH] reenabled cpp tests on windows --- .../maestro/codegen/mabl2cpp/CMakeLists.txt | 9 +++--- .../maestro/codegen/mabl2cpp/readme.md | 32 +++++++++++++++---- .../org/intocps/maestro/FullSpecCppTest.java | 2 +- 3 files changed, 31 insertions(+), 12 deletions(-) diff --git a/codegen/mabl2cpp/src/main/resources/org/intocps/maestro/codegen/mabl2cpp/CMakeLists.txt b/codegen/mabl2cpp/src/main/resources/org/intocps/maestro/codegen/mabl2cpp/CMakeLists.txt index 819c595ce..0d8ecc7d7 100644 --- a/codegen/mabl2cpp/src/main/resources/org/intocps/maestro/codegen/mabl2cpp/CMakeLists.txt +++ b/codegen/mabl2cpp/src/main/resources/org/intocps/maestro/codegen/mabl2cpp/CMakeLists.txt @@ -15,7 +15,7 @@ FetchContent_Declare(intocpsfmi SOURCE_DIR "${CMAKE_BINARY_DIR}/intocpsfmi-src" ) -FetchContent_Populate(intocpsfmi) +FetchContent_MakeAvailable(intocpsfmi) set(intocpsfmi-src "intocpsfmi-src") @@ -27,9 +27,8 @@ SET(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libraries") FetchContent_Declare(libzip GIT_REPOSITORY https://github.com/nih-at/libzip.git - GIT_TAG v1.10.1 + GIT_TAG v1.11 GIT_SHALLOW ON - SOURCE_DIR "${CMAKE_BINARY_DIR}/libzip" ) @@ -51,7 +50,7 @@ SET(RAPIDJSON_BUILD_EXAMPLES OFF CACHE BOOL "Build rapidjson examples" FORCE) SET(RAPIDJSON_BUILD_TESTS OFF CACHE BOOL "Build rapidjson perftests and unittests" FORCE) FetchContent_Declare(rapidjson GIT_REPOSITORY https://github.com/Tencent/rapidjson.git - GIT_TAG v1.1.0 + GIT_TAG 7c73dd7de7c4f14379b781418c6e947ad464c818 # this hash seems to make it work on windows (nix works with v1.1.0) # GIT_SHALLOW ON SOURCE_DIR "${CMAKE_BINARY_DIR}/rapidjson" BUILD_COMMAND "" @@ -60,7 +59,7 @@ FetchContent_Declare(rapidjson TEST_COMMAND "" ) -FetchContent_Populate(rapidjson) +FetchContent_MakeAvailable(rapidjson) #file(CHMOD_RECURSE "${CMAKE_BINARY_DIR}/rapidjson" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE WORLD_READ WORLD_WRITE ) diff --git a/codegen/mabl2cpp/src/main/resources/org/intocps/maestro/codegen/mabl2cpp/readme.md b/codegen/mabl2cpp/src/main/resources/org/intocps/maestro/codegen/mabl2cpp/readme.md index 6a7bc81e2..86951a242 100644 --- a/codegen/mabl2cpp/src/main/resources/org/intocps/maestro/codegen/mabl2cpp/readme.md +++ b/codegen/mabl2cpp/src/main/resources/org/intocps/maestro/codegen/mabl2cpp/readme.md @@ -9,18 +9,38 @@ make Install i.e.: -1. msys with mingw64 (https://www.msys2.org/) +1. msys2 with mingw64 (https://www.msys2.org/) 2. Follow the guide at https://www.msys2.org/ -3. Add C:\msys64\mingw64\bin -4. Add C:\msys64\usr\bin -5. Run pacman -S mingw-w64-x86_64-cmake in the MSYS terminal Make sure to use the mingw64 terminal + Note that `c:\msys64\msys2.exe` is the prompt used to install with pacman + The prompt at `c:\msys64\mingw64.exe` is what should be used for compilation +3. in `c:\msys64\msys2.exe` install the following: + ```bash +pacman -Syu +pacman -Su +pacman -S mingw-w64-x86_64-toolchain +pacman -S base-devel +pacman -S mingw-w64-x86_64-cmake mingw-w64-x86_64-make + ``` +4. in `c:\msys64\mingw64.exe` run +```bash +cd $USERPROFILE/Downloads/my_project #assuming its in our download folder +ls # to check that CMakeLists.txt is in the current folder +cmake . # to generate the project +ninja # to build +./sim.exe # run the program +``` + +If the application should be used in another shell then the mingw libraries needs to be available in the `PATH` so +1. Add C:\msys64\mingw64\bin +2. Add C:\msys64\usr\bin -Use the cmake profile `-G"MSYS Makefiles"` +Alternatively `make` can also be used instead of `ninja` +* then Run cmake with cmake profile `-G"MSYS Makefiles"` and use `make` to build To check what libraries needs to be in the path in case the program must be launched from elsewhere: ~~~bash -objdump -p sim-dse/cpp/program/sim.exe | grep "DLL Name:" +objdump -p sim.exe | grep "DLL Name:" ~~~ ## Linux (ubuntu) diff --git a/maestro/src/test/java/org/intocps/maestro/FullSpecCppTest.java b/maestro/src/test/java/org/intocps/maestro/FullSpecCppTest.java index bad3c3fda..c3515da9b 100644 --- a/maestro/src/test/java/org/intocps/maestro/FullSpecCppTest.java +++ b/maestro/src/test/java/org/intocps/maestro/FullSpecCppTest.java @@ -30,7 +30,7 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipFile; -@DisabledOnOs(OS.WINDOWS) + public class FullSpecCppTest extends FullSpecTest { public static final List CACHE_FOLDERS = Arrays.asList("libzip", "rapidjson", "intocpsfmi-src"); static final File baseProjectPath = Paths.get("target", FullSpecCppTest.class.getSimpleName(), "_base").toFile().getAbsoluteFile();