-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract GenerateWinMD.cmake to avoid recursive CMake invocation.
- Loading branch information
1 parent
ae379aa
commit d48b416
Showing
4 changed files
with
67 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Generates the WinRTComponent.winmd file from the WinRTComponent.idl file. | ||
if(NOT DEFINED WINRTCOMPONENT_IDL) | ||
message(FATAL_ERROR "WINRTCOMPONENT_IDL is not defined") | ||
endif() | ||
|
||
if(NOT DEFINED WINRTCOMPONENT_WINMD) | ||
message(FATAL_ERROR "WINRTCOMPONENT_WINMD_PATH is not defined") | ||
endif() | ||
|
||
message(STATUS "Generating WinRTComponent.winmd...") | ||
set(MIDLRT_EXE_NATIVE "$ENV{WindowsSdkVerBinPath}$ENV{VSCMD_ARG_HOST_ARCH}\\midlrt.exe") | ||
cmake_path(CONVERT "$ENV{WindowsSdkDir}References\\$ENV{WindowsSDKVersion}" TO_CMAKE_PATH_LIST WINSDK_REFERENCES_DIR NORMALIZE) | ||
set(FOUNDATIONCONTRACT_DIR "${WINSDK_REFERENCES_DIR}/Windows.Foundation.FoundationContract/4.0.0.0") | ||
cmake_path(CONVERT "${FOUNDATIONCONTRACT_DIR}" TO_NATIVE_PATH_LIST METADATA_DIR_NATIVE) | ||
cmake_path(CONVERT "${FOUNDATIONCONTRACT_DIR}/Windows.Foundation.FoundationContract.winmd" TO_NATIVE_PATH_LIST FOUNDATIONCONTRACT_WINMD_NATIVE) | ||
cmake_path(CONVERT "${WINSDK_REFERENCES_DIR}/Windows.Foundation.UniversalApiContract/15.0.0.0/Windows.Foundation.UniversalApiContract.winmd" TO_NATIVE_PATH_LIST UNIVERSALAPICONTRACT_WINMD_NATIVE) | ||
cmake_path(CONVERT "${WINRTCOMPONENT_WINMD}" TO_NATIVE_PATH_LIST WINRTCOMPONENT_WINMD_NATIVE) | ||
string(REPLACE ".winmd" ".h" WINRTCOMPONENT_H_NATIVE "${WINRTCOMPONENT_WINMD_NATIVE}") | ||
cmake_path(CONVERT "${WINRTCOMPONENT_IDL}" TO_NATIVE_PATH_LIST WINRTCOMPONENT_IDL_NATIVE) | ||
execute_process( | ||
COMMAND "${MIDLRT_EXE_NATIVE}" | ||
/W1 /nologo /nomidl | ||
/metadata_dir "${METADATA_DIR_NATIVE}" | ||
/reference "${FOUNDATIONCONTRACT_WINMD_NATIVE}" | ||
/reference "${UNIVERSALAPICONTRACT_WINMD_NATIVE}" | ||
/winmd "${WINRTCOMPONENT_WINMD_NATIVE}" | ||
/header "${WINRTCOMPONENT_H_NATIVE}" | ||
"${WINRTCOMPONENT_IDL_NATIVE}" | ||
COMMAND_ERROR_IS_FATAL ANY) |