slint/api/sixtyfps-cpp/cmake/SixtyFPSConfig.cmake.in
Simon Hausmann 547a732e33 Fix rebuild issues, part 10523
By setting RUSTFLAGS in the Cargo config we run into the situation that
when doing a host build, all rust files are compiled with the flags,
including build.rs. When cross-compiling, build.rs is not build with the
RUSTFLAGS specified. That makes kind of sense, but it also means that
all the build scripts are always recompiled when switching between a
target and a host build - and that applies to *all* packages, including
dependencies.

So short of a better solution, this patch removes the need to set
RUSTFLAGS. It was used to extract the system library dependencies for
the static library we'd create. Instead we're now building two shared
libraries and are linking against them. They contain the rust library
twice, so that's not really a desirable final state either, but
productivity wins right now :-)

It might make sense to go back to creating *one* shared library through
a dedicated crate and -- since 'pub extern "C"' functions are not
transitively exported, it may require re-exporting them by hand or using
some clever build trick perhaps.
2020-06-09 13:08:59 +02:00

26 lines
889 B
CMake

@PACKAGE_INIT@
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
if(_IMPORT_PREFIX STREQUAL "/")
set(_IMPORT_PREFIX "")
endif()
foreach(internal_lib IN ITEMS @internal_libs@)
add_library(${internal_lib} SHARED IMPORTED)
set(fn "${internal_lib}${CMAKE_SHARED_LIBRARY_SUFFIX}")
# Don't look in lib when we're inside a cargo tree, as cargo doesn't use a lib/ sub-dir.
if(EXISTS "${_IMPORT_PREFIX}/${fn}")
else()
set(fn "lib/${fn}")
endif()
set_property(TARGET ${internal_lib} PROPERTY IMPORTED_LOCATION "${_IMPORT_PREFIX}/${fn}")
set(fn)
endforeach()
set(_IMPORT_PREFIX)
include("${CMAKE_CURRENT_LIST_DIR}/SixtyFPSTargets.cmake")