Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 9 additions & 21 deletions support/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,31 @@

# Automatically @generated CMakeLists.txt.

add_library(crubit_support_annotations STATIC
"annotations.h"
)
set_target_properties(crubit_support_annotations PROPERTIES LINKER_LANGUAGE CXX)
add_library(crubit_support_annotations INTERFACE)

target_include_directories(crubit_support_annotations PUBLIC
target_include_directories(crubit_support_annotations INTERFACE
"${CMAKE_CURRENT_SOURCE_DIR}/.."
)

target_link_libraries(crubit_support_annotations PUBLIC
target_link_libraries(crubit_support_annotations INTERFACE
crubit_support_annotations_internal
)

add_library(crubit_support_annotations_internal STATIC
"annotations_internal.h"
)
set_target_properties(crubit_support_annotations_internal PROPERTIES LINKER_LANGUAGE CXX)
add_library(crubit_support_annotations_internal INTERFACE)

target_include_directories(crubit_support_annotations_internal PUBLIC
target_include_directories(crubit_support_annotations_internal INTERFACE
"${CMAKE_CURRENT_SOURCE_DIR}/.."
)

add_library(crubit_support_bridge_cpp STATIC
"bridge.h"
)
set_target_properties(crubit_support_bridge_cpp PROPERTIES LINKER_LANGUAGE CXX)
add_library(crubit_support_bridge_cpp INTERFACE)

target_include_directories(crubit_support_bridge_cpp PUBLIC
target_include_directories(crubit_support_bridge_cpp INTERFACE
"${CMAKE_CURRENT_SOURCE_DIR}/.."
)

add_library(crubit_support_lifetime_annotations STATIC
"lifetime_annotations.h"
)
set_target_properties(crubit_support_lifetime_annotations PROPERTIES LINKER_LANGUAGE CXX)
add_library(crubit_support_lifetime_annotations INTERFACE)

target_include_directories(crubit_support_lifetime_annotations PUBLIC
target_include_directories(crubit_support_lifetime_annotations INTERFACE
"${CMAKE_CURRENT_SOURCE_DIR}/.."
)

91 changes: 29 additions & 62 deletions support/rs_std/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,137 +20,104 @@ crubit_support_annotations
crubit_support_internal_bindings_support
)

add_library(crubit_support_rs_std_dyn_callable STATIC
"dyn_callable.h"
)
set_target_properties(crubit_support_rs_std_dyn_callable PROPERTIES LINKER_LANGUAGE CXX)
add_library(crubit_support_rs_std_dyn_callable INTERFACE)

target_include_directories(crubit_support_rs_std_dyn_callable PUBLIC
target_include_directories(crubit_support_rs_std_dyn_callable INTERFACE
"${CMAKE_CURRENT_SOURCE_DIR}/../.."
)

target_link_libraries(crubit_support_rs_std_dyn_callable PUBLIC
target_link_libraries(crubit_support_rs_std_dyn_callable INTERFACE
absl::core_headers
absl::nullability
absl::any_invocable
crubit_support_bridge_cpp
)

add_library(crubit_support_rs_std_dyn_erased_future_cc STATIC
"dyn_erased_future.h"
)
set_target_properties(crubit_support_rs_std_dyn_erased_future_cc PROPERTIES LINKER_LANGUAGE CXX)
add_library(crubit_support_rs_std_dyn_erased_future_cc INTERFACE)

target_include_directories(crubit_support_rs_std_dyn_erased_future_cc PUBLIC
target_include_directories(crubit_support_rs_std_dyn_erased_future_cc INTERFACE
"${CMAKE_CURRENT_SOURCE_DIR}/../.."
)

target_link_libraries(crubit_support_rs_std_dyn_erased_future_cc PUBLIC
target_link_libraries(crubit_support_rs_std_dyn_erased_future_cc INTERFACE
crubit_support_rs_std_waker
)

add_library(crubit_support_rs_std_iterator_adapter STATIC
"iterator_adapter.h"
)
set_target_properties(crubit_support_rs_std_iterator_adapter PROPERTIES LINKER_LANGUAGE CXX)
add_library(crubit_support_rs_std_iterator_adapter INTERFACE)

target_include_directories(crubit_support_rs_std_iterator_adapter PUBLIC
target_include_directories(crubit_support_rs_std_iterator_adapter INTERFACE
"${CMAKE_CURRENT_SOURCE_DIR}/../.."
)

target_link_libraries(crubit_support_rs_std_iterator_adapter PUBLIC
target_link_libraries(crubit_support_rs_std_iterator_adapter INTERFACE
crubit_support_rs_std_traits
)

add_library(crubit_support_rs_std_lossy_formatter_for_bindings STATIC
"lossy_formatter_for_bindings.h"
)
set_target_properties(crubit_support_rs_std_lossy_formatter_for_bindings PROPERTIES LINKER_LANGUAGE CXX)
add_library(crubit_support_rs_std_lossy_formatter_for_bindings INTERFACE)

target_include_directories(crubit_support_rs_std_lossy_formatter_for_bindings PUBLIC
target_include_directories(crubit_support_rs_std_lossy_formatter_for_bindings INTERFACE
"${CMAKE_CURRENT_SOURCE_DIR}/../.."
)

add_library(crubit_support_rs_std_option STATIC
"option.h"
)
set_target_properties(crubit_support_rs_std_option PROPERTIES LINKER_LANGUAGE CXX)
add_library(crubit_support_rs_std_option INTERFACE)

target_include_directories(crubit_support_rs_std_option PUBLIC
target_include_directories(crubit_support_rs_std_option INTERFACE
"${CMAKE_CURRENT_SOURCE_DIR}/../.."
)

target_link_libraries(crubit_support_rs_std_option PUBLIC
target_link_libraries(crubit_support_rs_std_option INTERFACE
crubit_support_internal_bindings_support
)

add_library(crubit_support_rs_std_result STATIC
"result.h"
)
set_target_properties(crubit_support_rs_std_result PROPERTIES LINKER_LANGUAGE CXX)
add_library(crubit_support_rs_std_result INTERFACE)

target_include_directories(crubit_support_rs_std_result PUBLIC
target_include_directories(crubit_support_rs_std_result INTERFACE
"${CMAKE_CURRENT_SOURCE_DIR}/../.."
)

target_link_libraries(crubit_support_rs_std_result PUBLIC
target_link_libraries(crubit_support_rs_std_result INTERFACE
crubit_support_internal_bindings_support
)

add_library(crubit_support_rs_std_slice_ref STATIC
"slice_ref.h"
)
set_target_properties(crubit_support_rs_std_slice_ref PROPERTIES LINKER_LANGUAGE CXX)
add_library(crubit_support_rs_std_slice_ref INTERFACE)

target_include_directories(crubit_support_rs_std_slice_ref PUBLIC
target_include_directories(crubit_support_rs_std_slice_ref INTERFACE
"${CMAKE_CURRENT_SOURCE_DIR}/../.."
)

target_link_libraries(crubit_support_rs_std_slice_ref PUBLIC
target_link_libraries(crubit_support_rs_std_slice_ref INTERFACE
crubit_support_annotations
crubit_support_internal_bindings_support
)

add_library(crubit_support_rs_std_str_ref STATIC
"str_ref.h"
)
set_target_properties(crubit_support_rs_std_str_ref PROPERTIES LINKER_LANGUAGE CXX)
add_library(crubit_support_rs_std_str_ref INTERFACE)

target_include_directories(crubit_support_rs_std_str_ref PUBLIC
target_include_directories(crubit_support_rs_std_str_ref INTERFACE
"${CMAKE_CURRENT_SOURCE_DIR}/../.."
)

target_link_libraries(crubit_support_rs_std_str_ref PUBLIC
target_link_libraries(crubit_support_rs_std_str_ref INTERFACE
crubit_support_rs_std_slice_ref
crubit_support_annotations_internal
crubit_support_internal_bindings_support
crubit_support_rs_std_internal_is_utf8
)

add_library(crubit_support_rs_std_traits STATIC
"traits.h"
)
set_target_properties(crubit_support_rs_std_traits PROPERTIES LINKER_LANGUAGE CXX)
add_library(crubit_support_rs_std_traits INTERFACE)

target_include_directories(crubit_support_rs_std_traits PUBLIC
target_include_directories(crubit_support_rs_std_traits INTERFACE
"${CMAKE_CURRENT_SOURCE_DIR}/../.."
)

add_library(crubit_support_rs_std_tuple STATIC
"tuple.h"
)
set_target_properties(crubit_support_rs_std_tuple PROPERTIES LINKER_LANGUAGE CXX)
add_library(crubit_support_rs_std_tuple INTERFACE)

target_include_directories(crubit_support_rs_std_tuple PUBLIC
target_include_directories(crubit_support_rs_std_tuple INTERFACE
"${CMAKE_CURRENT_SOURCE_DIR}/../.."
)

add_library(crubit_support_rs_std_vec STATIC
"vec.h"
)
set_target_properties(crubit_support_rs_std_vec PROPERTIES LINKER_LANGUAGE CXX)
add_library(crubit_support_rs_std_vec INTERFACE)

target_include_directories(crubit_support_rs_std_vec PUBLIC
target_include_directories(crubit_support_rs_std_vec INTERFACE
"${CMAKE_CURRENT_SOURCE_DIR}/../.."
)

Expand Down
7 changes: 2 additions & 5 deletions support/rs_std/internal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@

# Automatically @generated CMakeLists.txt.

@KHicketts KHicketts Jul 15, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing since these are autogenerated, the fix is actually in some generation script that I don't have access to?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have guessed correctly! Originally I wanted to open source our generation script but it's relatively entangled with our internal tooling atm and I don't have a good fix for it. But I can certainly reflect this change upstream and post here once the CMake is updated.

If you could help me out with understanding this fix that would be appreciated. My CMake knowledge is relatively limited. My understanding was PUBLIC was a superset of functionality of INTERFACE. Is that correct? And if so, why does swapping to INTERFACE fix the CMake build on mac?

Thank you for the PR!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:) thanks for the fast response!

That's a very fair question. It took me a while to understand it as well.

add_library(blah INTERFACE) [instead of STATIC] is the bit that actually fixes the build. [stops the empty archive creation]

You are correct about PUBLIC ----> PUBLIC = PRIVATE (let's .cc files see path) + INTERFACE (exposes path to consumers)

The PUBLIC -> INTERFACE changes are required because we changed the library to INTERFACE - we get a configuration error otherwise. CMake won't let you keep it as public.

In reality the PRIVATE part wasn't doing anything. It only applies to compiling the libraries own cc files and there weren't any so it's safe to drop it. PUBLIC - PRIVATE = INTERFACE.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the explanation I was missing the change in behavior from swapping STATIC -> INTERFACE. I've updated our CMakeLists.txt and they should now use INTERFACE everywhere in place of STATIC/PUBLIC.

It's exciting to hear you're trying out Crubit on mac. As you can see we have not done extensive testing for it yet. Is mac the host platform or the target platform?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks very much Ethan :). Mac is just my dev box. I wanted to look into getting this working with gcc as an experiment. Would be great to chat about it if you have bandwidth. 👀 It's easy to find a Hicketts on LinkedIn.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would be happy to do that! I'll reach out on LinkedIn. We also recently started a discord server, so it's easier for us to talk to OSS users: https://discord.gg/SpBTWJrH


add_library(crubit_support_rs_std_internal_is_utf8 STATIC
"is_utf8.h"
)
set_target_properties(crubit_support_rs_std_internal_is_utf8 PROPERTIES LINKER_LANGUAGE CXX)
add_library(crubit_support_rs_std_internal_is_utf8 INTERFACE)

target_include_directories(crubit_support_rs_std_internal_is_utf8 PUBLIC
target_include_directories(crubit_support_rs_std_internal_is_utf8 INTERFACE
"${CMAKE_CURRENT_SOURCE_DIR}/../../.."
)