diff options
| author | Stefano Sinigardi <stesinigardi@hotmail.com> | 2019-10-07 19:35:13 +0200 |
|---|---|---|
| committer | Curtis J Bezault <curtbezault@gmail.com> | 2019-10-07 10:35:13 -0700 |
| commit | 726c11148105a97aef39bec024fdb7c140b1b154 (patch) | |
| tree | 26bd2aee0c13a8351b259cc4ffffaf0efededb4e /ports/fmilib | |
| parent | e86ff2cc54bda9e9ee322ab69141e7113d5c40a9 (diff) | |
| download | vcpkg-726c11148105a97aef39bec024fdb7c140b1b154.tar.gz vcpkg-726c11148105a97aef39bec024fdb7c140b1b154.zip | |
[vcpkg] fatal_error when patch fails to apply (#8087)
vcpkg will now fail on failure to apply patches except when using `--head`.
Diffstat (limited to 'ports/fmilib')
| -rw-r--r-- | ports/fmilib/0001-remove-install-prefix.patch | 36 | ||||
| -rw-r--r-- | ports/fmilib/LICENSE | 26 | ||||
| -rw-r--r-- | ports/fmilib/portfile.cmake | 154 |
3 files changed, 55 insertions, 161 deletions
diff --git a/ports/fmilib/0001-remove-install-prefix.patch b/ports/fmilib/0001-remove-install-prefix.patch new file mode 100644 index 000000000..b54c903d7 --- /dev/null +++ b/ports/fmilib/0001-remove-install-prefix.patch @@ -0,0 +1,36 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f7372bf..f3c11f1 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -26,7 +26,6 @@ set(FMILIBRARYHOME ${FMILibrary_SOURCE_DIR}) + set(FMILIBRARYBUILD ${FMILibrary_BINARY_DIR}) + + # User configuration options and parameters +-SET(FMILIB_INSTALL_PREFIX ${FMILibrary_BINARY_DIR}/../install CACHE PATH "Prefix prepended to install directories") + set(FMILIB_THIRDPARTYLIBS ${FMILibrary_SOURCE_DIR}/ThirdParty CACHE PATH "Path to the ThirdParty library dir" ) + set(FMILIB_FMI_STANDARD_HEADERS ${FMILIB_THIRDPARTYLIBS}/FMI/default CACHE PATH "Path to the FMI standard headers dir" ) + +@@ -84,7 +83,6 @@ IF(NOT CMAKE_BUILD_TYPE) + SET(CMAKE_BUILD_TYPE ${FMILIB_DEFAULT_BUILD_TYPE}) + ENDIF(NOT CMAKE_BUILD_TYPE) + +-SET(CMAKE_INSTALL_PREFIX ${FMILIB_INSTALL_PREFIX} CACHE INTERNAL "Prefix prepended to install directories" FORCE) + + # debug_message is used to trace the build script + function(debug_message) +@@ -350,7 +348,6 @@ endfunction() + + if(FMILIB_GENERATE_DOXYGEN_DOC) + +- file(MAKE_DIRECTORY "${FMILIB_INSTALL_PREFIX}/doc") + + set(DOXYFILE_IN ${FMILIBRARYHOME}/Config.cmake/fmilib_doxydoc.conf CACHE INTERNAL "Doxygen config file") + set(DOXYFILE_IMAGE_DIR "${FMILIBRARYHOME}/images" CACHE INTERNAL "Doxygen images" FORCE) +@@ -372,7 +369,6 @@ if(FMILIB_GENERATE_DOXYGEN_DOC) + set(DOXYFILE_SOURCE_DIR "${FMILIBRARYBUILD}/doc" CACHE INTERNAL "Doxygen default source dir" FORCE) + set(DOXYFILE_EXTRA_SOURCES "${DOXYFILE_EXTRA_SOURCES} \"${FMILIBRARYHOME}/Test\"") + +- set(DOXYFILE_OUTPUT_DIR "${FMILIB_INSTALL_PREFIX}/doc") + + set(DOXYFILE_STRIP_FROM_PATH "${FMILIBRARYHOME}") + diff --git a/ports/fmilib/LICENSE b/ports/fmilib/LICENSE deleted file mode 100644 index 27d973645..000000000 --- a/ports/fmilib/LICENSE +++ /dev/null @@ -1,26 +0,0 @@ -License -------- - -Copyright (C) 2012 Modelon AB - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: -- Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -- Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -- Neither the name of the Modelon AB nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL MODELON AB BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/ports/fmilib/portfile.cmake b/ports/fmilib/portfile.cmake index bd7374559..39b0e0377 100644 --- a/ports/fmilib/portfile.cmake +++ b/ports/fmilib/portfile.cmake @@ -1,13 +1,19 @@ include(vcpkg_common_functions)
-set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/FMILibrary-2.0.3)
+vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+
vcpkg_download_distfile(ARCHIVE
URLS "https://jmodelica.org/fmil/FMILibrary-2.0.3-src.zip"
FILENAME "FMILibrary-2.0.3-src.zip"
SHA512 86e4b5019d8f2a76b01141411845d977fb3949617604de0b34351f23647e3e8b378477de184e1c4f2f59297bc4c7de3155e0edba9099b8924594a36b37b04cc8
)
-vcpkg_extract_source_archive(${ARCHIVE})
+vcpkg_extract_source_archive_ex(
+ OUT_SOURCE_PATH SOURCE_PATH
+ ARCHIVE ${ARCHIVE}
+ PATCHES
+ 0001-remove-install-prefix.patch
+)
# Note that if you have configured and built both static and shared library on Windows
# but want to link with the static library compile time define "FMILIB_BUILDING_LIBRARY" must be set.
@@ -45,140 +51,18 @@ else() SET(FMILIB_BUILD_SHARED_LIB ON)
endif()
-SET(OPTIONS
- -DFMILIB_BUILD_TESTS=OFF
- -DFMILIB_BUILD_STATIC_LIB=${FMILIB_BUILD_STATIC_LIB}
- -DFMILIB_BUILD_SHARED_LIB=${FMILIB_BUILD_SHARED_LIB}
- -DFMILIB_BUILDING_LIBRARY=${FMILIB_BUILDING_LIBRARY}
- -DFMILIB_BUILD_WITH_STATIC_RTLIB=${FMILIB_BUILD_WITH_STATIC_RTLIB}
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+ OPTIONS
+ -DFMILIB_BUILD_TESTS=OFF
+ -DFMILIB_BUILD_STATIC_LIB=${FMILIB_BUILD_STATIC_LIB}
+ -DFMILIB_BUILD_SHARED_LIB=${FMILIB_BUILD_SHARED_LIB}
+ -DFMILIB_BUILDING_LIBRARY=${FMILIB_BUILDING_LIBRARY}
+ -DFMILIB_BUILD_WITH_STATIC_RTLIB=${FMILIB_BUILD_WITH_STATIC_RTLIB}
)
-# Reset package dir
-file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR})
-file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR})
-
-if (NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
-
- if(VCPKG_TARGET_ARCHITECTURE MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v120")
- set(GENERATOR "Visual Studio 12 2013")
- elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v120")
- set(GENERATOR "Visual Studio 12 2013 Win64")
- elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "arm" AND VCPKG_PLATFORM_TOOLSET MATCHES "v120")
- set(GENERATOR "Visual Studio 12 2013 ARM")
-
- elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140")
- set(GENERATOR "Visual Studio 14 2015")
- elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140")
- set(GENERATOR "Visual Studio 14 2015 Win64")
- elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140")
- set(GENERATOR "Visual Studio 14 2015 ARM")
-
- elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141")
- set(GENERATOR "Visual Studio 15 2017")
- elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141")
- set(GENERATOR "Visual Studio 15 2017 Win64")
- elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141")
- set(GENERATOR "Visual Studio 15 2017 ARM")
- elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141")
- set(GENERATOR "Visual Studio 15 2017")
- else()
- message(FATAL_ERROR "Unable to determine appropriate generator for: ${VCPKG_CMAKE_SYSTEM_NAME}-${VCPKG_TARGET_ARCHITECTURE}-${VCPKG_PLATFORM_TOOLSET}")
- endif()
-
-endif()
-
-foreach(BUILDTYPE "rel" "dbg")
-
- message("Building ${TARGET_TRIPLET}-${BUILDTYPE}...")
-
- string(COMPARE EQUAL ${BUILDTYPE} "rel" RELEASE_BUILD)
-
- SET(BUILD_DIR ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${BUILDTYPE})
-
- # Reset working dir
- file(REMOVE_RECURSE ${BUILD_DIR})
- file(MAKE_DIRECTORY ${BUILD_DIR})
-
- SET(FMILIB_INSTALL_PREFIX ${CURRENT_PACKAGES_DIR})
- if(NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
- SET(OPTIONS ${OPTIONS} -G ${GENERATOR})
- endif()
- if(NOT RELEASE_BUILD)
- STRING(APPEND FMILIB_INSTALL_PREFIX "/debug")
- endif()
-
- # Step 1: Configure
- vcpkg_execute_required_process(COMMAND
- cmake
- -DFMILIB_INSTALL_PREFIX=${FMILIB_INSTALL_PREFIX}
- -DFMILIB_DEFAULT_BUILD_TYPE_RELEASE=${RELEASE_BUILD}
- ${OPTIONS}
- ${SOURCE_PATH}
- WORKING_DIRECTORY
- ${BUILD_DIR}
- )
-
- # Step 2: Build
- # Custom build - becouse vcpkg_configure_cmake() + vcpkg_install_cmake() fails on Linux for some unknown reason
- if (VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux" OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Darwin")
- find_program(MAKE make)
- if(NOT MAKE)
- message(FATAL_ERROR "Could not find make. Please install it through your package manager.")
- endif()
- vcpkg_execute_required_process(COMMAND make "install" WORKING_DIRECTORY ${BUILD_DIR})
- else()
- if(RELEASE_BUILD)
- SET(CONFIG "MinSizeRel")
- else()
- SET(CONFIG "Debug")
- endif()
- vcpkg_execute_required_process(COMMAND
- cmake
- --build .
- --config ${CONFIG}
- --target "install"
- WORKING_DIRECTORY
- ${BUILD_DIR}
- )
- endif()
-
- if (RELEASE_BUILD)
-
- # remove /doc folder
- file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/doc)
-
- # Move .dll files (if any) from /lib to /bin
- file(GLOB TMP ${CURRENT_PACKAGES_DIR}/lib/*.dll)
- if (TMP)
- file(COPY ${TMP} DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
- file(REMOVE ${TMP})
-
- # Add bin to path
- set(ENV{PATH} "${CURRENT_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin;$ENV{PATH}")
- endif()
-
- else()
-
- # remove duplicate folders in /debug
- file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
- file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/doc)
-
- # Move .dll files (if any) from /lib to /bin
- file(GLOB TMP ${CURRENT_PACKAGES_DIR}/debug/lib/*.dll)
- if (TMP)
- file(COPY ${TMP} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
- file(REMOVE ${TMP})
-
- # Add bin to path
- set(ENV{PATH} "${CURRENT_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/bin;$ENV{PATH}")
- endif()
-
- endif()
-
- message("Building ${TARGET_TRIPLET}-${BUILDTYPE}... Done")
-
-endforeach()
-
+vcpkg_install_cmake()
vcpkg_copy_pdbs()
-
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(INSTALL ${SOURCE_PATH}/LICENSE.md DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
|
