Fix --manifest-path argument usage for Android build

Whereas `cargo` expects the `--manifest-path` argument after the `build` command, `cargo ndk` only supports arguments being specified before the `build` command, which was causing the Android build to fail with:

```
error: Failed loading manifest
error: No such file or directory (os error 2)
```

Regression from #8557.
This commit is contained in:
Robert Müller 2024-07-12 22:26:03 +02:00
parent 888534e070
commit 6c4b920f0a

View file

@ -871,11 +871,11 @@ list(APPEND TARGETS_OWN rust-bridge-shared)
if(TARGET_OS STREQUAL "android")
set(CARGO_BUILD_DIR "${CARGO_NDK_TARGET}/")
set(CARGO_BUILD ${CMAKE_COMMAND} -E env CARGO_TARGET_DIR=${PROJECT_BINARY_DIR} DDNET_TEST_NO_LINK=1 ${RUST_CARGO} ndk -t ${CARGO_NDK_TARGET} -p ${CARGO_NDK_API} build)
set(CARGO_BUILD ${CMAKE_COMMAND} -E env CARGO_TARGET_DIR=${PROJECT_BINARY_DIR} DDNET_TEST_NO_LINK=1 ${RUST_CARGO} ndk --manifest-path "${PROJECT_SOURCE_DIR}/Cargo.toml" -t ${CARGO_NDK_TARGET} -p ${CARGO_NDK_API} build)
set(CARGO_TEST ${CMAKE_COMMAND} -E env CARGO_TARGET_DIR=${PROJECT_BINARY_DIR} ${RUST_CARGO} ndk -t ${CARGO_NDK_TARGET} -p ${CARGO_NDK_API} test)
else()
set(CARGO_BUILD_DIR "")
set(CARGO_BUILD ${CMAKE_COMMAND} -E env CARGO_TARGET_DIR=${PROJECT_BINARY_DIR} DDNET_TEST_NO_LINK=1 ${RUST_CARGO} build)
set(CARGO_BUILD ${CMAKE_COMMAND} -E env CARGO_TARGET_DIR=${PROJECT_BINARY_DIR} DDNET_TEST_NO_LINK=1 ${RUST_CARGO} build --manifest-path "${PROJECT_SOURCE_DIR}/Cargo.toml")
set(CARGO_TEST ${CMAKE_COMMAND} -E env CARGO_TARGET_DIR=${PROJECT_BINARY_DIR} ${RUST_CARGO} test)
endif()
if(MSVC)
@ -911,7 +911,6 @@ else()
endif()
endif()
list(APPEND CARGO_BUILD $<$<NOT:$<CONFIG:Debug>>:--release>)
list(APPEND CARGO_BUILD --manifest-path "${PROJECT_SOURCE_DIR}/Cargo.toml")
if(CMAKE_OSX_ARCHITECTURES)
set(RUST_OSX_ARCHITECTURES)