From c851d79cfbe8283b434f4d6d77adbc4596653a68 Mon Sep 17 00:00:00 2001 From: sneurlax Date: Tue, 16 Jan 2024 15:26:03 -0600 Subject: [PATCH 1/4] add windows build script --- scripts/windows/build_all.bat | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 scripts/windows/build_all.bat diff --git a/scripts/windows/build_all.bat b/scripts/windows/build_all.bat new file mode 100644 index 0000000..5f43870 --- /dev/null +++ b/scripts/windows/build_all.bat @@ -0,0 +1,21 @@ +@echo on + +rem Rust 1.71.0 Windows toolchain required, +rem `rustup toolchain install 1.71.0-x86_64-pc-windows-msvc`. + +set ROOT_DIR=%cd%\..\.. + +mkdir build + +rmdir /s /q "%ROOT_DIR%\src\serai\target" 2>nul + +cd "%ROOT_DIR%\src\serai\hrf" || exit +if "%IS_ARM%"=="true" ( + echo Building arm frostdart + cargo +1.71.0 build --target aarch64-pc-windows-msvc --release --lib + copy "..\target\x86_64-pc-windows-msvc\release\hrf_api.dll" "%ROOT_DIR%\scripts\windows\build\frostdart.dll" +) else ( + echo Building x86_64 frostdart + cargo +1.71.0 build --target x86_64-pc-windows-msvc --release --lib + copy "..\target\x86_64-pc-windows-msvc\release\hrf_api.dll" "%ROOT_DIR%\scripts\windows\build\frostdart.dll" +) From cdb3d3b5c891f43cb22fdb4778be3161dbd053d9 Mon Sep 17 00:00:00 2001 From: sneurlax Date: Tue, 16 Jan 2024 15:26:15 -0600 Subject: [PATCH 2/4] add bindings regen script for windows --- scripts/windows/regen_bindings.bat | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 scripts/windows/regen_bindings.bat diff --git a/scripts/windows/regen_bindings.bat b/scripts/windows/regen_bindings.bat new file mode 100644 index 0000000..5b369ae --- /dev/null +++ b/scripts/windows/regen_bindings.bat @@ -0,0 +1,6 @@ +@echo on + +cd .. +cd .. + +dart run ffigen --config ffigen.yaml From 9d25446557006dbdb09a5ab319f74e8eaa7484e9 Mon Sep 17 00:00:00 2001 From: sneurlax Date: Tue, 16 Jan 2024 15:30:15 -0600 Subject: [PATCH 3/4] windows cmakelists: bundle dll --- windows/CMakeLists.txt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/windows/CMakeLists.txt b/windows/CMakeLists.txt index 8584956..ced483a 100644 --- a/windows/CMakeLists.txt +++ b/windows/CMakeLists.txt @@ -8,9 +8,13 @@ cmake_minimum_required(VERSION 3.14) set(PROJECT_NAME "frostdart") project(${PROJECT_NAME} LANGUAGES CXX) +set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") + # Invoke the build for native code shared with the other target platforms. # This can be changed to accommodate different builds. -add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../src" "${CMAKE_CURRENT_BINARY_DIR}/shared") +# add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../src" "${CMAKE_CURRENT_BINARY_DIR}/shared") +# Disabled. Library built using script in scripts/windows, re-enable this if +# /when CMakeLists builds are made to work. See also below. # List of absolute paths to libraries that should be bundled with the plugin. # This list could contain prebuilt libraries, or libraries created by an @@ -18,6 +22,9 @@ add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../src" "${CMAKE_CURRENT_BINARY_DI set(frostdart_bundled_libraries # Defined in ../src/CMakeLists.txt. # This can be changed to accommodate different builds. - $ + # $ + # Disabled. Library built using script in scripts/windows, re-enable this if + # /when CMakeLists builds are made to work. See also above. + ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/windows/build/frostdart.dll PARENT_SCOPE ) From 5bee487f001e77cf020139c516998708d41376a3 Mon Sep 17 00:00:00 2001 From: sneurlax Date: Tue, 16 Jan 2024 15:32:45 -0600 Subject: [PATCH 4/4] windows docs --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 834c8f5..af38f88 100644 --- a/README.md +++ b/README.md @@ -11,3 +11,7 @@ git submodule update --init --recursive cd scripts/[platform] ./build_all.sh ``` + +or `build_all.bat` for Windows. + +Rust 1.71.0 is required. `[rustup](https://rustup.rs/) toolchain install 1.71.0-x86_64-pc-windows-msvc` for Windows.