diff --git a/Generator/CMakeLists.txt b/Generator/CMakeLists.txt index 8e93c7d4..11502f41 100644 --- a/Generator/CMakeLists.txt +++ b/Generator/CMakeLists.txt @@ -8,8 +8,8 @@ endif() add_subdirectory(Dependencies) -set(SWIFTWINRT_EXE_STAGING_DIR "${CMAKE_CURRENT_BINARY_DIR}") +set(GENERATOR_STAGING_DIR "${CMAKE_CURRENT_BINARY_DIR}") add_subdirectory(Sources) +add_subdirectory(mscorlib) -include(mscorlib.cmake) add_subdirectory(NuGet) \ No newline at end of file diff --git a/Generator/Sources/SwiftWinRT/CMakeLists.txt b/Generator/Sources/SwiftWinRT/CMakeLists.txt index 8e6fdc56..67075ffb 100644 --- a/Generator/Sources/SwiftWinRT/CMakeLists.txt +++ b/Generator/Sources/SwiftWinRT/CMakeLists.txt @@ -8,11 +8,10 @@ target_link_libraries(SwiftWinRT PRIVATE DotNetMetadata DotNetMetadataFormat WindowsMetadata CodeWriters ProjectionModel) -if(DEFINED SWIFTWINRT_EXE_STAGING_DIR) - add_custom_command(TARGET SwiftWinRT - POST_BUILD +if(DEFINED GENERATOR_STAGING_DIR) + add_custom_command(TARGET SwiftWinRT POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_BINARY_DIR}/SwiftWinRT.exe" - "${SWIFTWINRT_EXE_STAGING_DIR}/SwiftWinRT.exe" - BYPRODUCTS "${SWIFTWINRT_EXE_STAGING_DIR}/SwiftWinRT.exe") + "${GENERATOR_STAGING_DIR}/SwiftWinRT.exe" + BYPRODUCTS "${GENERATOR_STAGING_DIR}/SwiftWinRT.exe") endif() \ No newline at end of file diff --git a/Generator/mscorlib.cmake b/Generator/mscorlib.cmake deleted file mode 100644 index 660eeb30..00000000 --- a/Generator/mscorlib.cmake +++ /dev/null @@ -1,10 +0,0 @@ -add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/mscorlib.winmd" - COMMAND powershell.exe -File "${WINMDCORLIB_DIR}/Assemble.ps1" - -SourcePath "${WINMDCORLIB_DIR}/mscorlib.il" - -OutputPath "${CMAKE_CURRENT_BINARY_DIR}/mscorlib.winmd" - DEPENDS - "${WINMDCORLIB_DIR}/Assemble.ps1" - "${WINMDCORLIB_DIR}/mscorlib.il") - -add_custom_target(mscorlib ALL - DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/mscorlib.winmd") \ No newline at end of file diff --git a/Generator/mscorlib/CMakeLists.txt b/Generator/mscorlib/CMakeLists.txt new file mode 100644 index 00000000..91ebee8d --- /dev/null +++ b/Generator/mscorlib/CMakeLists.txt @@ -0,0 +1,20 @@ +# Assemble DotNetMetadata's mscorlib.il into mscorlib.winmd, +# which is required by the code generator. +add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/mscorlib.winmd" + COMMAND powershell.exe -File "${WINMDCORLIB_DIR}/Assemble.ps1" + -SourcePath "${WINMDCORLIB_DIR}/mscorlib.il" + -OutputPath "${CMAKE_CURRENT_BINARY_DIR}/mscorlib.winmd" + DEPENDS + "${WINMDCORLIB_DIR}/Assemble.ps1" + "${WINMDCORLIB_DIR}/mscorlib.il") + +add_custom_target(mscorlib ALL + DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/mscorlib.winmd") + +if(DEFINED GENERATOR_STAGING_DIR) + add_custom_command(TARGET mscorlib POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "${CMAKE_CURRENT_BINARY_DIR}/mscorlib.winmd" + "${GENERATOR_STAGING_DIR}/mscorlib.winmd" + BYPRODUCTS "${GENERATOR_STAGING_DIR}/mscorlib.winmd") +endif() \ No newline at end of file