1
0
mirror of synced 2024-12-01 02:37:18 +01:00
ImHex/plugins/script_loader/dotnet/CMakeLists.txt
2023-07-19 21:40:24 +02:00

25 lines
1.0 KiB
CMake

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)
file(GLOB_RECURSE sources ${CMAKE_CURRENT_SOURCE_DIR}/${name}/*.cs)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/../../${name}.dll
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
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${name}/${name}.csproj ${sources}
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)