[tinkerforge] add new port (#7523)

* triplet whitespace changes to change abi tags in ci and trigger full CI rebuild

* [tinkerforge] add new port

* Revert "triplet whitespace changes to change abi tags in ci and trigger full CI rebuild"

This reverts commit 5f356794b9.

* added uwp early failure
This commit is contained in:
Alexander Neumann 2019-08-16 21:02:14 +02:00 committed by Victor Romero
parent 1ccf986f76
commit c176532bd6
4 changed files with 107 additions and 0 deletions

View File

@ -0,0 +1,63 @@
cmake_minimum_required (VERSION 3.13 FATAL_ERROR)
include(GNUInstallDirs)
if(WIN32)
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}")
endif()
if(NOT TARGET_INSTALL_DIR)
set(TARGET_INSTALL_DIR "share/${PROJECT_NAME}")
endif()
if(NOT CONFIG_INSTALL_DIR)
set(CONFIG_INSTALL_DIR "share/${PROJECT_NAME}")
endif()
if(NOT INCLUDE_INSTALL_DIR)
set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}")
endif()
project(tinkerforge LANGUAGES C VERSION 2.1.25)
file(GLOB CPP_FILES source/*.c)
file(GLOB H_FILES source/*.h)
file(GLOB DEF_FILE source/*.def)
add_library(${PROJECT_NAME} ${CPP_FILES} ${H_FILES} ${DEF_FILE})
target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/source>
$<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}/${PROJECT_NAME}>)
target_link_libraries(${PROJECT_NAME} PUBLIC Ws2_32)
##---------------------------------------------------------------------------------------##
##----- Package definition.
##---------------------------------------------------------------------------------------##
include(CMakePackageConfigHelpers)
#Export as Package
set_target_properties (${PROJECT_NAME} PROPERTIES EXPORT_NAME ${PROJECT_NAME})
export(TARGETS ${PROJECT_NAME} NAMESPACE ${PROJECT_NAME}:: FILE cmake/${PROJECT_NAME}Targets.cmake)
export(PACKAGE ${PROJECT_NAME})
#Config files for find_package
configure_package_config_file(
${PROJECT_NAME}Config.cmake.in cmake/${PROJECT_NAME}Config.cmake
INSTALL_DESTINATION "${CONFIG_INSTALL_DIR}/${PROJECT_NAME}Config.cmake"
PATH_VARS TARGET_INSTALL_DIR INCLUDE_INSTALL_DIR
)
write_basic_package_version_file(cmake/${PROJECT_NAME}ConfigVersion.cmake COMPATIBILITY SameMinorVersion)
#Install the target and all it build outputs.
install (TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}Targets
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT Runtime
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT Development
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT Runtime
PUBLIC_HEADER DESTINATION "${INCLUDE_INSTALL_DIR}" COMPONENT Development
BUNDLE DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT Runtime)
#Install public headers
install(FILES ${H_FILES} DESTINATION "${INCLUDE_INSTALL_DIR}/${PROJECT_NAME}")
#Install the config files for find_package
install(FILES "${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}ConfigVersion.cmake"
"${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}Config.cmake"
DESTINATION "${CONFIG_INSTALL_DIR}")
#install the targets file included by the config
install(EXPORT ${PROJECT_NAME}Targets NAMESPACE ${PROJECT_NAME}:: DESTINATION "${TARGET_INSTALL_DIR}")

View File

@ -0,0 +1,3 @@
Source: tinkerforge
Version: 2.1.25
Description: Tinkerforge C API bindings for bricks and bricklets

View File

@ -0,0 +1,36 @@
vcpkg_fail_port_install(ON_TARGET "uwp")
set(VERSION 2_1_25)
vcpkg_download_distfile(ARCHIVE
URLS "http://download.tinkerforge.com/bindings/c/tinkerforge_c_bindings_${VERSION}.zip"
FILENAME "tinkerforge-${VERSION}.zip"
SHA512 c02b789bd466803d60aeb39a544b0aa17af811377b065a0b273bcfc15c5844f8cfe981d8143743e32bd05470c2c6af297df50924da0d2895a4cdf4bc9e9bd0b8
)
vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE}
REF tinker-${VERSION}
NO_REMOVE_ONE_LEVEL
)
file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION ${SOURCE_PATH})
file(COPY "${CMAKE_CURRENT_LIST_DIR}/tinkerforgeConfig.cmake.in" DESTINATION ${SOURCE_PATH})
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
)
vcpkg_install_cmake()
vcpkg_fixup_cmake_targets(CONFIG_PATH share)
file(REMOVE_RECURSE
${CURRENT_PACKAGES_DIR}/debug/include
${CURRENT_PACKAGES_DIR}/debug/share
)
file(INSTALL ${SOURCE_PATH}/license.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
vcpkg_copy_pdbs()

View File

@ -0,0 +1,5 @@
@PACKAGE_INIT@
include ("@PACKAGE_TARGET_INSTALL_DIR@@PROJECT_NAME@Targets.cmake")
set_and_check(REFL_ENUM_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@")
check_required_components("@PROJECT_NAME@")