mirror of
https://github.com/microsoft/regorus.git
synced 2026-08-05 02:16:11 +00:00
- FFI: add RVM/Program APIs, execution state accessors, HostAwait handling, and buffer/result helpers in rvm.rs, common.rs, engine.rs. - Compiler: emit HostAwait for __builtin_host_await in function_calls.rs. - RVM tests: add HostAwait regression cases and extend harness for suspend/resume responses in host_await.yaml and mod.rs. - C/C++: add RVM tests/examples and wrapper updates in rvm_tests.c, rvm_tests.cpp, regorus.hpp, plus CMake wiring. - C#: add Program/Rvm bindings, SafeHandle/PInvoke, tests, and example usage in Regorus, RvmProgramTests.cs, Program.cs, and README updates. - Go: add Program/Rvm bindings, tests, and examples in rvm.go, rvm_test.go, main.go. - Java: add Program/Rvm bindings, JNI glue, and examples in lib.rs, regorus, Test.java. - Python: add Program/Rvm bindings and examples in lib.rs, test.py. - WASM: add Program/Rvm bindings and examples in lib.rs, test.js. - Tooling: wire binding tests in xtask and ignore generated Java artifacts in .gitignore. Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
93 lines
2.5 KiB
CMake
93 lines
2.5 KiB
CMake
# Copyright (c) Microsoft
|
|
# Licensed under the MIT License.
|
|
|
|
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
|
|
include(FetchContent)
|
|
|
|
FetchContent_Declare(
|
|
Corrosion
|
|
GIT_REPOSITORY https://github.com/corrosion-rs/corrosion.git
|
|
# Use a tag that has a fix for https://github.com/corrosion-rs/corrosion/issues/590
|
|
GIT_TAG 6be991bb34c348dfb8344be22f3606288ea5c7fd
|
|
)
|
|
FetchContent_MakeAvailable(Corrosion)
|
|
|
|
project("regorus-test")
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
enable_testing()
|
|
|
|
# installable ffi target
|
|
|
|
corrosion_import_crate(
|
|
# Path to <regorus-source-folder>/bindings/ffi/Cargo.toml
|
|
MANIFEST_PATH "../ffi/Cargo.toml"
|
|
# Always build regorus in Release mode.
|
|
PROFILE "release"
|
|
# Only build the "regorus-ffi" crate.
|
|
CRATES "regorus-ffi"
|
|
|
|
# Select specific features in regorus.
|
|
FEATURES "regorus/semver"
|
|
|
|
LOCKED
|
|
|
|
# Link statically
|
|
CRATE_TYPES "cdylib")
|
|
|
|
include(GNUInstallDirs)
|
|
|
|
set(regorus_ffi_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR}/regorus_ffi)
|
|
set(regorus_ffi_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/regorus_ffi)
|
|
set(regorus_ffi_LIBDIR ${CMAKE_INSTALL_LIBDIR})
|
|
set(regorus_ffi_BINDIR ${CMAKE_INSTALL_BINDIR})
|
|
|
|
add_library(regorus_ffi::regorus_ffi ALIAS regorus_ffi)
|
|
corrosion_install(TARGETS regorus_ffi EXPORT regorus_ffi_targets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
|
|
target_include_directories(regorus_ffi
|
|
INTERFACE
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../ffi>
|
|
$<INSTALL_INTERFACE:${regorus_ffi_INCLUDEDIR}>
|
|
)
|
|
|
|
set(regorus_ffi_HEADER_FILES
|
|
regorus.hpp
|
|
../ffi/regorus.ffi.hpp
|
|
)
|
|
|
|
install(FILES ${regorus_ffi_HEADER_FILES}
|
|
DESTINATION ${regorus_ffi_INCLUDEDIR}
|
|
COMPONENT Devel
|
|
)
|
|
|
|
install(EXPORT regorus_ffi_targets
|
|
FILE regorus_ffi_targets.cmake
|
|
NAMESPACE regorus_ffi::
|
|
DESTINATION ${regorus_ffi_CONFIGDIR}
|
|
)
|
|
|
|
include(CMakePackageConfigHelpers)
|
|
|
|
configure_package_config_file(${CMAKE_CURRENT_LIST_DIR}/regorus_ffiConfig.cmake.in
|
|
${CMAKE_CURRENT_BINARY_DIR}/regorus_ffiConfig.cmake
|
|
INSTALL_DESTINATION ${regorus_ffi_CONFIGDIR}
|
|
)
|
|
|
|
install(FILES
|
|
${CMAKE_CURRENT_BINARY_DIR}/regorus_ffiConfig.cmake
|
|
${CMAKE_CURRENT_BINARY_DIR}/corrosion/regorus_ffi_targetsCorrosion.cmake
|
|
DESTINATION ${regorus_ffi_CONFIGDIR}
|
|
)
|
|
|
|
# test binary
|
|
|
|
add_executable(regorus_test main.cpp)
|
|
target_link_libraries(regorus_test regorus_ffi::regorus_ffi)
|
|
|
|
add_executable(regorus_rvm_test rvm_tests.cpp)
|
|
target_link_libraries(regorus_rvm_test regorus_ffi::regorus_ffi)
|
|
|
|
add_test(NAME regorus_cpp_engine COMMAND regorus_test)
|
|
add_test(NAME regorus_cpp_rvm COMMAND regorus_rvm_test)
|