Skip to content

Commit cb6341d

Browse files
committed
Merge commit 'f52027f9d5646dad0f31cdac32e7e06588664c58'
2 parents 9f810e9 + f52027f commit cb6341d

4 files changed

Lines changed: 131 additions & 3 deletions

File tree

CMakeLists.txt

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,16 @@
1111
# Creation date: 2026-03-05T19:28:13.964+0100
1212
# NOTICE: MADS Version 2.0.0
1313
cmake_minimum_required(VERSION 3.28)
14+
# Match the prebuilt rerun_c library's deployment target to suppress
15+
# "was built for newer macOS version" linker warnings.
16+
if(APPLE AND NOT CMAKE_OSX_DEPLOYMENT_TARGET)
17+
set(CMAKE_OSX_DEPLOYMENT_TARGET "26.2" CACHE STRING "Minimum macOS deployment target")
18+
endif()
1419
project(machinetool VERSION 2.0.0 LANGUAGES CXX)
1520
if(CMAKE_BUILD_TYPE STREQUAL "")
1621
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build." FORCE)
1722
endif()
23+
set(CMAKE_POLICY_VERSION_MINIMUM 3.5)
1824
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
1925
set(CMAKE_INSTALL_PREFIX "/Users/p4010/usr/local" CACHE PATH "Install path prefix, prepended onto install directories." FORCE)
2026
endif()
@@ -57,8 +63,15 @@ FetchContent_Declare(json
5763
)
5864

5965
FetchContent_Declare(rerun_cpp_sdk
60-
URL https://github.com/rerun-io/rerun/releases/download/0.27.3/rerun_cpp_sdk.zip
66+
URL https://github.com/rerun-io/rerun/releases/download/0.31.4/rerun_cpp_sdk.zip
6167
EXCLUDE_FROM_ALL
68+
# Arrow (a rerun dependency) is downloaded as a tarball, so "git apply" in
69+
# rerun's own PATCH_COMMAND always fails silently. We replace it with a
70+
# cmake -P script that applies the same fixes without needing git history.
71+
# See patches/patch_arrow_cmake4.cmake for details.
72+
PATCH_COMMAND ${CMAKE_COMMAND}
73+
-DPATCHES_DIR=${CMAKE_CURRENT_SOURCE_DIR}/patches
74+
-P ${CMAKE_CURRENT_SOURCE_DIR}/patches/patch_rerun_sdk.cmake
6275
)
6376

6477
# rerun_cpp tests call this helper when building standalone; define a no-op fallback.
@@ -101,7 +114,14 @@ macro(add_plugin name)
101114
add_library(${name} SHARED ${SRC_DIR}/${name}.cpp ${plugin_SRCS})
102115
add_executable(${name}_main ${SRC_DIR}/${name}.cpp ${plugin_SRCS})
103116
target_link_libraries(${name}_main PRIVATE pugg ${plugin_LIBS})
104-
set_target_properties(${name}_main PROPERTIES OUTPUT_NAME ${name})
117+
if(WIN32)
118+
set_target_properties(${name}_main PROPERTIES
119+
OUTPUT_NAME ${name}
120+
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/exe"
121+
PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/exe")
122+
else()
123+
set_target_properties(${name}_main PROPERTIES OUTPUT_NAME ${name})
124+
endif()
105125
set(${name}_EXEC ${name})
106126
list(APPEND TARGET_LIST ${name}_main)
107127
endif()

patches/patch_arrow_cmake4.cmake

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Patch Arrow cmake modules for CMake 4.x / Apple toolchain compatibility.
2+
# Invoked as PATCH_COMMAND in the arrow_cpp ExternalProject; CWD is the
3+
# Arrow source root (e.g. build/_deps/rerun_cpp_sdk-build/arrow/src/arrow_cpp).
4+
5+
cmake_minimum_required(VERSION 3.20)
6+
7+
# Fix 1: BuildUtils.cmake — Apple's libtool version string changed from
8+
# "cctools-XXXX" to "cctools_ld-XXXX" in recent Xcode / CLT releases,
9+
# causing Arrow to mistake Apple libtool for the incompatible GNU libtool.
10+
set(_f "cpp/cmake_modules/BuildUtils.cmake")
11+
if(EXISTS "${_f}")
12+
file(READ "${_f}" _c)
13+
if(_c MATCHES [[cctools-\(\[0-9]])
14+
string(REPLACE
15+
[[if(NOT "${LIBTOOL_V_OUTPUT}" MATCHES ".*cctools-([0-9.]+).*")]]
16+
[[if(NOT "${LIBTOOL_V_OUTPUT}" MATCHES ".*cctools")]]
17+
_c "${_c}")
18+
file(WRITE "${_f}" "${_c}")
19+
message(STATUS "[arrow-patch] Fixed libtool detection in ${_f}")
20+
else()
21+
message(STATUS "[arrow-patch] ${_f} already patched or different version, skipping")
22+
endif()
23+
endif()
24+
25+
# Fix 2: ThirdpartyToolchain.cmake — propagate CMAKE_POLICY_VERSION_MINIMUM
26+
# into the nested mimalloc ExternalProject so it can configure under CMake 4.x
27+
# (cmake_minimum_required VERSION < 3.5 became a hard error in CMake 4.0).
28+
# This replicates the content of rerun_cpp_sdk's mimalloc_cmake4.patch without
29+
# requiring git history.
30+
set(_f "cpp/cmake_modules/ThirdpartyToolchain.cmake")
31+
if(EXISTS "${_f}")
32+
file(READ "${_f}" _c)
33+
if(NOT _c MATCHES "MIMALLOC_POLICY_ARGS")
34+
string(REPLACE
35+
[[ set(MIMALLOC_CMAKE_ARGS
36+
${EP_COMMON_CMAKE_ARGS}
37+
"-DCMAKE_INSTALL_PREFIX=${MIMALLOC_PREFIX}"
38+
-DMI_OVERRIDE=OFF
39+
-DMI_LOCAL_DYNAMIC_TLS=ON
40+
-DMI_BUILD_OBJECT=OFF
41+
-DMI_BUILD_SHARED=OFF
42+
-DMI_BUILD_TESTS=OFF)]]
43+
[[ if(CMAKE_POLICY_VERSION_MINIMUM)
44+
set(MIMALLOC_POLICY_ARGS
45+
-DCMAKE_POLICY_VERSION_MINIMUM=${CMAKE_POLICY_VERSION_MINIMUM})
46+
else()
47+
set(MIMALLOC_POLICY_ARGS "")
48+
endif()
49+
50+
set(MIMALLOC_CMAKE_ARGS
51+
${EP_COMMON_CMAKE_ARGS}
52+
"-DCMAKE_INSTALL_PREFIX=${MIMALLOC_PREFIX}"
53+
-DMI_OVERRIDE=OFF
54+
-DMI_LOCAL_DYNAMIC_TLS=ON
55+
-DMI_BUILD_OBJECT=OFF
56+
-DMI_BUILD_SHARED=OFF
57+
-DMI_BUILD_TESTS=OFF
58+
${MIMALLOC_POLICY_ARGS}
59+
)]]
60+
_c "${_c}")
61+
file(WRITE "${_f}" "${_c}")
62+
message(STATUS "[arrow-patch] Fixed mimalloc policy propagation in ${_f}")
63+
else()
64+
message(STATUS "[arrow-patch] ${_f} already patched, skipping")
65+
endif()
66+
endif()

patches/patch_rerun_sdk.cmake

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Patches rerun_cpp_sdk's download_and_build_arrow.cmake to replace
2+
# git apply --check ... && git apply ... || true
3+
# with
4+
# cmake -P patch_arrow_cmake4.cmake
5+
#
6+
# Arrow is downloaded as a tar.gz (no git history), so "git apply" always
7+
# fails silently (the "|| true" hides it) and the patches are never applied.
8+
# cmake -P works regardless of VCS history.
9+
#
10+
# PATCHES_DIR — absolute path to this project's patches/ directory.
11+
# Passed as -DPATCHES_DIR=... by the caller.
12+
13+
cmake_minimum_required(VERSION 3.20)
14+
15+
if(NOT PATCHES_DIR)
16+
message(FATAL_ERROR "[rerun-patch] PATCHES_DIR must be set (-DPATCHES_DIR=<abs-path>)")
17+
endif()
18+
19+
set(_f "download_and_build_arrow.cmake")
20+
if(NOT EXISTS "${_f}")
21+
message(FATAL_ERROR "[rerun-patch] Cannot find ${_f}; CWD must be the rerun_cpp_sdk source root")
22+
endif()
23+
24+
file(READ "${_f}" _c)
25+
26+
# Idempotency guard
27+
if(_c MATCHES "patch_arrow_cmake4")
28+
message(STATUS "[rerun-patch] ${_f} already patched, skipping")
29+
return()
30+
endif()
31+
32+
# Replace the silent-failing git apply with a cmake -P invocation.
33+
# \${CMAKE_COMMAND} writes the literal cmake variable reference so that
34+
# rerun_cpp_sdk's own cmake expands it to the cmake executable path at
35+
# Arrow ExternalProject configuration time.
36+
string(REPLACE
37+
[[git apply --check ${MIMALLOC_PATCH} && git apply ${MIMALLOC_PATCH} || true]]
38+
"\${CMAKE_COMMAND} -P \"${PATCHES_DIR}/patch_arrow_cmake4.cmake\""
39+
_c "${_c}")
40+
41+
file(WRITE "${_f}" "${_c}")
42+
message(STATUS "[rerun-patch] Replaced git apply with cmake -P in ${_f}")

src/machine_viewer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ struct MachineViewer::Impl {
115115

116116
const auto length_f = static_cast<float>(length);
117117
const auto radius_f = static_cast<float>(diameter * 0.5);
118-
const auto center = rerun::components::PoseTranslation3D(
118+
const auto center = rerun::components::Translation3D(
119119
0.0F,
120120
0.0F,
121121
-0.5F * length_f + static_cast<float>(_tool_z_offset)

0 commit comments

Comments
 (0)