mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-17 13:38:18 +00:00
dcd76fd3e1
The glue is done using the [cxx crate](https://cxx.rs/) on the Rust side. As a proof-of-concept, only a small console command (`rust_version`) printing the currently used Rust version was added. You can generate and open the Rust documentation using `DDNET_TEST_NO_LINK=1 cargo doc --open`. You can run the Rust tests using `cmake --build <build dir> --target run_rust_tests`, they're automatically included in the `run_tests` target as well. Rust tests don't work on Windows in debug mode on Windows because Rust cannot currently link with the debug version of the C stdlib on Windows: https://github.com/rust-lang/rust/issues/39016. --- The stuff in `src/rust-bridge` is generated using ``` cxxbridge src/engine/shared/rust_version.rs --output src/rust-bridge/engine/shared/rust_version.cpp --output src/rust-bridge/engine/shared/rust_version.h cxxbridge src/engine/console.rs --output src/rust-bridge/cpp/console.cpp --output src/rust-bridge/cpp/console.h ```
20 lines
715 B
Plaintext
20 lines
715 B
Plaintext
if(NOT DEFINED ENV{OSXCROSS_TARGET} OR NOT DEFINED ENV{OSXCROSS_SDK})
|
|
message(FATAL_ERROR "Run eval `osxcross-conf` before compilation")
|
|
endif()
|
|
|
|
set(CMAKE_OSX_SYSROOT $ENV{OSXCROSS_SDK} CACHE INTERNAL "")
|
|
|
|
set(CMAKE_SYSTEM_NAME Darwin)
|
|
|
|
set(CMAKE_SYSTEM_PROCESSOR x86_64)
|
|
set(CMAKE_C_COMPILER o64-clang)
|
|
set(CMAKE_CXX_COMPILER o64-clang++)
|
|
set(CMAKE_INSTALL_NAME_TOOL x86_64-apple-$ENV{OSXCROSS_TARGET}-install_name_tool)
|
|
set(CMAKE_OTOOL x86_64-apple-$ENV{OSXCROSS_TARGET}-otool)
|
|
set(CMAKE_RUST_COMPILER_TARGET x86_64-apple-darwin)
|
|
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|