mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-01 06:11:16 +00:00
Fix C++ build
Map the target_pointer_width cfg's used for the opaque ffi interpreter data structures to #ifdefs in CMake, to avoid that cbindgen generates them multiple times without guard.
This commit is contained in:
parent
4ee0a02366
commit
272a87ccf1
2 changed files with 14 additions and 0 deletions
|
@ -24,6 +24,13 @@ add_library(SixtyFPS INTERFACE)
|
|||
add_library(SixtyFPS::SixtyFPS ALIAS SixtyFPS)
|
||||
target_link_libraries(SixtyFPS INTERFACE sixtyfps-cpp)
|
||||
target_compile_features(SixtyFPS INTERFACE cxx_std_17)
|
||||
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
target_compile_definitions(SixtyFPS INTERFACE SIXTYFPS_TARGET_64)
|
||||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
target_compile_definitions(SixtyFPS INTERFACE SIXTYFPS_TARGET_32)
|
||||
else()
|
||||
message(FATAL_ERROR "Unsupported CPU target architecture where the pointer size is neiter 4 nor 8")
|
||||
endif()
|
||||
|
||||
file(GLOB api_headers RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/include/"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include/*.h")
|
||||
|
|
|
@ -33,6 +33,13 @@ fn default_config() -> cbindgen::Config {
|
|||
.collect(),
|
||||
..Default::default()
|
||||
},
|
||||
defines: [
|
||||
("target_pointer_width = 64".into(), "SIXTYFPS_TARGET_64".into()),
|
||||
("target_pointer_width = 32".into(), "SIXTYFPS_TARGET_32".into()),
|
||||
]
|
||||
.iter()
|
||||
.cloned()
|
||||
.collect(),
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue