From 874e9eeac6f7b439a6f19ee80fd657573867e244 Mon Sep 17 00:00:00 2001 From: Reinder Feenstra Date: Mon, 18 Apr 2022 22:40:15 +0200 Subject: [PATCH 1/4] fix: macos: pthread_setname_np is different --- server/src/utils/setthreadname.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/src/utils/setthreadname.hpp b/server/src/utils/setthreadname.hpp index 9d4f9c0b..23ea18a6 100644 --- a/server/src/utils/setthreadname.hpp +++ b/server/src/utils/setthreadname.hpp @@ -33,7 +33,11 @@ inline void setThreadName(const char* name) { #if __has_include() if constexpr(std::is_same_v) + #ifdef __APPLE__ + pthread_setname_np(name); + #else pthread_setname_np(pthread_self(), name); + #endif #endif #ifdef WIN32 // TODO: From 70fe73a1876b3fb76c8600db74c712f27e0fd6bf Mon Sep 17 00:00:00 2001 From: Reinder Feenstra Date: Mon, 18 Apr 2022 22:40:41 +0200 Subject: [PATCH 2/4] fix: macos: added missing include --- server/src/hardware/protocol/ecos/kernel.hpp | 1 + server/src/hardware/protocol/loconet/kernel.hpp | 1 + 2 files changed, 2 insertions(+) diff --git a/server/src/hardware/protocol/ecos/kernel.hpp b/server/src/hardware/protocol/ecos/kernel.hpp index 5e003c7f..c46b5240 100644 --- a/server/src/hardware/protocol/ecos/kernel.hpp +++ b/server/src/hardware/protocol/ecos/kernel.hpp @@ -24,6 +24,7 @@ #define TRAINTASTIC_SERVER_HARDWARE_PROTOCOL_ECOS_KERNEL_HPP #include +#include #include #include #include diff --git a/server/src/hardware/protocol/loconet/kernel.hpp b/server/src/hardware/protocol/loconet/kernel.hpp index 7eff96fc..f206e330 100644 --- a/server/src/hardware/protocol/loconet/kernel.hpp +++ b/server/src/hardware/protocol/loconet/kernel.hpp @@ -24,6 +24,7 @@ #define TRAINTASTIC_SERVER_HARDWARE_PROTOCOL_LOCONET_KERNEL_HPP #include +#include #include #include #include From 95e4367029827b3f612e1fe6b6e0b71a6406f0ea Mon Sep 17 00:00:00 2001 From: Reinder Feenstra Date: Mon, 18 Apr 2022 23:12:13 +0200 Subject: [PATCH 3/4] macos: added paths for libarchive and liblua (brew) --- server/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 831ba5b2..95bf8528 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -194,6 +194,9 @@ if(WIN32) # copy archive.dll to build directory: add_custom_command(TARGET traintastic-server POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_SOURCE_DIR}/thirdparty/libarchive/bin/archive.dll" .) +elseif(APPLE) + set(LibArchive_INCLUDE_DIRS "/usr/local/opt/libarchive/include") + set(LibArchive_LIBRARIES "/usr/local/opt/libarchive/lib/libarchive.dylib") else() find_package(LibArchive REQUIRED) endif() @@ -219,6 +222,9 @@ if(ENABLE_LUA_SCRIPTING) # copy lua53.dll to build directory, to be able to run the tests: add_custom_command(TARGET traintastic-server-test POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_SOURCE_DIR}/thirdparty/lua5.3/bin/win64/lua53.dll" .) + elseif(APPLE) + set(LUA_INCLUDE_DIR "/usr/local/opt/lua@5.3/include/lua") + set(LUA_LIBRARIES "/usr/local/opt/lua@5.3/lib/liblua5.3.dylib") else() find_package(Lua 5.3 REQUIRED) endif() From 9ebeadaa73fda5dad71d1dbebb776ce48a730fc2 Mon Sep 17 00:00:00 2001 From: Reinder Feenstra Date: Mon, 18 Apr 2022 23:13:38 +0200 Subject: [PATCH 4/4] CI: added traintastic-server macos-11 build, try 1 --- .github/workflows/build.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 25a37bbe..45b6dd7f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -202,6 +202,18 @@ jobs: defines: "-DDEBIAN_PACKAGE_VERSION_EXTRA=~raspberrypios~buster~$CI_REF_NAME_SLUG~${{github.run_number}}~$CI_SHA_SHORT -DDISABLE_CLANG_TIDY=ON" ccov: false + - name: "macos-11" + os: "macos-11" + generator: "Unix Makefiles" + arch: "" + toolset: "" + target: all + jobs: 3 + build_type: Release + build_deb: false + defines: "-DDISABLE_CLANG_TIDY=ON" + ccov: false + steps: - uses: FranzDiebold/github-env-vars-action@v2 @@ -225,6 +237,11 @@ jobs: if: startswith(matrix.config.os, 'ubuntu') run: sudo apt install liblua5.3-dev lcov libarchive-dev clang-tidy + # MacOS only: + - name: Install brew packages + if: startswith(matrix.config.os, 'macos') + run: brew install libarchive lua@5.3 + # All: - name: Create Build Environment # Some projects don't allow in-source building, so create a separate build directory