Improved makefile and nethost structure

This commit is contained in:
Simon Lübeß
2022-04-14 13:39:25 +02:00
parent 6a250d4927
commit 8e46945362
16 changed files with 975 additions and 12 deletions
+22 -8
View File
@@ -5,20 +5,34 @@ cmake_minimum_required (VERSION 3.15)
project ("GlitchyEngineHelper")
# Nethost:
# DotNet Apphost:
# Directory where the files for hosting a dotnet enviroment are located
SET(DOTNET_HOST_DIR "vendor/dotnethost")
# Base directory of dotnet app host
SET(DOTNET_APP_HOST_BASE "${CMAKE_SOURCE_DIR}/vendor/dotnetapphost")
# todo: Find out how to handle this on other platforms
# Construct platform specific directory
IF (WIN32)
IF (${TARGET_ARCH} STREQUAL "amd64")
SET(DOTNET_APP_HOST ${DOTNET_APP_HOST_BASE}/win-x64/)
ELSE ()
SET(DOTNET_APP_HOST ${DOTNET_APP_HOST_BASE}/win-x86/)
ENDIF ()
SET(NET_HOST_LIB ${DOTNET_APP_HOST}/nethost.lib)
SET(NET_HOST_DLL_NAME "nethost.dll")
ELSE ()
# LINUX/MAC/...
ENDIF ()
# Less sketchy way of adding a library. If the other method breaks (because it's sketchy) use this one and include nethost.lib manually in Beef-IDE
# target_link_libraries(GlitchyEngineHelper "vendor/dotnethost/nethost.lib")
# Sketchy way to compile a static library into a static target. Notice that we add the objects of this libary in add_library(GlitchyEngineHelper ...
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)
set_property(TARGET NetHost PROPERTY IMPORTED_OBJECTS ${NET_HOST_LIB})
# Copy nethost.dll to output directory
configure_file("${DOTNET_HOST_DIR}/nethost.dll" "${CMAKE_CURRENT_BINARY_DIR}/nethost.dll" COPYONLY)
configure_file("${DOTNET_APP_HOST}/${NET_HOST_DLL_NAME}" "${CMAKE_CURRENT_BINARY_DIR}/${NET_HOST_DLL_NAME}" COPYONLY)
# GlitchyEngineHelper:
@@ -31,7 +45,7 @@ add_library (GlitchyEngineHelper STATIC
target_include_directories(GlitchyEngineHelper PRIVATE
"vendor/DirectXTK/Inc"
${DOTNET_HOST_DIR}
${DOTNET_APP_HOST}
)
IF (WIN32)