Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F85950395
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ae0a4eb..e0a1954 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,66 +1,71 @@
cmake_minimum_required(VERSION 3.23)
project(vodozemac-bindings)
include(GNUInstallDirs)
include(CTest)
find_package(Perl REQUIRED)
find_package(Corrosion REQUIRED)
# corrosion_import_crate requires that lib.rs exist, so we must generate it right now when configuring
message(STATUS "Generating lib.rs")
execute_process(COMMAND "${PERL_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/cpp/inject-maybe"
"${CMAKE_SOURCE_DIR}/cpp/src/lib.rs.in" "${CMAKE_BINARY_DIR}/vodozemac.lib.rs"
ERROR_FILE "${CMAKE_BINARY_DIR}/vodozemac.lib.rs.log"
COMMAND_ERROR_IS_FATAL ANY)
# Use a temporary file and copy it into place to avoid unnecessarily updating it
configure_file("${CMAKE_BINARY_DIR}/vodozemac.lib.rs" "${CMAKE_SOURCE_DIR}/cpp/src/lib.rs" COPYONLY)
corrosion_import_crate(MANIFEST_PATH cpp/Cargo.toml)
add_library(vodozemac-shared SHARED)
-add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/vodozemac.h"
- COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_BINARY_DIR}/cargo/build/${Rust_CARGO_TARGET}/cxxbridge/vodozemac/src/lib.rs.h" "${CMAKE_BINARY_DIR}/vodozemac.h"
+add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/vodozemac-dummy.cpp"
+ COMMAND "${CMAKE_COMMAND}" -E touch "${CMAKE_BINARY_DIR}/vodozemac-dummy.cpp" VERBATIM)
+# copy the header. if we install the lib.rs.h directly, we will install a symlink.
+add_custom_target(vodezemac-header ALL
+ "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_BINARY_DIR}/cargo/build/${Rust_CARGO_TARGET}/cxxbridge/vodozemac/src/lib.rs.h" "${CMAKE_BINARY_DIR}/vodozemac.h"
VERBATIM
+ BYPRODUCTS "${CMAKE_BINARY_DIR}/vodozemac.h"
DEPENDS vodozemac-static
)
set(vodozemac_HEADERS "${CMAKE_BINARY_DIR}/vodozemac.h")
target_sources(
vodozemac-shared
- PRIVATE
- FILE_SET HEADERS FILES ${vodozemac_HEADERS})
+ PRIVATE "${CMAKE_BINARY_DIR}/vodozemac-dummy.cpp"
+)
set_target_properties(vodozemac-shared
PROPERTIES
LINKER_LANGUAGE CXX
OUTPUT_NAME vodozemac
EXPORT_NAME vodozemac
VERSION 1.0.0
SOVERSION 4
)
target_link_libraries(vodozemac-shared PRIVATE "$<LINK_LIBRARY:WHOLE_ARCHIVE,vodozemac-static>")
target_include_directories(vodozemac-shared INTERFACE
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
+
install(FILES ${vodozemac_HEADERS} TYPE INCLUDE RENAME vodozemac.h)
install(TARGETS vodozemac-shared EXPORT vodozemacTargets LIBRARY)
set(ConfigPackageLocation ${CMAKE_INSTALL_LIBDIR}/cmake/vodozemac)
install(
EXPORT vodozemacTargets
NAMESPACE vodozemac::
DESTINATION ${ConfigPackageLocation}
)
install(
FILES cmake/vodozemacConfig.cmake
DESTINATION ${ConfigPackageLocation})
if(BUILD_TESTING)
find_package(Catch2 REQUIRED)
find_package(Boost REQUIRED COMPONENTS json)
find_package(Olm REQUIRED)
add_subdirectory(cpp/tests)
endif()
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Wed, Nov 18, 4:17 PM (1 d, 14 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1839579
Default Alt Text
(2 KB)
Attached To
Mode
rVB vodozemac-bindings
Attached
Detach File
Event Timeline