2023-07-15 14:29:14 +02:00
|
|
|
project(dotnet_assemblies)
|
|
|
|
|
|
|
|
function(add_dotnet_assembly name)
|
|
|
|
set(OUTPUT_DLL ${CMAKE_CURRENT_BINARY_DIR}/../../${name}.dll)
|
|
|
|
set(OUTPUT_RUNTIMECONFIG ${CMAKE_CURRENT_BINARY_DIR}/../../${name}.runtimeconfig.json)
|
|
|
|
|
2023-07-16 20:13:50 +02:00
|
|
|
file(GLOB_RECURSE sources ${CMAKE_CURRENT_SOURCE_DIR}/${name}/*.cs)
|
2023-07-15 14:29:14 +02:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/../../${name}.dll
|
2023-07-19 21:40:24 +02:00
|
|
|
COMMAND ${DOTNET_EXECUTABLE} build ${CMAKE_CURRENT_SOURCE_DIR}/${name}/${name}.csproj --nologo -c Release -o ${CMAKE_CURRENT_BINARY_DIR}/../.. && ${CMAKE_COMMAND} -DOUTPUT_RUNTIMECONFIG="\"${OUTPUT_RUNTIMECONFIG}\"" -P ${CMAKE_CURRENT_SOURCE_DIR}/post_process_runtimeconfig.cmake
|
2023-07-16 20:13:50 +02:00
|
|
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${name}/${name}.csproj ${sources}
|
2023-07-15 14:29:14 +02:00
|
|
|
COMMENT "Building ${name}.dll"
|
|
|
|
)
|
|
|
|
|
|
|
|
add_custom_target(${name} ALL DEPENDS ${OUTPUT_DLL})
|
|
|
|
|
|
|
|
install(FILES
|
|
|
|
${OUTPUT_DLL}
|
|
|
|
${OUTPUT_RUNTIMECONFIG}
|
|
|
|
DESTINATION
|
|
|
|
${PLUGINS_INSTALL_LOCATION}
|
|
|
|
)
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
add_dotnet_assembly(AssemblyLoader)
|