mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-02 22:54:36 +00:00

The cargo target directory tree is now populated with a cmake package file and that's also installed into the prefix specified with the cargo cmake xtask. As a consequence, the cpptest example can be built by first building the cmake package: cargo xtask cmake or cargo xtask cmake --release --target some-triplet) or cargo xtask cmake --release --prefix /somewhere --install and then run cmake in the cpptest example with a prefix path: -DCMAKE_PREFIX_PATH=/where/you/installed/it or simply -DCMAKE_PREFIX_PATH=../../target/debug for example. Pending still is the sixtyfps compiler tool installation and discovery.
41 lines
1.5 KiB
CMake
41 lines
1.5 KiB
CMake
cmake_minimum_required(VERSION 3.14)
|
|
project(sixtyfps_cpptest LANGUAGES CXX)
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
|
|
### BEGIN This should be moce in some file in api/sixtyfps-cpp/cmake
|
|
|
|
|
|
#FIXME: i guess this file need to be generated so it knows where to look
|
|
find_program(SIXTYFPS_COMPILER sixtyfps_compiler HINTS
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../../target/release
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../../target/debug )
|
|
|
|
# FIXME that's not where all the things are
|
|
get_filename_component(_SIXTYFPS_TARGET_DIR ${SIXTYFPS_COMPILER} DIRECTORY)
|
|
|
|
|
|
function(SIXTYFPS_TARGET_60_SOURCES target)
|
|
foreach (it IN ITEMS ${ARGN})
|
|
get_filename_component(_60_BASE_NAME ${it} NAME_WE)
|
|
get_filename_component(_60_ABSOLUTE ${it} REALPATH BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
add_custom_command(
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_60_BASE_NAME}.h
|
|
COMMAND ${SIXTYFPS_COMPILER} ${_60_ABSOLUTE} > ${CMAKE_CURRENT_BINARY_DIR}/${_60_BASE_NAME}.h
|
|
DEPENDS ${_60_ABSOLUTE} ${SIXTYFPS_COMPILER}
|
|
COMMENT "Running sixtyfps_compiler on ${it}")
|
|
target_sources(${target} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/${_60_BASE_NAME}.h)
|
|
|
|
endforeach()
|
|
# FIXME: DO WE NEED THIS HERE?
|
|
target_include_directories(${target} PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
|
endfunction()
|
|
|
|
find_package(SixtyFPS REQUIRED)
|
|
|
|
### END This should be moce in some file in api/sixtyfps-cpp/cmake
|
|
|
|
add_executable(hello main.cpp)
|
|
target_link_libraries(hello SixtyFPS::SixtyFPS)
|
|
sixtyfps_target_60_sources(hello hello.60)
|