File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -192,6 +192,8 @@ corrosion_import_crate(MANIFEST_PATH <path/to/cargo.toml>
192
192
[NO_DEFAULT_FEATURES]
193
193
# Disable linking of standard libraries (required for no_std crates).
194
194
[NO_STD]
195
+ # Add headers generated by cxx-build or cxx-qt-build to include paths
196
+ [CODE_GENERATOR]
195
197
# Specify cargo build profile (e.g. release or a custom profile)
196
198
[PROFILE <cargo-profile>]
197
199
# Only import the specified crates from a workspace
Original file line number Diff line number Diff line change @@ -821,6 +821,11 @@ function(_add_cargo_build out_cargo_build_out_dir)
821
821
if (COR_NO_STD)
822
822
set (no_default_libraries_arg --no -default-libraries)
823
823
endif ()
824
+ if (COR_CODE_GENERATOR)
825
+ set (generated_header_dir "${CMAKE_CURRENT_BINARY_DIR} /generated-code" )
826
+ target_include_directories ("${target_name} " INTERFACE "${generated_header_dir} " )
827
+ set (generated_header_dir_env "GENERATED_HEADER_DIR=${generated_header_dir} " )
828
+ endif ()
824
829
825
830
set (global_rustflags_target_property "$<TARGET_GENEX_EVAL:${target_name} ,$<TARGET_PROPERTY:${target_name} ,INTERFACE_CORROSION_RUSTFLAGS>>" )
826
831
set (local_rustflags_target_property "$<TARGET_GENEX_EVAL:${target_name} ,$<TARGET_PROPERTY:${target_name} ,INTERFACE_CORROSION_LOCAL_RUSTFLAGS>>" )
@@ -954,6 +959,7 @@ function(_add_cargo_build out_cargo_build_out_dir)
954
959
"${cargo_target_linker} "
955
960
"${corrosion_cc_rs_flags} "
956
961
"${cargo_library_path} "
962
+ "${generated_header_dir_env} "
957
963
"CORROSION_BUILD_DIR=${CMAKE_CURRENT_BINARY_DIR} "
958
964
"CARGO_BUILD_RUSTC=${_CORROSION_RUSTC} "
959
965
"${_CORROSION_CARGO} "
@@ -1026,7 +1032,7 @@ function(_add_cargo_build out_cargo_build_out_dir)
1026
1032
endfunction ()
1027
1033
1028
1034
function (corrosion_import_crate)
1029
- set (OPTIONS ALL_FEATURES NO_DEFAULT_FEATURES NO_STD)
1035
+ set (OPTIONS ALL_FEATURES NO_DEFAULT_FEATURES NO_STD CODE_GENERATOR )
1030
1036
set (ONE_VALUE_KEYWORDS MANIFEST_PATH PROFILE)
1031
1037
set (MULTI_VALUE_KEYWORDS CRATES FEATURES FLAGS )
1032
1038
cmake_parse_arguments (COR "${OPTIONS} " "${ONE_VALUE_KEYWORDS} " "${MULTI_VALUE_KEYWORDS} " ${ARGN} )
You can’t perform that action at this time.
0 commit comments