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. 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" +) 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 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 )