mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-30 13:51:13 +00:00
40 lines
1.6 KiB
CMake
40 lines
1.6 KiB
CMake
cmake_minimum_required(VERSION 3.14)
|
|
project(sixtyfps_cpptest LANGUAGES CXX)
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
|
|
### BEGIN This should be moved 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 HINTS ${_SIXTYFPS_TARGET_DIR})
|
|
|
|
### END This should be moved in some file in api/sixtyfps-cpp/cmake
|
|
|
|
add_executable(printerdemo main.cpp)
|
|
target_link_libraries(printerdemo SixtyFPS::SixtyFPS)
|
|
sixtyfps_target_60_sources(printerdemo ../ui/printerdemo.60)
|