Skip to content

Commit

Permalink
[libusb] Fix issue to support linux (#9561)
Browse files Browse the repository at this point in the history
* [libusb] support linux

* Add Supports

* Using vcpkg_configure_make instead

* Revert to install headers in windows

* Fix failures in libftd1

* Update treehopper

* Add failed ports in ci baseline file

* Revert to remove azure-kinect-sensor-sdk:x64-windows-static=fail in baseline file

* Resolve conflicts

Co-authored-by: PhoebeHui <[email protected]>
  • Loading branch information
PhoebeHui and PhoebeHui authored Jul 29, 2020
1 parent 0babd2f commit a2d3782
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 84 deletions.
2 changes: 1 addition & 1 deletion ports/libftdi1/CONTROL
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Source: libftdi1
Version: 1.4
Version: 1.4-1
Build-Depends: libusb
Description: FTDI USB driver with bitbang mode (v1.4)
10 changes: 5 additions & 5 deletions ports/libftdi1/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
include(vcpkg_common_functions)

vcpkg_download_distfile(ARCHIVE
URLS "https://www.intra2net.com/en/developer/libftdi/download/libftdi1-1.4.tar.bz2"
FILENAME "libftdi1-1.4.tar.bz2"
Expand All @@ -26,7 +24,6 @@ vcpkg_configure_cmake(
-DEXAMPLES=OFF
-DPYTHON_BINDINGS=OFF
-DLINK_PYTHON_LIBRARY=OFF

-DCMAKE_DISABLE_FIND_PACKAGE_Doxygen=ON
-DCMAKE_DISABLE_FIND_PACKAGE_Boost=ON
-DCMAKE_DISABLE_FIND_PACKAGE_Confuse=ON
Expand All @@ -41,7 +38,10 @@ vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/libftdi1 TARGET_PATH share/libft

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share)

file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/libftdi1)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/libftdi1/LICENSE ${CURRENT_PACKAGES_DIR}/share/libftdi1/copyright)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()

vcpkg_copy_pdbs()

file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
3 changes: 2 additions & 1 deletion ports/libusb/CONTROL
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Source: libusb
Version: 1.0.23
Version: 1.0.23-1
Homepage: https://github.com/libusb/libusb
Description: a cross-platform library to access USB devices
Supports: !uwp
78 changes: 8 additions & 70 deletions ports/libusb/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
if (VCPKG_CMAKE_SYSTEM_NAME)
message(FATAL_ERROR "Error: the port is unsupported on your platform. Please open an issue on github.com/Microsoft/vcpkg to request a fix")
endif()
vcpkg_fail_port_install(ON_TARGET "uwp")

if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux")
if(VCPKG_TARGET_IS_LINUX)
message("${PORT} currently requires the following tools and libraries from the system package manager:\n autoreconf\n libudev\n\nThese can be installed on Ubuntu systems via apt-get install autoreconf libudev-dev")
endif()

Expand Down Expand Up @@ -46,73 +44,13 @@ if(VCPKG_TARGET_IS_WINDOWS)
PROJECT_SUBPATH msvc/libusb_${LIBUSB_PROJECT_TYPE}_${MSVS_VERSION}.vcxproj
LICENSE_SUBPATH COPYING
)
file(INSTALL ${SOURCE_PATH}/libusb/libusb.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/libusb-1.0)
else()
set(BASH /bin/bash)

if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "Release")
file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel)
file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel)
# Copy sources
message(STATUS "Copying source files...")
file(GLOB PORT_SOURCE_FILES ${SOURCE_PATH}/*)
foreach(SOURCE_FILE ${PORT_SOURCE_FILES})
file(COPY ${SOURCE_FILE} DESTINATION "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel")
endforeach()
message(STATUS "Copying source files... done")
# Configure release
message(STATUS "Configuring ${TARGET_TRIPLET}-rel")
execute_process(
COMMAND "${BASH} --noprofile --norc -c \"./autogen.sh\""
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel")
execute_process(
COMMAND "${BASH} --noprofile --norc -c \"./configure --prefix=${CURRENT_PACKAGES_DIR}\""
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel")
message(STATUS "Configuring ${TARGET_TRIPLET}-rel done")
endif()

if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "Debug")
file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg)
file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg)
# Copy sources
message(STATUS "Copying source files...")
file(GLOB PORT_SOURCE_FILES ${SOURCE_PATH}/*)
foreach(SOURCE_FILE ${PORT_SOURCE_FILES})
file(COPY ${SOURCE_FILE} DESTINATION "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg")
endforeach()
message(STATUS "Copying source files... done")
# Configure debug
message(STATUS "Configuring ${TARGET_TRIPLET}-dbg")
execute_process(
COMMAND "${BASH} --noprofile --norc -c \"./autogen.sh\""
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg")
execute_process(
COMMAND "${BASH} --noprofile --norc -c \"./configure --prefix=${CURRENT_PACKAGES_DIR}/debug\""
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg")
message(STATUS "Configuring ${TARGET_TRIPLET}-dbg done")
endif()

if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
# Build release
message(STATUS "Package ${TARGET_TRIPLET}-rel")
execute_process(
COMMAND "${BASH} --noprofile --norc -c \"make install\""
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel")
message(STATUS "Package ${TARGET_TRIPLET}-rel done")
endif()

if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
# Build debug
message(STATUS "Package ${TARGET_TRIPLET}-dbg")
execute_process(
COMMAND "${BASH} --noprofile --norc -c \"make install\""
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg")
message(STATUS "Package ${TARGET_TRIPLET}-dbg done")
endif()
vcpkg_configure_make(
SOURCE_PATH ${SOURCE_PATH}
AUTOCONFIG
)
vcpkg_install_make()
endif()

file(INSTALL
${SOURCE_PATH}/libusb/libusb.h
DESTINATION ${CURRENT_PACKAGES_DIR}/include/libusb-1.0
)

file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
2 changes: 1 addition & 1 deletion ports/treehopper/CONTROL
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Source: treehopper
Version: 1.11.3-3
Version: 1.11.3-4
Description: Treehopper connects the physical world to your computer, tablet, or smartphone.
Homepage: https://treehopper.io
Build-Depends: libusb
7 changes: 3 additions & 4 deletions ports/treehopper/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
include(vcpkg_common_functions)

vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY ONLY_DYNAMIC_CRT)

vcpkg_from_github(
Expand All @@ -18,8 +16,9 @@ vcpkg_install_cmake()
vcpkg_copy_pdbs()
vcpkg_fixup_cmake_targets()

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)

file(INSTALL ${SOURCE_PATH}/C++/API/inc/ DESTINATION ${CURRENT_PACKAGES_DIR}/include/Treehopper/)

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

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
7 changes: 5 additions & 2 deletions scripts/ci.baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ aws-lambda-cpp:x86-windows=fail
aws-lambda-cpp:x64-osx=fail
azure-c-shared-utility:arm-uwp=fail
azure-c-shared-utility:x64-uwp=fail
azure-kinect-sensor-sdk:x64-linux=fail
azure-kinect-sensor-sdk:x64-osx=fail
bde:arm64-windows=fail
bde:arm-uwp=fail
bde:x64-uwp=fail
Expand Down Expand Up @@ -703,6 +705,8 @@ libfabric:x64-uwp=fail
libfabric:x64-windows=fail
libfabric:x64-windows-static=fail
libfreenect2:arm64-windows=fail
libfreenect2:x64-linux=fail
libfreenect2:x64-osx=fail
libgit2:arm-uwp=fail
libgit2:x64-uwp=fail
libgo:arm-uwp=fail
Expand Down Expand Up @@ -890,8 +894,6 @@ libui:arm-uwp=fail
libui:x64-linux=fail
libui:x64-uwp=fail
libusb:arm-uwp=fail
libusb:x64-linux=fail
libusb:x64-osx=fail
libusb:x64-uwp=fail
libusbmuxd:arm-uwp=fail
libusbmuxd:x64-uwp=fail
Expand Down Expand Up @@ -1768,6 +1770,7 @@ torch-th:x64-uwp=fail
torch-th:x64-windows-static=fail
tre:x64-osx=fail
treehopper:x64-windows-static=fail
treehopper:x64-linux=fail
turbobase64:arm64-windows=fail
turbobase64:arm-uwp=fail
turbobase64:x64-uwp=fail
Expand Down

0 comments on commit a2d3782

Please sign in to comment.