diff --git a/ports/arrow/CONTROL b/ports/arrow/CONTROL index 9650c7823b0eeb..bebf9be879cd1e 100644 --- a/ports/arrow/CONTROL +++ b/ports/arrow/CONTROL @@ -1,5 +1,5 @@ Source: arrow -Version: 0.14.1-1 +Version: 0.14.1-2 Build-Depends: boost-system, boost-filesystem, boost-multiprecision, boost-algorithm, flatbuffers, rapidjson, zlib, lz4, brotli, zstd, snappy, gflags, thrift, double-conversion, glog, uriparser Homepage: https://github.com/apache/arrow Description: Apache Arrow is a columnar in-memory analytics layer designed to accelerate big data. It houses a set of canonical in-memory representations of flat and hierarchical data along with multiple language-bindings for structure manipulation. It also provides IPC and common algorithm implementations. diff --git a/ports/arrow/all.patch b/ports/arrow/all.patch index 0675356fffbddc..0293b81ba65801 100644 --- a/ports/arrow/all.patch +++ b/ports/arrow/all.patch @@ -25,7 +25,7 @@ index 8410916..a196b25 100644 +endif() -set(LZ4_STATIC_LIB_NAME ${CMAKE_STATIC_LIBRARY_PREFIX}lz4${LZ4_STATIC_LIB_SUFFIX}) -+set(LZ4_STATIC_LIB_NAME ${CMAKE_STATIC_LIBRARY_PREFIX}lz4${LZ4_MSVC_STATIC_LIB_SUFFIX}${LZ4_LIB_NAME_DEBUG_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}) ++set(LZ4_STATIC_LIB_NAME ${CMAKE_STATIC_LIBRARY_PREFIX}lz4${LZ4_MSVC_STATIC_LIB_SUFFIX}${LZ4_LIB_NAME_DEBUG_SUFFIX}) if(LZ4_ROOT) find_library( @@ -99,7 +99,7 @@ index 8e47086..d7ce559 100644 + set(ZSTD_LIB_NAME_DEBUG_SUFFIX d) +endif() + -+set(ZSTD_STATIC_LIB_SUFFIX "${ZSTD_MSVC_STATIC_LIB_SUFFIX}${ZSTD_LIB_NAME_DEBUG_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}") ++set(ZSTD_STATIC_LIB_SUFFIX "${ZSTD_MSVC_STATIC_LIB_SUFFIX}${ZSTD_LIB_NAME_DEBUG_SUFFIX}") set(ZSTD_STATIC_LIB_NAME ${CMAKE_STATIC_LIBRARY_PREFIX}zstd${ZSTD_STATIC_LIB_SUFFIX}) # First, find via if specified ZTD_ROOT diff --git a/ports/curl/CONTROL b/ports/curl/CONTROL index 9c0471e42a9394..1022e223b4dcd4 100644 --- a/ports/curl/CONTROL +++ b/ports/curl/CONTROL @@ -1,5 +1,5 @@ Source: curl -Version: 7.66.0 +Version: 7.66.0-1 Build-Depends: zlib Homepage: https://github.com/curl/curl Description: A library for transferring data with URLs diff --git a/ports/fluidsynth/CONTROL b/ports/fluidsynth/CONTROL index 4532fa60ea1507..71a8333c7beb6b 100644 --- a/ports/fluidsynth/CONTROL +++ b/ports/fluidsynth/CONTROL @@ -1,4 +1,4 @@ Source: fluidsynth -Version: 2.0.5-1 +Version: 2.0.5-2 Description: FluidSynth reads and handles MIDI events from the MIDI input device. It is the software analogue of a MIDI synthesizer. FluidSynth can also play midifiles using a Soundfont. Build-Depends: glib diff --git a/ports/fluidsynth/Genexp.patch b/ports/fluidsynth/Genexp.patch new file mode 100644 index 00000000000000..1f379479fa1026 --- /dev/null +++ b/ports/fluidsynth/Genexp.patch @@ -0,0 +1,13 @@ +diff --git a/cmake_admin/FluidUnitTest.cmake b/cmake_admin/FluidUnitTest.cmake +index 367a406c5..77f5703a9 100644 +--- a/cmake_admin/FluidUnitTest.cmake ++++ b/cmake_admin/FluidUnitTest.cmake +@@ -8,7 +8,7 @@ macro ( ADD_FLUID_TEST _test ) + if ( FLUID_CPPFLAGS ) + set_target_properties ( ${_test} PROPERTIES COMPILE_FLAGS ${FLUID_CPPFLAGS} ) + endif ( FLUID_CPPFLAGS ) +- TARGET_LINK_LIBRARIES(${_test} $) ++ TARGET_LINK_LIBRARIES(${_test} $>) + + # use the local include path to look for fluidsynth.h, as we cannot be sure fluidsynth is already installed + target_include_directories(${_test} diff --git a/ports/fluidsynth/portfile.cmake b/ports/fluidsynth/portfile.cmake index 3427180a387a35..f1f38df345a4f5 100644 --- a/ports/fluidsynth/portfile.cmake +++ b/ports/fluidsynth/portfile.cmake @@ -8,6 +8,7 @@ vcpkg_from_github( SHA512 5344ac889d2927dc2465bae40096d756a9bf9b1100e287ba0621c55ffc76f9cb8fa763f6bc832d701cd0ad2997965cf344f58ae4b3dd445eb3491e3659c093d9 HEAD_REF master PATCHES + Genexp.patch force-x86-gentables.patch ) diff --git a/ports/forge/CONTROL b/ports/forge/CONTROL index 595f6d2a2dd9f2..dce85bf9359378 100644 --- a/ports/forge/CONTROL +++ b/ports/forge/CONTROL @@ -1,4 +1,4 @@ Source: forge -Version: 1.0.4-1 +Version: 1.0.4-3 Description: Helps with high performance visualizations involving OpenGL-CUDA/OpenCL interop. Build-Depends: glfw3, glm, glbinding, freetype, boost-functional, freeimage, fontconfig (!windows) diff --git a/ports/forge/FindFreeImage.patch b/ports/forge/FindFreeImage.patch new file mode 100644 index 00000000000000..6efa53f8a72352 --- /dev/null +++ b/ports/forge/FindFreeImage.patch @@ -0,0 +1,33 @@ +diff --git a/CMakeModules/FindFreeImage.cmake b/CMakeModules/FindFreeImage.cmake +index f305d7f41..94bf04117 100644 +--- a/CMakeModules/FindFreeImage.cmake ++++ b/CMakeModules/FindFreeImage.cmake +@@ -65,9 +65,8 @@ find_library(FreeImage_LINK_LIBRARY + + find_library(FreeImage_STATIC_LIBRARY + NAMES +- ${CMAKE_STATIC_LIBRARY_PREFIX}FreeImageLIB${CMAKE_STATIC_LIBRARY_SUFFIX} +- ${CMAKE_STATIC_LIBRARY_PREFIX}FreeImage${CMAKE_STATIC_LIBRARY_SUFFIX} +- ${CMAKE_STATIC_LIBRARY_PREFIX}freeimage${CMAKE_STATIC_LIBRARY_SUFFIX} ++ ${CMAKE_STATIC_LIBRARY_PREFIX}FreeImageLIB ++ ${CMAKE_STATIC_LIBRARY_PREFIX}FreeImage + PATHS + /usr + /usr/local +@@ -83,14 +82,11 @@ find_library(FreeImage_STATIC_LIBRARY + if (WIN32) + find_file(FreeImage_DLL_LIBRARY + NAMES +- ${CMAKE_SHARED_LIBRARY_PREFIX}FreeImage${CMAKE_SHARED_LIBRARY_SUFFIX} +- ${CMAKE_SHARED_LIBRARY_PREFIX}freeimage${CMAKE_SHARED_LIBRARY_SUFFIX} ++ ${CMAKE_SHARED_LIBRARY_PREFIX}FreeImage ++ ${CMAKE_SHARED_LIBRARY_PREFIX}freeimage + PATHS + ${FreeImage_ROOT} + PATH_SUFFIXES +- lib +- lib64 +- x64/lib + bin + x64/bin + DOC "The FreeImage dll") diff --git a/ports/forge/portfile.cmake b/ports/forge/portfile.cmake index 24df90dce44615..326560f25da26c 100644 --- a/ports/forge/portfile.cmake +++ b/ports/forge/portfile.cmake @@ -11,6 +11,7 @@ vcpkg_from_github( SHA512 2093464db0f3a7f0178f65bed37986a4df1117f1d7ad65157d525584490cdf234475f01ed1a2003a9e54bdc3b9e2e450808044a264c2284d67b8c2a353400027 HEAD_REF master PATCHES fix-static_build.patch + FindFreeImage.patch ) vcpkg_configure_cmake( diff --git a/ports/g2o/CONTROL b/ports/g2o/CONTROL index 0e6b43f7d0605b..689e8ed2e68d25 100644 --- a/ports/g2o/CONTROL +++ b/ports/g2o/CONTROL @@ -1,5 +1,5 @@ Source: g2o Version: 20170730_git-5 Build-Depends: suitesparse, eigen3, clapack (!osx), ceres -Description: g2o: A General Framework for Graph Optimization +Description: g2o: A General Framework for Graph Optimization Homepage: https://openslam.org/g2o.html diff --git a/ports/gppanel/CONTROL b/ports/gppanel/CONTROL index 580f233d2f6009..f1a100cec2bf92 100644 --- a/ports/gppanel/CONTROL +++ b/ports/gppanel/CONTROL @@ -1,5 +1,5 @@ Source: gppanel -Version: 2018-04-06 +Version: 2018-04-06_1 Build-Depends: wxwidgets Homepage: https://github.com/woollybah/gppanel Description: gpPanel is chart libary for wxWidget. It inheritance from wxPanel and use modified wxMathPlot library at chart engine. diff --git a/ports/gppanel/FindwxWidgets.patch b/ports/gppanel/FindwxWidgets.patch new file mode 100644 index 00000000000000..d489c6e0241d09 --- /dev/null +++ b/ports/gppanel/FindwxWidgets.patch @@ -0,0 +1,36 @@ +diff --git a/FindwxWidgets.cmake b/FindwxWidgets.cmake +index 22d7e7315..74c91d0fd 100644 +--- a/FindwxWidgets.cmake ++++ b/FindwxWidgets.cmake +@@ -281,6 +281,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32") + find_library(WX_base${_DBG} + NAMES + wxbase31${_UCD}${_DBG} ++ wxbase31${_UCD} + wxbase30${_UCD}${_DBG} + wxbase29${_UCD}${_DBG} + wxbase28${_UCD}${_DBG} +@@ -295,6 +296,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32") + find_library(WX_${LIB}${_DBG} + NAMES + wxbase31${_UCD}${_DBG}_${LIB} ++ wxbase31${_UCD}_${LIB} + wxbase30${_UCD}${_DBG}_${LIB} + wxbase29${_UCD}${_DBG}_${LIB} + wxbase28${_UCD}${_DBG}_${LIB} +@@ -311,6 +313,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32") + find_library(WX_mono${_DBG} + NAMES + wxmsw${_UNV}31${_UCD}${_DBG} ++ wxmsw${_UNV}31${_UCD} + wxmsw${_UNV}30${_UCD}${_DBG} + wxmsw${_UNV}29${_UCD}${_DBG} + wxmsw${_UNV}28${_UCD}${_DBG} +@@ -328,6 +331,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32") + find_library(WX_${LIB}${_DBG} + NAMES + wxmsw${_UNV}31${_UCD}${_DBG}_${LIB} ++ wxmsw${_UNV}31${_UCD}_${LIB} + wxmsw${_UNV}30${_UCD}${_DBG}_${LIB} + wxmsw${_UNV}29${_UCD}${_DBG}_${LIB} + wxmsw${_UNV}28${_UCD}${_DBG}_${LIB} diff --git a/ports/gppanel/portfile.cmake b/ports/gppanel/portfile.cmake index 04ef9be56a67d0..073924bae5aba8 100644 --- a/ports/gppanel/portfile.cmake +++ b/ports/gppanel/portfile.cmake @@ -13,13 +13,15 @@ vcpkg_from_github( file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) + vcpkg_from_github( OUT_SOURCE_PATH VCPKG_WX_FIND_SOURCE_PATH REPO CaeruleusAqua/vcpkg-wx-find REF 17993e942f677799b488a06ca659a8e46ff272c9 SHA512 0fe07d3669f115c9b6a761abd7743f87e67f24d1eae3f3abee4715fa4d6b76af0d1ea3a4bd82dbdbed430ae50295e1722615ce0ee7d46182125f5048185ee153 HEAD_REF master -) + PATCHES FindwxWidgets.patch +) # Hmm. How is this different from the CMake version of FindwxWidget? Issue #4756 -> should probably be solved with a vcpkg_cmake_wrapper.cmake file(COPY ${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake DESTINATION ${VCPKG_WX_FIND_SOURCE_PATH}) file(COPY ${CMAKE_ROOT}/Modules/FindPackageMessage.cmake DESTINATION ${VCPKG_WX_FIND_SOURCE_PATH}) diff --git a/ports/liblas/fix-BuildError.patch b/ports/liblas/fix-BuildError.patch index 277e81ef7f75cb..953dd0adf15ffa 100644 --- a/ports/liblas/fix-BuildError.patch +++ b/ports/liblas/fix-BuildError.patch @@ -41,7 +41,7 @@ index e35de06..f7c25d2 100644 ${LASZIP_LIBRARY} - ${Boost_LIBRARIES}) + ${Boost_LIBRARIES} -+ proj) ++ ${PROJ4_LIBRARY}) target_link_libraries(${LIBLAS_C_LIB_NAME} ${LIBLAS_LIB_NAME} ) diff --git a/ports/libmysql/CONTROL b/ports/libmysql/CONTROL index 37c42943eb52f3..62501d683e7c8d 100644 --- a/ports/libmysql/CONTROL +++ b/ports/libmysql/CONTROL @@ -1,5 +1,5 @@ Source: libmysql -Version: 8.0.4-4 +Version: 8.0.4-4 Homepage: https://github.com/mysql/mysql-server Build-Depends: boost-algorithm, boost-geometry, boost-optional, boost-functional, boost-graph, openssl, icu, libevent, liblzma, lz4, zlib Description: A MySQL client library for C development. diff --git a/ports/openmvs/CONTROL b/ports/openmvs/CONTROL index 6cbbe4119e0d1a..1708205a8977a0 100644 --- a/ports/openmvs/CONTROL +++ b/ports/openmvs/CONTROL @@ -1,4 +1,4 @@ Source: openmvs -Version: 1.0-1 +Version: 1.0-3 Description: OpenMVS: open Multi-View Stereo reconstruction library Build-Depends: zlib, boost-iostreams, boost-program-options, boost-system, boost-serialization, eigen3, ceres, opencv, cgal[core], glew, glfw3, vcglib diff --git a/ports/openmvs/portfile.cmake b/ports/openmvs/portfile.cmake index 97f78938331b5f..5f552fdcaeb634 100644 --- a/ports/openmvs/portfile.cmake +++ b/ports/openmvs/portfile.cmake @@ -27,37 +27,30 @@ else() vcpkg_fixup_cmake_targets(CONFIG_PATH lib/CMake/OpenMVS) endif() -#somehow the native CMAKE_EXECUTABLE_SUFFIX does not work, so here we emulate it -if(CMAKE_HOST_WIN32) -set(EXECUTABLE_SUFFIX ".exe") -else() -set(EXECUTABLE_SUFFIX "") -endif() - -file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/OpenMVS/DensifyPointCloud${EXECUTABLE_SUFFIX}) -file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/OpenMVS/InterfaceCOLMAP${EXECUTABLE_SUFFIX}) -file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/OpenMVS/InterfaceVisualSFM${EXECUTABLE_SUFFIX}) -file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/OpenMVS/ReconstructMesh${EXECUTABLE_SUFFIX}) -file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/OpenMVS/RefineMesh${EXECUTABLE_SUFFIX}) -file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/OpenMVS/TextureMesh${EXECUTABLE_SUFFIX}) +file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/OpenMVS/DensifyPointCloud${VCPKG_HOST_EXECUTABLE_SUFFIX}) +file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/OpenMVS/InterfaceCOLMAP${VCPKG_HOST_EXECUTABLE_SUFFIX}) +file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/OpenMVS/InterfaceVisualSFM${VCPKG_HOST_EXECUTABLE_SUFFIX}) +file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/OpenMVS/ReconstructMesh${VCPKG_HOST_EXECUTABLE_SUFFIX}) +file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/OpenMVS/RefineMesh${VCPKG_HOST_EXECUTABLE_SUFFIX}) +file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/OpenMVS/TextureMesh${VCPKG_HOST_EXECUTABLE_SUFFIX}) file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools/openmvs/) -if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/OpenMVS/DensifyPointCloud${EXECUTABLE_SUFFIX}") - file(RENAME ${CURRENT_PACKAGES_DIR}/bin/OpenMVS/DensifyPointCloud${EXECUTABLE_SUFFIX} ${CURRENT_PACKAGES_DIR}/tools/openmvs/DensifyPointCloud${EXECUTABLE_SUFFIX}) +if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/OpenMVS/DensifyPointCloud${VCPKG_HOST_EXECUTABLE_SUFFIX}") + file(RENAME ${CURRENT_PACKAGES_DIR}/bin/OpenMVS/DensifyPointCloud${VCPKG_HOST_EXECUTABLE_SUFFIX} ${CURRENT_PACKAGES_DIR}/tools/openmvs/DensifyPointCloud${VCPKG_HOST_EXECUTABLE_SUFFIX}) endif() -if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/OpenMVS/InterfaceCOLMAP${EXECUTABLE_SUFFIX}") - file(RENAME ${CURRENT_PACKAGES_DIR}/bin/OpenMVS/InterfaceCOLMAP${EXECUTABLE_SUFFIX} ${CURRENT_PACKAGES_DIR}/tools/openmvs/InterfaceCOLMAP${EXECUTABLE_SUFFIX}) +if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/OpenMVS/InterfaceCOLMAP${VCPKG_HOST_EXECUTABLE_SUFFIX}") + file(RENAME ${CURRENT_PACKAGES_DIR}/bin/OpenMVS/InterfaceCOLMAP${VCPKG_HOST_EXECUTABLE_SUFFIX} ${CURRENT_PACKAGES_DIR}/tools/openmvs/InterfaceCOLMAP${VCPKG_HOST_EXECUTABLE_SUFFIX}) endif() -if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/OpenMVS/InterfaceVisualSFM${EXECUTABLE_SUFFIX}") - file(RENAME ${CURRENT_PACKAGES_DIR}/bin/OpenMVS/InterfaceVisualSFM${EXECUTABLE_SUFFIX} ${CURRENT_PACKAGES_DIR}/tools/openmvs/InterfaceVisualSFM${EXECUTABLE_SUFFIX}) +if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/OpenMVS/InterfaceVisualSFM${VCPKG_HOST_EXECUTABLE_SUFFIX}") + file(RENAME ${CURRENT_PACKAGES_DIR}/bin/OpenMVS/InterfaceVisualSFM${VCPKG_HOST_EXECUTABLE_SUFFIX} ${CURRENT_PACKAGES_DIR}/tools/openmvs/InterfaceVisualSFM${VCPKG_HOST_EXECUTABLE_SUFFIX}) endif() -if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/OpenMVS/ReconstructMesh${EXECUTABLE_SUFFIX}") - file(RENAME ${CURRENT_PACKAGES_DIR}/bin/OpenMVS/ReconstructMesh${EXECUTABLE_SUFFIX} ${CURRENT_PACKAGES_DIR}/tools/openmvs/ReconstructMesh${EXECUTABLE_SUFFIX}) +if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/OpenMVS/ReconstructMesh${VCPKG_HOST_EXECUTABLE_SUFFIX}") + file(RENAME ${CURRENT_PACKAGES_DIR}/bin/OpenMVS/ReconstructMesh${VCPKG_HOST_EXECUTABLE_SUFFIX} ${CURRENT_PACKAGES_DIR}/tools/openmvs/ReconstructMesh${VCPKG_HOST_EXECUTABLE_SUFFIX}) endif() -if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/OpenMVS/RefineMesh${EXECUTABLE_SUFFIX}") - file(RENAME ${CURRENT_PACKAGES_DIR}/bin/OpenMVS/RefineMesh${EXECUTABLE_SUFFIX} ${CURRENT_PACKAGES_DIR}/tools/openmvs/RefineMesh${EXECUTABLE_SUFFIX}) +if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/OpenMVS/RefineMesh${VCPKG_HOST_EXECUTABLE_SUFFIX}") + file(RENAME ${CURRENT_PACKAGES_DIR}/bin/OpenMVS/RefineMesh${VCPKG_HOST_EXECUTABLE_SUFFIX} ${CURRENT_PACKAGES_DIR}/tools/openmvs/RefineMesh${VCPKG_HOST_EXECUTABLE_SUFFIX}) endif() -if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/OpenMVS/TextureMesh${EXECUTABLE_SUFFIX}") - file(RENAME ${CURRENT_PACKAGES_DIR}/bin/OpenMVS/TextureMesh${EXECUTABLE_SUFFIX} ${CURRENT_PACKAGES_DIR}/tools/openmvs/TextureMesh${EXECUTABLE_SUFFIX}) +if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/OpenMVS/TextureMesh${VCPKG_HOST_EXECUTABLE_SUFFIX}") + file(RENAME ${CURRENT_PACKAGES_DIR}/bin/OpenMVS/TextureMesh${VCPKG_HOST_EXECUTABLE_SUFFIX} ${CURRENT_PACKAGES_DIR}/tools/openmvs/TextureMesh${VCPKG_HOST_EXECUTABLE_SUFFIX}) endif() vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/openmvs) diff --git a/ports/orc/CONTROL b/ports/orc/CONTROL index 3ab0d5903e0b32..894e6bfd6e9424 100644 --- a/ports/orc/CONTROL +++ b/ports/orc/CONTROL @@ -1,5 +1,5 @@ Source: orc -Version: 1.5.6 +Version: 1.5.6 Homepage: https://orc.apache.org/ Build-Depends: zlib, protobuf, lz4, snappy, zstd, gtest Description: The smallest, fastest columnar storage for Hadoop workloads. diff --git a/ports/paho-mqttpp3/CONTROL b/ports/paho-mqttpp3/CONTROL index 1656c094d308ac..72870932e6f51f 100644 --- a/ports/paho-mqttpp3/CONTROL +++ b/ports/paho-mqttpp3/CONTROL @@ -1,5 +1,5 @@ Source: paho-mqttpp3 -Version: 1.0.1-2 +Version: 1.0.1-4 Description: Paho project provides open-source C++ wrapper for Paho C library Build-Depends: paho-mqtt Default-Features: ssl diff --git a/ports/paho-mqttpp3/FindPahoMqttC_name_fix.patch b/ports/paho-mqttpp3/FindPahoMqttC_name_fix.patch new file mode 100644 index 00000000000000..a3b639f3fad2d1 --- /dev/null +++ b/ports/paho-mqttpp3/FindPahoMqttC_name_fix.patch @@ -0,0 +1,24 @@ +diff --git a/cmake/FindPahoMqttC.cmake b/cmake/FindPahoMqttC.cmake +index 10c2bfa62..afbf7f9c5 100644 +--- a/cmake/FindPahoMqttC.cmake ++++ b/cmake/FindPahoMqttC.cmake +@@ -1,9 +1,17 @@ + # find the Paho MQTT C library + if(PAHO_WITH_SSL) +- set(_PAHO_MQTT_C_LIB_NAME paho-mqtt3as) ++ if(PAHO_MQTTPP3_SHARED) ++ set(_PAHO_MQTT_C_LIB_NAME paho-mqtt3as) ++ else() ++ set(_PAHO_MQTT_C_LIB_NAME paho-mqtt3as-static paho-mqtt3as) ++ endif() + find_package(OpenSSL REQUIRED) + else() +- set(_PAHO_MQTT_C_LIB_NAME paho-mqtt3a) ++ if(PAHO_MQTTPP3_SHARED) ++ set(_PAHO_MQTT_C_LIB_NAME paho-mqtt3a) ++ else() ++ set(_PAHO_MQTT_C_LIB_NAME paho-mqtt3a-static paho-mqtt3a) ++ endif() + endif() + + find_library(PAHO_MQTT_C_LIBRARIES NAMES ${_PAHO_MQTT_C_LIB_NAME}) diff --git a/ports/paho-mqttpp3/portfile.cmake b/ports/paho-mqttpp3/portfile.cmake index 97633e0ea62caf..a44a5a6ef5aea4 100644 --- a/ports/paho-mqttpp3/portfile.cmake +++ b/ports/paho-mqttpp3/portfile.cmake @@ -9,6 +9,7 @@ vcpkg_from_github( HEAD_REF master PATCHES fix-include-path.patch + FindPahoMqttC_name_fix.patch ) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS @@ -16,7 +17,7 @@ vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS ) # Link with 'paho-mqtt3as' library -set(PAHO_C_LIBNAME paho-mqtt3as) + # Setting the library path if (NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") @@ -35,11 +36,13 @@ set(PAHO_CMAKE_GENERATOR "Ninja") # It uses two different options PAHO_BUILD_STATIC and PAHO_BUILD_SHARED instead of just using one variable. # Unless the open source community cleans up the cmake files, we are stuck with setting both of them. if (VCPKG_LIBRARY_LINKAGE STREQUAL "static") + set(PAHO_C_LIBNAME paho-mqtt3as-static) set(PAHO_MQTTPP3_STATIC ON) set(PAHO_MQTTPP3_SHARED OFF) set(PAHO_C_LIB "${PAHO_C_LIBRARY_PATH}/${PAHO_C_LIBNAME}") set(PAHO_OPTIONS -DPAHO_MQTT_C_LIBRARIES=${PAHO_C_LIB}) else() + set(PAHO_C_LIBNAME paho-mqtt3as) set(PAHO_MQTTPP3_STATIC OFF) set(PAHO_MQTTPP3_SHARED ON) set(PAHO_OPTIONS) diff --git a/ports/pybind11/CONTROL b/ports/pybind11/CONTROL index acaedef63fe470..2a16a0c2093f30 100644 --- a/ports/pybind11/CONTROL +++ b/ports/pybind11/CONTROL @@ -1,5 +1,5 @@ Source: pybind11 -Version: 2.3.0 +Version: 2.3.0-2 Homepage: https://github.com/pybind/pybind11 Description: pybind11 is a lightweight header-only library that exposes C++ types in Python and vice versa, mainly to create Python bindings of existing C++ code. Build-Depends: python3 (windows) \ No newline at end of file diff --git a/ports/pybind11/portfile.cmake b/ports/pybind11/portfile.cmake index 71786016d57c09..daa42ac12c71f3 100644 --- a/ports/pybind11/portfile.cmake +++ b/ports/pybind11/portfile.cmake @@ -13,22 +13,27 @@ vcpkg_from_github( vcpkg_find_acquire_program(PYTHON3) get_filename_component(PYPATH ${PYTHON3} PATH) -set(ENV{PATH} "$ENV{PATH};${PYPATH}") +set(ENV{PATH} "$ENV{PATH};${PYPATH}") #TODO: Use vcpkg_add_to_path +if(VCPKG_TARGET_IS_WINDOWS) + set(PYTHON3_LIBS -DPYTHON_LIBRARIES=\"optimized\\\\\\\\;${CURRENT_INSTALLED_DIR}/lib/python36.lib\\\\\\\\;debug\\\\\\\\;${CURRENT_INSTALLED_DIR}/debug/lib/python36_d.lib\" + -DPYTHONLIBS_FOUND=ON + -DPYTHON_INCLUDE_DIRS=${CURRENT_INSTALLED_DIR}/include) +else() + set(PYTHON3_LIBS) +endif() vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA OPTIONS -DPYBIND11_TEST=OFF - -DPYTHONLIBS_FOUND=ON - -DPYTHON_INCLUDE_DIRS=${CURRENT_INSTALLED_DIR}/include - -DPYTHON_MODULE_EXTENSION=.dll + -DPYTHON_MODULE_EXTENSION=${VCPKG_TARGET_SHARED_LIBRARY_SUFFIX} + ${PYTHON3_LIBS} + -DVCPKG_LIBTRACK_DEACTIVATE=ON OPTIONS_RELEASE -DPYTHON_IS_DEBUG=OFF - -DPYTHON_LIBRARIES=${CURRENT_INSTALLED_DIR}/lib/python36.lib OPTIONS_DEBUG -DPYTHON_IS_DEBUG=ON - -DPYTHON_LIBRARIES=${CURRENT_INSTALLED_DIR}/debug/lib/python36_d.lib ) vcpkg_install_cmake() diff --git a/ports/qt-advanced-docking-system/CONTROL b/ports/qt-advanced-docking-system/CONTROL index a578f8643f4f9a..751a0d0ff99ebf 100644 --- a/ports/qt-advanced-docking-system/CONTROL +++ b/ports/qt-advanced-docking-system/CONTROL @@ -1,4 +1,4 @@ Source: qt-advanced-docking-system -Version: 2019-08-14 +Version: 2019-08-14 Build-Depends: qt5-base, zlib, bzip2 Description: Create customizable layouts using an advanced window docking system similar to what is found in many popular IDEs such as Visual Studio diff --git a/ports/qt5-base/vcpkg-cmake-wrapper.cmake b/ports/qt5-base/vcpkg-cmake-wrapper.cmake index 81a434ffd5e46d..febe9fe28ff3a1 100644 --- a/ports/qt5-base/vcpkg-cmake-wrapper.cmake +++ b/ports/qt5-base/vcpkg-cmake-wrapper.cmake @@ -16,7 +16,7 @@ if("${_target_type}" STREQUAL "STATIC_LIBRARY") find_package(PNG) find_package(Freetype) find_package(sqlite3 CONFIG) - find_package(PostgreSQL MODULE REQUIRED) + #find_package(PostgreSQL MODULE REQUIRED) find_package(double-conversion CONFIG) find_package(OpenSSL) find_package(harfbuzz CONFIG) diff --git a/ports/quickfix/CONTROL b/ports/quickfix/CONTROL index b0d8e7d6b64c79..272249e920b3cc 100644 --- a/ports/quickfix/CONTROL +++ b/ports/quickfix/CONTROL @@ -1,5 +1,5 @@ Source: quickfix -Version: 1.15.1 +Version: 1.15.1 Build-Depends: openssl Homepage: https://github.com/quickfix/quickfix Description: QuickFIX is a free and open source implementation of the FIX protocol. diff --git a/ports/rpclib/CONTROL b/ports/rpclib/CONTROL index 15e6abd3edabad..a6b58d68e030e8 100644 --- a/ports/rpclib/CONTROL +++ b/ports/rpclib/CONTROL @@ -1,4 +1,4 @@ Source: rpclib -Version: 2.2.1-1 +Version: 2.2.1-1 Homepage: https://github.com/rpclib/rpclib Description: a RPC library for C++, providing both a client and server implementation. It is built using modern C++14. diff --git a/ports/solid3/CONTROL b/ports/solid3/CONTROL index 7dce173ee840e7..cdd8ea2f7f8e09 100644 --- a/ports/solid3/CONTROL +++ b/ports/solid3/CONTROL @@ -1,3 +1,3 @@ Source: solid3 -Version: 3.5.8 +Version: 3.5.8 Description: Software Library for Interference Detection diff --git a/ports/tesseract/CONTROL b/ports/tesseract/CONTROL index a24dd9435a0bbe..8342aa3dace3bd 100644 --- a/ports/tesseract/CONTROL +++ b/ports/tesseract/CONTROL @@ -1,5 +1,5 @@ Source: tesseract -Version: 4.1.0-2 +Version: 4.1.0-2 Homepage: https://github.com/tesseract-ocr/tesseract Description: An OCR Engine that was developed at HP Labs between 1985 and 1995... and now at Google. Build-Depends: leptonica diff --git a/ports/urdfdom/CONTROL b/ports/urdfdom/CONTROL index 7420aaca63bd75..5a54bce5640ded 100644 --- a/ports/urdfdom/CONTROL +++ b/ports/urdfdom/CONTROL @@ -1,5 +1,5 @@ Source: urdfdom -Version: 1.0.3-1 +Version: 1.0.3-2 Homepage: https://github.com/ros/urdfdom Description: Provides core data structures and a simple XML parsers for populating the class data structures from an URDF file. Build-Depends: console-bridge, tinyxml, urdfdom-headers diff --git a/scripts/buildsystems/cmake/vcpkg-add_executable.cmake b/scripts/buildsystems/cmake/vcpkg-add_executable.cmake new file mode 100644 index 00000000000000..1679ab27bf8bcd --- /dev/null +++ b/scripts/buildsystems/cmake/vcpkg-add_executable.cmake @@ -0,0 +1,53 @@ +option(VCPKG_APPLOCAL_DEPS "Automatically copy dependencies into the output directory for executables." ON) + +vcpkg_define_function_overwrite_option(add_executable) + +if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" OR CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone") + set(_VCPKG_TARGET_TRIPLET_PLAT uwp) +elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR (NOT CMAKE_SYSTEM_NAME AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")) + set(_VCPKG_TARGET_TRIPLET_PLAT linux) +elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR (NOT CMAKE_SYSTEM_NAME AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")) + set(_VCPKG_TARGET_TRIPLET_PLAT osx) +elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows" OR (NOT CMAKE_SYSTEM_NAME AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")) + set(_VCPKG_TARGET_TRIPLET_PLAT windows) +elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR (NOT CMAKE_SYSTEM_NAME AND CMAKE_HOST_SYSTEM_NAME STREQUAL "FreeBSD")) + set(_VCPKG_TARGET_TRIPLET_PLAT freebsd) +endif() + +function(vcpkg_add_executable name) + _add_executable(${ARGV}) + + list(FIND ARGV "IMPORTED" IMPORTED_IDX) + list(FIND ARGV "ALIAS" ALIAS_IDX) + list(FIND ARGV "MACOSX_BUNDLE" MACOSX_BUNDLE_IDX) + if(IMPORTED_IDX EQUAL -1 AND ALIAS_IDX EQUAL -1) + if(VCPKG_APPLOCAL_DEPS) + if(_VCPKG_TARGET_TRIPLET_PLAT MATCHES "windows|uwp") + add_custom_command(TARGET ${name} POST_BUILD + COMMAND powershell -noprofile -executionpolicy Bypass -file ${_VCPKG_TOOLCHAIN_DIR}/msbuild/applocal.ps1 + -targetBinary $ + -installedDir "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$:/debug>/bin" + -OutVariable out + ) + elseif(_VCPKG_TARGET_TRIPLET_PLAT MATCHES "osx") + if (NOT MACOSX_BUNDLE_IDX EQUAL -1) + add_custom_command(TARGET ${name} POST_BUILD + COMMAND python ${_VCPKG_TOOLCHAIN_DIR}/osx/applocal.py + $ + "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$:/debug>" + ) + endif() + endif() + endif() + set_target_properties(${name} PROPERTIES VS_USER_PROPS do_not_import_user.props) + set_target_properties(${name} PROPERTIES VS_GLOBAL_VcpkgEnabled false) + endif() +endfunction() + +if(VCPKG_ENABLE_add_executable) + function(add_executable name) + vcpkg_enable_function_overwrite_guard(add_executable "") + vcpkg_add_executable(${ARGV}) + vcpkg_disable_function_overwrite_guard(add_executable "") + endfunction() +endif() \ No newline at end of file diff --git a/scripts/buildsystems/cmake/vcpkg-add_library.cmake b/scripts/buildsystems/cmake/vcpkg-add_library.cmake new file mode 100644 index 00000000000000..eb6bda646d3563 --- /dev/null +++ b/scripts/buildsystems/cmake/vcpkg-add_library.cmake @@ -0,0 +1,32 @@ +option(VCPKG_ENABLE_ADD_LIBRARY "Enables override of the cmake function add_library." ON) + +vcpkg_define_function_overwrite_option(add_library) + +function(vcpkg_add_library name) + _add_library(${ARGV}) + + list(FIND ARGV "IMPORTED" IMPORTED_IDX) + list(FIND ARGV "INTERFACE" INTERFACE_IDX) + list(FIND ARGV "ALIAS" ALIAS_IDX) + if(IMPORTED_IDX EQUAL -1 AND INTERFACE_IDX EQUAL -1 AND ALIAS_IDX EQUAL -1) + get_target_property(IS_LIBRARY_SHARED ${name} TYPE) + if(VCPKG_APPLOCAL_DEPS AND _VCPKG_TARGET_TRIPLET_PLAT MATCHES "windows|uwp" AND (IS_LIBRARY_SHARED STREQUAL "SHARED_LIBRARY" OR IS_LIBRARY_SHARED STREQUAL "MODULE_LIBRARY")) + add_custom_command(TARGET ${name} POST_BUILD + COMMAND powershell -noprofile -executionpolicy Bypass -file ${_VCPKG_TOOLCHAIN_DIR}/msbuild/applocal.ps1 + -targetBinary $ + -installedDir "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$:/debug>/bin" + -OutVariable out + ) + endif() + set_target_properties(${name} PROPERTIES VS_USER_PROPS do_not_import_user.props) + set_target_properties(${name} PROPERTIES VS_GLOBAL_VcpkgEnabled false) + endif() +endfunction() + +if(VCPKG_ENABLE_add_library) + function(add_library name) + vcpkg_enable_function_overwrite_guard(add_library "") + vcpkg_add_library(${ARGV}) + vcpkg_disable_function_overwrite_guard(add_library "") + endfunction() +endif() \ No newline at end of file diff --git a/scripts/buildsystems/cmake/vcpkg-check_linkage.cmake b/scripts/buildsystems/cmake/vcpkg-check_linkage.cmake new file mode 100644 index 00000000000000..9dcb68ecac49ad --- /dev/null +++ b/scripts/buildsystems/cmake/vcpkg-check_linkage.cmake @@ -0,0 +1,158 @@ + + +function(vcpkg_check_linkage OUTPUT_LINK_LIST) + #Match Start of Generator expression until first : without a new start of a generator expression -> should give the deepest nested : + #Use MATCHALL and List length to determine + set(_vcpkg_genexp_start "\\$<") + set(_vcpkg_genexp_close "([^>]*>)") # closing > at the end of the expression + #set(_vcpkg_genexp_opening "^(:?\\$<[^:]+)+:") # stops at deepest nested : + set(_vcpkg_genexp_closing_begin "([^>]*>)+:|^\\$<[^:]+:") # stops at last : . After that the link path/target has to be + set(_vcpkg_genexp_close_end "(>)+$") # closing > at the end of the expression + + get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE ) + #if( _CMAKE_IN_TRY_COMPILE) + if( _CMAKE_IN_TRY_COMPILE) + set(${OUTPUT_LINK_LIST} ${ARGN} PARENT_SCOPE) + return() + endif() + + unset(${OUTPUT_LINK_LIST} PARENT_SCOPE) + set(_tmp_list) + set(_tmp_gen_list) + set(_tmp_cur_list _tmp_list) + set(_genexp_counter 0) + foreach(_vcpkg_link_lib ${ARGN}) + vcpkg_msg(STATUS "vcpkg_check_linkage" "Link element to check ${_vcpkg_link_lib}") + + if(${_vcpkg_link_lib} MATCHES "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}") + set(_vcpkg_check_link TRUE) + else() + set(_vcpkg_check_link FALSE) + endif() + + #Generator expressions list guard + if(${_vcpkg_link_lib} MATCHES ${_vcpkg_genexp_start}) + while(${_vcpkg_link_lib} MATCHES ${_vcpkg_genexp_start}) + vcpkg_msg(STATUS "vcpkg_check_linkage" "Detected opening generator expression!") + string(REGEX MATCH ${_vcpkg_genexp_closing_begin} _vcpkg_link_lib_genexp_begin_tmp ${_vcpkg_link_lib}) + vcpkg_msg(STATUS "vcpkg_check_linkage" "Found expression ${_vcpkg_link_lib_genexp_begin_tmp} at the start.") + string(REGEX MATCHALL ${_vcpkg_genexp_start} _vcpkg_genexp_opening_match ${_vcpkg_link_lib_genexp_begin_tmp}) + string(REGEX MATCHALL ${_vcpkg_genexp_close} _vcpkg_genexp_close_match ${_vcpkg_link_lib_genexp_begin_tmp}) + list(LENGTH _vcpkg_genexp_opening_match _vcpkg_genexp_opening_counter) + list(LENGTH _vcpkg_genexp_close_match _vcpkg_genexp_closing_counter) + unset(_vcpkg_genexp_opening_match) + unset(_vcpkg_genexp_close_match) + string(CONCAT _vcpkg_link_lib_genexp_begin ${_vcpkg_link_lib_genexp_begin} ${_vcpkg_link_lib_genexp_begin_tmp}) + + vcpkg_msg(STATUS "vcpkg_check_linkage" "Found ${_vcpkg_genexp_opening_counter} opening and ${_vcpkg_genexp_closing_counter} closing expressions.") + + math(EXPR _genexp_counter "${_genexp_counter} + ${_vcpkg_genexp_opening_counter} - ${_vcpkg_genexp_closing_counter}") + unset(_vcpkg_genexp_opening_counter) + unset(_vcpkg_genexp_closing_counter) + + vcpkg_msg(STATUS "vcpkg_check_linkage" "Genexpression remaining counter ${_genexp_counter}") + + string(REPLACE "${_vcpkg_link_lib_genexp_begin_tmp}" "" _vcpkg_link_lib ${_vcpkg_link_lib}) # Remove starting genexp + + set(_tmp_cur_list _tmp_gen_list) + vcpkg_msg(STATUS "vcpkg_check_linkage" "Link element to check changed to ${_vcpkg_link_lib} due to opening generator expression") + endwhile() + endif() + + if(${_vcpkg_link_lib} MATCHES ${_vcpkg_genexp_close_end}) + string(REGEX MATCH ${_vcpkg_genexp_close_end} _vcpkg_link_lib_genexp_close ${_vcpkg_link_lib}) + string(REGEX MATCHALL ${_vcpkg_genexp_close} _vcpkg_genexp_close_match ${_vcpkg_link_lib_genexp_close}) + list(LENGTH _vcpkg_genexp_close_match _vcpkg_genexp_close_counter) + string(REPLACE "${_vcpkg_link_lib_genexp_close}" "" _vcpkg_link_lib ${_vcpkg_link_lib}) + + math(EXPR _genexp_counter "${_genexp_counter} - ${_vcpkg_genexp_close_counter}") + vcpkg_msg(STATUS "vcpkg_check_linkage" "Genexpression counter decreased ${_genexp_counter}") + + if(${_genexp_counter} EQUAL 0) + set(_vcpkg_close_genexp 1) + endif() + if(${_genexp_counter} LESS 0) + vcpkg_msg(FATAL_ERROR "vcpkg_check_linkage" "Programming error. Expression counter below 0!") + endif() + vcpkg_msg(STATUS "vcpkg_check_linkage" "Link element to check changed to ${_vcpkg_link_lib} due to closing generator expression") + endif() + + #Keyword check + if(${_vcpkg_link_lib} MATCHES "(^debug$|^optimized$|^general$)") + set(_vcpkg_link_lib_keyword ${_vcpkg_link_lib}) + vcpkg_msg(STATUS "vcpkg_check_linkage" "Setting keyword: ${_vcpkg_link_lib_keyword}!") + continue() + endif() + + #Linkage Check + if(_vcpkg_check_link AND "${_vcpkg_link_lib}" MATCHES "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}(/debug/(lib|bin)|/(lib|bin))(/manual-link)*") + # Library picked up from VCPKG -> check and correct linkage if necessary + vcpkg_extract_library_name_from_path(_vcpkg_libtrack_name ${_vcpkg_link_lib}) + if(("${_vcpkg_link_lib_keyword}" MATCHES "debug" OR + ("${_vcpkg_link_lib_genexp_begin}" MATCHES "\$" AND + NOT "${_vcpkg_link_lib_genexp_begin}" MATCHES "\$")) + AND NOT "${_vcpkg_link_lib}" MATCHES "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/(lib|bin)(/manual-link)*") + if(DEFINED VCPKG_LIBTRACK_${_vcpkg_libtrack_name}_DEBUG) + vcpkg_msg(WARNING "vcpkg_check_linkage" "Correcting debug linkage from ${_vcpkg_link_lib}!") + set(${_vcpkg_link_lib} ${VCPKG_LIBTRACK_${_vcpkg_libtrack_name}_DEBUG}) + vcpkg_msg(WARNING "vcpkg_check_linkage" "to ${_vcpkg_link_lib}!") + endif() + vcpkg_msg(WARNING "vcpkg_check_linkage" "Wrong debug linkage: ${_vcpkg_link_lib}!") # should be correct if find_library did not screw up + elseif(("${_vcpkg_link_lib_keyword}" MATCHES "optimized" OR + "${_vcpkg_link_lib_genexp_begin}" MATCHES "\$") + AND NOT "${_vcpkg_link_lib}" MATCHES "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/(lib|bin)(/manual-link)*") + if(DEFINED VCPKG_LIBTRACK_${_vcpkg_libtrack_name}_RELEASE) + vcpkg_msg(WARNING "vcpkg_check_linkage" "Correcting optimized linkage from ${_vcpkg_link_lib}!") + set(${_vcpkg_link_lib} ${VCPKG_LIBTRACK_${_vcpkg_libtrack_name}_RELEASE}) + vcpkg_msg(WARNING "vcpkg_check_linkage" "to ${_vcpkg_link_lib}!") + endif() + vcpkg_msg(WARNING "vcpkg_check_linkage" "Wrong optimized linkage: ${_vcpkg_link_lib}!") # should be correct if find_library did not screw up + elseif(${_vcpkg_link_lib_keyword} MATCHES "general" OR (NOT DEFINED _vcpkg_link_lib_keyword AND NOT DEFINED _vcpkg_link_lib_genexp_begin)) # means general or no keyword! + vcpkg_msg(STATUS "vcpkg_check_linkage" "Correcting general linkage option!") + if(DEFINED VCPKG_LIBTRACK_${_vcpkg_libtrack_name}_DEBUG AND VCPKG_DEBUG_AVAILABLE) + list(APPEND ${_tmp_cur_list} debug "${VCPKG_LIBTRACK_${_vcpkg_libtrack_name}_DEBUG}") + else() + vcpkg_msg(WARNING "vcpkg_check_linkage" "VCPKG_LIBTRACK_${_vcpkg_libtrack_name}_DEBUG not available!") + endif() + if(DEFINED VCPKG_LIBTRACK_${_vcpkg_libtrack_name}_RELEASE) + list(APPEND ${_tmp_cur_list} optimized "${VCPKG_LIBTRACK_${_vcpkg_libtrack_name}_RELEASE}") + else() + vcpkg_msg(FATAL_ERROR "vcpkg_check_linkage" "VCPKG_LIBTRACK_${_vcpkg_libtrack_name}_RELEASE not available!") + endif() + else() #everything fine. Nothing to do + if(DEFINED _vcpkg_link_lib_keyword) # External LIB -> do nothing + list(APPEND ${_tmp_cur_list} "${_vcpkg_link_lib_genexp_begin}${_vcpkg_link_lib_keyword}" "${_vcpkg_link_lib}${_vcpkg_link_lib_genexp_close}") + else() + list(APPEND ${_tmp_cur_list} "${_vcpkg_link_lib_genexp_begin}${_vcpkg_link_lib}${_vcpkg_link_lib_genexp_close}") + endif() + endif() + elseif(DEFINED _vcpkg_link_lib_keyword) # External LIB -> do nothing + vcpkg_msg(STATUS "vcpkg_check_linkage" "External library with keyword!") + list(APPEND ${_tmp_cur_list} "${_vcpkg_link_lib_genexp_begin}${_vcpkg_link_lib_keyword}" "${_vcpkg_link_lib}${_vcpkg_link_lib_genexp_close}") # keywords do not exist in genex so no guard needed + else() + list(APPEND ${_tmp_cur_list} "${_vcpkg_link_lib_genexp_begin}${_vcpkg_link_lib}${_vcpkg_link_lib_genexp_close}") + endif() + + #close generator expression + if(_vcpkg_close_genexp) + vcpkg_msg(STATUS "vcpkg_check_linkage" "Closing generator expression list!") + set(_is_genex_list 0) + vcpkg_msg(STATUS "vcpkg_check_linkage" "Old List: ${_tmp_list}") + list(JOIN _tmp_gen_list "\\\\\;" _tmp_glue_list) + list(APPEND _tmp_list ${_tmp_glue_list}) + vcpkg_msg(STATUS "vcpkg_check_linkage" "Gen List: ${_tmp_gen_list}") + vcpkg_msg(STATUS "vcpkg_check_linkage" "New List: ${_tmp_list}") + unset(_tmp_gen_list) + unset(_vcpkg_link_lib_genexp) + unset(_vcpkg_close_genexp) + set(_tmp_cur_list _tmp_list) + endif() + + unset(_vcpkg_link_lib_keyword) + unset(_vcpkg_link_lib_genexp_begin) + unset(_vcpkg_link_lib_genexp_close) + endforeach() + vcpkg_msg(STATUS "vcpkg_check_linkage" "Link List: ${ARGN}") + vcpkg_msg(STATUS "vcpkg_check_linkage" "checked List: ${_tmp_list}") + set(${OUTPUT_LINK_LIST} ${_tmp_list} PARENT_SCOPE) +endfunction() diff --git a/scripts/buildsystems/cmake/vcpkg-default_triplet.cmake b/scripts/buildsystems/cmake/vcpkg-default_triplet.cmake new file mode 100644 index 00000000000000..7b3f07aee01b4b --- /dev/null +++ b/scripts/buildsystems/cmake/vcpkg-default_triplet.cmake @@ -0,0 +1,59 @@ +if(CMAKE_GENERATOR_PLATFORM MATCHES "^[Ww][Ii][Nn]32$") + set(_VCPKG_TARGET_TRIPLET_ARCH x86) +elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Xx]64$") + set(_VCPKG_TARGET_TRIPLET_ARCH x64) +elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Aa][Rr][Mm]$") + set(_VCPKG_TARGET_TRIPLET_ARCH arm) +elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Aa][Rr][Mm]64$") + set(_VCPKG_TARGET_TRIPLET_ARCH arm64) +else() + if(CMAKE_GENERATOR MATCHES "^Visual Studio 14 2015 Win64$") + set(_VCPKG_TARGET_TRIPLET_ARCH x64) + elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 14 2015 ARM$") + set(_VCPKG_TARGET_TRIPLET_ARCH arm) + elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 14 2015$") + set(_VCPKG_TARGET_TRIPLET_ARCH x86) + elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017 Win64$") + set(_VCPKG_TARGET_TRIPLET_ARCH x64) + elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017 ARM$") + set(_VCPKG_TARGET_TRIPLET_ARCH arm) + elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017$") + set(_VCPKG_TARGET_TRIPLET_ARCH x86) + elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 16 2019$") + if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^[Xx]86$") + set(_VCPKG_TARGET_TRIPLET_ARCH x86) + elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^[Aa][Mm][Dd]64$") + set(_VCPKG_TARGET_TRIPLET_ARCH x64) + elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^[Aa][Rr][Mm]$") + set(_VCPKG_TARGET_TRIPLET_ARCH arm) + elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^[Aa][Rr][Mm]64$") + set(_VCPKG_TARGET_TRIPLET_ARCH arm64) + else() + + endif() + else() + find_program(_VCPKG_CL cl) + if(_VCPKG_CL MATCHES "amd64/cl.exe$" OR _VCPKG_CL MATCHES "x64/cl.exe$") + set(_VCPKG_TARGET_TRIPLET_ARCH x64) + elseif(_VCPKG_CL MATCHES "arm/cl.exe$") + set(_VCPKG_TARGET_TRIPLET_ARCH arm) + elseif(_VCPKG_CL MATCHES "arm64/cl.exe$") + set(_VCPKG_TARGET_TRIPLET_ARCH arm64) + elseif(_VCPKG_CL MATCHES "bin/cl.exe$" OR _VCPKG_CL MATCHES "x86/cl.exe$") + set(_VCPKG_TARGET_TRIPLET_ARCH x86) + elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64") + set(_VCPKG_TARGET_TRIPLET_ARCH x64) + else() + if( _CMAKE_IN_TRY_COMPILE ) + message(STATUS "Unable to determine target architecture, continuing without vcpkg.") + else() + message(WARNING "Unable to determine target architecture, continuing without vcpkg.") + endif() + set(VCPKG_TOOLCHAIN ON) + return() + endif() + endif() +endif() + + +set(VCPKG_TARGET_TRIPLET ${_VCPKG_TARGET_TRIPLET_ARCH}-${_VCPKG_TARGET_TRIPLET_PLAT} CACHE STRING "Vcpkg target triplet (ex. x86-windows)") \ No newline at end of file diff --git a/scripts/buildsystems/cmake/vcpkg-find_library.cmake b/scripts/buildsystems/cmake/vcpkg-find_library.cmake new file mode 100644 index 00000000000000..e259183f29c744 --- /dev/null +++ b/scripts/buildsystems/cmake/vcpkg-find_library.cmake @@ -0,0 +1,198 @@ + +vcpkg_define_function_overwrite_option(find_library) + +CMAKE_DEPENDENT_OPTION(VCPKG_ENABLE_FIND_LIBRARY_EXTERNAL_OVERRIDE "Tells VCPKG to use _find_library instead of find_library." OFF "NOT VCPKG_ENABLE_find_library" OFF) +mark_as_advanced(VCPKG_ENABLE_FIND_LIBRARY_EXTERNAL_OVERRIDE) + +function(vcpkg_find_library _vcpkg_find_library_imp_output) + cmake_policy(PUSH) + cmake_policy(SET CMP0054 NEW) + cmake_policy(SET CMP0012 NEW) + + # This fixes the parameter list given to find_library to + # always include NAMES_PER_DIR because that is the prefered search order using vcpkg + set(_vcpkg_list_vars "${ARGV}") + set(options NAMES_PER_DIR + NO_DEFAULT_PATH + NO_PACKAGE_ROOT_PATH + NO_CMAKE_PATH + NO_CMAKE_ENVIRONMENT_PATH + NO_SYSTEM_ENVIRONMENT_PATH + NO_CMAKE_SYSTEM_PATH + CMAKE_FIND_ROOT_PATH_BOTH + ONLY_CMAKE_FIND_ROOT_PATH + NO_CMAKE_FIND_ROOT_PATH) + set(oneValueArgs DOC) + set(multiValueArgs NAMES + HINTS + PATHS + PATH_SUFFIXES) + cmake_parse_arguments(PARSE_ARGV 0 _vcpkg_find_lib "${options}" "${oneValueArgs}" "${multiValueArgs}") + + if(NOT DEFINED _vcpkg_find_lib_NAMES) + if("${ARGV}" MATCHES "NAMES;") # the extra ; makes sure that it does not match NAMES_PER_DIR + #NAMES in argument list but not parsed for some reason -> retry with old parser syntax + vcpkg_msg(STATUS "find_library" "cmake_parse_arguments PARSE_ARGV not working correctly! Retrying!") + cmake_parse_arguments(_vcpkg_find_lib "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + if(NOT DEFINED _vcpkg_find_lib_NAMES) + cmake_policy(POP) + vcpkg_msg(FATAL_ERROR "find_library" "cmake_parse_arguments not working correctly!") + else() + # this will generate NAMES_POS+1 since ARGV is used and not ARGN; Moves it Behind NAMES + list(FIND ARGV "NAMES" _insert_offset) + # this will generate NAMES_POS+2 since the offset must be set behind the first possible library name! + math(EXPR _insert_offset "1+${_insert_offset}" OUTPUT_FORMAT DECIMAL) + endif() + else() + #NAMES not in argument list -> only single name + set(_vcpkg_find_lib_NAMES ${ARGV1}) + set(_insert_offset 1) + endif() + else() + list(FIND ARGV "NAMES" _insert_offset) + math(EXPR _insert_offset "1+${_insert_offset}" OUTPUT_FORMAT DECIMAL) #reason see above + endif() + ##Insert NAMES_PER_DIR if not set! + if(NOT _vcpkg_find_lib_NAMES_PER_DIR) + list(LENGTH _vcpkg_find_lib_NAMES _vcpkg_find_lib_NAMES_LENGTH) + if(_vcpkg_find_lib_NAMES_LENGTH GREATER 0) + math(EXPR _insert_pos "${_vcpkg_find_lib_NAMES_LENGTH}+${_insert_offset}" OUTPUT_FORMAT DECIMAL) + list(INSERT _vcpkg_list_vars ${_insert_pos} NAMES_PER_DIR) + else() # Logic programming error! (Treat it like an assert!) + cmake_policy(POP) + vcpkg_msg(STATUS "find_library-vars" "${_vcpkg_list_vars}") + vcpkg_msg(FATAL_ERROR "find_library" "Could not insert NAMES_PER_DIR to find_library call. Length: ${_vcpkg_find_lib_NAMES_LENGTH}; Names: ${_vcpkg_find_lib_NAMES}!") + endif() + vcpkg_msg(STATUS "find_library" "Added NAMES_PER_DIR to find_library call at position ${_vcpkg_find_lib_NAMES_LENGTH}!") + endif() + vcpkg_msg(STATUS "find_library-vars" "${_vcpkg_list_vars}") + + #Actual find_library call with fixed argument list! + _find_library(${_vcpkg_list_vars}) + + # Check found Library variable: + # If NOTFOUND means: + # a) it really cannot be found + # b) the search names are wrong in vcpkg because: + # 1. a debug suffix is missing in the library name + # or 2. or a debug suffix was added to the library name + # + # If FOUND: + # 1. Check if path is prefixed with ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET} . If not return early + # 2. check if variable has _RELEASE or _DEBUG name suffix + # a) If yes check correctnes of path + # b) if _RELEASE variable points to debug path -> release lib name == debug lib name -> adjust path + # 1. memorize lib name + # 2. create internal cache varibles with the lib name. + # c) if _DEBUG variable points to release path -> missing debug suffix in library name -> try search without common debugsuffixes -> if found everything is fine + # 1. memorize lib name without debug suffix + # 2. create internal cache varibles with the lib name. + # d) no special variable suffix + # 1. check path -> should be release path if not adjust it + # 2. memorize lib name + # 3. create internal cache variables with the lib name + + if("${${_vcpkg_find_library_imp_output}}" MATCHES "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}") + + vcpkg_msg(STATUS "find_library" "Found library inside vcpkg: ${_vcpkg_find_library_imp_output}:${${_vcpkg_find_library_imp_output}}") + vcpkg_msg(STATUS "find_library" "Search names: ${_vcpkg_find_lib_NAMES}") + #Here we know that the library somehow exists in the vcpkg folder and the user asked for it. So lets try to discover the vcpkg debug and release versions in a very controlled way. + if(_vcpkg_find_lib_PATH_SUFFIXES) + vcpkg_search_library_debug(_vcpkg_debug_lib_path NAMES ${_vcpkg_find_lib_NAMES} PATH_SUFFIXES ${_vcpkg_find_lib_PATH_SUFFIXES}) + vcpkg_search_library_release(_vcpkg_release_lib_path NAMES ${_vcpkg_find_lib_NAMES} PATH_SUFFIXES ${_vcpkg_find_lib_PATH_SUFFIXES}) + else() + vcpkg_search_library_debug(_vcpkg_debug_lib_path NAMES ${_vcpkg_find_lib_NAMES} PATH_SUFFIXES "") + vcpkg_search_library_release(_vcpkg_release_lib_path NAMES ${_vcpkg_find_lib_NAMES} PATH_SUFFIXES "") + endif() + + vcpkg_msg(STATUS "find_library" "VCPKG internal debug lib path: ${_vcpkg_debug_lib_path}") + vcpkg_msg(STATUS "find_library" "VCPKG internal release lib path:: ${_vcpkg_release_lib_path}") + + if("${_vcpkg_find_library_imp_output}" MATCHES "_DEBUG$|_DBG$") + set(${_vcpkg_find_library_imp_output} ${_vcpkg_debug_lib_path} CACHE INTERNAL "") + set(${_vcpkg_find_library_imp_output} ${_vcpkg_debug_lib_path} PARENT_SCOPE) + elseif("${_vcpkg_find_library_imp_output}" MATCHES "_RELEASE$|_REL$") + if(${_vcpkg_release_lib_path} MATCHES "NOTFOUND") # Release must be found. + cmake_policy(POP) + vcpkg_msg(FATAL_ERROR "find_library" "Unable to find release library within vcpkg. Release library must always be found! \ + variable: ${_vcpkg_find_library_imp_output} search names: ${_vcpkg_find_lib_NAMES}") + endif() + set(${_vcpkg_find_library_imp_output} ${_vcpkg_release_lib_path} CACHE INTERNAL "") + set(${_vcpkg_find_library_imp_output} ${_vcpkg_release_lib_path} PARENT_SCOPE) + else() #these are the cases which are ambigous! Sometimes also used as synonym for the release version + if(CMAKE_BUILD_TYPE MATCHES "^[Dd][Ee][Bb][Uu][Gg]$") + set(${_vcpkg_find_library_imp_output} ${_vcpkg_debug_lib_path} CACHE INTERNAL "") + set(${_vcpkg_find_library_imp_output} ${_vcpkg_debug_lib_path} PARENT_SCOPE) + if(${_vcpkg_debug_lib_path} MATCHES "NOTFOUND") # If only release was build we use that instead! + cmake_policy(POP) + vcpkg_msg(FATAL_ERROR "find_library" "Build type is debug but vcpkg was unable to find the debug library. \ + variable: ${_vcpkg_find_library_imp_output} search names: ${_vcpkg_find_lib_NAMES}") + set(${_vcpkg_find_library_imp_output} ${_vcpkg_release_lib_path} CACHE INTERNAL "") + set(${_vcpkg_find_library_imp_output} ${_vcpkg_release_lib_path} PARENT_SCOPE) + endif() + else() # Not debug and multi config generator + set(${_vcpkg_find_library_imp_output} ${_vcpkg_release_lib_path} CACHE INTERNAL "") + set(${_vcpkg_find_library_imp_output} ${_vcpkg_release_lib_path} PARENT_SCOPE) + # For a multi configuration generator this selection might be wrong and there is no way to change it here because + # it is unknown in which way the value might be used. Injecting a configuration dependent generator expressions here + # does not work everywhere (e.g. try_compile or func_exists checks) and also injecting debug/optimized keywords here does not work. + # So we need VCPKG_LIBTRACK to check/fix other places e.g. the IMPORTED_LOCATION in generated targets via set_property and set_target_properties + # and the calls to link_libraries and target_link_libraries + endif() + endif() + elseif("${${_vcpkg_find_library_imp_output}}" MATCHES "NOTFOUND") + if("${_vcpkg_find_library_imp_output}" MATCHES "_DEBUG" AND VCPKG_DEBUG_AVAILABLE) #Retry search (probably requires a search without common debug suffixes) + vcpkg_search_library_debug(_vcpkg_debug_lib_path NAMES "${_vcpkg_find_lib_NAMES}" PATH_SUFFIXES "${_vcpkg_find_lib_PATH_SUFFIXES}") + if(${_vcpkg_debug_lib_path}) + vcpkg_search_library_release(_vcpkg_release_lib_path NAMES ${_vcpkg_find_lib_NAMES} PATH_SUFFIXES ${_vcpkg_find_lib_PATH_SUFFIXES}) + set(${_vcpkg_find_library_imp_output} ${_vcpkg_debug_lib_path} CACHE INTERNAL "") + set(${_vcpkg_find_library_imp_output} ${_vcpkg_debug_lib_path} PARENT_SCOPE) + endif() + else() + vcpkg_msg(STATUS "find_library" "${_vcpkg_find_library_imp_output} was not found!") + endif() + else() + #found library outside vcpkg + vcpkg_msg(STATUS "find_library" "Found external library: ${_vcpkg_find_library_imp_output}:${${_vcpkg_find_library_imp_output}}") + endif() + + ##Setup VCPKG_LIBTRACK + ##Assumptions: _vcpkg_debug_lib_path and _vcpkg_release_lib_path are setup correctly (which should be the case if either one could be found) + ##Note: The only thing we have is a list of search names and the filename for usage. So we use the filename to create a redirection to a variable using the found search name + ##The Release library must always exist! + if(NOT "${${_vcpkg_find_library_imp_output}}" MATCHES "NOTFOUND") + vcpkg_msg(STATUS "find_library" "*** Setting up VCPKG LIBTRACK ***") + if(NOT ${_vcpkg_release_lib_path} MATCHES "NOTFOUND") + vcpkg_extract_library_name_from_path(_vcpkg_rel_lib_name ${_vcpkg_release_lib_path}) + set(VCPKG_LIBTRACK_${_vcpkg_rel_lib_name}_RELEASE ${_vcpkg_release_lib_path} CACHE INTERNAL "" ) + vcpkg_msg(STATUS "find_library" "Setting VCPKG_LIBTRACK_${_vcpkg_rel_lib_name}_RELEASE: ${VCPKG_LIBTRACK_${_vcpkg_rel_lib_name}_RELEASE}") + set(VCPKG_LIBTRACK_RELEASE ON) + endif() + if(NOT ${_vcpkg_debug_lib_path} MATCHES "NOTFOUND") + vcpkg_extract_library_name_from_path(_vcpkg_dbg_lib_name ${_vcpkg_debug_lib_path}) + set(VCPKG_LIBTRACK_${_vcpkg_dbg_lib_name}_DEBUG ${_vcpkg_debug_lib_path} CACHE INTERNAL "" ) + vcpkg_msg(STATUS "find_library" "Setting VCPKG_LIBTRACK_${_vcpkg_dbg_lib_name}_DEBUG: ${VCPKG_LIBTRACK_${_vcpkg_dbg_lib_name}_DEBUG}") + set(VCPKG_LIBTRACK_DEBUG ON) + endif() + if(VCPKG_LIBTRACK_RELEASE AND VCPKG_LIBTRACK_DEBUG) + vcpkg_msg(STATUS "find_library" "Setting up VCPKG LIBTRACK RELEASE/DEBUG") + set(VCPKG_LIBTRACK_${_vcpkg_rel_lib_name}_DEBUG ${_vcpkg_debug_lib_path} CACHE INTERNAL "" ) + vcpkg_msg(STATUS "find_library" "Setting VCPKG_LIBTRACK_${_vcpkg_rel_lib_name}_DEBUG: ${VCPKG_LIBTRACK_${_vcpkg_rel_lib_name}_DEBUG}") + set(VCPKG_LIBTRACK_${_vcpkg_dbg_lib_name}_RELEASE ${_vcpkg_release_lib_path} CACHE INTERNAL "" ) + vcpkg_msg(STATUS "find_library" "Setting VCPKG_LIBTRACK_${_vcpkg_dbg_lib_name}_RELEASE: ${VCPKG_LIBTRACK_${_vcpkg_dbg_lib_name}_RELEASE}") + endif() + endif() + + cmake_policy(POP) +endfunction() + +if(VCPKG_ENABLE_find_library) + function(find_library _vcpkg_find_library_var_name) + vcpkg_enable_function_overwrite_guard(find_library "") + + vcpkg_find_library(${_vcpkg_find_library_var_name} ${ARGN}) + set(${_vcpkg_find_library_var_name} "${${_vcpkg_find_library_var_name}}" PARENT_SCOPE) #Propagate the variable into the parent scope! + + vcpkg_disable_function_overwrite_guard(find_library "") + endfunction() +endif(VCPKG_ENABLE_find_library) \ No newline at end of file diff --git a/scripts/buildsystems/cmake/vcpkg-find_package.cmake b/scripts/buildsystems/cmake/vcpkg-find_package.cmake new file mode 100644 index 00000000000000..07a4381acdb1f9 --- /dev/null +++ b/scripts/buildsystems/cmake/vcpkg-find_package.cmake @@ -0,0 +1,115 @@ +vcpkg_define_function_overwrite_option(find_package) +CMAKE_DEPENDENT_OPTION(VCPKG_ENABLE_FIND_PACKAGE_EXTERNAL_OVERRIDE "Tells VCPKG to use _find_package instead of find_package." OFF "NOT VCPKG_ENABLE_FIND_PACKAGE" OFF) +mark_as_advanced(VCPKG_ENABLE_FIND_PACKAGE_EXTERNAL_OVERRIDE) + +macro(vcpkg_find_package name) + string(TOLOWER "${name}" _vcpkg_lowercase_name) + string(TOUPPER "${name}" _vcpkg_uppercase_name) + if(EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share/${_vcpkg_lowercase_name}/vcpkg-cmake-wrapper.cmake") + vcpkg_msg(STATUS "find_package" "Using vcpkg-cmake-wrapper.cmake for package: ${name}!") + set(ARGS "${ARGV}") + include(${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share/${_vcpkg_lowercase_name}/vcpkg-cmake-wrapper.cmake) + elseif("${name}" STREQUAL "Boost" AND EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/boost") + #TODO: put into vcpkg_cmake_wrapper.cmake + # Checking for the boost headers disables this wrapper unless the user has installed at least one boost library + set(Boost_USE_STATIC_LIBS OFF) + set(Boost_USE_MULTITHREADED ON) + unset(Boost_USE_STATIC_RUNTIME) + set(Boost_NO_BOOST_CMAKE ON) + unset(Boost_USE_STATIC_RUNTIME CACHE) + set(Boost_COMPILER "-vc140") + _find_package(${ARGV}) + elseif("${name}" STREQUAL "ICU" AND EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/unicode/utf.h") + #TODO: put into vcpkg_cmake_wrapper.cmake + function(_vcpkg_find_in_list) + list(FIND ARGV "COMPONENTS" COMPONENTS_IDX) + set(COMPONENTS_IDX ${COMPONENTS_IDX} PARENT_SCOPE) + endfunction() + _vcpkg_find_in_list(${ARGV}) + if(NOT COMPONENTS_IDX EQUAL -1) + _find_package(${ARGV} COMPONENTS data) + else() + _find_package(${ARGV}) + endif() + elseif("${_vcpkg_lowercase_name}" STREQUAL "grpc" AND EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share/grpc") + #TODO: put into vcpkg_cmake_wrapper.cmake + _find_package(gRPC ${ARGN}) + else() + # If package does not define targets and only uses old school variables we have to fix the paths to the libraries since + # find_package will only find the debug libraries or only find the release libraries if the name of the library was + # changed for debug builds. + _find_package(${ARGV}) + + # cmake_policy(PUSH) + # cmake_policy(SET CMP0054 NEW) + + # get_cmake_property(_pkg_all_vars VARIABLES) + + #general find_package debug info. show all defined package variables to examine if they are set wrong + set(_pkg_names_rgx "(${name}|${_vcpkg_uppercase_name}|${_vcpkg_lowercase_name})") + #need to escape special regex characters + string(REPLACE "+" "\\+" _pkg_names_rgx "${_pkg_names_rgx}") + string(REPLACE "*" "\\*" _pkg_names_rgx "${_pkg_names_rgx}") + set(_pkg_filter_rgx "^(${_pkg_names_rgx})([^_]*_)+") + list(FILTER _pkg_all_vars INCLUDE REGEX ${_pkg_filter_rgx}) + vcpkg_msg(status "find_package" " all vars defined after find_package call: ${_pkg_all_vars}") # good for debugging the regex + foreach(_pkg_var ${_pkg_all_vars}) + vcpkg_msg(status "find_package" "value of ${_pkg_var}: ${${_pkg_var}}") + endforeach() + + # #Fixing Libraries paths. + # #Filtering for variables which are probably library variables for the package. + set(_pkg_filter_rgx "^(${_pkg_names_rgx})([^_]*_)+(LIBRAR|LIBS)") + list(FILTER _pkg_all_vars INCLUDE REGEX ${_pkg_filter_rgx}) + # vcpkg_msg(STATUS "find_package" "Filtered-libraries-vars: ${_pkg_all_vars}") + + # list(FILTER _pkg_all_vars EXCLUDE REGEX "(_RELEASE|_DEBUG)")# Excluding debug and releas libraries from fixing (they should be handled by find_library.) + + # if(DEFINED VCPKG_BUILD_TYPE OR "${_pkg_all_vars}" MATCHES "_CONFIG") + # vcpkg_msg(STATUS "find_package" "VCPKG_BUILD_TYPE or CONFIG found. Skipping loop.") + # else() + # #Since everthing is fixed by find_library the fix here shouldn't be required + # foreach(_pkg_var ${_pkg_all_vars}) + # vcpkg_msg(STATUS "find_package" "Filtered: Value of ${_pkg_var}: ${${_pkg_var}}") + # # if(not "${${_pkg_var}}" matches "(optimized;|[cc][oo][nn][ff][ii][gg]:[rr][ee][ll][ee][aa][ss][ee])" + # # and not "${${_pkg_var}}" matches "(debug;|[cc][oo][nn][ff][ii][gg]:[dd][ee][bb][uu][gg])" + # # and ("${${_pkg_var}}" matches "${_vcpkg_installed_dir}/${vcpkg_target_triplet}/lib" + # # or "${${_pkg_var}}" matches "${_vcpkg_installed_dir}/${vcpkg_target_triplet}/debug/lib")) + # # # optimized,debug or generator expression not found within the package variable. need to probably fix the variable to generate correct targets! + # # # the only thing this thing should still fix is "_librar(y|ies)_dirs?" all other variables should be fixed by find_library! + # # # most of the times the "dirs?" variable is set by a find_path call to an include file and then the relativ path "../lib" is added. + # # set(_pkg_var_new "${${_pkg_var}}") + # # if("${${_pkg_var}}" matches "${_vcpkg_installed_dir}/${vcpkg_target_triplet}/debug") # no need to guard from generator expression; already done above. + # # # debug path found + # # if(cmake_build_type matches "^[rr][ee][ll][ee][aa][ss][ee]$") + # # vcpkg_msg(warning "find_package-fix" "found debug path in release build in variable ${_pkg_var}! path: ${${_pkg_var}}") + # # endif() + # # else() + # # # release path found + # # if(cmake_build_type matches "^[dd][ee][bb][uu][gg]$") + # # vcpkg_msg(warning "find_package-fix" "found release path in debug build in variable ${_pkg_var}! path: ${${_pkg_var}}") + # # endif() + # # endif() + # # endif() + # endforeach() + #endif() + #cmake_policy(POP) + endif() +endmacro() + +if(VCPKG_ENABLE_find_package) + # Must be a macro since we do not know which variables are being set and thus cannot propagte them into PARENT_SCOPE from a function. + macro(find_package name) + # Cannot use the loop protection in find_package because a module might want to also call find_package but with other parameters. + # Using only the parameter count is thus not enough to make sure that the guard is correct. Needs additional some kind of hash dependent on the parameterlist to be correct. + #if(DEFINED _vcpkg_find_package_guard_${name}${ARGC}) + # vcpkg_msg(FATAL_ERROR "find_package" "INFINIT LOOP DETECTED. Guard _vcpkg_find_package_guard_${name}${ARGC}. Did you supply your own find_package override? \n \ + # If yes: please set VCPKG_ENABLE_FIND_PACKAGE off and call vcpkg_find_package if you want to have vcpkg corrected behavior. \n \ + # If no: please open an issue on GITHUB describe the fail case!" ALWAYS) + #else() + # set(_vcpkg_find_package_guard_${name}${ARGC} ON) + #endif() + vcpkg_find_package(${ARGV}) + #unset(_vcpkg_find_package_guard_${name}${ARGC}) + endmacro() +endif() \ No newline at end of file diff --git a/scripts/buildsystems/cmake/vcpkg-function_overwrite_guard.cmake b/scripts/buildsystems/cmake/vcpkg-function_overwrite_guard.cmake new file mode 100644 index 00000000000000..747ffce4ac8daf --- /dev/null +++ b/scripts/buildsystems/cmake/vcpkg-function_overwrite_guard.cmake @@ -0,0 +1,24 @@ +macro(vcpkg_define_function_overwrite_option FUNCTION_NAME) +option(VCPKG_ENABLE_${FUNCTION_NAME} "Enables override of the cmake function ${FUNCTION_NAME}." ON) +mark_as_advanced(VCPKG_ENABLE_${FUNCTION_NAME}) +endmacro() + +macro(vcpkg_enable_function_overwrite_guard FUNCTION_NAME ADDITIONAL_SUFFIX) + if(NOT ${ARGN} EQUAL 2 AND NOT ${ARGN} EQUAL 1) + message(FATAL_ERROR "vcpkg_enable_function_overwrite_guard not used correctly in ${FUNCTION_NAME}. Must have one or two arguments!") + endif() + if(DEFINED _vcpkg_${FUNCTION_NAME}${ADDITIONAL_SUFFIX}_guard) + vcpkg_msg(FATAL_ERROR "${FUNCTION_NAME}" "INFINIT LOOP DETECT. Did you supply your own ${FUNCTION_NAME} override? \n \ + If yes: please set VCPKG_ENABLE_${FUNCTION_NAME} to off and call vcpkg_${FUNCTION_NAME} if you want to have vcpkg corrected behavior. \n \ + If no: please open an issue on GITHUB describe the fail case!" ALWAYS) + else() + set(_vcpkg_${FUNCTION_NAME}${ADDITIONAL_SUFFIX}_guard ON) + endif() +endmacro() + +macro(vcpkg_disable_function_overwrite_guard FUNCTION_NAME ADDITIONAL_SUFFIX) + if(NOT DEFINED _vcpkg_${FUNCTION_NAME}${ADDITIONAL_SUFFIX}_guard) + message(FATAL_ERROR "vcpkg_disable_function_overwrite_guard not used correctly in ${FUNCTION_NAME}!") + endif() + unset(_vcpkg_${FUNCTION_NAME}${ADDITIONAL_SUFFIX}_guard) +endmacro() \ No newline at end of file diff --git a/scripts/buildsystems/cmake/vcpkg-link_libraries.cmake b/scripts/buildsystems/cmake/vcpkg-link_libraries.cmake new file mode 100644 index 00000000000000..997ec04b8c5888 --- /dev/null +++ b/scripts/buildsystems/cmake/vcpkg-link_libraries.cmake @@ -0,0 +1,23 @@ +vcpkg_define_function_overwrite_option(link_libraries) + +function(vcpkg_link_libraries) + + #get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE ) + #if( _CMAKE_IN_TRY_COMPILE ) + # _link_libraries(${ARGV}) +# return() +# endif() + + vcpkg_check_linkage(_vcpkg_check_linkage ${ARGV}) + _link_libraries(${_vcpkg_check_linkage}) +endfunction() + +if(VCPKG_ENABLE_link_libraries) + function(link_libraries) + vcpkg_enable_function_overwrite_guard(link_libraries "") + + vcpkg_link_libraries(${ARGV}) + + vcpkg_disable_function_overwrite_guard(link_libraries "") + endfunction() +endif() \ No newline at end of file diff --git a/scripts/buildsystems/cmake/vcpkg-msg.cmake b/scripts/buildsystems/cmake/vcpkg-msg.cmake new file mode 100644 index 00000000000000..e1eecb30aff291 --- /dev/null +++ b/scripts/buildsystems/cmake/vcpkg-msg.cmake @@ -0,0 +1,21 @@ +option(VCPKG_VERBOSE "Enables messages from the VCPKG toolchain for debugging purposes." ON) +mark_as_advanced(VCPKG_VERBOSE) + +option(VCPKG_ERROR_TO_WARNING "Reduces vcpkg message mode from FATAL_ERROR to WARNING." OFF) +mark_as_advanced(VCPKG_FATAL_ERROR_TO_WARNING) + +option(VCPKG_WARNING_TO_ERROR "Escalates vcpkg message mode from WARNING to FATAL_ERROR." OFF) +mark_as_advanced(VCPKG_WARNING_TO_ERROR) + +function(vcpkg_msg _mode _function _message) + cmake_parse_arguments(PARSE_ARGV 3 vcpkg-msg "ALWAYS" "" "") + if(VCPKG_VERBOSE OR vcpkg-msg_ALWAYS) + if(${_mode} STREQUAL FATAL_ERROR AND VCPKG_ERROR_TO_WARNING) + message(WARNING "VCPKG-${_function}: ${_message}") + elseif((${_mode} STREQUAL WARNING OR ${_mode} STREQUAL AUTHOR_WARNING) AND VCPKG_WARNING_TO_ERROR) + message(FATAL_ERROR "VCPKG-${_function}: ${_message}") + else() + message(${_mode} "VCPKG-${_function}: ${_message}") + endif() + endif() +endfunction() \ No newline at end of file diff --git a/scripts/buildsystems/cmake/vcpkg-search_library.cmake b/scripts/buildsystems/cmake/vcpkg-search_library.cmake new file mode 100644 index 00000000000000..4a38b073840a45 --- /dev/null +++ b/scripts/buildsystems/cmake/vcpkg-search_library.cmake @@ -0,0 +1,199 @@ +#Setup common debug suffix used by ports; +set(VCPKG_ADDITIONAL_DEBUG_LIBNAME_SEARCH_SUFFIXES "d;D;_d;_D;-d;-D;-gd;-debug;_debug;_Debug;_DEBUG") +#TODO: Split search for shared libs .dll/.so and libs .a/.lib ! +#foreach(_dbg_suffix ${VCPKG_ADDITIONAL_DEBUG_LIBNAME_SEARCH_SUFFIXES}) +# list(APPEND VCPKG_ADDITIONAL_DEBUG_LIBNAME_SEARCH_SUFFIXES "${_dbg_suffix}.lib") +# list(APPEND VCPKG_ADDITIONAL_DEBUG_LIBNAME_SEARCH_SUFFIXES "${_dbg_suffix}.a") +# list(APPEND VCPKG_ADDITIONAL_DEBUG_LIBNAME_SEARCH_SUFFIXES "${_dbg_suffix}.dll") +# list(APPEND VCPKG_ADDITIONAL_DEBUG_LIBNAME_SEARCH_SUFFIXES "${_dbg_suffix}.so") +#endforeach() +mark_as_advanced(VCPKG_ADDITIONAL_DEBUG_LIBNAME_SEARCH_SUFFIXES) + +function(vcpkg_search_library_debug OUTPUT_VAR) + if(NOT VCPKG_DEBUG_AVAILABLE) + set(${OUTPUT_VAR} "${OUTPUT_VAR}-NOTFOUND" PARENT_SCOPE) + return() + endif() + cmake_parse_arguments(PARSE_ARGV 0 _vcpkg_search_lib "" "" "NAMES;PATH_SUFFIXES") + if(NOT DEFINED _vcpkg_search_lib_NAMES) + if("${ARGV}" MATCHES "NAMES") + #NAMES in argument list but not parsed for some reason -> retry with old parser syntax + vcpkg_msg(STATUS "vcpkg_search_library_debug" "cmake_parse_arguments PARSE_ARGV not working correctly! Retrying!") + cmake_parse_arguments(_vcpkg_search_lib "" "" "NAMES;PATH_SUFFIXES" ${ARGN}) + endif() + if(NOT DEFINED _vcpkg_search_lib_NAMES) + message(FATAL_ERROR "vcpkg_search_library_debug requires NAMES option") + else() + vcpkg_msg(STATUS "vcpkg_search_library_debug" "Search names: ${_vcpkg_search_lib_NAMES}") + endif() + endif() + vcpkg_build_library_debug_search_paths(_vcpkg_search_paths ${_vcpkg_search_lib_PATH_SUFFIXES}) + vcpkg_msg(STATUS "vcpkg_search_library_debug" "Search paths: ${_vcpkg_search_paths}") + _find_library(_vcpkg_lib_out NAMES ${_vcpkg_search_lib_NAMES} NAMES_PER_DIR PATHS ${_vcpkg_search_paths} NO_DEFAULT_PATH) + + # Retry without common debug suffixes + if(${_vcpkg_lib_out} MATCHES "NOTFOUND") + vcpkg_msg(STATUS "vcpkg_search_library_debug" "Searching without common debug suffixes!") + foreach(_vcpkg_debug_suffix ${VCPKG_ADDITIONAL_DEBUG_LIBNAME_SEARCH_SUFFIXES}) + vcpkg_remove_debug_suffixes(_vcpkg_search_lib_name ${_vcpkg_search_lib_NAMES} ) + if(DEFINED _vcpkg_search_lib_name) + vcpkg_msg(STATUS "vcpkg_search_library_debug" "Search names: ${_vcpkg_search_lib_name}") + _find_library(_vcpkg_lib_out_${_vcpkg_debug_suffix} NAMES ${_vcpkg_search_lib_name} NAMES_PER_DIR PATHS ${_vcpkg_search_paths} NO_DEFAULT_PATH) + if(NOT "${_vcpkg_lib_out_${_vcpkg_debug_suffix}}" MATCHES "NOTFOUND") + set(_vcpkg_lib_out "${_vcpkg_lib_out_${_vcpkg_debug_suffix}}" CACHE INTERNAL "") + unset(_vcpkg_lib_out_${_vcpkg_debug_suffix} CACHE) + break() + endif() + unset(_vcpkg_lib_out_${_vcpkg_debug_suffix} CACHE) + endif() + endforeach() + endif() + + # Retry with common debug suffixes + if(${_vcpkg_lib_out} MATCHES "NOTFOUND") + vcpkg_msg(STATUS "vcpkg_search_library_debug" "Searching with common debug suffixes!") + foreach(_vcpkg_debug_suffix ${VCPKG_ADDITIONAL_DEBUG_LIBNAME_SEARCH_SUFFIXES}) + set(_vcpkg_debug_lib_names_${_vcpkg_debug_suffix}) + foreach(_vcpkg_lib_out_name ${_vcpkg_search_lib_NAMES}) + vcpkg_msg(STATUS "vcpkg_search_library_debug" "Generating debug name: ${_vcpkg_lib_out_name}${_vcpkg_debug_suffix}") + list(APPEND _vcpkg_debug_lib_names_${_vcpkg_debug_suffix} ${_vcpkg_lib_out_name}${_vcpkg_debug_suffix}) + endforeach() + vcpkg_msg(STATUS "vcpkg_search_library_debug" "Search names: ${_vcpkg_debug_lib_names_${_vcpkg_debug_suffix}}") + vcpkg_msg(STATUS "vcpkg_search_library_debug" "Search PATHS: ${_vcpkg_search_paths}") + _find_library(_vcpkg_lib_out_${_vcpkg_debug_suffix} NAMES ${_vcpkg_debug_lib_names_${_vcpkg_debug_suffix}} NAMES_PER_DIR PATHS ${_vcpkg_search_paths} NO_DEFAULT_PATH) + if(NOT "${_vcpkg_lib_out_${_vcpkg_debug_suffix}}" MATCHES "NOTFOUND") + if(NOT "${_vcpkg_lib_out_${_vcpkg_debug_suffix}}" MATCHES "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug") + vcpkg_msg(FATAL_ERROR "vcpkg_search_library_debug" "Somehow found release library!") + endif() + set(_vcpkg_lib_out "${_vcpkg_lib_out_${_vcpkg_debug_suffix}}" CACHE INTERNAL "") + unset(_vcpkg_lib_out_${_vcpkg_debug_suffix} CACHE) + break() + endif() + unset(_vcpkg_lib_out_${_vcpkg_debug_suffix} CACHE) + endforeach() + endif() + set(${OUTPUT_VAR} ${_vcpkg_lib_out} PARENT_SCOPE) + if(${_vcpkg_lib_out} MATCHES "NOTFOUND") + vcpkg_msg(WARNING "vcpkg_search_library_debug" "Debug library not found! Search names: ${_vcpkg_search_lib_NAMES}") + endif() + vcpkg_msg(STATUS "vcpkg_search_library_debug" "${OUTPUT_VAR} set to ${_vcpkg_lib_out}") + + unset(_vcpkg_lib_out CACHE) +endfunction() + +function(vcpkg_search_library_release OUTPUT_VAR) + cmake_parse_arguments(PARSE_ARGV 0 _vcpkg_search_lib "" "" "NAMES;PATH_SUFFIXES") + if(NOT DEFINED _vcpkg_search_lib_NAMES) + if("${ARGV}" MATCHES "NAMES") + #NAMES in argument list but not parsed for some reason -> retry with old parser syntax + vcpkg_msg(STATUS "vcpkg_search_library_release" "cmake_parse_arguments PARSE_ARGV not working correctly! Retrying!") + cmake_parse_arguments(_vcpkg_search_lib "" "" "NAMES;PATH_SUFFIXES" ${ARGN}) + endif() + if(NOT DEFINED _vcpkg_search_lib_NAMES) + message(FATAL_ERROR "vcpkg_search_library_release requires NAMES option") + else() + vcpkg_msg(STATUS "vcpkg_search_library_release" "Search names: ${_vcpkg_search_lib_NAMES}") + endif() + endif() + vcpkg_build_library_release_search_paths(_vcpkg_search_paths ${_vcpkg_search_lib_PATH_SUFFIXES}) + vcpkg_msg(STATUS "vcpkg_search_library_release" "Search paths: ${_vcpkg_search_paths}") + _find_library(_vcpkg_lib_out NAMES ${_vcpkg_search_lib_NAMES} NAMES_PER_DIR PATHS ${_vcpkg_search_paths} NO_DEFAULT_PATH) + + # Retry without common debug suffixes + if(${_vcpkg_lib_out} MATCHES "NOTFOUND") + foreach(_vcpkg_debug_suffix ${VCPKG_ADDITIONAL_DEBUG_LIBNAME_SEARCH_SUFFIXES}) + vcpkg_remove_debug_suffixes(_vcpkg_search_lib_name ${_vcpkg_search_lib_NAMES} ) + vcpkg_msg(STATUS "vcpkg_search_library_release" "Search names: ${_vcpkg_search_lib_name}") + _find_library(_vcpkg_lib_out_${_vcpkg_debug_suffix} NAMES ${_vcpkg_search_lib_name} NAMES_PER_DIR PATHS ${_vcpkg_search_paths} NO_DEFAULT_PATH) + if("${_vcpkg_lib_out_${_vcpkg_debug_suffix}}" MATCHES "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug") + vcpkg_msg(FATAL_ERROR "vcpkg_search_library_release" "Somehow found debug library! :${_vcpkg_lib_out_${_vcpkg_debug_suffix}}") + endif() + if("${_vcpkg_lib_out_${_vcpkg_debug_suffix}}" MATCHES "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}") + set(_vcpkg_lib_out "${_vcpkg_lib_out_${_vcpkg_debug_suffix}}" CACHE INTERNAL "") + unset(_vcpkg_lib_out_${_vcpkg_debug_suffix} CACHE) + break() + endif() + unset(_vcpkg_lib_out_${_vcpkg_debug_suffix} CACHE) + endforeach() + endif() + + set(${OUTPUT_VAR} ${_vcpkg_lib_out} PARENT_SCOPE) + if(${_vcpkg_lib_out} MATCHES "NOTFOUND") + vcpkg_msg(WARNING "vcpkg_search_library_release" "Release library not found! Search names: ${_vcpkg_search_lib_NAMES}") + endif() + vcpkg_msg(STATUS "vcpkg_search_library_release" "${OUTPUT_VAR} set to ${_vcpkg_lib_out}") + unset(_vcpkg_lib_out CACHE) +endfunction() + +function(vcpkg_remove_debug_suffixes OUT_NAMES) + set(_tmp_list) + foreach(_vcpkg_debug_suffix ${VCPKG_ADDITIONAL_DEBUG_LIBNAME_SEARCH_SUFFIXES}) + vcpkg_msg(STATUS "vcpkg_remove_debug_suffixes" "Suffix to remove: ${_vcpkg_debug_suffix}") + vcpkg_msg(STATUS "vcpkg_remove_debug_suffixes" "Remove from: ${ARGN}") + string(REGEX REPLACE "${_vcpkg_debug_suffix}$" "" _vcpkg_search_lib_name "${ARGN}") + #vcpkg_msg(STATUS "vcpkg_remove_debug_suffixes" "${_vcpkg_search_lib_name}") + string(REGEX REPLACE "${_vcpkg_debug_suffix};" ";" _vcpkg_search_lib_name "${_vcpkg_search_lib_name}") + vcpkg_msg(STATUS "vcpkg_remove_debug_suffixes" "Removed: ${_vcpkg_search_lib_name}") + if(NOT "${ARGN}" STREQUAL "${_vcpkg_search_lib_name}") + list(APPEND _tmp_list ${_vcpkg_search_lib_name}) + vcpkg_msg(STATUS "vcpkg_remove_debug_suffixes" "list updated: ${_tmp_list}") + endif() + endforeach() + list(REMOVE_DUPLICATES _tmp_list) + vcpkg_msg(STATUS "vcpkg_remove_debug_suffixes" "final search list: ${_tmp_list}") + set(${OUT_NAMES} ${_tmp_list} PARENT_SCOPE) +endfunction() + +function(vcpkg_add_debug_suffixes OUT_NAMES NAMES) + set(_tmp_list) + foreach(_vcpkg_debug_suffix ${VCPKG_ADDITIONAL_DEBUG_LIBNAME_SEARCH_SUFFIXES}) + foreach(_vcpkg_lib_out_name ${_vcpkg_search_lib_NAMES}) + list(APPEND _tmp_list ${_vcpkg_lib_out_name}${_vcpkg_debug_suffix}) + endforeach() + endforeach() + list(REMOVE_DUPLICATES _tmp_list) + set(${OUT_NAMES} ${_tmp_list} PARENT_SCOPE) +endfunction() + +# function(vcpkg_extract_library_found_name FOUND_NAME SEARCH_NAMES LIBRARY_PATH) + # foreach(_search_name ${SEARCH_NAMES}) + # if(${LIBRARY_PATH} MATCHES "\\${_search_name}\\${CMAKE_STATIC_LIBRARY_SUFFIX}$") + # set(${FOUND_NAME} ${_search_name} PARENT_SCOPE) + # vcpkg_msg(STATUS "vcpkg_extract_library_found_name" "Found library name: ${_search_name} in path: ${LIBRARY_PATH}!") + # break() + # endif() + # endforeach() + # unset(_search_name) +# endfunction() + +function(vcpkg_extract_library_name_from_path EXTRACTED_NAME LIBRARY_PATH) + get_filename_component(_tmp_name "${LIBRARY_PATH}" NAME) + string(REGEX REPLACE "\\${CMAKE_STATIC_LIBRARY_SUFFIX}$" "" _tmp_name ${_tmp_name}) + set(${EXTRACTED_NAME} ${_tmp_name} PARENT_SCOPE) +endfunction() + +function(vcpkg_build_library_search_paths OUT_VAR PATH_SUFFIXES VCPKG_SUFFIX) + set(_vcpkg_path_search_list "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}${VCPKG_SUFFIX}/lib") + list(APPEND _vcpkg_path_search_list "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}${VCPKG_SUFFIX}/lib/manual-link") + list(APPEND _vcpkg_path_search_list "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}${VCPKG_SUFFIX}/bin") + list(APPEND _vcpkg_path_search_list "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}${VCPKG_SUFFIX}") # Last resort + if(DEFINED PATH_SUFFIXES) + string(REGEX REPLACE "[Dd][Ee][Bb][Uu][Gg]/" "" PATH_SUFFIXES "${PATH_SUFFIXES}") + foreach(_vcpkg_path_prefix ${_vcpkg_path_search_list}) + foreach(_path_suffix ${PATH_SUFFIXES}) + list(APPEND _vcpkg_path_search_list "${_vcpkg_path_prefix}/${_path_suffix}") + endforeach() + endforeach() + endif() + set(${OUT_VAR} ${_vcpkg_path_search_list} PARENT_SCOPE) +endfunction() + +function(vcpkg_build_library_release_search_paths OUT_VAR) + vcpkg_build_library_search_paths("${OUT_VAR}" "${ARGV1}" "") + set(${OUT_VAR} ${${OUT_VAR}} PARENT_SCOPE) +endfunction() + +function(vcpkg_build_library_debug_search_paths OUT_VAR) + vcpkg_build_library_search_paths("${OUT_VAR}" "${ARGV1}" "/debug") + set(${OUT_VAR} ${${OUT_VAR}} PARENT_SCOPE) +endfunction() \ No newline at end of file diff --git a/scripts/buildsystems/cmake/vcpkg-set_property.cmake b/scripts/buildsystems/cmake/vcpkg-set_property.cmake new file mode 100644 index 00000000000000..0efcdff0241c6e --- /dev/null +++ b/scripts/buildsystems/cmake/vcpkg-set_property.cmake @@ -0,0 +1,163 @@ +option(VCPKG_ENABLE_SET_PROPERTY "Enables override of the cmake function set_property." ON) +mark_as_advanced(VCPKG_ENABLE_SET_PROPERTY) +CMAKE_DEPENDENT_OPTION(VCPKG_ENABLE_SET_PROPERTY_EXTERNAL_OVERRIDE "Tells VCPKG to use _set_property instead of set_property." OFF "NOT VCPKG_ENABLE_SET_TARGET_PROPERTIES" OFF) +mark_as_advanced(VCPKG_ENABLE_SET_PROPERTY_EXTERNAL_OVERRIDE) + +function(vcpkg_set_property _vcpkg_set_property_mode_impl) + cmake_policy(PUSH) + cmake_policy(SET CMP0054 NEW) + if(VCPKG_ENABLE_SET_PROPERTY OR VCPKG_ENABLE_SET_PROPERTY_EXTERNAL_OVERRIDE) + vcpkg_msg(STATUS "set_property" "Forwarding to _set_property: ${ARGV}") + if("${ARGV}" MATCHES ";$") + _set_property(${ARGV} "") + else() + _set_property(${ARGV}) + endif() + else() + vcpkg_msg(STATUS "set_property" "Forwarding to set_property: ${ARGV}") + set_property(${ARGV}) + endif() + if(NOT _CMAKE_IN_TRY_COMPILE AND "${_vcpkg_set_property_mode_impl}" MATCHES "TARGET" AND "${ARGV}" MATCHES "IMPORTED_LOCATION|IMPORTED_IMPLIB" ) + cmake_parse_arguments(PARSE_ARGV 0 _vcpkg_set_property "APPEND;APPEND_STRING" "" "TARGET;PROPERTY") + + foreach(_vcpkg_target_name ${_vcpkg_set_property_TARGET}) + get_target_property(_vcpkg_target_imported ${_vcpkg_target_name} IMPORTED) + if(_vcpkg_target_imported) + # Just debugging + vcpkg_msg(STATUS "set_properties" "${_vcpkg_target_name} is an IMPORTED target. Checking import location (if available)!") + get_target_property(_vcpkg_target_imp_loc ${_vcpkg_target_name} IMPORTED_LOCATION) + vcpkg_msg(STATUS "set_properties" "IMPORTED_LOCATION: ${_vcpkg_target_imp_loc}") + get_target_property(_vcpkg_target_imp_loc_rel ${_vcpkg_target_name} IMPORTED_LOCATION_RELEASE) + vcpkg_msg(STATUS "set_properties" "IMPORTED_LOCATION_RELEASE: ${_vcpkg_target_imp_loc_rel}") + get_target_property(_vcpkg_target_imp_loc_dbg ${_vcpkg_target_name} IMPORTED_LOCATION_DEBUG) + vcpkg_msg(STATUS "set_properties" "IMPORTED_LOCATION_DEBUG: ${_vcpkg_target_imp_loc_dbg}") + get_target_property(_vcpkg_target_implib_loc ${_vcpkg_target_name} IMPORTED_IMPLIB) + vcpkg_msg(STATUS "set_properties" "IMPORTED_IMPLIB: ${_vcpkg_target_implib_loc}") + get_target_property(_vcpkg_target_implib_loc_rel ${_vcpkg_target_name} IMPORTED_IMPLIB_RELEASE) + vcpkg_msg(STATUS "set_properties" "IMPORTED_IMPLIB_RELEASE: ${_vcpkg_target_implib_loc_rel}") + get_target_property(_vcpkg_target_implib_loc_dbg ${_vcpkg_target_name} IMPORTED_IMPLIB_DEBUG) + vcpkg_msg(STATUS "set_properties" "IMPORTED_IMPLIB_DEBUG: ${_vcpkg_target_implib_loc_dbg}") + + # Release location (just checking) + if(_vcpkg_target_imp_loc_rel AND "${_vcpkg_target_imp_loc_rel}" MATCHES "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}") + vcpkg_msg(STATUS "set_property" "${_vcpkg_target_name} has property IMPORTED_LOCATION_RELEASE: ${_vcpkg_target_imp_loc_rel}. Checking for correct vcpkg path!") + if("${_vcpkg_target_imp_loc_rel}" MATCHES "/debug/") + #This is the death case. If we reach this line the linkage of the target will be wrong! + #Side effect: This also fails for executables within the debug directory which is a nice feature and makes sure only release tools are used by vcpkg + cmake_policy(POP) + vcpkg_msg(FATAL_ERROR "set_property" "Property IMPORTED_LOCATION_RELEASE: ${_vcpkg_target_imp_loc_rel}. Not set to vcpkg release library dir!" ALWAYS) + else() + vcpkg_msg(STATUS "set_property" "${_vcpkg_target_name} IMPORTED_LOCATION_RELEASE is correct: ${_vcpkg_target_imp_loc_rel}.") + endif() + endif() + # same for IMPLIB + if(_vcpkg_target_implib_loc_rel AND "${_vcpkg_target_implib_loc_rel}" MATCHES "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}") + vcpkg_msg(STATUS "set_property" "${_vcpkg_target_name} has property IMPORTED_IMPLIB_RELEASE: ${_vcpkg_target_implib_loc_rel}. Checking for correct vcpkg path!") + if("${_vcpkg_target_implib_loc_rel}" MATCHES "/debug/") + #This is the death case. If we reach this line the linkage of the target will be wrong! + cmake_policy(POP) + vcpkg_msg(FATAL_ERROR "set_property" "Property IMPORTED_IMPLIB_RELEASE: ${_vcpkg_target_implib_loc_rel}. Not set to vcpkg release library dir!" ALWAYS) + else() + vcpkg_msg(STATUS "set_property" "${_vcpkg_target_name} IMPORTED_IMPLIB_RELEASE is correct: ${_vcpkg_target_implib_loc_rel}.") + endif() + endif() + + # Debug location (just checking) + if(_vcpkg_target_imp_loc_dbg AND "${_vcpkg_target_imp_loc_dbg}" MATCHES "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}") + vcpkg_msg(STATUS "set_property" "${_vcpkg_target_name} has property IMPORTED_LOCATION_DEBUG: ${_vcpkg_target_imp_loc_dbg}. Checking for correct vcpkg path!") + if(NOT "${_vcpkg_target_imp_loc_dbg}" MATCHES "/debug/") + if("${_vcpkg_target_imp_loc_dbg}" MATCHES "/tools/") + vcpkg_msg(STATUS "set_property" "${_vcpkg_target_name} IMPORTED_LOCATION_DEBUG is an execuable: ${_vcpkg_target_imp_loc_dbg}. VCPKG will use release tools for performance reasons.") + else() + #This is the death case. If we reach this line the linkage of the target will be wrong! + cmake_policy(POP) + vcpkg_msg(FATAL_ERROR "set_property" "Property IMPORTED_LOCATION_DEBUG: ${_vcpkg_target_imp_loc_dbg}. Not set to vcpkg debug library dir!" ALWAYS) + endif() + else() + vcpkg_msg(STATUS "set_property" "${_vcpkg_target_name} IMPORTED_LOCATION_DEBUG is correct: ${_vcpkg_target_imp_loc_dbg}.") + endif() + endif() + # same for IMPLIB + if(_vcpkg_target_implib_loc_dbg AND "${_vcpkg_target_implib_loc_dbg}" MATCHES "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}") + vcpkg_msg(STATUS "set_property" "${_vcpkg_target_name} has property IMPORTED_IMPLIB_DEBUG: ${_vcpkg_target_implib_loc_dbg}. Checking for correct vcpkg path!") + if(NOT "${_vcpkg_target_implib_loc_dbg}" MATCHES "/debug/") + #This is the death case. If we reach this line the linkage of the target will be wrong! + cmake_policy(POP) + vcpkg_msg(FATAL_ERROR "set_property" "Property IMPORTED_IMPLIB_DEBUG: ${_vcpkg_target_implib_loc_dbg}. Not set to vcpkg release library dir!" ALWAYS) + else() + vcpkg_msg(STATUS "set_property" "${_vcpkg_target_name} IMPORTED_IMPLIB_DEBUG is correct: ${_vcpkg_target_implib_loc_dbg}.") + endif() + endif() + + # General import location. Here we assume changes made by find_library to the library name + # We probably need to correct this one using VPCKG_LIBTRACK + if(_vcpkg_target_imp_loc AND "${_vcpkg_target_imp_loc}" MATCHES "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}(/lib|/debug/lib)") + vcpkg_msg(STATUS "set_property" "${_vcpkg_target_name} has property IMPORTED_LOCATION: ${_vcpkg_target_imp_loc}. Checking for configuration dependent locations!") + #Need VCPKG_LIBTRACK here + vcpkg_extract_library_name_from_path(_vcpkg_libtrack_name ${_vcpkg_target_imp_loc}) + if(NOT ${_vcpkg_target_imp_loc_rel}) + if(NOT DEFINED VCPKG_LIBTRACK_${_vcpkg_libtrack_name}_RELEASE OR "${VCPKG_LIBTRACK_${_vcpkg_libtrack_name}_RELEASE}" MATCHES "NOTFOUND") + cmake_policy(POP) + vcpkg_msg(FATAL_ERROR "set_property" "Unable to find VCPKG_LIBTRACK_${_vcpkg_libtrack_name}_RELEASE!" ALWAYS) + endif() + _set_property(TARGET ${_vcpkg_target_name} PROPERTY IMPORTED_LOCATION_RELEASE "${VCPKG_LIBTRACK_${_vcpkg_libtrack_name}_RELEASE}") + else() + vcpkg_msg(WARNING "set_property" "Unable to setup IMPORTED_LOCATION_RELEASE for target ${_vcpkg_target_name}!" ALWAYS) + endif() + if(NOT ${_vcpkg_target_imp_loc_dbg} AND VCPKG_DEBUG_AVAILABLE) + if(NOT DEFINED VCPKG_LIBTRACK_${_vcpkg_libtrack_name}_DEBUG OR "${VCPKG_LIBTRACK_${_vcpkg_libtrack_name}_DEBUG}" MATCHES "NOTFOUND") + cmake_policy(POP) + vcpkg_msg(FATAL_ERROR "set_property" "Unable to find VCPKG_LIBTRACK_${_vcpkg_libtrack_name}_DEBUG!" ALWAYS) + endif() + _set_property(TARGET ${_vcpkg_target_name} PROPERTY IMPORTED_LOCATION_DEBUG "${VCPKG_LIBTRACK_${_vcpkg_libtrack_name}_DEBUG}") + else() + vcpkg_msg(WARNING "set_property" "Unable to setup IMPORTED_LOCATION_DEBUG for target ${_vcpkg_target_name}!" ALWAYS) + endif() + endif() + + #IMPLIB + if(_vcpkg_target_implib_loc AND "${_vcpkg_target_implib_loc}" MATCHES "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}(/lib|/debug/lib)") + vcpkg_msg(STATUS "set_property" "${_vcpkg_target_name} has property IMPLIB_LOCATION: ${_vcpkg_target_implib_loc}. Checking for configuration dependent locations!") + #Need VCPKG_LIBTRACK here + vcpkg_extract_library_name_from_path(_vcpkg_libtrack_name ${_vcpkg_target_implib_loc}) + if(NOT ${_vcpkg_target_implib_loc_rel}) + if(NOT DEFINED VCPKG_LIBTRACK_${_vcpkg_libtrack_name}_RELEASE OR "${VCPKG_LIBTRACK_${_vcpkg_libtrack_name}_RELEASE}" MATCHES "NOTFOUND") + cmake_policy(POP) + vcpkg_msg(FATAL_ERROR "set_property" "Unable to find VCPKG_LIBTRACK_${_vcpkg_libtrack_name}_RELEASE!" ALWAYS) + endif() + _set_property(TARGET ${_vcpkg_target_name} PROPERTY IMPLIB_LOCATION_RELEASE "${VCPKG_LIBTRACK_${_vcpkg_libtrack_name}_RELEASE}") + else() + vcpkg_msg(WARNING "set_property" "Unable to setup IMPLIB_LOCATION_RELEASE for target ${_vcpkg_target_name}!" ALWAYS) + endif() + if(NOT ${_vcpkg_target_implib_loc_dbg} AND VCPKG_DEBUG_AVAILABLE) + if(NOT DEFINED VCPKG_LIBTRACK_${_vcpkg_libtrack_name}_DEBUG OR "${VCPKG_LIBTRACK_${_vcpkg_libtrack_name}_DEBUG}" MATCHES "NOTFOUND") + cmake_policy(POP) + vcpkg_msg(FATAL_ERROR "set_property" "Unable to find VCPKG_LIBTRACK_${_vcpkg_libtrack_name}_DEBUG!" ALWAYS) + endif() + _set_property(TARGET ${_vcpkg_target_name} PROPERTY IMPLIB_LOCATION_DEBUG "${VCPKG_LIBTRACK_${_vcpkg_libtrack_name}_DEBUG}") + else() + vcpkg_msg(WARNING "set_property" "Unable to setup IMPLIB_LOCATION_DEBUG for target ${_vcpkg_target_name}!" ALWAYS) + endif() + endif() + + endif() + endforeach() + endif() + cmake_policy(POP) +endfunction() + +if(VCPKG_ENABLE_SET_PROPERTY) + function(set_property _vcpkg_set_property_mode) + vcpkg_enable_function_overwrite_guard(set_property "") + + vcpkg_msg(STATUS "set_property" "Called with: ${ARGV}") + + if("${ARGV}" MATCHES ";$") + vcpkg_set_property(${ARGV} "") + else() + vcpkg_set_property(${ARGV}) + endif() + + vcpkg_disable_function_overwrite_guard(set_property "") + endfunction() +endif() \ No newline at end of file diff --git a/scripts/buildsystems/cmake/vcpkg-set_target_properties.cmake b/scripts/buildsystems/cmake/vcpkg-set_target_properties.cmake new file mode 100644 index 00000000000000..a7dbc93060e139 --- /dev/null +++ b/scripts/buildsystems/cmake/vcpkg-set_target_properties.cmake @@ -0,0 +1,56 @@ +option(VCPKG_ENABLE_SET_TARGET_PROPERTIES "Enables override of the cmake function set_target_properties." ON) +mark_as_advanced(VCPKG_ENABLE_SET_TARGET_PROPERTIES) +#CMAKE_DEPENDENT_OPTION(VCPKG_ENABLE_SET_TARGET_PROPERTIES_EXTERNAL_OVERRIDE "Tells VCPKG to use _set_target_properties instead of set_target_properties." OFF "NOT VCPKG_ENABLE_SET_TARGET_PROPERTIES" OFF) +#mark_as_advanced(VCPKG_ENABLE_SET_TARGET_PROPERTIES_EXTERNAL_OVERRIDE) + +function(vcpkg_set_target_properties) + list(FIND ARGV PROPERTIES _vcpkg_properties_pos) + list(SUBLIST ARGV 0 ${_vcpkg_properties_pos} _vcpkg_target_sublist) + math(EXPR _vcpkg_target_index_key "${_vcpkg_properties_pos}+1") + vcpkg_msg(STATUS "set_target_properties" "ARGS: ${ARGV}") + vcpkg_msg(STATUS "set_target_properties" "PROPERTIES Index: ${_vcpkg_properties_pos}") + vcpkg_msg(STATUS "set_target_properties" "TARGETS: ${_vcpkg_target_sublist}") + #Properties are key-value pairs and must be passed one by one since they are allowed to contain empty elements! + while("${_vcpkg_target_index_key}" LESS "${ARGC}") + math(EXPR _vcpkg_target_args_index_val "${_vcpkg_target_index_key}+1") + vcpkg_msg(STATUS "set_target_properties" "Property: ARGV${_vcpkg_target_index_key}: ${ARGV${_vcpkg_target_index_key}}") + vcpkg_msg(STATUS "set_target_properties" "Value: ARGV${_vcpkg_target_args_index_val}: ${ARGV${_vcpkg_target_args_index_val}}") + set_property(TARGET ${_vcpkg_target_sublist} PROPERTY "${ARGV${_vcpkg_target_index_key}}" "${ARGV${_vcpkg_target_args_index_val}}") + #if(VCPKG_ENABLE_SET_TARGET_PROPERTIES OR VCPKG_ENABLE_SET_TARGET_PROPERTIES_EXTERNAL_OVERRIDE) + # _set_target_properties(${_vcpkg_target_sublist} PROPERTIES "${ARGV${_vcpkg_target_index_key}}" "${ARGV${_vcpkg_target_args_index_val}}") + #else() + # set_target_properties(${_vcpkg_target_sublist} PROPERTIES "${ARGV${_vcpkg_target_args_index}}" "${ARGV${_vcpkg_target_args_index_val}}") + #endif() + math(EXPR _vcpkg_target_index_key "${_vcpkg_target_args_index_val}+1") + endwhile() + #checks moved to set_property +endfunction() + +if(VCPKG_ENABLE_SET_TARGET_PROPERTIES) + function(set_target_properties) + if(DEFINED _vcpkg_set_target_properties_guard) + vcpkg_msg(FATAL_ERROR "set_target_properties" "INFINIT LOOP DETECT. Guard _vcpkg_set_target_properties_guard. Did you supply your own set_target_properties override? \n \ + If yes: please set VCPKG_ENABLE_SET_TARGET_PROPERTIES off and call vcpkg_set_target_properties if you want to have vcpkg corrected behavior. \n \ + If no: please open an issue on GITHUB describe the fail case!" ALWAYS) + else() + set(_vcpkg_set_target_properties_guard ON) + endif() + + list(FIND ARGV PROPERTIES _vcpkg_set_target_properties_index) + list(SUBLIST ARGV 0 ${_vcpkg_set_target_properties_index} _vcpkg_set_target_properties_sublist) + math(EXPR _vcpkg_set_target_properties_index_key "${_vcpkg_set_target_properties_index}+1") + #vcpkg_msg(STATUS "set_target_properties" "ARGC: ${ARGC} ARGS: ${ARGV}") + #vcpkg_msg(STATUS "set_target_properties" "PROPERTIES Index: ${_vcpkg_set_target_properties_index}") + #vcpkg_msg(STATUS "set_target_properties" "TARGETS: ${vcpkg_set_target_properties_sublist}") + #Properties are key-value pairs and must be passed one by one since they are allowed to contain empty elements! + while("${_vcpkg_set_target_properties_index_key}" LESS "${ARGC}") + math(EXPR _vcpkg_set_target_properties_index_val "${_vcpkg_set_target_properties_index_key}+1") + #vcpkg_msg(STATUS "set_target_properties" "Key: ARGV${_vcpkg_set_target_properties_index_key}: ${ARGV${_vcpkg_set_target_properties_index_key}}") + #vcpkg_msg(STATUS "set_target_properties" "Value: ARGV${_vcpkg_set_target_properties_index_val}: ${ARGV${_vcpkg_set_target_properties_index_val}}") + vcpkg_set_target_properties(${_vcpkg_set_target_properties_sublist} PROPERTIES "${ARGV${_vcpkg_set_target_properties_index_key}}" "${ARGV${_vcpkg_set_target_properties_index_val}}") + math(EXPR _vcpkg_set_target_properties_index_key "${_vcpkg_set_target_properties_index_val}+1") + endwhile() + + unset(_vcpkg_set_target_properties_guard) + endfunction() +endif() \ No newline at end of file diff --git a/scripts/buildsystems/cmake/vcpkg-setup_cmake_paths.cmake b/scripts/buildsystems/cmake/vcpkg-setup_cmake_paths.cmake new file mode 100644 index 00000000000000..f45b13fb8146e8 --- /dev/null +++ b/scripts/buildsystems/cmake/vcpkg-setup_cmake_paths.cmake @@ -0,0 +1,106 @@ + +#Setting up single configuration generators +if(CMAKE_BUILD_TYPE MATCHES "^[Dd][Ee][Bb][Uu][Gg]$") +#Debug build: Put Debug paths before Release paths. + list(APPEND CMAKE_PREFIX_PATH + ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug + ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET} + ) + list(APPEND CMAKE_LIBRARY_PATH + ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib/manual-link + ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/manual-link + ) + list(APPEND CMAKE_FIND_ROOT_PATH + ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug + ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET} + ) +else() +#Release build: Put Release paths before Debug paths. +#Debug Paths are required so that CMake generates correct info in autogenerated target files. If it can distingush both +#This setup will also be used by multi configuration generators + list(APPEND CMAKE_PREFIX_PATH + ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET} + ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug + ) + list(APPEND CMAKE_LIBRARY_PATH + ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/manual-link + ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib/manual-link + ) + list(APPEND CMAKE_FIND_ROOT_PATH + ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET} + ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug + ) +endif() + +#Setting up mutli configuration generators +#if(DEFINED CMAKE_CONFIGURATION_TYPES) +# list(APPEND CMAKE_PREFIX_PATH +# ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug +# ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET} +# ) +# list(APPEND CMAKE_LIBRARY_PATH +# ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib/manual-link +# ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/manual-link +# ) +# list(APPEND CMAKE_FIND_ROOT_PATH +# ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug +# ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET} +# ) + #This paths mean that cmake will ALWAYS find the debug library first if there is no other way to distinguish between release and debug libraries. + #This fact will be used to correct the library paths in the find_library call! Both paths are still required so that CMake can find both libraries + #if it can distinguish the release and debug libraries by name! +#endif() + +#Setting up CMake search paths (always debug first!) +#list(APPEND CMAKE_PREFIX_PATH +# ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug +# ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET} +#) +#list(APPEND CMAKE_LIBRARY_PATH +# ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib/manual-link +# ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/manual-link +#) +#list(APPEND CMAKE_FIND_ROOT_PATH +# ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug +# ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET} +#) +#setting up the search paths like this will make sure that vcpkg always finds the debug libraries first. +#This circumstance will be used to fix the library paths in find_library + +#Setting up find_program calls to find all compiled programs (only release versions!) +list(APPEND CMAKE_PROGRAM_PATH ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools) +file(GLOB _VCPKG_TOOLS_DIRS ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools/*) +foreach(_VCPKG_TOOLS_DIR ${_VCPKG_TOOLS_DIRS}) + if(IS_DIRECTORY ${_VCPKG_TOOLS_DIR}) + list(APPEND CMAKE_PROGRAM_PATH ${_VCPKG_TOOLS_DIR}) + endif() +endforeach() + +file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _programfiles) +set(_PROGRAMFILESX86 "PROGRAMFILES(x86)") +file(TO_CMAKE_PATH "$ENV{${_PROGRAMFILESX86}}" _programfiles_x86) + +#VCPKG will ignore default installation paths of OpenSSL on Windows. +set(CMAKE_SYSTEM_IGNORE_PATH + "${_programfiles}/OpenSSL" + "${_programfiles}/OpenSSL-Win32" + "${_programfiles}/OpenSSL-Win64" + "${_programfiles}/OpenSSL-Win32/lib/VC" + "${_programfiles}/OpenSSL-Win64/lib/VC" + "${_programfiles}/OpenSSL-Win32/lib/VC/static" + "${_programfiles}/OpenSSL-Win64/lib/VC/static" + "${_programfiles_x86}/OpenSSL" + "${_programfiles_x86}/OpenSSL-Win32" + "${_programfiles_x86}/OpenSSL-Win64" + "${_programfiles_x86}/OpenSSL-Win32/lib/VC" + "${_programfiles_x86}/OpenSSL-Win64/lib/VC" + "${_programfiles_x86}/OpenSSL-Win32/lib/VC/static" + "${_programfiles_x86}/OpenSSL-Win64/lib/VC/static" + "C:/OpenSSL/" + "C:/OpenSSL-Win32/" + "C:/OpenSSL-Win64/" + "C:/OpenSSL-Win32/lib/VC" + "C:/OpenSSL-Win64/lib/VC" + "C:/OpenSSL-Win32/lib/VC/static" + "C:/OpenSSL-Win64/lib/VC/static" +) \ No newline at end of file diff --git a/scripts/buildsystems/cmake/vcpkg-target_link_libraries.cmake b/scripts/buildsystems/cmake/vcpkg-target_link_libraries.cmake new file mode 100644 index 00000000000000..9598a9721c6699 --- /dev/null +++ b/scripts/buildsystems/cmake/vcpkg-target_link_libraries.cmake @@ -0,0 +1,73 @@ +vcpkg_define_function_overwrite_option(target_link_libraries) + +function(vcpkg_target_link_libraries _target_name) + + #get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE ) + #if( _CMAKE_IN_TRY_COMPILE ) + # _target_link_libraries(${ARGV}) +# return() + # endif() + + vcpkg_msg(STATUS "vcpkg_target_link_libraries" "Target ${_target_name} links: ${ARGN}") + + cmake_parse_arguments(PARSE_ARGV 1 _vcpkg_tll "" "" "PRIVATE;PUBLIC;INTERFACE;LINK_PRIVATE;LINK_PUBLIC;LINK_INTERFACE_LIBRARIES") + if(NOT DEFINED _vcpkg_tll_PRIVATE AND NOT DEFINED _vcpkg_tll_PUBLIC AND NOT DEFINED _vcpkg_tll_INTERFACE + AND NOT DEFINED _vcpkg_tll_LINK_PRIVATE AND NOT DEFINED _vcpkg_tll_LINK_PUBLIC AND NOT DEFINED _vcpkg_tll_LINK_INTERFACE_LIBRARIES + AND NOT DEFINED _vcpkg_tll_UNPARSED_ARGUMENTS) + cmake_parse_arguments(_vcpkg_tll "" "" "PRIVATE;PUBLIC;INTERFACE;LINK_PRIVATE;LINK_PUBLIC;LINK_INTERFACE_LIBRARIES" ${ARGN}) + endif() + + if(DEFINED _vcpkg_tll_PRIVATE) + vcpkg_msg(STATUS "vcpkg_target_link_libraries" "Target ${_target_name} links private: ${_vcpkg_tll_PRIVATE}") + vcpkg_check_linkage(_vcpkg_check_linkage ${_vcpkg_tll_PRIVATE}) + _target_link_libraries(${_target_name} PRIVATE ${_vcpkg_check_linkage}) + unset(_vcpkg_check_linkage) + endif() + if(DEFINED _vcpkg_tll_PUBLIC) + vcpkg_msg(STATUS "vcpkg_target_link_libraries" "Target ${_target_name} links public: ${_vcpkg_tll_PUBLIC}") + vcpkg_check_linkage(_vcpkg_check_linkage ${_vcpkg_tll_PUBLIC}) + _target_link_libraries(${_target_name} PUBLIC ${_vcpkg_check_linkage}) + unset(_vcpkg_check_linkage) + endif() + if(DEFINED _vcpkg_tll_INTERFACE) + vcpkg_msg(STATUS "vcpkg_target_link_libraries" "Target ${_target_name} links interface: ${_vcpkg_tll_INTERFACE}") + vcpkg_check_linkage(_vcpkg_check_linkage ${_vcpkg_tll_INTERFACE}) + _target_link_libraries(${_target_name} INTERFACE ${_vcpkg_check_linkage}) + unset(_vcpkg_check_linkage) + endif() + #Deprecated link styles + if(DEFINED _vcpkg_tll_LINK_PRIVATE) + vcpkg_msg(STATUS "vcpkg_target_link_libraries" "Target ${_target_name} links private: ${_vcpkg_tll_LINK_PRIVATE}") + vcpkg_check_linkage(_vcpkg_check_linkage ${_vcpkg_tll_LINK_PRIVATE}) + _target_link_libraries(${_target_name} LINK_PRIVATE ${_vcpkg_check_linkage}) + unset(_vcpkg_check_linkage) + endif() + if(DEFINED _vcpkg_tll_LINK_PUBLIC) + vcpkg_msg(STATUS "vcpkg_target_link_libraries" "Target ${_target_name} links public: ${_vcpkg_tll_LINK_PUBLIC}") + vcpkg_check_linkage(_vcpkg_check_linkage ${_vcpkg_tll_LINK_PUBLIC}) + _target_link_libraries(${_target_name} LINK_PUBLIC ${_vcpkg_check_linkage}) + unset(_vcpkg_check_linkage) + endif() + if(DEFINED _vcpkg_tll_LINK_INTERFACE_LIBRARIES) + vcpkg_msg(STATUS "vcpkg_target_link_libraries" "Target ${_target_name} links interface: ${_vcpkg_tll_LINK_INTERFACE_LIBRARIES}") + vcpkg_check_linkage(_vcpkg_check_linkage ${_vcpkg_tll_LINK_INTERFACE_LIBRARIES}) + _target_link_libraries(${_target_name} LINK_INTERFACE_LIBRARIES ${_vcpkg_check_linkage}) + unset(_vcpkg_check_linkage) + endif() + if(DEFINED _vcpkg_tll_UNPARSED_ARGUMENTS) + vcpkg_msg(STATUS "vcpkg_target_link_libraries" "Target ${_target_name} links unparsed: ${_vcpkg_tll_UNPARSED_ARGUMENTS}") + vcpkg_check_linkage(_vcpkg_check_linkage ${_vcpkg_tll_UNPARSED_ARGUMENTS}) + _target_link_libraries(${_target_name} ${_vcpkg_check_linkage}) + unset(_vcpkg_check_linkage) + endif() +endfunction() + +if(VCPKG_ENABLE_target_link_libraries) + function(target_link_libraries) + vcpkg_enable_function_overwrite_guard(target_link_libraries "") + + vcpkg_target_link_libraries(${ARGV}) + + vcpkg_disable_function_overwrite_guard(target_link_libraries "") + endfunction() +endif() \ No newline at end of file diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake index ed9bcbc69e8cac..bcc3bfcc084c0a 100644 --- a/scripts/buildsystems/vcpkg.cmake +++ b/scripts/buildsystems/vcpkg.cmake @@ -1,6 +1,10 @@ # Mark variables as used so cmake doesn't complain about them mark_as_advanced(CMAKE_TOOLCHAIN_FILE) +# VCPKG toolchain options. +option(VCPKG_VERBOSE "Enables messages from the VCPKG toolchain for debugging purposes." ON) +mark_as_advanced(VCPKG_VERBOSE) + # Determine whether the toolchain is loaded during a try-compile configuration get_property(_CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE) @@ -22,76 +26,41 @@ if(VCPKG_TOOLCHAIN) return() endif() -if(VCPKG_TARGET_TRIPLET) -elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Ww][Ii][Nn]32$") - set(_VCPKG_TARGET_TRIPLET_ARCH x86) -elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Xx]64$") - set(_VCPKG_TARGET_TRIPLET_ARCH x64) -elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Aa][Rr][Mm]$") - set(_VCPKG_TARGET_TRIPLET_ARCH arm) -elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Aa][Rr][Mm]64$") - set(_VCPKG_TARGET_TRIPLET_ARCH arm64) -else() - if(CMAKE_GENERATOR MATCHES "^Visual Studio 14 2015 Win64$") - set(_VCPKG_TARGET_TRIPLET_ARCH x64) - elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 14 2015 ARM$") - set(_VCPKG_TARGET_TRIPLET_ARCH arm) - elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 14 2015$") - set(_VCPKG_TARGET_TRIPLET_ARCH x86) - elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017 Win64$") - set(_VCPKG_TARGET_TRIPLET_ARCH x64) - elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017 ARM$") - set(_VCPKG_TARGET_TRIPLET_ARCH arm) - elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017$") - set(_VCPKG_TARGET_TRIPLET_ARCH x86) - elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 16 2019$") - set(_VCPKG_TARGET_TRIPLET_ARCH x86) - else() - find_program(_VCPKG_CL cl) - if(_VCPKG_CL MATCHES "amd64/cl.exe$" OR _VCPKG_CL MATCHES "x64/cl.exe$") - set(_VCPKG_TARGET_TRIPLET_ARCH x64) - elseif(_VCPKG_CL MATCHES "arm/cl.exe$") - set(_VCPKG_TARGET_TRIPLET_ARCH arm) - elseif(_VCPKG_CL MATCHES "arm64/cl.exe$") - set(_VCPKG_TARGET_TRIPLET_ARCH arm64) - elseif(_VCPKG_CL MATCHES "bin/cl.exe$" OR _VCPKG_CL MATCHES "x86/cl.exe$") - set(_VCPKG_TARGET_TRIPLET_ARCH x86) - elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64") - set(_VCPKG_TARGET_TRIPLET_ARCH x64) - else() - if( _CMAKE_IN_TRY_COMPILE ) - message(STATUS "Unable to determine target architecture, continuing without vcpkg.") - else() - message(WARNING "Unable to determine target architecture, continuing without vcpkg.") - endif() - set(VCPKG_TOOLCHAIN ON) - return() + +set(_VCPKG_TOOLCHAIN_DIR ${CMAKE_CURRENT_LIST_DIR}) +include(${_VCPKG_TOOLCHAIN_DIR}/cmake/vcpkg-msg.cmake) + +if(DEFINED CMAKE_CONFIGURATION_TYPES) #Generating with a multi config generator + #If CMake does not have a mapping for MinSizeRel and RelWithDebInfo in imported targets + #it will map those configuration to the first valid configuration in CMAKE_CONFIGURATION_TYPES. + #By default this is the debug configuration which is wrong. + if(NOT DEFINED CMAKE_MAP_IMPORTED_CONFIG_MINSIZEREL) + set(CMAKE_MAP_IMPORTED_CONFIG_MINSIZEREL "MinSizeRel;Release;") + if(VCPKG_VERBOSE) + message(STATUS "VCPKG-Info: CMAKE_MAP_IMPORTED_CONFIG_MINSIZEREL set to MinSizeRel;Release;") + endif() + endif() + if(NOT DEFINED CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO) + set(CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO "RelWithDebInfo;Release;") + if(VCPKG_VERBOSE) + message(STATUS "VCPKG-Info: CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO set to RelWithDebInfo;Release;") endif() endif() endif() -if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" OR CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone") - set(_VCPKG_TARGET_TRIPLET_PLAT uwp) -elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR (NOT CMAKE_SYSTEM_NAME AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")) - set(_VCPKG_TARGET_TRIPLET_PLAT linux) -elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR (NOT CMAKE_SYSTEM_NAME AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")) - set(_VCPKG_TARGET_TRIPLET_PLAT osx) -elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows" OR (NOT CMAKE_SYSTEM_NAME AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")) - set(_VCPKG_TARGET_TRIPLET_PLAT windows) -elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR (NOT CMAKE_SYSTEM_NAME AND CMAKE_HOST_SYSTEM_NAME STREQUAL "FreeBSD")) - set(_VCPKG_TARGET_TRIPLET_PLAT freebsd) +if(NOT VCPKG_TARGET_TRIPLET) + include(${_VCPKG_TOOLCHAIN_DIR}/cmake/vcpkg-default_triplet.cmake) + vcpkg_msg(WARNING toolchain "Target triplet not specified! Default is: ${VCPKG_TARGET_TRIPLET}! If you want to change it please delete the cache and rerun CMake with -DVCPKG_TARGET_TRIPLET=" ALWAYS) + #Cleaning the cache is required so that cmake actually reruns find_ calls; Should probably be made a FATAL_ERROR instead. endif() -set(VCPKG_TARGET_TRIPLET ${_VCPKG_TARGET_TRIPLET_ARCH}-${_VCPKG_TARGET_TRIPLET_PLAT} CACHE STRING "Vcpkg target triplet (ex. x86-windows)") -set(_VCPKG_TOOLCHAIN_DIR ${CMAKE_CURRENT_LIST_DIR}) - if(NOT DEFINED _VCPKG_ROOT_DIR) # Detect .vcpkg-root to figure VCPKG_ROOT_DIR set(_VCPKG_ROOT_DIR_CANDIDATE ${CMAKE_CURRENT_LIST_DIR}) while(IS_DIRECTORY ${_VCPKG_ROOT_DIR_CANDIDATE} AND NOT EXISTS "${_VCPKG_ROOT_DIR_CANDIDATE}/.vcpkg-root") get_filename_component(_VCPKG_ROOT_DIR_TEMP ${_VCPKG_ROOT_DIR_CANDIDATE} DIRECTORY) if (_VCPKG_ROOT_DIR_TEMP STREQUAL _VCPKG_ROOT_DIR_CANDIDATE) # If unchanged, we have reached the root of the drive - message(FATAL_ERROR "Could not find .vcpkg-root") + vcpkg_msg(FATAL_ERROR toolchain "Could not find .vcpkg-root" ALWAYS) else() SET(_VCPKG_ROOT_DIR_CANDIDATE ${_VCPKG_ROOT_DIR_TEMP}) endif() @@ -101,170 +70,32 @@ endif() set(_VCPKG_INSTALLED_DIR ${_VCPKG_ROOT_DIR}/installed) if(NOT EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" AND NOT _CMAKE_IN_TRY_COMPILE) - message(WARNING "There are no libraries installed for the Vcpkg triplet ${VCPKG_TARGET_TRIPLET}.") + vcpkg_msg(WARNING toolchain "There are no libraries installed for the vcpkg triplet ${VCPKG_TARGET_TRIPLET}." ALWAYS) endif() -if(CMAKE_BUILD_TYPE MATCHES "^[Dd][Ee][Bb][Uu][Gg]$" OR NOT DEFINED CMAKE_BUILD_TYPE) #Debug build: Put Debug paths before Release paths. - list(APPEND CMAKE_PREFIX_PATH - ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET} - ) - list(APPEND CMAKE_LIBRARY_PATH - ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib/manual-link ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/manual-link - ) - list(APPEND CMAKE_FIND_ROOT_PATH - ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET} - ) -else() #Release build: Put Release paths before Debug paths. Debug Paths are required so that CMake generates correct info in autogenerated target files. - list(APPEND CMAKE_PREFIX_PATH - ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET} ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug - ) - list(APPEND CMAKE_LIBRARY_PATH - ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/manual-link ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib/manual-link - ) - list(APPEND CMAKE_FIND_ROOT_PATH - ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET} ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug - ) +if(EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug") + set(VCPKG_DEBUG_AVAILABLE TRUE CACHE INTERNAL "VCPKG debug libraries available") +else() + set(VCPKG_DEBUG_AVAILABLE FALSE CACHE INTERNAL "VCPKG debug libraries available" ) endif() -file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _programfiles) -set(_PROGRAMFILESX86 "PROGRAMFILES(x86)") -file(TO_CMAKE_PATH "$ENV{${_PROGRAMFILESX86}}" _programfiles_x86) -set(CMAKE_SYSTEM_IGNORE_PATH - "${_programfiles}/OpenSSL" - "${_programfiles}/OpenSSL-Win32" - "${_programfiles}/OpenSSL-Win64" - "${_programfiles}/OpenSSL-Win32/lib/VC" - "${_programfiles}/OpenSSL-Win64/lib/VC" - "${_programfiles}/OpenSSL-Win32/lib/VC/static" - "${_programfiles}/OpenSSL-Win64/lib/VC/static" - "${_programfiles_x86}/OpenSSL" - "${_programfiles_x86}/OpenSSL-Win32" - "${_programfiles_x86}/OpenSSL-Win64" - "${_programfiles_x86}/OpenSSL-Win32/lib/VC" - "${_programfiles_x86}/OpenSSL-Win64/lib/VC" - "${_programfiles_x86}/OpenSSL-Win32/lib/VC/static" - "${_programfiles_x86}/OpenSSL-Win64/lib/VC/static" - "C:/OpenSSL/" - "C:/OpenSSL-Win32/" - "C:/OpenSSL-Win64/" - "C:/OpenSSL-Win32/lib/VC" - "C:/OpenSSL-Win64/lib/VC" - "C:/OpenSSL-Win32/lib/VC/static" - "C:/OpenSSL-Win64/lib/VC/static" -) - -list(APPEND CMAKE_PROGRAM_PATH ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools) -file(GLOB _VCPKG_TOOLS_DIRS ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools/*) -foreach(_VCPKG_TOOLS_DIR ${_VCPKG_TOOLS_DIRS}) - if(IS_DIRECTORY ${_VCPKG_TOOLS_DIR}) - list(APPEND CMAKE_PROGRAM_PATH ${_VCPKG_TOOLS_DIR}) - endif() -endforeach() - -option(VCPKG_APPLOCAL_DEPS "Automatically copy dependencies into the output directory for executables." ON) -function(add_executable name) - _add_executable(${ARGV}) - list(FIND ARGV "IMPORTED" IMPORTED_IDX) - list(FIND ARGV "ALIAS" ALIAS_IDX) - list(FIND ARGV "MACOSX_BUNDLE" MACOSX_BUNDLE_IDX) - if(IMPORTED_IDX EQUAL -1 AND ALIAS_IDX EQUAL -1) - if(VCPKG_APPLOCAL_DEPS) - if(_VCPKG_TARGET_TRIPLET_PLAT MATCHES "windows|uwp") - add_custom_command(TARGET ${name} POST_BUILD - COMMAND powershell -noprofile -executionpolicy Bypass -file ${_VCPKG_TOOLCHAIN_DIR}/msbuild/applocal.ps1 - -targetBinary $ - -installedDir "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$:/debug>/bin" - -OutVariable out - ) - elseif(_VCPKG_TARGET_TRIPLET_PLAT MATCHES "osx") - if (NOT MACOSX_BUNDLE_IDX EQUAL -1) - add_custom_command(TARGET ${name} POST_BUILD - COMMAND python ${_VCPKG_TOOLCHAIN_DIR}/osx/applocal.py - $ - "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$:/debug>" - ) - endif() - endif() - endif() - set_target_properties(${name} PROPERTIES VS_USER_PROPS do_not_import_user.props) - set_target_properties(${name} PROPERTIES VS_GLOBAL_VcpkgEnabled false) - endif() -endfunction() - -function(add_library name) - _add_library(${ARGV}) - list(FIND ARGV "IMPORTED" IMPORTED_IDX) - list(FIND ARGV "INTERFACE" INTERFACE_IDX) - list(FIND ARGV "ALIAS" ALIAS_IDX) - if(IMPORTED_IDX EQUAL -1 AND INTERFACE_IDX EQUAL -1 AND ALIAS_IDX EQUAL -1) - get_target_property(IS_LIBRARY_SHARED ${name} TYPE) - if(VCPKG_APPLOCAL_DEPS AND _VCPKG_TARGET_TRIPLET_PLAT MATCHES "windows|uwp" AND (IS_LIBRARY_SHARED STREQUAL "SHARED_LIBRARY" OR IS_LIBRARY_SHARED STREQUAL "MODULE_LIBRARY")) - add_custom_command(TARGET ${name} POST_BUILD - COMMAND powershell -noprofile -executionpolicy Bypass -file ${_VCPKG_TOOLCHAIN_DIR}/msbuild/applocal.ps1 - -targetBinary $ - -installedDir "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$:/debug>/bin" - -OutVariable out - ) - endif() - set_target_properties(${name} PROPERTIES VS_USER_PROPS do_not_import_user.props) - set_target_properties(${name} PROPERTIES VS_GLOBAL_VcpkgEnabled false) - endif() -endfunction() - -macro(find_package name) - string(TOLOWER "${name}" _vcpkg_lowercase_name) - if(EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share/${_vcpkg_lowercase_name}/vcpkg-cmake-wrapper.cmake") - set(ARGS "${ARGV}") - include(${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share/${_vcpkg_lowercase_name}/vcpkg-cmake-wrapper.cmake) - elseif("${name}" STREQUAL "Boost" AND EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/boost") - # Checking for the boost headers disables this wrapper unless the user has installed at least one boost library - set(Boost_USE_STATIC_LIBS OFF) - set(Boost_USE_MULTITHREADED ON) - unset(Boost_USE_STATIC_RUNTIME) - set(Boost_NO_BOOST_CMAKE ON) - unset(Boost_USE_STATIC_RUNTIME CACHE) - set(Boost_COMPILER "-vc140") - _find_package(${ARGV}) - elseif("${name}" STREQUAL "ICU" AND EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/unicode/utf.h") - function(_vcpkg_find_in_list) - list(FIND ARGV "COMPONENTS" COMPONENTS_IDX) - set(COMPONENTS_IDX ${COMPONENTS_IDX} PARENT_SCOPE) - endfunction() - _vcpkg_find_in_list(${ARGV}) - if(NOT COMPONENTS_IDX EQUAL -1) - _find_package(${ARGV} COMPONENTS data) - else() - _find_package(${ARGV}) - endif() - elseif("${name}" STREQUAL "GSL" AND EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/gsl") - _find_package(${ARGV}) - if(GSL_FOUND AND TARGET GSL::gsl) - set_property( TARGET GSL::gslcblas APPEND PROPERTY IMPORTED_CONFIGURATIONS Release ) - set_property( TARGET GSL::gsl APPEND PROPERTY IMPORTED_CONFIGURATIONS Release ) - if( EXISTS "${GSL_LIBRARY_DEBUG}" AND EXISTS "${GSL_CBLAS_LIBRARY_DEBUG}") - set_property( TARGET GSL::gsl APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug ) - set_target_properties( GSL::gsl PROPERTIES IMPORTED_LOCATION_DEBUG "${GSL_LIBRARY_DEBUG}" ) - set_property( TARGET GSL::gslcblas APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug ) - set_target_properties( GSL::gslcblas PROPERTIES IMPORTED_LOCATION_DEBUG "${GSL_CBLAS_LIBRARY_DEBUG}" ) - endif() - endif() - elseif("${name}" STREQUAL "CURL" AND EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/curl") - _find_package(${ARGV}) - if(CURL_FOUND) - if(EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/nghttp2.lib") - list(APPEND CURL_LIBRARIES - "debug" "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib/nghttp2.lib" - "optimized" "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/nghttp2.lib") - endif() - endif() - elseif("${_vcpkg_lowercase_name}" STREQUAL "grpc" AND EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share/grpc") - _find_package(gRPC ${ARGN}) - else() - _find_package(${ARGV}) - endif() -endmacro() +include(CMakeDependentOption) +include(${_VCPKG_TOOLCHAIN_DIR}/cmake/vcpkg-setup_cmake_paths.cmake) +include(${_VCPKG_TOOLCHAIN_DIR}/cmake/vcpkg-function_overwrite_guard.cmake) +include(${_VCPKG_TOOLCHAIN_DIR}/cmake/vcpkg-check_linkage.cmake) +include(${_VCPKG_TOOLCHAIN_DIR}/cmake/vcpkg-search_library.cmake) +include(${_VCPKG_TOOLCHAIN_DIR}/cmake/vcpkg-link_libraries.cmake) +include(${_VCPKG_TOOLCHAIN_DIR}/cmake/vcpkg-target_link_libraries.cmake) +include(${_VCPKG_TOOLCHAIN_DIR}/cmake/vcpkg-add_executable.cmake) +include(${_VCPKG_TOOLCHAIN_DIR}/cmake/vcpkg-add_library.cmake) +include(${_VCPKG_TOOLCHAIN_DIR}/cmake/vcpkg-find_package.cmake) +include(${_VCPKG_TOOLCHAIN_DIR}/cmake/vcpkg-find_library.cmake) +include(${_VCPKG_TOOLCHAIN_DIR}/cmake/vcpkg-set_property.cmake) +include(${_VCPKG_TOOLCHAIN_DIR}/cmake/vcpkg-set_target_properties.cmake) set(VCPKG_TOOLCHAIN ON) + +#Silence CMake? set(_UNUSED ${CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION}) set(_UNUSED ${CMAKE_EXPORT_NO_PACKAGE_REGISTRY}) set(_UNUSED ${CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY}) diff --git a/triplets/arm-uwp.cmake b/triplets/arm-uwp.cmake index f16f96a4ab8e4f..787cdf34251d9a 100644 --- a/triplets/arm-uwp.cmake +++ b/triplets/arm-uwp.cmake @@ -1,5 +1,5 @@ set(VCPKG_TARGET_ARCHITECTURE arm) -set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_CRT_LINKAGE dynamic) set(VCPKG_LIBRARY_LINKAGE dynamic) set(VCPKG_CMAKE_SYSTEM_NAME WindowsStore) diff --git a/triplets/arm-windows.cmake b/triplets/arm-windows.cmake index 3aa75933fd1ea9..6a2cd75820fdde 100644 --- a/triplets/arm-windows.cmake +++ b/triplets/arm-windows.cmake @@ -1,5 +1,3 @@ set(VCPKG_TARGET_ARCHITECTURE arm) set(VCPKG_CRT_LINKAGE dynamic) -set(VCPKG_LIBRARY_LINKAGE dynamic) - - +set(VCPKG_LIBRARY_LINKAGE dynamic) diff --git a/triplets/arm64-uwp.cmake b/triplets/arm64-uwp.cmake index b37c34e87306b1..536ced15b36c74 100644 --- a/triplets/arm64-uwp.cmake +++ b/triplets/arm64-uwp.cmake @@ -1,6 +1,6 @@ set(VCPKG_TARGET_ARCHITECTURE arm64) set(VCPKG_CRT_LINKAGE dynamic) -set(VCPKG_LIBRARY_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE dynamic) set(VCPKG_CMAKE_SYSTEM_NAME WindowsStore) set(VCPKG_CMAKE_SYSTEM_VERSION 10.0) diff --git a/triplets/arm64-windows.cmake b/triplets/arm64-windows.cmake index ac911c476c5f78..7450ced804b017 100644 --- a/triplets/arm64-windows.cmake +++ b/triplets/arm64-windows.cmake @@ -1,5 +1,7 @@ set(VCPKG_TARGET_ARCHITECTURE arm64) set(VCPKG_CRT_LINKAGE dynamic) -set(VCPKG_LIBRARY_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE dynamic) + + diff --git a/triplets/x64-linux.cmake b/triplets/x64-linux.cmake index 5196184638bbfb..604c8012b3c36b 100644 --- a/triplets/x64-linux.cmake +++ b/triplets/x64-linux.cmake @@ -1,5 +1,10 @@ set(VCPKG_TARGET_ARCHITECTURE x64) set(VCPKG_CRT_LINKAGE dynamic) -set(VCPKG_LIBRARY_LINKAGE static) +set(VCPKG_LIBRARY_LINKAGE static) set(VCPKG_CMAKE_SYSTEM_NAME Linux) + + + + + diff --git a/triplets/x64-osx.cmake b/triplets/x64-osx.cmake index af3a8c3483028e..bc3db0d68e88b6 100644 --- a/triplets/x64-osx.cmake +++ b/triplets/x64-osx.cmake @@ -1,5 +1,5 @@ set(VCPKG_TARGET_ARCHITECTURE x64) set(VCPKG_CRT_LINKAGE dynamic) -set(VCPKG_LIBRARY_LINKAGE static) +set(VCPKG_LIBRARY_LINKAGE static) set(VCPKG_CMAKE_SYSTEM_NAME Darwin) diff --git a/triplets/x64-uwp.cmake b/triplets/x64-uwp.cmake index 944acdd833de07..b748c625e349c3 100644 --- a/triplets/x64-uwp.cmake +++ b/triplets/x64-uwp.cmake @@ -2,5 +2,5 @@ set(VCPKG_TARGET_ARCHITECTURE x64) set(VCPKG_CRT_LINKAGE dynamic) set(VCPKG_LIBRARY_LINKAGE dynamic) -set(VCPKG_CMAKE_SYSTEM_NAME WindowsStore) +set(VCPKG_CMAKE_SYSTEM_NAME WindowsStore) set(VCPKG_CMAKE_SYSTEM_VERSION 10.0) diff --git a/triplets/x64-windows-static.cmake b/triplets/x64-windows-static.cmake index 75f9b95325ed5b..6fb6356701804d 100644 --- a/triplets/x64-windows-static.cmake +++ b/triplets/x64-windows-static.cmake @@ -1,3 +1,3 @@ set(VCPKG_TARGET_ARCHITECTURE x64) set(VCPKG_CRT_LINKAGE static) -set(VCPKG_LIBRARY_LINKAGE static) +set(VCPKG_LIBRARY_LINKAGE static) diff --git a/triplets/x64-windows.cmake b/triplets/x64-windows.cmake index d0be7297f0c468..5f648d05326a7a 100644 --- a/triplets/x64-windows.cmake +++ b/triplets/x64-windows.cmake @@ -2,3 +2,6 @@ set(VCPKG_TARGET_ARCHITECTURE x64) set(VCPKG_CRT_LINKAGE dynamic) set(VCPKG_LIBRARY_LINKAGE dynamic) + + + diff --git a/triplets/x86-uwp.cmake b/triplets/x86-uwp.cmake index 13b9d77c244e44..85581ee26dd17e 100644 --- a/triplets/x86-uwp.cmake +++ b/triplets/x86-uwp.cmake @@ -2,5 +2,5 @@ set(VCPKG_TARGET_ARCHITECTURE x86) set(VCPKG_CRT_LINKAGE dynamic) set(VCPKG_LIBRARY_LINKAGE dynamic) -set(VCPKG_CMAKE_SYSTEM_NAME WindowsStore) +set(VCPKG_CMAKE_SYSTEM_NAME WindowsStore) set(VCPKG_CMAKE_SYSTEM_VERSION 10.0) diff --git a/triplets/x86-windows-static.cmake b/triplets/x86-windows-static.cmake index c855f0caa0d489..774e26f2680f75 100644 --- a/triplets/x86-windows-static.cmake +++ b/triplets/x86-windows-static.cmake @@ -1,3 +1,4 @@ set(VCPKG_TARGET_ARCHITECTURE x86) -set(VCPKG_CRT_LINKAGE static) -set(VCPKG_LIBRARY_LINKAGE static) \ No newline at end of file +set(VCPKG_CRT_LINKAGE static) +set(VCPKG_LIBRARY_LINKAGE static) + diff --git a/triplets/x86-windows.cmake b/triplets/x86-windows.cmake index 40ccbe152dc10c..99945715c53ffb 100644 --- a/triplets/x86-windows.cmake +++ b/triplets/x86-windows.cmake @@ -1,3 +1,3 @@ set(VCPKG_TARGET_ARCHITECTURE x86) set(VCPKG_CRT_LINKAGE dynamic) -set(VCPKG_LIBRARY_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE dynamic)