| 1 | add_idl_winrt(wslcsdkwinrtidl "wslcsdk.idl") |
| 2 | set_target_properties(wslcsdkwinrtidl PROPERTIES FOLDER windows) |
| 3 | |
| 4 | set(SOURCES |
| 5 | AuthenticateResult.cpp |
| 6 | Container.cpp |
| 7 | ContainerNamedVolume.cpp |
| 8 | ContainerPortMapping.cpp |
| 9 | ContainerSettings.cpp |
| 10 | ContainerVolume.cpp |
| 11 | ImageInfo.cpp |
| 12 | ImageProgress.cpp |
| 13 | InstallOptions.cpp |
| 14 | InstallProgress.cpp |
| 15 | Process.cpp |
| 16 | ProcessCrashInformation.cpp |
| 17 | ProcessSettings.cpp |
| 18 | PullImageOptions.cpp |
| 19 | PushImageOptions.cpp |
| 20 | ServiceVersion.cpp |
| 21 | Session.cpp |
| 22 | SessionSettings.cpp |
| 23 | Streams.cpp |
| 24 | TagImageOptions.cpp |
| 25 | VhdOptions.cpp |
| 26 | WslcService.cpp |
| 27 | ) |
| 28 | |
| 29 | set(HEADERS |
| 30 | AuthenticateResult.h |
| 31 | Container.h |
| 32 | ContainerNamedVolume.h |
| 33 | ContainerPortMapping.h |
| 34 | ContainerSettings.h |
| 35 | ContainerVolume.h |
| 36 | Helpers.h |
| 37 | ImageInfo.h |
| 38 | ImageProgress.h |
| 39 | InstallOptions.h |
| 40 | InstallProgress.h |
| 41 | Process.h |
| 42 | ProcessCrashInformation.h |
| 43 | ProcessSettings.h |
| 44 | PullImageOptions.h |
| 45 | PushImageOptions.h |
| 46 | ServiceVersion.h |
| 47 | Session.h |
| 48 | SessionSettings.h |
| 49 | Streams.h |
| 50 | TagImageOptions.h |
| 51 | VhdOptions.h |
| 52 | WslcService.h |
| 53 | ) |
| 54 | |
| 55 | add_library(wslcsdkwinrt STATIC ${SOURCES} ${HEADERS}) |
| 56 | add_dependencies(wslcsdkwinrt wslcsdkwinrtidl) |
| 57 | |
| 58 | set(MODULE_G_CPP ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_PLATFORM}/${CMAKE_BUILD_TYPE}/module.g.cpp) |
| 59 | target_sources(wslcsdkwinrt PRIVATE ${MODULE_G_CPP}) |
| 60 | # The generated module mixes classic COM and C++/WinRT headers, so sharing a |
| 61 | # translation unit with a projection source makes IUnknown ambiguous. |
| 62 | set_source_files_properties( |
| 63 | ${MODULE_G_CPP} |
| 64 | PROPERTIES |
| 65 | GENERATED TRUE |
| 66 | SKIP_UNITY_BUILD_INCLUSION ON) |
| 67 | |
| 68 | target_precompile_headers(wslcsdkwinrt PRIVATE precomp.h) |
| 69 | target_include_directories(wslcsdkwinrt PRIVATE |
| 70 | ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_PLATFORM}/${CMAKE_BUILD_TYPE} |
| 71 | ${CMAKE_SOURCE_DIR}/src/windows/WslcSDK |
| 72 | ) |
| 73 | |
| 74 | set_target_properties( |
| 75 | wslcsdkwinrt |
| 76 | PROPERTIES |
| 77 | FOLDER windows |
| 78 | EXCLUDE_FROM_ALL FALSE |
| 79 | ) |
| 80 | |
| 81 | # Copy the winmd to the bin output directory so the nuspec can reference it |
| 82 | # from a stable, arch-aware path (bin\<platform>\<config>\Microsoft.WSL.Containers.winmd). |
| 83 | set(WINMD_SRC ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_PLATFORM}/${CMAKE_BUILD_TYPE}/wslcsdk.winmd) |
| 84 | set(WINMD_DEST ${CMAKE_SOURCE_DIR}/bin/${TARGET_PLATFORM}/${CMAKE_BUILD_TYPE}/Microsoft.WSL.Containers.winmd) |
| 85 | |
| 86 | add_custom_command(TARGET wslcsdkwinrtidl POST_BUILD |
| 87 | COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_SOURCE_DIR}/bin/${TARGET_PLATFORM}/${CMAKE_BUILD_TYPE}" |
| 88 | COMMAND ${CMAKE_COMMAND} -E copy_if_different "${WINMD_SRC}" "${WINMD_DEST}" |
| 89 | COMMENT "Copying Microsoft.WSL.Containers.winmd to bin output" |
| 90 | ) |