From 6d5eba6a6d4f99a03f104e0a639cbbba5325d41b Mon Sep 17 00:00:00 2001 From: Roger Leigh Date: Thu, 25 Oct 2018 20:34:45 +0100 Subject: xalan-c: Install headers correctly (#4565) * Add SKIP_CLEAN option to vcpkg_install_msbuild Also add vcpkg_clean_msbuild function to factor out clean logic and allow re-use in portfiles. * xalan-c: Correct header globbing * vcpkg_install_msbuild: SKIP_CLEAN documentation correction * [xalan-c] Add explicit check for localmsgindex header. [docs] Regenerate --- scripts/cmake/vcpkg_add_to_path.cmake | 41 ++++++++++++++++++++++++++++++ scripts/cmake/vcpkg_append_to_path.cmake | 41 ------------------------------ scripts/cmake/vcpkg_clean_msbuild.cmake | 19 ++++++++++++++ scripts/cmake/vcpkg_common_functions.cmake | 3 ++- scripts/cmake/vcpkg_install_msbuild.cmake | 20 ++++++++++----- 5 files changed, 75 insertions(+), 49 deletions(-) create mode 100644 scripts/cmake/vcpkg_add_to_path.cmake delete mode 100644 scripts/cmake/vcpkg_append_to_path.cmake create mode 100644 scripts/cmake/vcpkg_clean_msbuild.cmake (limited to 'scripts/cmake') diff --git a/scripts/cmake/vcpkg_add_to_path.cmake b/scripts/cmake/vcpkg_add_to_path.cmake new file mode 100644 index 000000000..6890dfe31 --- /dev/null +++ b/scripts/cmake/vcpkg_add_to_path.cmake @@ -0,0 +1,41 @@ +## # vcpkg_add_to_path +## +## Add a directory to the PATH environment variable +## +## ## Usage +## ```cmake +## vcpkg_add_to_path([PREPEND] <${PYTHON3_DIR}>) +## ``` +## +## ## Parameters +## ### +## The directory to add +## +## ### PREPEND +## Prepends the directory. +## +## The default is to append. +function(vcpkg_add_to_path) + if(NOT "${ARGC}" STREQUAL "1" AND NOT "${ARGC}" STREQUAL "2") + message(FATAL_ERROR "vcpkg_add_to_path() only accepts 1 or 2 arguments.") + endif() + if("${ARGV0}" STREQUAL "PREPEND") + if(NOT "${ARGC}" STREQUAL "2") + message(FATAL_ERROR "Expected second argument.") + endif() + if(CMAKE_HOST_WIN32) + set(ENV{PATH} "${ARGV1};$ENV{PATH}") + else() + set(ENV{PATH} "${ARGV1}:$ENV{PATH}") + endif() + else() + if(NOT "${ARGC}" STREQUAL "1") + message(FATAL_ERROR "Unexpected second argument: ${ARGV1}") + endif() + if(CMAKE_HOST_WIN32) + set(ENV{PATH} "$ENV{PATH};${ARGV0}") + else() + set(ENV{PATH} "$ENV{PATH}:${ARGV0}") + endif() + endif() +endfunction() \ No newline at end of file diff --git a/scripts/cmake/vcpkg_append_to_path.cmake b/scripts/cmake/vcpkg_append_to_path.cmake deleted file mode 100644 index 6890dfe31..000000000 --- a/scripts/cmake/vcpkg_append_to_path.cmake +++ /dev/null @@ -1,41 +0,0 @@ -## # vcpkg_add_to_path -## -## Add a directory to the PATH environment variable -## -## ## Usage -## ```cmake -## vcpkg_add_to_path([PREPEND] <${PYTHON3_DIR}>) -## ``` -## -## ## Parameters -## ### -## The directory to add -## -## ### PREPEND -## Prepends the directory. -## -## The default is to append. -function(vcpkg_add_to_path) - if(NOT "${ARGC}" STREQUAL "1" AND NOT "${ARGC}" STREQUAL "2") - message(FATAL_ERROR "vcpkg_add_to_path() only accepts 1 or 2 arguments.") - endif() - if("${ARGV0}" STREQUAL "PREPEND") - if(NOT "${ARGC}" STREQUAL "2") - message(FATAL_ERROR "Expected second argument.") - endif() - if(CMAKE_HOST_WIN32) - set(ENV{PATH} "${ARGV1};$ENV{PATH}") - else() - set(ENV{PATH} "${ARGV1}:$ENV{PATH}") - endif() - else() - if(NOT "${ARGC}" STREQUAL "1") - message(FATAL_ERROR "Unexpected second argument: ${ARGV1}") - endif() - if(CMAKE_HOST_WIN32) - set(ENV{PATH} "$ENV{PATH};${ARGV0}") - else() - set(ENV{PATH} "$ENV{PATH}:${ARGV0}") - endif() - endif() -endfunction() \ No newline at end of file diff --git a/scripts/cmake/vcpkg_clean_msbuild.cmake b/scripts/cmake/vcpkg_clean_msbuild.cmake new file mode 100644 index 000000000..b0d77dfd2 --- /dev/null +++ b/scripts/cmake/vcpkg_clean_msbuild.cmake @@ -0,0 +1,19 @@ +## # vcpkg_clean_msbuild +## +## Clean intermediate files generated by `vcpkg_install_msbuild()`. +## +## ## Usage +## ```cmake +## vcpkg_clean_msbuild() +## ``` +## +## ## Examples +## +## * [xalan-c](https://github.com/Microsoft/vcpkg/blob/master/ports/xalan-c/portfile.cmake) + +function(vcpkg_clean_msbuild) + file(REMOVE_RECURSE + ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg + ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel + ) +endfunction() diff --git a/scripts/cmake/vcpkg_common_functions.cmake b/scripts/cmake/vcpkg_common_functions.cmake index 90a3e2814..595ebb00e 100644 --- a/scripts/cmake/vcpkg_common_functions.cmake +++ b/scripts/cmake/vcpkg_common_functions.cmake @@ -1,6 +1,7 @@ include(vcpkg_acquire_msys) -include(vcpkg_append_to_path) +include(vcpkg_add_to_path) include(vcpkg_check_linkage) +include(vcpkg_clean_msbuild) include(vcpkg_download_distfile) include(vcpkg_extract_source_archive) include(vcpkg_execute_required_process) diff --git a/scripts/cmake/vcpkg_install_msbuild.cmake b/scripts/cmake/vcpkg_install_msbuild.cmake index ad700dd35..11bcdf189 100644 --- a/scripts/cmake/vcpkg_install_msbuild.cmake +++ b/scripts/cmake/vcpkg_install_msbuild.cmake @@ -52,12 +52,16 @@ ## ### REMOVE_ROOT_INCLUDES ## Indicates that top-level include files (e.g. `include/Makefile.am`) should be removed. ## +## ### SKIP_CLEAN +## Indicates that the intermediate files should not be removed. +## +## Ports using this option should later call [`vcpkg_clean_msbuild()`](vcpkg_clean_msbuild.md) to manually clean up. +## ## ### RELEASE_CONFIGURATION ## The configuration (``/p:Configuration`` msbuild parameter) used for Release builds. ## ## ### DEBUG_CONFIGURATION -## The configuration (``/p:Configuration`` msbuild parameter) -## used for Debug builds. +## The configuration (``/p:Configuration`` msbuild parameter) used for Debug builds. ## ## ### TARGET_PLATFORM_VERSION ## The WindowsTargetPlatformVersion (``/p:WindowsTargetPlatformVersion`` msbuild parameter) @@ -82,12 +86,15 @@ ## ## ## Examples ## +## * [xalan-c](https://github.com/Microsoft/vcpkg/blob/master/ports/xalan-c/portfile.cmake) ## * [libimobiledevice](https://github.com/Microsoft/vcpkg/blob/master/ports/libimobiledevice/portfile.cmake) +include(vcpkg_clean_msbuild) + function(vcpkg_install_msbuild) cmake_parse_arguments( _csc - "USE_VCPKG_INTEGRATION;ALLOW_ROOT_INCLUDES;REMOVE_ROOT_INCLUDES" + "USE_VCPKG_INTEGRATION;ALLOW_ROOT_INCLUDES;REMOVE_ROOT_INCLUDES;SKIP_CLEAN" "SOURCE_PATH;PROJECT_SUBPATH;INCLUDES_SUBPATH;LICENSE_SUBPATH;RELEASE_CONFIGURATION;DEBUG_CONFIGURATION;PLATFORM;PLATFORM_TOOLSET;TARGET_PLATFORM_VERSION;TARGET" "OPTIONS;OPTIONS_RELEASE;OPTIONS_DEBUG" ${ARGN} @@ -196,10 +203,9 @@ function(vcpkg_install_msbuild) vcpkg_copy_pdbs() - file(REMOVE_RECURSE - ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg - ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel - ) + if(NOT _csc_SKIP_CLEAN) + vcpkg_clean_msbuild() + endif() if(DEFINED _csc_INCLUDES_SUBPATH) file(COPY ${_csc_SOURCE_PATH}/${_csc_INCLUDES_SUBPATH}/ DESTINATION ${CURRENT_PACKAGES_DIR}/include/) -- cgit v1.2.3