Skip to content

Commit

Permalink
Add subfolder and CMakeLists.txt for mscorlib.winmd (#449)
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanlabelle authored Dec 27, 2024
1 parent becbfa2 commit 84ede97
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 17 deletions.
4 changes: 2 additions & 2 deletions Generator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
9 changes: 4 additions & 5 deletions Generator/Sources/SwiftWinRT/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
10 changes: 0 additions & 10 deletions Generator/mscorlib.cmake

This file was deleted.

20 changes: 20 additions & 0 deletions Generator/mscorlib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit 84ede97

Please sign in to comment.