From 4d1fd42fca46f4c4dfe35011c8c96ff941db3ca6 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Wed, 14 Nov 2018 15:11:41 -0800 Subject: [PATCH] [vcpkg-toolchains] Use XYZ_INIT CMake variables for _significantly_ better integration [brynet] Add missing openssl dependency [discord-rpc] Ensure no external downloading [podofo] Improve stability. Modernize. [usrsctp] Disable Werror [vcpkg-toolchains] Add linux changes to android and freebsd. [usrsctp] Remove excess DLLs --- ports/brynet/CONTROL | 3 +- ports/brynet/portfile.cmake | 5 +--- ports/discord-rpc/CONTROL | 2 +- ports/discord-rpc/disable-downloading.patch | 21 +++++++++++++ ports/discord-rpc/portfile.cmake | 5 ++++ ports/podofo/CONTROL | 2 +- ports/podofo/portfile.cmake | 18 +++++++---- ports/usrsctp/CONTROL | 2 +- ports/usrsctp/portfile.cmake | 33 ++++++++------------- scripts/toolchains/android.cmake | 16 ++++++++++ scripts/toolchains/freebsd.cmake | 20 +++++++------ scripts/toolchains/linux.cmake | 20 +++++++------ scripts/toolchains/osx.cmake | 20 +++++++------ 13 files changed, 107 insertions(+), 60 deletions(-) create mode 100644 ports/discord-rpc/disable-downloading.patch diff --git a/ports/brynet/CONTROL b/ports/brynet/CONTROL index a08457902d..3309ab1cf9 100644 --- a/ports/brynet/CONTROL +++ b/ports/brynet/CONTROL @@ -1,3 +1,4 @@ Source: brynet -Version: 1.0.0 +Version: 1.0.0-1 Description: A C++ cross platform high performance tcp network library, and support SSL/HTTP/Websocket. +Build-Depends: openssl diff --git a/ports/brynet/portfile.cmake b/ports/brynet/portfile.cmake index 0224eae76b..9c9097bfc6 100644 --- a/ports/brynet/portfile.cmake +++ b/ports/brynet/portfile.cmake @@ -1,9 +1,6 @@ include(vcpkg_common_functions) -if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) - message(STATUS "brynet does not support dynamic linkage. Building statically.") - set(VCPKG_LIBRARY_LINKAGE static) -endif() +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH diff --git a/ports/discord-rpc/CONTROL b/ports/discord-rpc/CONTROL index ea7bc5d235..b6af1dc984 100644 --- a/ports/discord-rpc/CONTROL +++ b/ports/discord-rpc/CONTROL @@ -1,4 +1,4 @@ Source: discord-rpc -Version: 3.3.0-1 +Version: 3.3.0-2 Description: Rich Presence allows you to leverage the totally overhauled "Now Playing" section in a Discord user's profile to help people play your game together. Build-Depends: rapidjson diff --git a/ports/discord-rpc/disable-downloading.patch b/ports/discord-rpc/disable-downloading.patch new file mode 100644 index 0000000000..bb85049608 --- /dev/null +++ b/ports/discord-rpc/disable-downloading.patch @@ -0,0 +1,21 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5dad9e9..961f02d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -12,6 +12,7 @@ file(GLOB_RECURSE ALL_SOURCE_FILES + src/*.cpp src/*.h src/*.c + ) + ++if(0) + # Set CLANG_FORMAT_SUFFIX if you are using custom clang-format, e.g. clang-format-5.0 + find_program(CLANG_FORMAT_CMD clang-format${CLANG_FORMAT_SUFFIX}) + +@@ -43,7 +44,7 @@ if (NOT RAPIDJSONTEST) + ) + file(REMOVE ${RJ_TAR_FILE}) + endif(NOT RAPIDJSONTEST) +- ++endif() + find_file(RAPIDJSON NAMES rapidjson rapidjson-1.1.0 PATHS ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty CMAKE_FIND_ROOT_PATH_BOTH) + + add_library(rapidjson STATIC IMPORTED ${RAPIDJSON}) diff --git a/ports/discord-rpc/portfile.cmake b/ports/discord-rpc/portfile.cmake index 1fc21e8e6c..1dd6d30010 100644 --- a/ports/discord-rpc/portfile.cmake +++ b/ports/discord-rpc/portfile.cmake @@ -6,6 +6,7 @@ vcpkg_from_github( REF v3.3.0 SHA512 8bb2674edefabf75670ceca29364d69e2002152bff9fe55757f4cda03544b4d827ff33595d98e6d8acdc73ca61cef8ab8054ad0a1ffc905cb26496068b15025f HEAD_REF master + PATCHES disable-downloading.patch ) string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" STATIC_CRT) @@ -21,6 +22,10 @@ vcpkg_configure_cmake( -DRAPIDJSON=${CURRENT_INSTALLED_DIR} ) +if(EXISTS ${SOURCE_PATH}/thirdparty) + message(FATAL_ERROR "The source directory should not be modified during the build.") +endif() + vcpkg_install_cmake() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) diff --git a/ports/podofo/CONTROL b/ports/podofo/CONTROL index ba5fa11094..e5485c4935 100644 --- a/ports/podofo/CONTROL +++ b/ports/podofo/CONTROL @@ -1,5 +1,5 @@ Source: podofo -Version: 0.9.6 +Version: 0.9.6-1 Description: PoDoFo is a library to work with the PDF file format Build-Depends: zlib, libpng, libjpeg-turbo, tiff, openssl (!windows&!uwp), freetype diff --git a/ports/podofo/portfile.cmake b/ports/podofo/portfile.cmake index e33cda7f49..0897576d08 100644 --- a/ports/podofo/portfile.cmake +++ b/ports/podofo/portfile.cmake @@ -1,11 +1,16 @@ include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/podofo-0.9.6) + +set(PODOFO_VERSION 0.9.6) vcpkg_download_distfile(ARCHIVE - URLS "https://sourceforge.net/projects/podofo/files/podofo/0.9.6/podofo-0.9.6.tar.gz/download" - FILENAME "podofo-0.9.6.tar.gz" + URLS "https://sourceforge.net/projects/podofo/files/podofo/${PODOFO_VERSION}/podofo-${PODOFO_VERSION}.tar.gz/download" + FILENAME "podofo-${PODOFO_VERSION}.tar.gz" SHA512 35c1a457758768bdadc93632385f6b9214824fead279f1b85420443fb2135837cefca9ced476df0d47066f060e9150e12fcd40f60fa1606b177da433feb20130 ) -vcpkg_extract_source_archive(${ARCHIVE}) +vcpkg_extract_source_archive_ex( + OUT_SOURCE_PATH SOURCE_PATH + ARCHIVE ${ARCHIVE} + REF ${PODOFO_VERSION} +) set(PODOFO_NO_FONTMANAGER ON) if("fontconfig" IN_LIST FEATURES) @@ -22,6 +27,7 @@ endif() vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS -DPODOFO_BUILD_LIB_ONLY=1 -DPODOFO_BUILD_SHARED=${PODOFO_BUILD_SHARED} @@ -30,11 +36,13 @@ vcpkg_configure_cmake( -DCMAKE_DISABLE_FIND_PACKAGE_FONTCONFIG=${PODOFO_NO_FONTMANAGER} -DCMAKE_DISABLE_FIND_PACKAGE_LIBCRYPTO=${IS_WIN32} -DCMAKE_DISABLE_FIND_PACKAGE_LIBIDN=ON + -DCMAKE_DISABLE_FIND_PACKAGE_CppUnit=ON + -DCMAKE_DISABLE_FIND_PACKAGE_Boost=ON ) vcpkg_install_cmake() +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) # Handle copyright -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/podofo) file(RENAME ${CURRENT_PACKAGES_DIR}/share/podofo/COPYING ${CURRENT_PACKAGES_DIR}/share/podofo/copyright) diff --git a/ports/usrsctp/CONTROL b/ports/usrsctp/CONTROL index 5e5f172bac..4269947326 100644 --- a/ports/usrsctp/CONTROL +++ b/ports/usrsctp/CONTROL @@ -1,3 +1,3 @@ Source: usrsctp -Version: 35c1d97020a +Version: 35c1d97020a-2 Description: This is a userland SCTP stack supporting FreeBSD, Linux, Mac OS X and Windows. diff --git a/ports/usrsctp/portfile.cmake b/ports/usrsctp/portfile.cmake index 863b3f75cc..416cdc6c33 100644 --- a/ports/usrsctp/portfile.cmake +++ b/ports/usrsctp/portfile.cmake @@ -1,7 +1,7 @@ include(vcpkg_common_functions) -vcpkg_check_linkage( - ONLY_STATIC_LIBRARY -) + +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) + vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO sctplab/usrsctp @@ -10,27 +10,20 @@ vcpkg_from_github( HEAD_REF master ) - vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA + OPTIONS -Dsctp_werror=OFF -Dsctp_build_programs=OFF ) - vcpkg_install_cmake() + +file(REMOVE_RECURSE + ${CURRENT_PACKAGES_DIR}/debug/include + ${CURRENT_PACKAGES_DIR}/debug/lib/usrsctp.dll + ${CURRENT_PACKAGES_DIR}/lib/usrsctp.dll +) + +configure_file(${SOURCE_PATH}/LICENSE.md ${CURRENT_PACKAGES_DIR}/share/usrsctp/copyright COPYONLY) + vcpkg_copy_pdbs() - -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) - -file(GLOB_RECURSE release_dlls ${CURRENT_PACKAGES_DIR}/lib/*.dll) -file(GLOB_RECURSE debug_dlls ${CURRENT_PACKAGES_DIR}/debug/lib/*.dll) - -if(release_dlls) - file(REMOVE ${release_dlls}) -endif() -if(debug_dlls) - file(REMOVE ${debug_dlls}) -endif() - - -file(INSTALL ${SOURCE_PATH}/LICENSE.md DESTINATION ${CURRENT_PACKAGES_DIR}/share/usrsctp RENAME copyright) diff --git a/scripts/toolchains/android.cmake b/scripts/toolchains/android.cmake index 355ccc3ac1..893463056f 100644 --- a/scripts/toolchains/android.cmake +++ b/scripts/toolchains/android.cmake @@ -17,3 +17,19 @@ if(NOT EXISTS "${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake") endif() include("${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake") + +if(NOT _VCPKG_ANDROID_TOOLCHAIN) +set(_VCPKG_ANDROID_TOOLCHAIN 1) +get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE ) +if(NOT _CMAKE_IN_TRY_COMPILE) + string(APPEND CMAKE_C_FLAGS_INIT " -fPIC ${VCPKG_C_FLAGS} ") + string(APPEND CMAKE_CXX_FLAGS_INIT " -fPIC ${VCPKG_CXX_FLAGS} ") + string(APPEND CMAKE_C_FLAGS_DEBUG_INIT " ${VCPKG_C_FLAGS_DEBUG} ") + string(APPEND CMAKE_CXX_FLAGS_DEBUG_INIT " ${VCPKG_CXX_FLAGS_DEBUG} ") + string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " ${VCPKG_C_FLAGS_RELEASE} ") + string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " ${VCPKG_CXX_FLAGS_RELEASE} ") + + string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " ${VCPKG_LINKER_FLAGS} ") + string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " ${VCPKG_LINKER_FLAGS} ") +endif() +endif() diff --git a/scripts/toolchains/freebsd.cmake b/scripts/toolchains/freebsd.cmake index ecd4a4478a..b6bf5a4791 100644 --- a/scripts/toolchains/freebsd.cmake +++ b/scripts/toolchains/freebsd.cmake @@ -1,3 +1,5 @@ +if(NOT _VCPKG_FREEBSD_TOOLCHAIN) +set(_VCPKG_FREEBSD_TOOLCHAIN 1) if(CMAKE_HOST_SYSTEM_NAME STREQUAL "FreeBSD") set(CMAKE_CROSSCOMPILING OFF CACHE BOOL "") endif() @@ -5,14 +7,14 @@ set(CMAKE_SYSTEM_NAME FreeBSD CACHE STRING "") get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE ) if(NOT _CMAKE_IN_TRY_COMPILE) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${VCPKG_CXX_FLAGS} -fPIC" CACHE STRING "") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VCPKG_C_FLAGS} -fPIC" CACHE STRING "") + string(APPEND CMAKE_C_FLAGS_INIT " -fPIC ${VCPKG_C_FLAGS} ") + string(APPEND CMAKE_CXX_FLAGS_INIT " -fPIC ${VCPKG_CXX_FLAGS} ") + string(APPEND CMAKE_C_FLAGS_DEBUG_INIT " ${VCPKG_C_FLAGS_DEBUG} ") + string(APPEND CMAKE_CXX_FLAGS_DEBUG_INIT " ${VCPKG_CXX_FLAGS_DEBUG} ") + string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " ${VCPKG_C_FLAGS_RELEASE} ") + string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " ${VCPKG_CXX_FLAGS_RELEASE} ") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${VCPKG_CXX_FLAGS_DEBUG}" CACHE STRING "") - set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${VCPKG_C_FLAGS_DEBUG}" CACHE STRING "") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${VCPKG_CXX_FLAGS_RELEASE}" CACHE STRING "") - set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${VCPKG_C_FLAGS_RELEASE}" CACHE STRING "") - - set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} ${VCPKG_LINKER_FLAGS}" CACHE STRING "") - set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${VCPKG_LINKER_FLAGS}" CACHE STRING "") + string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " ${VCPKG_LINKER_FLAGS} ") + string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " ${VCPKG_LINKER_FLAGS} ") +endif() endif() diff --git a/scripts/toolchains/linux.cmake b/scripts/toolchains/linux.cmake index ade9db90bb..6bfb57621e 100644 --- a/scripts/toolchains/linux.cmake +++ b/scripts/toolchains/linux.cmake @@ -1,3 +1,5 @@ +if(NOT _VCPKG_LINUX_TOOLCHAIN) +set(_VCPKG_LINUX_TOOLCHAIN 1) if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux") set(CMAKE_CROSSCOMPILING OFF CACHE BOOL "") endif() @@ -5,14 +7,14 @@ set(CMAKE_SYSTEM_NAME Linux CACHE STRING "") get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE ) if(NOT _CMAKE_IN_TRY_COMPILE) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${VCPKG_CXX_FLAGS} -fPIC" CACHE STRING "") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VCPKG_C_FLAGS} -fPIC" CACHE STRING "") + string(APPEND CMAKE_C_FLAGS_INIT " -fPIC ${VCPKG_C_FLAGS} ") + string(APPEND CMAKE_CXX_FLAGS_INIT " -fPIC ${VCPKG_CXX_FLAGS} ") + string(APPEND CMAKE_C_FLAGS_DEBUG_INIT " ${VCPKG_C_FLAGS_DEBUG} ") + string(APPEND CMAKE_CXX_FLAGS_DEBUG_INIT " ${VCPKG_CXX_FLAGS_DEBUG} ") + string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " ${VCPKG_C_FLAGS_RELEASE} ") + string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " ${VCPKG_CXX_FLAGS_RELEASE} ") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${VCPKG_CXX_FLAGS_DEBUG}" CACHE STRING "") - set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${VCPKG_C_FLAGS_DEBUG}" CACHE STRING "") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${VCPKG_CXX_FLAGS_RELEASE}" CACHE STRING "") - set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${VCPKG_C_FLAGS_RELEASE}" CACHE STRING "") - - set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} ${VCPKG_LINKER_FLAGS}" CACHE STRING "") - set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${VCPKG_LINKER_FLAGS}" CACHE STRING "") + string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " ${VCPKG_LINKER_FLAGS} ") + string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " ${VCPKG_LINKER_FLAGS} ") +endif() endif() diff --git a/scripts/toolchains/osx.cmake b/scripts/toolchains/osx.cmake index 9465ae0de4..7f6487c409 100644 --- a/scripts/toolchains/osx.cmake +++ b/scripts/toolchains/osx.cmake @@ -1,3 +1,5 @@ +if(NOT _VCPKG_OSX_TOOLCHAIN) +set(_VCPKG_OSX_TOOLCHAIN 1) if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") set(CMAKE_CROSSCOMPILING OFF CACHE BOOL "") @@ -13,14 +15,14 @@ set(CMAKE_MACOSX_RPATH ON CACHE BOOL "") get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE ) if(NOT _CMAKE_IN_TRY_COMPILE) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${VCPKG_CXX_FLAGS} -fPIC" CACHE STRING "") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VCPKG_C_FLAGS} -fPIC" CACHE STRING "") + string(APPEND CMAKE_C_FLAGS_INIT " -fPIC ${VCPKG_C_FLAGS} ") + string(APPEND CMAKE_CXX_FLAGS_INIT " -fPIC ${VCPKG_CXX_FLAGS} ") + string(APPEND CMAKE_C_FLAGS_DEBUG_INIT " ${VCPKG_C_FLAGS_DEBUG} ") + string(APPEND CMAKE_CXX_FLAGS_DEBUG_INIT " ${VCPKG_CXX_FLAGS_DEBUG} ") + string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " ${VCPKG_C_FLAGS_RELEASE} ") + string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " ${VCPKG_CXX_FLAGS_RELEASE} ") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${VCPKG_CXX_FLAGS_DEBUG}" CACHE STRING "") - set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${VCPKG_C_FLAGS_DEBUG}" CACHE STRING "") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${VCPKG_CXX_FLAGS_RELEASE}" CACHE STRING "") - set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${VCPKG_C_FLAGS_RELEASE}" CACHE STRING "") - - set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} ${VCPKG_LINKER_FLAGS}" CACHE STRING "") - set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${VCPKG_LINKER_FLAGS}" CACHE STRING "") + string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " ${VCPKG_LINKER_FLAGS} ") + string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " ${VCPKG_LINKER_FLAGS} ") +endif() endif()