aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThad House <thadhouse1@gmail.com>2019-04-11 23:03:35 -0700
committerThad House <thadhouse1@gmail.com>2019-04-14 11:09:32 -0700
commit73a99865b1ff60bb3aa3d6a7dd98219f9301d379 (patch)
tree9ae4b647fe7476da75148c6e903ed5e6ff1dbc8d
parent0907798d406d036a488b826b91d1cea427d93497 (diff)
downloadvcpkg-73a99865b1ff60bb3aa3d6a7dd98219f9301d379.tar.gz
vcpkg-73a99865b1ff60bb3aa3d6a7dd98219f9301d379.zip
Add WPILib port for vcpkg
-rw-r--r--ports/wpilib/0006-Fix-GUID-comparison-creating-weird-symbol.patch57
-rw-r--r--ports/wpilib/CONTROL11
-rw-r--r--ports/wpilib/portfile.cmake62
-rw-r--r--scripts/buildsystems/vcpkg.cmake8
4 files changed, 137 insertions, 1 deletions
diff --git a/ports/wpilib/0006-Fix-GUID-comparison-creating-weird-symbol.patch b/ports/wpilib/0006-Fix-GUID-comparison-creating-weird-symbol.patch
new file mode 100644
index 000000000..44b6be481
--- /dev/null
+++ b/ports/wpilib/0006-Fix-GUID-comparison-creating-weird-symbol.patch
@@ -0,0 +1,57 @@
+From afa930371f3b297a1846cd1892576a20ec7e6ece Mon Sep 17 00:00:00 2001
+From: Thad House <thadhouse1@gmail.com>
+Date: Thu, 11 Apr 2019 22:37:46 -0700
+Subject: [PATCH 6/6] Fix GUID comparison creating weird symbol
+
+---
+ cscore/build.gradle | 4 ++--
+ cscore/src/main/native/windows/UsbCameraImpl.cpp | 10 +++++-----
+ 2 files changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/cscore/build.gradle b/cscore/build.gradle
+index 3162c8804..40cb97daf 100644
+--- a/cscore/build.gradle
++++ b/cscore/build.gradle
+@@ -98,11 +98,11 @@ model {
+ x86ExcludeSymbols = ['_CT??_R0?AV_System_error', '_CT??_R0?AVexception', '_CT??_R0?AVfailure',
+ '_CT??_R0?AVbad_cast',
+ '_CT??_R0?AVruntime_error', '_CT??_R0?AVsystem_error', '_CTA5?AVfailure',
+- '_TI5?AVfailure', '==']
++ '_TI5?AVfailure']
+ x64ExcludeSymbols = ['_CT??_R0?AV_System_error', '_CT??_R0?AVexception', '_CT??_R0?AVfailure',
+ '_CT??_R0?AVbad_cast',
+ '_CT??_R0?AVruntime_error', '_CT??_R0?AVsystem_error', '_CTA5?AVfailure',
+- '_TI5?AVfailure', '==']
++ '_TI5?AVfailure']
+ }
+ cscoreJNI(ExportsConfig) {
+ x86SymbolFilter = { symbols ->
+diff --git a/cscore/src/main/native/windows/UsbCameraImpl.cpp b/cscore/src/main/native/windows/UsbCameraImpl.cpp
+index e45f361d4..3a6446554 100644
+--- a/cscore/src/main/native/windows/UsbCameraImpl.cpp
++++ b/cscore/src/main/native/windows/UsbCameraImpl.cpp
+@@ -413,16 +413,16 @@ LRESULT UsbCameraImpl::PumpMain(HWND hwnd, UINT uiMsg, WPARAM wParam,
+
+ static cs::VideoMode::PixelFormat GetFromGUID(const GUID& guid) {
+ // Compare GUID to one of the supported ones
+- if (guid == MFVideoFormat_NV12) {
++ if (IsEqualGUID(guid, MFVideoFormat_NV12)) {
+ // GrayScale
+ return cs::VideoMode::PixelFormat::kGray;
+- } else if (guid == MFVideoFormat_YUY2) {
++ } else if (IsEqualGUID(guid, MFVideoFormat_YUY2)) {
+ return cs::VideoMode::PixelFormat::kYUYV;
+- } else if (guid == MFVideoFormat_RGB24) {
++ } else if (IsEqualGUID(guid, MFVideoFormat_RGB24)) {
+ return cs::VideoMode::PixelFormat::kBGR;
+- } else if (guid == MFVideoFormat_MJPG) {
++ } else if (IsEqualGUID(guid, MFVideoFormat_MJPG)) {
+ return cs::VideoMode::PixelFormat::kMJPEG;
+- } else if (guid == MFVideoFormat_RGB565) {
++ } else if (IsEqualGUID(guid, MFVideoFormat_RGB565)) {
+ return cs::VideoMode::PixelFormat::kRGB565;
+ } else {
+ return cs::VideoMode::PixelFormat::kUnknown;
+--
+2.18.0.windows.1
+
diff --git a/ports/wpilib/CONTROL b/ports/wpilib/CONTROL
new file mode 100644
index 000000000..24ab2e23f
--- /dev/null
+++ b/ports/wpilib/CONTROL
@@ -0,0 +1,11 @@
+Source: wpilib
+Version: 2019.4.1
+Description: WPILib is the software library package for the FIRST Robotics Competition. The core install includes wpiutil, a common utilies library, and ntcore, the base NetworkTables library.
+
+Feature: cameraserver
+Build-Depends: opencv
+Description: Enables the CameraServer and CSCore libraries for manipulating USB Cameras and HTTP Camera Streams
+
+Feature: allwpilib
+Build-Depends: wpilib[cameraserver] opencv
+Description: Enables the simulation HAL, and the high level wpilibc library.
diff --git a/ports/wpilib/portfile.cmake b/ports/wpilib/portfile.cmake
new file mode 100644
index 000000000..90627060e
--- /dev/null
+++ b/ports/wpilib/portfile.cmake
@@ -0,0 +1,62 @@
+include(vcpkg_common_functions)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO wpilibsuite/allwpilib
+ REF v2019.4.1
+ SHA512 8a79e55cd5f3aaf60eb8c0a952d33c82b5e5c997e72d7ad1cf3a99165a0057dfc5d3fc742d7dcefc7a1d3031bfc185b107968545159d7d5177a601df85df271e
+ HEAD_REF master
+ PATCHES
+ 0006-Fix-GUID-comparison-creating-weird-symbol.patch
+)
+
+set(WITHOUT_JAVA ON)
+set(WITHOUT_CSCORE ON)
+set(WITHOUT_ALLWPILIB ON)
+
+if ("cameraserver" IN_LIST FEATURES)
+ set(WITHOUT_CSCORE OFF)
+endif()
+
+if ("allwpilib" IN_LIST FEATURES)
+ set(WITHOUT_ALLWPILIB OFF)
+endif()
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+
+ OPTIONS
+ -DWITHOUT_JAVA=${WITHOUT_JAVA}
+ -DWITHOUT_CSCORE=${WITHOUT_CSCORE}
+ -DWITHOUT_ALLWPILIB=${WITHOUT_ALLWPILIB}
+ -DFLAT_INSTALL_HEADERS=ON
+)
+vcpkg_install_cmake()
+
+file(COPY ${CURRENT_PACKAGES_DIR}/wpilib/include/ntcore/ DESTINATION ${CURRENT_PACKAGES_DIR}/include)
+file(COPY ${CURRENT_PACKAGES_DIR}/wpilib/include/wpiutil/ DESTINATION ${CURRENT_PACKAGES_DIR}/include)
+if (NOT WITHOUT_ALLWPILIB)
+file(COPY ${CURRENT_PACKAGES_DIR}/wpilib/include/wpilibc/ DESTINATION ${CURRENT_PACKAGES_DIR}/include)
+file(COPY ${CURRENT_PACKAGES_DIR}/wpilib/include/hal/gen/ DESTINATION ${CURRENT_PACKAGES_DIR}/include)
+file(COPY ${CURRENT_PACKAGES_DIR}/wpilib/include/hal/ DESTINATION ${CURRENT_PACKAGES_DIR}/include)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/gen)
+endif()
+if (NOT WITHOUT_CSCORE)
+file(COPY ${CURRENT_PACKAGES_DIR}/wpilib/include/cameraserver/ DESTINATION ${CURRENT_PACKAGES_DIR}/include)
+file(COPY ${CURRENT_PACKAGES_DIR}/wpilib/include/cscore/ DESTINATION ${CURRENT_PACKAGES_DIR}/include)
+endif()
+
+file(COPY ${CURRENT_PACKAGES_DIR}/wpilib/lib/ DESTINATION ${CURRENT_PACKAGES_DIR}/bin FILES_MATCHING PATTERN "*.dll")
+file(COPY ${CURRENT_PACKAGES_DIR}/debug/wpilib/lib/ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin FILES_MATCHING PATTERN "*.dll")
+
+file(COPY ${CURRENT_PACKAGES_DIR}/wpilib/lib/ DESTINATION ${CURRENT_PACKAGES_DIR}/bin FILES_MATCHING PATTERN "*.pdb")
+file(COPY ${CURRENT_PACKAGES_DIR}/debug/wpilib/lib/ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin FILES_MATCHING PATTERN "*.pdb")
+
+file(COPY ${CURRENT_PACKAGES_DIR}/wpilib/lib/ DESTINATION ${CURRENT_PACKAGES_DIR}/lib FILES_MATCHING PATTERN "*.lib")
+file(COPY ${CURRENT_PACKAGES_DIR}/debug/wpilib/lib/ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib FILES_MATCHING PATTERN "*.lib")
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/wpilib)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/wpilib)
+
+file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/wpilib RENAME copyright)
diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake
index b2a589421..29bbd7523 100644
--- a/scripts/buildsystems/vcpkg.cmake
+++ b/scripts/buildsystems/vcpkg.cmake
@@ -37,6 +37,12 @@ else()
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 Win64$")
+ set(_VCPKG_TARGET_TRIPLET_ARCH x64)
+ elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 16 2019 ARM$")
+ set(_VCPKG_TARGET_TRIPLET_ARCH arm)
+ 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$")
@@ -95,7 +101,7 @@ if(NOT EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" AND NOT _CMAKE_I
message(WARNING "There are no libraries installed for the Vcpkg triplet ${VCPKG_TARGET_TRIPLET}.")
endif()
-if(CMAKE_BUILD_TYPE MATCHES "^Debug$" OR NOT DEFINED CMAKE_BUILD_TYPE) #Debug build: Put Debug paths before Release paths.
+if(CMAKE_BUILD_TYPE MATCHES "^Debug$" 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}
)