mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Run cargo from CMake
This commit is contained in:
+13
-6
@@ -24,8 +24,6 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
# External Projects
|
||||
##############################
|
||||
|
||||
add_library(libloot-cxx STATIC IMPORTED)
|
||||
|
||||
if(MSVC)
|
||||
set(LIBLOOT_CXX_FILENAME "libloot_cxx.lib")
|
||||
else()
|
||||
@@ -38,10 +36,19 @@ else()
|
||||
set(TARGET_PATH "${CMAKE_SOURCE_DIR}/../target")
|
||||
endif()
|
||||
|
||||
set_target_properties(libloot-cxx PROPERTIES
|
||||
IMPORTED_CONFIGURATIONS "Release;Debug"
|
||||
IMPORTED_LOCATION "${TARGET_PATH}/release/${LIBLOOT_CXX_FILENAME}"
|
||||
IMPORTED_LOCATION_DEBUG "${TARGET_PATH}/debug/${LIBLOOT_CXX_FILENAME}")
|
||||
add_custom_target(libloot-cxx-build
|
||||
COMMAND cargo build
|
||||
$<$<NOT:$<CONFIG:Debug>>:--release>
|
||||
$<$<AND:$<CONFIG:Debug>,$<PLATFORM_ID:Windows>>:--config>
|
||||
$<$<AND:$<CONFIG:Debug>,$<PLATFORM_ID:Windows>>:${CMAKE_SOURCE_DIR}/../.cargo/msvcd-config.toml>
|
||||
)
|
||||
|
||||
add_library(libloot-cxx INTERFACE)
|
||||
add_dependencies(libloot-cxx libloot-cxx-build)
|
||||
|
||||
target_link_libraries(libloot-cxx INTERFACE
|
||||
optimized "${TARGET_PATH}/release/${LIBLOOT_CXX_FILENAME}"
|
||||
debug "${TARGET_PATH}/debug/${LIBLOOT_CXX_FILENAME}")
|
||||
target_include_directories(libloot-cxx INTERFACE "${TARGET_PATH}/cxxbridge")
|
||||
|
||||
|
||||
|
||||
+1
-4
@@ -14,15 +14,13 @@ The wrapper has two layers:
|
||||
To build a release build with debug info:
|
||||
|
||||
```
|
||||
cargo build --release
|
||||
cmake -B build .
|
||||
cmake --build build --parallel --config RelWithDebInfo
|
||||
```
|
||||
|
||||
Debug builds need a little extra config to get the static and shared libraries to use the same C runtime library on Windows:
|
||||
To build a debug build:
|
||||
|
||||
```
|
||||
cargo build --config ../.cargo/msvcd-config.toml
|
||||
cmake -B build .
|
||||
cmake --build build --parallel --config Debug
|
||||
```
|
||||
@@ -32,7 +30,6 @@ cmake --build build --parallel --config Debug
|
||||
To build a release build with debug info:
|
||||
|
||||
```
|
||||
cargo build --release
|
||||
cmake -B build . -DCMAKE_BUILD_TYPE=RelWithDebInfo
|
||||
cmake --build build --parallel
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user