From f934b491560d49d2b5fcd52f4dac7445f03f31c7 Mon Sep 17 00:00:00 2001 From: nbrodbec Date: Mon, 13 Jan 2025 14:00:29 -0500 Subject: [PATCH 1/5] Force test target to be built in 32 bits --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f290e96d..d603ab67 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,8 @@ elseif(${CMAKE_BUILD_TYPE} MATCHES HIL) include(${CMAKE_SOURCE_DIR}/cmake/fetch_googletest.cmake) set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchain_hil_gcc.cmake) elseif(${CMAKE_BUILD_TYPE} MATCHES Test) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32") include(${CMAKE_SOURCE_DIR}/cmake/fetch_googletest.cmake) set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchain_linux_gcc.cmake) elseif(${CMAKE_BUILD_TYPE} MATCHES Examples) @@ -48,6 +50,7 @@ endif() if(${CMAKE_BUILD_TYPE} MATCHES Test) enable_language(C CXX) enable_testing() + add_subdirectory(test) endif() From baff537a82234db430c3c11cbe4902723d5e6f63 Mon Sep 17 00:00:00 2001 From: nbrodbec Date: Mon, 13 Jan 2025 14:02:34 -0500 Subject: [PATCH 2/5] Force dynamic runtime linking in gtest --- cmake/fetch_googletest.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmake/fetch_googletest.cmake b/cmake/fetch_googletest.cmake index 0b4d32fd..5422efa8 100644 --- a/cmake/fetch_googletest.cmake +++ b/cmake/fetch_googletest.cmake @@ -10,6 +10,8 @@ googletest GIT_REPOSITORY https://github.com/google/googletest.git GIT_TAG release-1.11.0 ) + +set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) FetchContent_MakeAvailable(googletest) add_library(GTest::GTest INTERFACE IMPORTED) target_link_libraries(GTest::GTest INTERFACE gtest_main) From 0fa8cfee4191665f77b7f84242e4e1199892846c Mon Sep 17 00:00:00 2001 From: nbrodbec Date: Mon, 13 Jan 2025 14:17:14 -0500 Subject: [PATCH 3/5] Add GNU multilib to test github action --- .github/workflows/test.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6566abdc..b6fa119f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,6 +11,10 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Install GNU cross compilation + run: | + sudo apt-get update + sudo apt-get install gcc-multilib g++-multilib - name: Configure CMake run: | mkdir build From 848804f81eb822998e40219b4469c68533d5ef3c Mon Sep 17 00:00:00 2001 From: nbrodbec Date: Mon, 13 Jan 2025 14:22:03 -0500 Subject: [PATCH 4/5] Remove useless whitespace --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d603ab67..84d438b7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,7 +50,6 @@ endif() if(${CMAKE_BUILD_TYPE} MATCHES Test) enable_language(C CXX) enable_testing() - add_subdirectory(test) endif() From 5b98eec4d0386cdd0a605da0f46b48fe3f98ef22 Mon Sep 17 00:00:00 2001 From: nbrodbec Date: Wed, 15 Jan 2025 11:13:23 -0500 Subject: [PATCH 5/5] Add multilib to dependency installation instructions where required --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 41393219..db6fa5eb 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ This command opens a terminal in VSCode: ```Ctrl + Shift + ` ``` Enter these commands in your terminal: ``` sudo apt-get update -sudo apt-get install -y python3-pip build-essential cmake +sudo apt-get install -y python3-pip build-essential cmake gcc-multilib g++-multilib pip3 install -r requirements.txt pre-commit install ``` @@ -83,7 +83,7 @@ Skip this section if you set up a Docker development environment. 2. In WSL2, run the following: ```sh sudo apt-get update - sudo apt-get install build-essential + sudo apt-get install build-essential gcc-multilib g++-multilib ``` 3. Choose the environment where you'll be running `git commit` (either WSL2 or the host) and install Python 3.10 and pip. (Only required for Python devs) A. If using WSL, follow the instructions under the `Linux` section 2. @@ -144,7 +144,7 @@ Skip this section if you set up a Docker development environment. 1. Install required build tools (CMake, Make, gcc) ```sh sudo apt-get update -sudo apt-get install build-essential +sudo apt-get install build-essential gcc-multilib g++-multilib ``` 2. Install Python 3.10 and setup Python virtual environment (Only required for Python devs)