Skip to content

Commit

Permalink
Merge pull request #1361 from microsoft/master
Browse files Browse the repository at this point in the history
Merge from microsoft/vcpkg
  • Loading branch information
Jimmy-Hu authored May 13, 2023
2 parents f8067b1 + ed8fb07 commit 209d09b
Show file tree
Hide file tree
Showing 49 changed files with 533 additions and 387 deletions.
13 changes: 0 additions & 13 deletions ports/behaviortree-cpp/001_port_fixes.patch

This file was deleted.

34 changes: 0 additions & 34 deletions ports/behaviortree-cpp/002_fix_dependencies.patch

This file was deleted.

35 changes: 35 additions & 0 deletions ports/behaviortree-cpp/fix-x86_build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
diff --git a/3rdparty/lexy/include/lexy/_detail/swar.hpp b/3rdparty/lexy/include/lexy/_detail/swar.hpp
index a268abb..d31bdaa 100644
--- a/3rdparty/lexy/include/lexy/_detail/swar.hpp
+++ b/3rdparty/lexy/include/lexy/_detail/swar.hpp
@@ -141,8 +141,13 @@ constexpr std::size_t swar_find_difference(swar_int lhs, swar_int rhs)
auto bit_idx = __builtin_ctzll(mask);
#elif defined(_MSC_VER)
unsigned long bit_idx;
- if (!_BitScanForward64(&bit_idx, mask))
- bit_idx = 64;
+ #if defined(_WIN64)
+ if (!_BitScanForward64(&bit_idx, mask))
+ bit_idx = 64;
+ #elif defined(_WIN32)
+ if (!_BitScanForward(&bit_idx, mask))
+ bit_idx = 32;
+ #endif
#else
# error "unsupported compiler; please file an issue"
#endif
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 295b317..0f1cd5c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -154,6 +154,10 @@ else()
add_library(${BTCPP_LIBRARY} STATIC ${BT_SOURCE})
endif()

+if (MSVC)
+ target_compile_definitions(${BTCPP_LIBRARY} PRIVATE NOMINMAX)
+endif ()
+
message(STATUS "BTCPP_EXTRA_LIBRARIES: ${BTCPP_EXTRA_LIBRARIES}")

target_link_libraries(${BTCPP_LIBRARY}
35 changes: 18 additions & 17 deletions ports/behaviortree-cpp/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,37 +1,38 @@
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)

vcpkg_download_distfile(ARCHIVE
URLS "https://github.com/BehaviorTree/BehaviorTree.CPP/archive/3.5.6.tar.gz"
FILENAME "BehaviorTree.CPP.3.5.6.tar.gz"
SHA512 cd3b15eb7c5bab68239b697da166220b4df8dd7e6cf5e831f316d411e24be56c9ed74e54a3e3dd332164d740159eaf9ce62d005601fd65133809dab29430c9b7
URLS "https://github.com/BehaviorTree/BehaviorTree.CPP/archive/${VERSION}.tar.gz"
FILENAME "BehaviorTree.CPP.${VERSION}.tar.gz"
SHA512 4505c4c8798ccbbc02f58320810eb86e791fb6ef57d8c85882e62bd2b509b41e0549dc311ed61926a873b5b956eda979efda488f01d00746e1e8db559f60253c
)

vcpkg_extract_source_archive(
SOURCE_PATH
ARCHIVE "${ARCHIVE}"
PATCHES
001_port_fixes.patch
002_fix_dependencies.patch
fix-x86_build.patch
)

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DCMAKE_DISABLE_FIND_PACKAGE_ament_cmake=1
-DCMAKE_DISABLE_FIND_PACKAGE_Curses=1
-DBUILD_EXAMPLES=OFF
-DBUILD_UNIT_TESTS=OFF
-DBUILD_TOOLS=OFF
-DBTCPP_EXAMPLES=OFF
-DBTCPP_UNIT_TESTS=OFF
-DBTCPP_BUILD_TOOLS=OFF
-DBTCPP_GROOT_INTERFACE=OFF
-DBTCPP_SQLITE_LOGGING=OFF
MAYBE_UNUSED_VARIABLES
CMAKE_DISABLE_FIND_PACKAGE_Curses
)

vcpkg_cmake_install()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/BehaviorTreeV3/cmake PACKAGE_NAME behaviortreev3)
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/behaviortree_cpp PACKAGE_NAME behaviortree_cpp)
vcpkg_copy_pdbs()

file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")

file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/lib/BehaviorTreeV3"
"${CURRENT_PACKAGES_DIR}/debug/lib/BehaviorTreeV3"
)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")

if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
3 changes: 1 addition & 2 deletions ports/behaviortree-cpp/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "behaviortree-cpp",
"version": "3.5.6",
"port-version": 3,
"version": "4.1.1",
"description": "Behavior Trees Library in C++.",
"homepage": "https://www.behaviortree.dev",
"supports": "!uwp",
Expand Down
49 changes: 49 additions & 0 deletions ports/boinc/fix-build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
diff --git a/lib/filesys.cpp b/lib/filesys.cpp
index c258a0f8d1..76530fb432 100644
--- a/lib/filesys.cpp
+++ b/lib/filesys.cpp
@@ -63,6 +63,7 @@

#include "error_numbers.h"
#include "filesys.h"
+#include "str_replace.h"
#include "str_util.h"
#include "util.h"

diff --git a/lib/str_util.h b/lib/str_util.h
index 0e2d5f179a..22908d8568 100644
--- a/lib/str_util.h
+++ b/lib/str_util.h
@@ -22,8 +22,6 @@
#include <vector>
#include <string.h>

-#include "str_replace.h"
-
#define safe_strcpy(x, y) strlcpy(x, y, sizeof(x))
#define safe_strcat(x, y) strlcat(x, y, sizeof(x))

diff --git a/lib/util.cpp b/lib/util.cpp
index cfa495a6f9..2af4b0fb94 100644
--- a/lib/util.cpp
+++ b/lib/util.cpp
@@ -17,6 +17,7 @@

#if defined(_WIN32)
#include "boinc_win.h"
+#include "str_replace.h"
#include "str_util.h"
#include "win_util.h"
#endif
diff --git a/lib/win_util.cpp b/lib/win_util.cpp
index 86289e0ce7..82b17f4425 100644
--- a/lib/win_util.cpp
+++ b/lib/win_util.cpp
@@ -23,6 +23,7 @@
#include "util.h"
#include "filesys.h"
#include "win_util.h"
+#include "str_replace.h"
#include "str_util.h"

/**
8 changes: 8 additions & 0 deletions ports/boinc/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ vcpkg_from_github(
REF client_release/7.22/7.22.1
SHA512 8b3efc68fe8df8f95a674d9deddbe355da2070a960b1768ee7f9c2afdd8a373e97297715dec5d7daf131d4b5c478afbc4476e152ec516080620f66e1a1f785af
HEAD_REF master
PATCHES
fix-build.patch
)

file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
Expand Down Expand Up @@ -37,6 +39,12 @@ vcpkg_cmake_configure(
vcpkg_cmake_install()

vcpkg_cmake_config_fixup()
file(READ "${CURRENT_PACKAGES_DIR}/share/boinc/boinc-config.cmake" BOINC_CONFIG)
file(WRITE "${CURRENT_PACKAGES_DIR}/share/boinc/boinc-config.cmake" "
include(CMakeFindDependencyMacro)
find_dependency(OpenSSL)
${BOINC_CONFIG}
")

vcpkg_copy_pdbs()

Expand Down
1 change: 1 addition & 0 deletions ports/boinc/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "boinc",
"version": "7.22.1",
"port-version": 1,
"description": "Open-source software for volunteer computing and grid computing.",
"homepage": "https://boinc.berkeley.edu/",
"license": "LGPL-3.0-or-later",
Expand Down
3 changes: 2 additions & 1 deletion ports/gstreamer/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ vcpkg_configure_meson(
-Dlibav=${LIBAV}
-Dlibnice=disabled
-Ddevtools=disabled
-Dges=disabled
-Dges=enabled
-Drtsp_server=disabled
-Domx=disabled
-Dvaapi=disabled
Expand Down Expand Up @@ -644,6 +644,7 @@ list(APPEND GST_BIN_TOOLS
gst-launch-1.0
gst-stats-1.0
gst-typefind-1.0
ges-launch-1.0
)
list(APPEND GST_LIBEXEC_TOOLS
gst-plugin-scanner
Expand Down
2 changes: 1 addition & 1 deletion ports/gstreamer/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gstreamer",
"version": "1.20.5",
"port-version": 7,
"port-version": 8,
"description": "GStreamer open-source multimedia framework core library",
"homepage": "https://gstreamer.freedesktop.org/",
"license": "LGPL-2.0-only",
Expand Down
53 changes: 53 additions & 0 deletions ports/intel-mkl/copy-from-dmg.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
find_program(HDIUTIL NAMES hdiutil REQUIRED)
set(dmg_path "NOTFOUND" CACHE FILEPATH "Where to find the DMG")
set(output_dir "output_dir" CACHE FILEPATH "Where to put the packages")

if(NOT EXISTS "${dmg_path}")
message(FATAL_ERROR "'dmg_path' (${dmg_path}) does not exist.")
endif()
if(NOT IS_DIRECTORY "${output_dir}")
message(FATAL_ERROR "'output_dir' (${output_dir}) is not a directory.")
endif()

execute_process(
COMMAND mktemp -d
RESULT_VARIABLE mktemp_result
OUTPUT_VARIABLE mount_point
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT mktemp_result STREQUAL "0")
message(FATAL_ERROR "mktemp -d failed: ${mktemp_result}")
elseif(NOT IS_DIRECTORY "${mount_point}")
message(FATAL_ERROR "'mount_point' (${mount_point}) is not a directory.")
endif()

execute_process(
COMMAND "${HDIUTIL}" attach "${dmg_path}" -mountpoint "${mount_point}" -readonly
RESULT_VARIABLE mount_result
)
if(mount_result STREQUAL "0")
set(dmg_packages_dir "${mount_point}/bootstrapper.app/Contents/Resources/packages")
file(GLOB packages
"${dmg_packages_dir}/intel.oneapi.mac.mkl.devel,*"
"${dmg_packages_dir}/intel.oneapi.mac.mkl.runtime,*"
"${dmg_packages_dir}/intel.oneapi.mac.mkl.product,*"
"${dmg_packages_dir}/intel.oneapi.mac.openmp,*"
)
# Using execute_process to avoid direct errors
execute_process(
COMMAND cp -R ${packages} "${output_dir}/"
RESULT_VARIABLE copy_result
)
endif()
execute_process(
COMMAND "${HDIUTIL}" detach "${mount_point}"
RESULT_VARIABLE unmount_result
)

if(NOT mount_result STREQUAL "0")
message(FATAL_ERROR "Mounting ${dmg_path} failed: ${mount_result}")
elseif(NOT copy_result STREQUAL "0")
message(FATAL_ERROR "Coyping packages failed: ${copy_result}")
elseif(NOT unmount_result STREQUAL "0")
message(FATAL_ERROR "Unounting ${dmg_path} failed: ${unmount_result}")
endif()
Loading

0 comments on commit 209d09b

Please sign in to comment.