From 7955320bf358b27d1fa30cc650a254bfb48825a3 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Thu, 8 Mar 2018 15:33:11 -0800 Subject: [PATCH] [msix] Initial commit of 1.0 --- ports/msix/CMakeLists.txt | 1 + ports/msix/CONTROL | 5 ++++ ports/msix/install-cmake.patch | 35 ++++++++++++++++++++++++++ ports/msix/portfile.cmake | 46 ++++++++++++++++++++++++++++++++++ ports/xerces-c/portfile.cmake | 2 +- ports/xerces-c/usage | 4 +++ 6 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 ports/msix/CMakeLists.txt create mode 100644 ports/msix/CONTROL create mode 100644 ports/msix/install-cmake.patch create mode 100644 ports/msix/portfile.cmake create mode 100644 ports/xerces-c/usage diff --git a/ports/msix/CMakeLists.txt b/ports/msix/CMakeLists.txt new file mode 100644 index 0000000000..4c193bbb3f --- /dev/null +++ b/ports/msix/CMakeLists.txt @@ -0,0 +1 @@ +add_custom_target(LIBS) \ No newline at end of file diff --git a/ports/msix/CONTROL b/ports/msix/CONTROL new file mode 100644 index 0000000000..52ec64556a --- /dev/null +++ b/ports/msix/CONTROL @@ -0,0 +1,5 @@ +Source: msix +Version: 1.0 +Build-Depends: xerces-c, zlib +Description: The MSIX Packaging SDK project is an effort to enable developers on a variety of platforms to pack and unpack packages for the purposes of distribution from either the Microsoft Store, or their own content distribution networks. + The MSIX Packaging APIs that a client app would use to interact with .msix/.appx packages are a subset of those documented here. See sample/ExtractContentsSample/ExtractContentsSample.cpp for additional details. diff --git a/ports/msix/install-cmake.patch b/ports/msix/install-cmake.patch new file mode 100644 index 0000000000..e44cc9b3c0 --- /dev/null +++ b/ports/msix/install-cmake.patch @@ -0,0 +1,35 @@ +diff --git a/src/msix/CMakeLists.txt b/src/msix/CMakeLists.txt +index 586c140..41a24ae 100644 +--- a/src/msix/CMakeLists.txt ++++ b/src/msix/CMakeLists.txt +@@ -129,6 +129,17 @@ set(LIB_SOURCES + # Define the library + add_library(${LIBRARY_NAME} SHARED ${LIB_SOURCES} ${LIB_PUBLIC_HEADERS} ${LIB_PRIVATE_HEADERS}) + ++if(INSTALL_LIBMSIX) ++ install(TARGETS ${LIBRARY_NAME} ++ RUNTIME DESTINATION bin ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib ++ ) ++ if(INSTALL_HEADERS) ++ install(FILES ${LIB_PUBLIC_HEADERS} DESTINATION include) ++ endif() ++endif() ++ + # specify that this library is to be built with C++14 + set_property(TARGET ${LIBRARY_NAME} PROPERTY CXX_STANDARD 14) + +@@ -149,8 +160,10 @@ include_directories( + ${CMAKE_PROJECT_ROOT}/lib/xerces/src + ) + +-target_link_libraries(${PROJECT_NAME} PRIVATE zlibstatic) +-target_link_libraries(${PROJECT_NAME} PRIVATE xerces-c) ++find_package(ZLIB REQUIRED) ++find_package(XercesC REQUIRED) ++target_link_libraries(${PROJECT_NAME} PRIVATE ZLIB::ZLIB) ++target_link_libraries(${PROJECT_NAME} PRIVATE XercesC::XercesC) + + IF(AOSP) + target_link_libraries(${PROJECT_NAME} PRIVATE -latomic) diff --git a/ports/msix/portfile.cmake b/ports/msix/portfile.cmake new file mode 100644 index 0000000000..552d576997 --- /dev/null +++ b/ports/msix/portfile.cmake @@ -0,0 +1,46 @@ +include(vcpkg_common_functions) + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + message("msix only supports dynamic library linkage") + set(VCPKG_LIBRARY_LINKAGE "dynamic") +endif() +if(VCPKG_CRT_LINKAGE STREQUAL "static") + message(FATAL_ERROR "msix only supports dynamic crt linkage") +endif() + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO Microsoft/msix-packaging + REF v1.0 + SHA512 11abf60da3414ce59f4347df8b2872ad6aa8a3c1e077f6e0be5c66ce90f14340cec5e58c30fb42ed17a10d5296dc0718bb8cddd665bdc20359bf7f0be4b0b4dc + HEAD_REF master +) + +file(REMOVE_RECURSE ${SOURCE_PATH}/lib) +file(MAKE_DIRECTORY ${SOURCE_PATH}/lib) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}/lib) + +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES ${CMAKE_CURRENT_LIST_DIR}/install-cmake.patch +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -DCMAKE_DISABLE_FIND_PACKAGE_Git=ON + -DWIN32=ON + -DINSTALL_LIBMSIX=ON + OPTIONS_RELEASE + -DINSTALL_HEADERS=ON +) + +vcpkg_install_cmake() + +file(INSTALL + ${SOURCE_PATH}/LICENSE + DESTINATION ${CURRENT_PACKAGES_DIR}/share/msix RENAME copyright) + +vcpkg_copy_pdbs() + diff --git a/ports/xerces-c/portfile.cmake b/ports/xerces-c/portfile.cmake index 5623e9518d..c0a4166fb4 100644 --- a/ports/xerces-c/portfile.cmake +++ b/ports/xerces-c/portfile.cmake @@ -52,7 +52,7 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/xercesc/NLS) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/xercesc/util/MsgLoaders/ICU/resources) # Handle copyright -file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/xerces-c) +file(COPY ${SOURCE_PATH}/LICENSE ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/xerces-c) file(RENAME ${CURRENT_PACKAGES_DIR}/share/xerces-c/LICENSE ${CURRENT_PACKAGES_DIR}/share/xerces-c/copyright) vcpkg_copy_pdbs() \ No newline at end of file diff --git a/ports/xerces-c/usage b/ports/xerces-c/usage new file mode 100644 index 0000000000..70333bf7c1 --- /dev/null +++ b/ports/xerces-c/usage @@ -0,0 +1,4 @@ +The package xerces-c is compatible with built-in CMake targets: + + find_package(XercesC REQUIRED) + target_link_libraries(main PRIVATE XercesC::XercesC)