From 045f81e60373ee08a7d989786a1bef036cdad362 Mon Sep 17 00:00:00 2001 From: Taiju Yamada Date: Fri, 8 Dec 2023 11:18:08 +0900 Subject: [PATCH 1/8] Add github action to ensure build --- .github/workflows/build_linux.yaml | 37 +++++++++++++++++++++ .github/workflows/build_windows.yaml | 48 ++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 .github/workflows/build_linux.yaml create mode 100644 .github/workflows/build_windows.yaml diff --git a/.github/workflows/build_linux.yaml b/.github/workflows/build_linux.yaml new file mode 100644 index 00000000..ed3995c4 --- /dev/null +++ b/.github/workflows/build_linux.yaml @@ -0,0 +1,37 @@ +name: Build Linux + +on: + push: + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-20.04] + architecture: ["x64"] + + steps: + - uses: actions/checkout@v3 + - name: Set up APT + if: ${{ matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04' }} + run: | + sudo apt-get update -y + sudo apt-get -y install g++ cmake-data cmake ninja-build libzmq3-dev liblog4cxx-dev libboost-filesystem-dev libboost-system-dev libboost-thread-dev libboost-date-time-dev libboost-program-options-dev libcurl4-openssl-dev + - name: Install RapidJSON + run: | + set -e + git clone https://github.com/Tencent/rapidjson.git && mkdir rapidjson/build + cd rapidjson/build + # there are no stable version available + cmake .. -GNinja -DRAPIDJSON_HAS_STDSTRING=ON -DRAPIDJSON_BUILD_DOC=OFF -DRAPIDJSON_BUILD_EXAMPLES=OFF -DRAPIDJSON_BUILD_TESTS=OFF + ninja -j4 && sudo ninja install + cd ../.. + - name: Install + run: | + set -e + mkdir -p build + cd build + cmake .. -GNinja -DOPT_SAMPLES=OFF -DOPT_BUILD_TESTS=OFF + ninja -j4 && sudo ninja install + cd .. diff --git a/.github/workflows/build_windows.yaml b/.github/workflows/build_windows.yaml new file mode 100644 index 00000000..f37f5afa --- /dev/null +++ b/.github/workflows/build_windows.yaml @@ -0,0 +1,48 @@ +name: Build Windows + +on: + push: + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [windows-2022] + architecture: ["x64"] + + steps: + - uses: actions/checkout@v3 + - uses: microsoft/setup-msbuild@v1.1 + - name: Set up Boost + run: | + choco install boost-msvc-14.3 -f -y + - name: Set up curl + run: | + curl -O -L https://curl.se/windows/dl-8.5.0_1/curl-8.5.0_1-win64-mingw.zip + 7z x -y curl-8.5.0_1-win64-mingw.zip + - name: Install RapidJSON + run: | + git clone https://github.com/Tencent/rapidjson.git && mkdir rapidjson\build + cd rapidjson\build + # there are no stable version available + # but take the last version without -targets.cmake + git checkout 516d0473949fdcf0a6dc9fbb40fa92b3b85db184 + cmake .. -G 'Visual Studio 17 2022' -A x64 -DRAPIDJSON_HAS_STDSTRING=ON -DRAPIDJSON_BUILD_DOC=OFF -DRAPIDJSON_BUILD_EXAMPLES=OFF -DRAPIDJSON_BUILD_TESTS=OFF + msbuild ALL_BUILD.vcxproj /p:Configuration=Release + cd ..\.. + - name: Install libzmq + run: | + git clone https://github.com/zeromq/libzmq.git && mkdir libzmq\build + cd libzmq\build + git checkout v4.3.5 + cmake .. -G 'Visual Studio 17 2022' -A x64 -DBUILD_TESTS=OFF + msbuild ALL_BUILD.vcxproj /p:Configuration=Release + cd ..\.. + - name: Install + run: | + mkdir -p build + cd build + cmake .. -G 'Visual Studio 17 2022' -A x64 -DCMAKE_CXX_STANDARD=11 "-DZeroMQ_DIR=${PWD}\..\libzmq\build" "-DCURL_INCLUDE_DIR=${PWD}\..\curl-8.5.0_1-win64-mingw\include" "-DCURL_LIBRARY=${PWD}\..\curl-8.5.0_1-win64-mingw\lib\libcurl.dll.a" -DCMAKE_CONFIGURATION_TYPES=Release -DOPT_SAMPLES=OFF -DOPT_BUILD_TESTS=OFF + msbuild ALL_BUILD.vcxproj /p:Configuration=Release + cd .. From ff29a3e35e5f3e0918bf55e522372fa093127730 Mon Sep 17 00:00:00 2001 From: Taiju Yamada Date: Fri, 8 Dec 2023 11:18:36 +0900 Subject: [PATCH 2/8] Fix msvc compilation --- include/mujincontrollerclient/mujinjson.h | 4 ++++ src/mujinjson.cpp | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/include/mujincontrollerclient/mujinjson.h b/include/mujincontrollerclient/mujinjson.h index 6c7235bf..f8c4eeb0 100644 --- a/include/mujincontrollerclient/mujinjson.h +++ b/include/mujincontrollerclient/mujinjson.h @@ -358,6 +358,7 @@ inline void LoadJsonValue(const rapidjson::Value& v, unsigned long long& t) { } } +#ifndef _MSC_VER inline void LoadJsonValue(const rapidjson::Value& v, uint64_t& t) { if (v.IsUint64()) { t = v.GetUint64(); @@ -381,6 +382,7 @@ inline void LoadJsonValue(const rapidjson::Value& v, int64_t& t) { throw MujinJSONException("Cannot convert json type " + GetJsonString(v) + " to Int64"); } } +#endif inline void LoadJsonValue(const rapidjson::Value& v, double& t) { if (v.IsNumber()) { @@ -576,9 +578,11 @@ inline void SaveJsonValue(rapidjson::Value& v, long long t, rapidjson::Document: v.SetInt64(t); } +#ifndef _MSC_VER inline void SaveJsonValue(rapidjson::Value& v, int64_t t, rapidjson::Document::AllocatorType& alloc) { v.SetInt64(t); } +#endif inline void SaveJsonValue(rapidjson::Value& v, unsigned long long t, rapidjson::Document::AllocatorType& alloc) { v.SetUint64(t); diff --git a/src/mujinjson.cpp b/src/mujinjson.cpp index 2654a946..7a166836 100644 --- a/src/mujinjson.cpp +++ b/src/mujinjson.cpp @@ -4,7 +4,17 @@ #include #include + +#if defined(_WIN32) +#include +#else #include +#endif + +#if defined(_MSC_VER) +#include +typedef SSIZE_T ssize_t; +#endif namespace mujinjson { From c640c64ad7c8ca2a0f5bc5334c3d070a55f706cd Mon Sep 17 00:00:00 2001 From: Taiju Yamada Date: Tue, 3 Feb 2026 18:37:04 +0900 Subject: [PATCH 3/8] Use ubuntu22 --- .github/workflows/build_linux.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_linux.yaml b/.github/workflows/build_linux.yaml index ed3995c4..6083af74 100644 --- a/.github/workflows/build_linux.yaml +++ b/.github/workflows/build_linux.yaml @@ -8,7 +8,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-20.04] + os: [ubuntu-22.04] architecture: ["x64"] steps: From 14a5f61168abdd04cbd0770c10fb76b563baac08 Mon Sep 17 00:00:00 2001 From: Taiju Yamada Date: Tue, 3 Feb 2026 19:06:17 +0900 Subject: [PATCH 4/8] Use c++17 --- .github/workflows/build_windows.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_windows.yaml b/.github/workflows/build_windows.yaml index f37f5afa..7388c497 100644 --- a/.github/workflows/build_windows.yaml +++ b/.github/workflows/build_windows.yaml @@ -43,6 +43,6 @@ jobs: run: | mkdir -p build cd build - cmake .. -G 'Visual Studio 17 2022' -A x64 -DCMAKE_CXX_STANDARD=11 "-DZeroMQ_DIR=${PWD}\..\libzmq\build" "-DCURL_INCLUDE_DIR=${PWD}\..\curl-8.5.0_1-win64-mingw\include" "-DCURL_LIBRARY=${PWD}\..\curl-8.5.0_1-win64-mingw\lib\libcurl.dll.a" -DCMAKE_CONFIGURATION_TYPES=Release -DOPT_SAMPLES=OFF -DOPT_BUILD_TESTS=OFF + cmake .. -G 'Visual Studio 17 2022' -A x64 -DCMAKE_CXX_STANDARD=17 "-DZeroMQ_DIR=${PWD}\..\libzmq\build" "-DCURL_INCLUDE_DIR=${PWD}\..\curl-8.5.0_1-win64-mingw\include" "-DCURL_LIBRARY=${PWD}\..\curl-8.5.0_1-win64-mingw\lib\libcurl.dll.a" -DCMAKE_CONFIGURATION_TYPES=Release -DOPT_SAMPLES=OFF -DOPT_BUILD_TESTS=OFF msbuild ALL_BUILD.vcxproj /p:Configuration=Release cd .. From 1ce7ca14d37a16901400d863c17a6893d6c9ae75 Mon Sep 17 00:00:00 2001 From: "T.Yamada" Date: Tue, 3 Feb 2026 19:28:59 +0900 Subject: [PATCH 5/8] Update common.h --- src/common.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/common.h b/src/common.h index 0ba8d61d..c919ee2c 100644 --- a/src/common.h +++ b/src/common.h @@ -35,6 +35,7 @@ #include #if defined(_WIN32) || defined(_WIN64) +#define NOMINMAX #include #undef GetUserName // classes with ControllerClient::GetUserName From d647858008ccc389d569927eb9f14a02fca6fefa Mon Sep 17 00:00:00 2001 From: "T.Yamada" Date: Tue, 3 Feb 2026 19:45:28 +0900 Subject: [PATCH 6/8] Update build_windows.yaml --- .github/workflows/build_windows.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_windows.yaml b/.github/workflows/build_windows.yaml index 7388c497..4f6ce395 100644 --- a/.github/workflows/build_windows.yaml +++ b/.github/workflows/build_windows.yaml @@ -16,7 +16,7 @@ jobs: - uses: microsoft/setup-msbuild@v1.1 - name: Set up Boost run: | - choco install boost-msvc-14.3 -f -y + choco install boost-msvc-14.3 -f -y --version 1.85.0 - name: Set up curl run: | curl -O -L https://curl.se/windows/dl-8.5.0_1/curl-8.5.0_1-win64-mingw.zip From 795faa737bb2826ba78d200bc7681c0a197aeef9 Mon Sep 17 00:00:00 2001 From: "T.Yamada" Date: Tue, 3 Feb 2026 19:55:24 +0900 Subject: [PATCH 7/8] Update mujincontrollerclient.h --- include/mujincontrollerclient/mujincontrollerclient.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/mujincontrollerclient/mujincontrollerclient.h b/include/mujincontrollerclient/mujincontrollerclient.h index c0aa3499..7ca9f662 100644 --- a/include/mujincontrollerclient/mujincontrollerclient.h +++ b/include/mujincontrollerclient/mujincontrollerclient.h @@ -20,6 +20,7 @@ #ifdef _MSC_VER +#define NOMINMAX #pragma warning(disable:4251)// needs to have dll-interface to be used by clients of class #pragma warning(disable:4190)// C-linkage specified, but returns UDT 'boost::shared_ptr' which is incompatible with C #pragma warning(disable:4819)//The file contains a character that cannot be represented in the current code page (932). Save the file in Unicode format to prevent data loss using native typeof From 49730279857347c21cd81109540d08a5acbc3fd4 Mon Sep 17 00:00:00 2001 From: "T.Yamada" Date: Tue, 3 Feb 2026 19:55:55 +0900 Subject: [PATCH 8/8] Update build_windows.yaml --- .github/workflows/build_windows.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_windows.yaml b/.github/workflows/build_windows.yaml index 4f6ce395..7388c497 100644 --- a/.github/workflows/build_windows.yaml +++ b/.github/workflows/build_windows.yaml @@ -16,7 +16,7 @@ jobs: - uses: microsoft/setup-msbuild@v1.1 - name: Set up Boost run: | - choco install boost-msvc-14.3 -f -y --version 1.85.0 + choco install boost-msvc-14.3 -f -y - name: Set up curl run: | curl -O -L https://curl.se/windows/dl-8.5.0_1/curl-8.5.0_1-win64-mingw.zip