DotNet hosting test

This commit is contained in:
Simon Lübeß
2022-04-14 02:24:36 +02:00
parent 9c93ccee47
commit 6a250d4927
16 changed files with 806 additions and 13 deletions
+32 -5
View File
@@ -5,11 +5,38 @@ cmake_minimum_required (VERSION 3.15)
project ("GlitchyEngineHelper")
# Add source to this project's executable.
add_library (GlitchyEngineHelper "GlitchyEngineHelper.cpp" "GlitchyEngineHelper.h" "vendor/xxHash/xxhash.c" "vendor/xxHash/xxhash.h" "vendor/DirectXTK/Src/DDSTextureLoader.cpp")
# Nethost:
include_directories("vendor/DirectXTK/Inc")
# Directory where the files for hosting a dotnet enviroment are located
SET(DOTNET_HOST_DIR "vendor/dotnethost")
# todo: Find out how to handle this on other platforms
# target_link_libraries(GlitchyEngineHelper "vendor/dotnethost/nethost.lib")
add_library(NetHost OBJECT IMPORTED)
set_target_properties(NetHost PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/vendor/dotnethost/nethost.lib)
set_property(TARGET NetHost PROPERTY IMPORTED_OBJECTS ${CMAKE_SOURCE_DIR}/vendor/dotnethost/nethost.lib)
# Copy nethost.dll to output directory
configure_file("${DOTNET_HOST_DIR}/nethost.dll" "${CMAKE_CURRENT_BINARY_DIR}/nethost.dll" COPYONLY)
# GlitchyEngineHelper:
# Add source to this project's executable.
add_library (GlitchyEngineHelper STATIC
"GlitchyEngineHelper.cpp" "GlitchyEngineHelper.h" "vendor/xxHash/xxhash.c" "vendor/xxHash/xxhash.h" "vendor/DirectXTK/Src/DDSTextureLoader.cpp" "DotNetRuntime.h" "DotNetRuntime.cpp"
# Link object files from nethost into library (kinda dirty I think, but avoids linking to nethost.lib when compiling in beef)
$<TARGET_OBJECTS:NetHost>
)
target_include_directories(GlitchyEngineHelper PRIVATE
"vendor/DirectXTK/Inc"
${DOTNET_HOST_DIR}
)
IF (WIN32)
add_compile_definitions(WINDOWS)
ENDIF()
# Use statically linked multithreaded MSVC runtime
set_property(TARGET GlitchyEngineHelper PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreadedDebug")
#$<$<CONFIG:Debug>:Debug>
set_property(TARGET GlitchyEngineHelper PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")