Skip to content

Commit 93bf83d

Browse files
authored
temp: fix ros builds when FETCHCONTENT_FULLY_DISABLE is ON, aka the ros build farm (#45)
* clean up ament target dependencies deprecation * update bonxai version * add bonxai core source to dependencies/bonxai with a check to include only on specific conditions
1 parent cc2fdc5 commit 93bf83d

File tree

10 files changed

+1791
-23
lines changed

10 files changed

+1791
-23
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
The code here is covered by Bonxai's [LICENSE](../LICENSE) file.
2+
Please note that this is essentially a hack to fix a very specific case encountered in the ROS build farm.
3+
I'm repeating the comment i have from [bonxai.cmake](bonxai.cmake) here.
4+
5+
The ros build farm uses `FETCHCONTENT_FULLY_DISCONNECTED` to perform an isolated build.
6+
But as per the author of FetchContent himself, this is an abuse of the flag.
7+
See https://github.com/Homebrew/brew/pull/17075 and https://gitlab.kitware.com/cmake/cmake/-/issues/25946.
8+
Nevertheless this is a problem for us since Bonxai is not part of rosdistro (or any upstream system package repo) yet.
9+
See here for possible progress: https://github.com/facontidavide/Bonxai/issues/55.
10+
11+
Since a user can use this flag as valid behavior, my best attempt at fixing this issue for the build farm is to vendor Bonxai code right here.
12+
Hopefully soon enough, one way or another, I can remove this hack and stop vendoring bonxai code in my own repository.
Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,38 @@
11
FetchContent_Declare(
22
Bonxai
33
GIT_REPOSITORY https://github.com/facontidavide/Bonxai.git
4-
GIT_TAG 47ffd0a2917c899f6199dfa71445481164298006 # apr 7 2025 master
4+
GIT_TAG 02d401b1ce38bce870c6704bcd4e35a56a641411 # sep 14 2025 master
55
SOURCE_SUBDIR
66
bonxai_core
77
SYSTEM
88
EXCLUDE_FROM_ALL
99
OVERRIDE_FIND_PACKAGE)
1010
FetchContent_MakeAvailable(Bonxai)
11+
12+
if(FETCHCONTENT_FULLY_DISCONNECTED)
13+
# the ros build farm uses this option to perform an isolated build. but as per
14+
# the author of FetchContent himself, this is an abuse of the flag. See
15+
# https://github.com/Homebrew/brew/pull/17075 and
16+
# https://gitlab.kitware.com/cmake/cmake/-/issues/25946. Nevertheless this is
17+
# a problem for us since Bonxai is not part of rosdistro yet. See here for
18+
# progress: https://github.com/facontidavide/Bonxai/issues/55. Since a user
19+
# can use this flag as valid behavior, the following is my best attempt at
20+
# catching the specific situation in the build farm. Hopefully soon enough, i
21+
# can remove this hack and stop vendoring bonxai code in my own repository.
22+
23+
file(
24+
GLOB_RECURSE bonxai_source_files
25+
LIST_DIRECTORIES false
26+
"${bonxai_SOURCE_DIR}/*")
27+
28+
list(LENGTH bonxai_source_files bonxai_source_count)
29+
30+
if(bonxai_source_count EQUAL 0)
31+
message(
32+
WARNING
33+
"Bonxai source directory (${bonxai_SOURCE_DIR}) is empty and FETCHCONTENT_FULLY_DISCONNECTED is ON. This is likely unintended. Bonxai will be manually included for now as it is a required dependency."
34+
)
35+
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/bonxai_core)
36+
endif()
37+
38+
endif()
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
add_library(bonxai_core INTERFACE
2+
include/bonxai/bonxai.hpp
3+
include/bonxai/serialization.hpp
4+
include/bonxai/grid_coord.hpp
5+
)
6+
set_target_properties(bonxai_core PROPERTIES LINKER_LANGUAGE CXX)
7+
8+
target_include_directories(bonxai_core PUBLIC INTERFACE
9+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
10+
$<INSTALL_INTERFACE:include>)

0 commit comments

Comments
 (0)