mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-01 06:11:16 +00:00
Make it possible to use the C++ headers without CMake
Detect the pointer size solely via the pre-processor
This commit is contained in:
parent
7a708525d9
commit
3f6bbaf53a
3 changed files with 19 additions and 7 deletions
|
@ -24,13 +24,6 @@ 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")
|
||||
|
|
18
api/sixtyfps-cpp/include/sixtyfps_config.h
Normal file
18
api/sixtyfps-cpp/include/sixtyfps_config.h
Normal file
|
@ -0,0 +1,18 @@
|
|||
/* LICENSE BEGIN
|
||||
This file is part of the SixtyFPS Project -- https://sixtyfps.io
|
||||
Copyright (c) 2020 Olivier Goffart <olivier.goffart@sixtyfps.io>
|
||||
Copyright (c) 2020 Simon Hausmann <simon.hausmann@sixtyfps.io>
|
||||
|
||||
SPDX-License-Identifier: GPL-3.0-only
|
||||
This file is also available under commercial licensing terms.
|
||||
Please contact info@sixtyfps.io for more information.
|
||||
LICENSE END */
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#if UINTPTR_MAX == 0xFFFFFFFF
|
||||
# define SIXTYFPS_TARGET_32
|
||||
#elif UINTPTR_MAX == 0xFFFFFFFFFFFFFFFFu
|
||||
# define SIXTYFPS_TARGET_64
|
||||
#endif
|
|
@ -256,6 +256,7 @@ fn gen_corelib(root_dir: &Path, include_dir: &Path) -> anyhow::Result<()> {
|
|||
cbindgen::Builder::new()
|
||||
.with_config(config)
|
||||
.with_src(crate_dir.join("lib.rs"))
|
||||
.with_include("sixtyfps_config.h")
|
||||
.with_include("vtable.h")
|
||||
.with_include("sixtyfps_string.h")
|
||||
.with_include("sixtyfps_sharedvector.h")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue