Skip to content

Commit

Permalink
reenabled cpp tests on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
lausdahl committed Sep 19, 2024
1 parent 1aac687 commit 0673779
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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")


Expand All @@ -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"
)

Expand All @@ -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 ""
Expand All @@ -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 )

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> CACHE_FOLDERS = Arrays.asList("libzip", "rapidjson", "intocpsfmi-src");
static final File baseProjectPath = Paths.get("target", FullSpecCppTest.class.getSimpleName(), "_base").toFile().getAbsoluteFile();
Expand Down

0 comments on commit 0673779

Please sign in to comment.