From 9ed2fc546cd9896340706f25c04aab93ddf45e45 Mon Sep 17 00:00:00 2001 From: Barath Kannan Date: Sun, 5 Nov 2017 18:00:01 +1100 Subject: [PATCH] qt5 - serial, svg, charts, and 3d modules --- ports/qt53d/CONTROL | 4 ++ ports/qt53d/fixcmake.py | 57 ++++++++++++++++++++++ ports/qt53d/portfile.cmake | 88 ++++++++++++++++++++++++++++++++++ ports/qt5charts/CONTROL | 4 ++ ports/qt5charts/fixcmake.py | 57 ++++++++++++++++++++++ ports/qt5charts/portfile.cmake | 79 ++++++++++++++++++++++++++++++ ports/qt5serial/CONTROL | 4 ++ ports/qt5serial/fixcmake.py | 57 ++++++++++++++++++++++ ports/qt5serial/portfile.cmake | 79 ++++++++++++++++++++++++++++++ ports/qt5svg/CONTROL | 4 ++ ports/qt5svg/fixcmake.py | 57 ++++++++++++++++++++++ ports/qt5svg/portfile.cmake | 81 +++++++++++++++++++++++++++++++ 12 files changed, 571 insertions(+) create mode 100644 ports/qt53d/CONTROL create mode 100644 ports/qt53d/fixcmake.py create mode 100644 ports/qt53d/portfile.cmake create mode 100644 ports/qt5charts/CONTROL create mode 100644 ports/qt5charts/fixcmake.py create mode 100644 ports/qt5charts/portfile.cmake create mode 100644 ports/qt5serial/CONTROL create mode 100644 ports/qt5serial/fixcmake.py create mode 100644 ports/qt5serial/portfile.cmake create mode 100644 ports/qt5svg/CONTROL create mode 100644 ports/qt5svg/fixcmake.py create mode 100644 ports/qt5svg/portfile.cmake diff --git a/ports/qt53d/CONTROL b/ports/qt53d/CONTROL new file mode 100644 index 00000000000..d8130de6e11 --- /dev/null +++ b/ports/qt53d/CONTROL @@ -0,0 +1,4 @@ +Source: qt53d +Version: 5.9.2-0 +Description: Qt5 3d Module - Functionality for near-realtime simulation systems with support for 2D and 3D rendering +Build-Depends: qt5base \ No newline at end of file diff --git a/ports/qt53d/fixcmake.py b/ports/qt53d/fixcmake.py new file mode 100644 index 00000000000..923e600bc32 --- /dev/null +++ b/ports/qt53d/fixcmake.py @@ -0,0 +1,57 @@ +import os +import re +from glob import glob + +files = [y for x in os.walk('.') for y in glob(os.path.join(x[0], '*.cmake'))] + +for f in files: + openedfile = open(f, "r") + builder = "" + dllpattern = re.compile("_install_prefix}/bin/Qt5.*d.dll") + libpattern = re.compile("_install_prefix}/lib/Qt5.*d.lib") + exepattern = re.compile("_install_prefix}/bin/[a-z]+.exe") + tooldllpattern = re.compile("_install_prefix}/tools/qt5/Qt5.*d.dll") + for line in openedfile: + if "_install_prefix}/tools/qt5/${LIB_LOCATION}" in line: + builder += " if (${Configuration} STREQUAL \"RELEASE\")" + builder += "\n " + line.replace("/tools/qt5/", "/bin/") + builder += " else()" + builder += "\n " + line.replace("/tools/qt5/", "/debug/bin/") + builder += " endif()\n" + elif "_install_prefix}/bin/${LIB_LOCATION}" in line: + builder += " if (${Configuration} STREQUAL \"RELEASE\")" + builder += "\n " + line + builder += " else()" + builder += "\n " + line.replace("/bin/", "/debug/bin/") + builder += " endif()\n" + elif "_install_prefix}/lib/${LIB_LOCATION}" in line: + builder += " if (${Configuration} STREQUAL \"RELEASE\")" + builder += "\n " + line + builder += " else()" + builder += "\n " + line.replace("/lib/", "/debug/lib/") + builder += " endif()\n" + elif "_install_prefix}/lib/${IMPLIB_LOCATION}" in line: + builder += " if (${Configuration} STREQUAL \"RELEASE\")" + builder += "\n " + line + builder += " else()" + builder += "\n " + line.replace("/lib/", "/debug/lib/") + builder += " endif()\n" + elif "_install_prefix}/plugins/${PLUGIN_LOCATION}" in line: + builder += " if (${Configuration} STREQUAL \"RELEASE\")" + builder += "\n " + line + builder += " else()" + builder += "\n " + line.replace("/plugins/", "/debug/plugins/") + builder += " endif()\n" + elif dllpattern.search(line) != None: + builder += line.replace("/bin/", "/debug/bin/") + elif libpattern.search(line) != None: + builder += line.replace("/lib/", "/debug/lib/") + elif tooldllpattern.search(line) != None: + builder += line.replace("/tools/qt5/", "/debug/bin/") + elif exepattern.search(line) != None: + builder += line.replace("/bin/", "/tools/qt5/") + else: + builder += line + new_file = open(f, "w") + new_file.write(builder) + new_file.close() \ No newline at end of file diff --git a/ports/qt53d/portfile.cmake b/ports/qt53d/portfile.cmake new file mode 100644 index 00000000000..cb0ac87ef66 --- /dev/null +++ b/ports/qt53d/portfile.cmake @@ -0,0 +1,88 @@ +include(vcpkg_common_functions) + +string(LENGTH "${CURRENT_BUILDTREES_DIR}" BUILDTREES_PATH_LENGTH) +if(BUILDTREES_PATH_LENGTH GREATER 27) + message(WARNING "Qt5's buildsystem uses very long paths and may fail on your system.\n" + "We recommend moving vcpkg to a short path such as 'C:\\src\\vcpkg' or using the subst command." + ) +endif() + +if(VCPKG_LIBRARY_LINKAGE STREQUAL static) + message(FATAL_ERROR "Qt5 doesn't currently support static builds. Please use a dynamic triplet instead.") +endif() + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) + +set(SRCDIR_NAME "qt3d-5.9.2") +set(ARCHIVE_NAME "qt3d-opensource-src-5.9.2") +set(ARCHIVE_EXTENSION ".tar.xz") + +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/${SRCDIR_NAME}) +vcpkg_download_distfile(ARCHIVE_FILE + URLS "http://download.qt.io/official_releases/qt/5.9/5.9.2/submodules/${ARCHIVE_NAME}${ARCHIVE_EXTENSION}" + FILENAME ${SRCDIR_NAME}${ARCHIVE_EXTENSION} + SHA512 1c7dbd4e557cdd183ec6e929aae5727ce2ffcb519517942b588594bb81a78cb3d732cde4dae58085a70ec2968a8c2443eae96536125c25938222ff7c89f4f9a2 +) +vcpkg_extract_source_archive(${ARCHIVE_FILE}) +if (EXISTS ${CURRENT_BUILDTREES_DIR}/src/${ARCHIVE_NAME}) + file(RENAME ${CURRENT_BUILDTREES_DIR}/src/${ARCHIVE_NAME} ${CURRENT_BUILDTREES_DIR}/src/${SRCDIR_NAME}) +endif() + +# This fixes issues on machines with default codepages that are not ASCII compatible, such as some CJK encodings +set(ENV{_CL_} "/utf-8") + +vcpkg_configure_qmake_debug( + SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/${SRCDIR_NAME} +) + +vcpkg_build_qmake_debug() + +vcpkg_configure_qmake_release( + SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/${SRCDIR_NAME} +) + +vcpkg_build_qmake_release() + +vcpkg_find_acquire_program(PYTHON3) +get_filename_component(PYTHON3_EXE_PATH ${PYTHON3} DIRECTORY) +set(ENV{PATH} "${PYTHON3_EXE_PATH};$ENV{PATH}") +set(_path "$ENV{PATH}") + +set(DEBUG_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg") +set(RELEASE_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel") + +vcpkg_execute_required_process( + COMMAND ${PYTHON3} ${CMAKE_CURRENT_LIST_DIR}/fixcmake.py + WORKING_DIRECTORY ${RELEASE_DIR}/lib/cmake + LOGNAME fix-cmake +) + +set(ENV{PATH} "${_path}") + +file(INSTALL ${DEBUG_DIR}/bin DESTINATION ${CURRENT_PACKAGES_DIR}/debug) +file(INSTALL ${DEBUG_DIR}/lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug) +file(INSTALL ${DEBUG_DIR}/plugins DESTINATION ${CURRENT_PACKAGES_DIR}/debug) +file(INSTALL ${DEBUG_DIR}/include DESTINATION ${CURRENT_PACKAGES_DIR}/share/qt5/debug) +file(INSTALL ${DEBUG_DIR}/mkspecs DESTINATION ${CURRENT_PACKAGES_DIR}/share/qt5/debug) + +file(INSTALL ${RELEASE_DIR}/bin DESTINATION ${CURRENT_PACKAGES_DIR}) +file(INSTALL ${RELEASE_DIR}/lib DESTINATION ${CURRENT_PACKAGES_DIR}) +file(INSTALL ${RELEASE_DIR}/plugins DESTINATION ${CURRENT_PACKAGES_DIR}) +file(INSTALL ${RELEASE_DIR}/include DESTINATION ${CURRENT_PACKAGES_DIR}) +file(INSTALL ${RELEASE_DIR}/mkspecs DESTINATION ${CURRENT_PACKAGES_DIR}/share/qt5) + +file(GLOB BINARY_TOOLS "${CURRENT_PACKAGES_DIR}/bin/*.exe") +file(INSTALL ${BINARY_TOOLS} DESTINATION ${CURRENT_PACKAGES_DIR}/tools/qt5) +file(REMOVE ${BINARY_TOOLS}) +file(GLOB BINARY_TOOLS "${CURRENT_PACKAGES_DIR}/debug/bin/*.exe") +file(INSTALL ${BINARY_TOOLS} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/tools/qt5) +file(REMOVE ${BINARY_TOOLS}) + +file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake ${CURRENT_PACKAGES_DIR}/share/cmake) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/cmake) + +file(GLOB RELEASE_DLLS "${CURRENT_PACKAGES_DIR}/lib/*.dll") +file(GLOB DEBUG_DLLS "${CURRENT_PACKAGES_DIR}/debug/lib/*.dll") +file(REMOVE ${RELEASE_DLLS} ${DEBUG_DLLS}) + +file(INSTALL ${SOURCE_PATH}/LICENSE.LGPLv3 DESTINATION ${CURRENT_PACKAGES_DIR}/share/qt53d RENAME copyright) \ No newline at end of file diff --git a/ports/qt5charts/CONTROL b/ports/qt5charts/CONTROL new file mode 100644 index 00000000000..d1a2eb84438 --- /dev/null +++ b/ports/qt5charts/CONTROL @@ -0,0 +1,4 @@ +Source: qt5charts +Version: 5.9.2-0 +Description: Qt5 Charts Module - UI components for displaying charts, driven by static or dynamic data models +Build-Depends: qt5base \ No newline at end of file diff --git a/ports/qt5charts/fixcmake.py b/ports/qt5charts/fixcmake.py new file mode 100644 index 00000000000..923e600bc32 --- /dev/null +++ b/ports/qt5charts/fixcmake.py @@ -0,0 +1,57 @@ +import os +import re +from glob import glob + +files = [y for x in os.walk('.') for y in glob(os.path.join(x[0], '*.cmake'))] + +for f in files: + openedfile = open(f, "r") + builder = "" + dllpattern = re.compile("_install_prefix}/bin/Qt5.*d.dll") + libpattern = re.compile("_install_prefix}/lib/Qt5.*d.lib") + exepattern = re.compile("_install_prefix}/bin/[a-z]+.exe") + tooldllpattern = re.compile("_install_prefix}/tools/qt5/Qt5.*d.dll") + for line in openedfile: + if "_install_prefix}/tools/qt5/${LIB_LOCATION}" in line: + builder += " if (${Configuration} STREQUAL \"RELEASE\")" + builder += "\n " + line.replace("/tools/qt5/", "/bin/") + builder += " else()" + builder += "\n " + line.replace("/tools/qt5/", "/debug/bin/") + builder += " endif()\n" + elif "_install_prefix}/bin/${LIB_LOCATION}" in line: + builder += " if (${Configuration} STREQUAL \"RELEASE\")" + builder += "\n " + line + builder += " else()" + builder += "\n " + line.replace("/bin/", "/debug/bin/") + builder += " endif()\n" + elif "_install_prefix}/lib/${LIB_LOCATION}" in line: + builder += " if (${Configuration} STREQUAL \"RELEASE\")" + builder += "\n " + line + builder += " else()" + builder += "\n " + line.replace("/lib/", "/debug/lib/") + builder += " endif()\n" + elif "_install_prefix}/lib/${IMPLIB_LOCATION}" in line: + builder += " if (${Configuration} STREQUAL \"RELEASE\")" + builder += "\n " + line + builder += " else()" + builder += "\n " + line.replace("/lib/", "/debug/lib/") + builder += " endif()\n" + elif "_install_prefix}/plugins/${PLUGIN_LOCATION}" in line: + builder += " if (${Configuration} STREQUAL \"RELEASE\")" + builder += "\n " + line + builder += " else()" + builder += "\n " + line.replace("/plugins/", "/debug/plugins/") + builder += " endif()\n" + elif dllpattern.search(line) != None: + builder += line.replace("/bin/", "/debug/bin/") + elif libpattern.search(line) != None: + builder += line.replace("/lib/", "/debug/lib/") + elif tooldllpattern.search(line) != None: + builder += line.replace("/tools/qt5/", "/debug/bin/") + elif exepattern.search(line) != None: + builder += line.replace("/bin/", "/tools/qt5/") + else: + builder += line + new_file = open(f, "w") + new_file.write(builder) + new_file.close() \ No newline at end of file diff --git a/ports/qt5charts/portfile.cmake b/ports/qt5charts/portfile.cmake new file mode 100644 index 00000000000..2ff08e71574 --- /dev/null +++ b/ports/qt5charts/portfile.cmake @@ -0,0 +1,79 @@ +include(vcpkg_common_functions) + +string(LENGTH "${CURRENT_BUILDTREES_DIR}" BUILDTREES_PATH_LENGTH) +if(BUILDTREES_PATH_LENGTH GREATER 27) + message(WARNING "Qt5's buildsystem uses very long paths and may fail on your system.\n" + "We recommend moving vcpkg to a short path such as 'C:\\src\\vcpkg' or using the subst command." + ) +endif() + +if(VCPKG_LIBRARY_LINKAGE STREQUAL static) + message(FATAL_ERROR "Qt5 doesn't currently support static builds. Please use a dynamic triplet instead.") +endif() + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) + +set(SRCDIR_NAME "qtcharts-5.9.2") +set(ARCHIVE_NAME "qtcharts-opensource-src-5.9.2") +set(ARCHIVE_EXTENSION ".tar.xz") + +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/${SRCDIR_NAME}) +vcpkg_download_distfile(ARCHIVE_FILE + URLS "http://download.qt.io/official_releases/qt/5.9/5.9.2/submodules/${ARCHIVE_NAME}${ARCHIVE_EXTENSION}" + FILENAME ${SRCDIR_NAME}${ARCHIVE_EXTENSION} + SHA512 297547b565dd71b05237bb05ecc1abf1a774a4909668417e78bd65e805c1e47a456a5a06898fe06d4c4614118e4129e19893d4c77598667a9354ab969307a293 +) +vcpkg_extract_source_archive(${ARCHIVE_FILE}) +if (EXISTS ${CURRENT_BUILDTREES_DIR}/src/${ARCHIVE_NAME}) + file(RENAME ${CURRENT_BUILDTREES_DIR}/src/${ARCHIVE_NAME} ${CURRENT_BUILDTREES_DIR}/src/${SRCDIR_NAME}) +endif() + +# This fixes issues on machines with default codepages that are not ASCII compatible, such as some CJK encodings +set(ENV{_CL_} "/utf-8") + +vcpkg_configure_qmake_debug( + SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/${SRCDIR_NAME} +) + +vcpkg_build_qmake_debug() + +vcpkg_configure_qmake_release( + SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/${SRCDIR_NAME} +) + +vcpkg_build_qmake_release() + +vcpkg_find_acquire_program(PYTHON3) +get_filename_component(PYTHON3_EXE_PATH ${PYTHON3} DIRECTORY) +set(ENV{PATH} "${PYTHON3_EXE_PATH};$ENV{PATH}") +set(_path "$ENV{PATH}") + +set(DEBUG_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg") +set(RELEASE_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel") + +vcpkg_execute_required_process( + COMMAND ${PYTHON3} ${CMAKE_CURRENT_LIST_DIR}/fixcmake.py + WORKING_DIRECTORY ${RELEASE_DIR}/lib/cmake + LOGNAME fix-cmake +) + +set(ENV{PATH} "${_path}") + +file(INSTALL ${DEBUG_DIR}/bin DESTINATION ${CURRENT_PACKAGES_DIR}/debug) +file(INSTALL ${DEBUG_DIR}/lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug) +file(INSTALL ${DEBUG_DIR}/include DESTINATION ${CURRENT_PACKAGES_DIR}/share/qt5/debug) +file(INSTALL ${DEBUG_DIR}/mkspecs DESTINATION ${CURRENT_PACKAGES_DIR}/share/qt5/debug) + +file(INSTALL ${RELEASE_DIR}/bin DESTINATION ${CURRENT_PACKAGES_DIR}) +file(INSTALL ${RELEASE_DIR}/lib DESTINATION ${CURRENT_PACKAGES_DIR}) +file(INSTALL ${RELEASE_DIR}/include DESTINATION ${CURRENT_PACKAGES_DIR}) +file(INSTALL ${RELEASE_DIR}/mkspecs DESTINATION ${CURRENT_PACKAGES_DIR}/share/qt5) + +file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake ${CURRENT_PACKAGES_DIR}/share/cmake) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/cmake) + +file(GLOB RELEASE_DLLS "${CURRENT_PACKAGES_DIR}/lib/*.dll") +file(GLOB DEBUG_DLLS "${CURRENT_PACKAGES_DIR}/debug/lib/*.dll") +file(REMOVE ${RELEASE_DLLS} ${DEBUG_DLLS}) + +file(INSTALL ${SOURCE_PATH}/LICENSE.GPL3 DESTINATION ${CURRENT_PACKAGES_DIR}/share/qt5charts RENAME copyright) \ No newline at end of file diff --git a/ports/qt5serial/CONTROL b/ports/qt5serial/CONTROL new file mode 100644 index 00000000000..386fc8e6cfc --- /dev/null +++ b/ports/qt5serial/CONTROL @@ -0,0 +1,4 @@ +Source: qt5serial +Version: 5.9.2-0 +Description: Qt5 Serial Port - provides access to hardware and virtual serial ports +Build-Depends: qt5base \ No newline at end of file diff --git a/ports/qt5serial/fixcmake.py b/ports/qt5serial/fixcmake.py new file mode 100644 index 00000000000..923e600bc32 --- /dev/null +++ b/ports/qt5serial/fixcmake.py @@ -0,0 +1,57 @@ +import os +import re +from glob import glob + +files = [y for x in os.walk('.') for y in glob(os.path.join(x[0], '*.cmake'))] + +for f in files: + openedfile = open(f, "r") + builder = "" + dllpattern = re.compile("_install_prefix}/bin/Qt5.*d.dll") + libpattern = re.compile("_install_prefix}/lib/Qt5.*d.lib") + exepattern = re.compile("_install_prefix}/bin/[a-z]+.exe") + tooldllpattern = re.compile("_install_prefix}/tools/qt5/Qt5.*d.dll") + for line in openedfile: + if "_install_prefix}/tools/qt5/${LIB_LOCATION}" in line: + builder += " if (${Configuration} STREQUAL \"RELEASE\")" + builder += "\n " + line.replace("/tools/qt5/", "/bin/") + builder += " else()" + builder += "\n " + line.replace("/tools/qt5/", "/debug/bin/") + builder += " endif()\n" + elif "_install_prefix}/bin/${LIB_LOCATION}" in line: + builder += " if (${Configuration} STREQUAL \"RELEASE\")" + builder += "\n " + line + builder += " else()" + builder += "\n " + line.replace("/bin/", "/debug/bin/") + builder += " endif()\n" + elif "_install_prefix}/lib/${LIB_LOCATION}" in line: + builder += " if (${Configuration} STREQUAL \"RELEASE\")" + builder += "\n " + line + builder += " else()" + builder += "\n " + line.replace("/lib/", "/debug/lib/") + builder += " endif()\n" + elif "_install_prefix}/lib/${IMPLIB_LOCATION}" in line: + builder += " if (${Configuration} STREQUAL \"RELEASE\")" + builder += "\n " + line + builder += " else()" + builder += "\n " + line.replace("/lib/", "/debug/lib/") + builder += " endif()\n" + elif "_install_prefix}/plugins/${PLUGIN_LOCATION}" in line: + builder += " if (${Configuration} STREQUAL \"RELEASE\")" + builder += "\n " + line + builder += " else()" + builder += "\n " + line.replace("/plugins/", "/debug/plugins/") + builder += " endif()\n" + elif dllpattern.search(line) != None: + builder += line.replace("/bin/", "/debug/bin/") + elif libpattern.search(line) != None: + builder += line.replace("/lib/", "/debug/lib/") + elif tooldllpattern.search(line) != None: + builder += line.replace("/tools/qt5/", "/debug/bin/") + elif exepattern.search(line) != None: + builder += line.replace("/bin/", "/tools/qt5/") + else: + builder += line + new_file = open(f, "w") + new_file.write(builder) + new_file.close() \ No newline at end of file diff --git a/ports/qt5serial/portfile.cmake b/ports/qt5serial/portfile.cmake new file mode 100644 index 00000000000..73267533724 --- /dev/null +++ b/ports/qt5serial/portfile.cmake @@ -0,0 +1,79 @@ +include(vcpkg_common_functions) + +string(LENGTH "${CURRENT_BUILDTREES_DIR}" BUILDTREES_PATH_LENGTH) +if(BUILDTREES_PATH_LENGTH GREATER 27) + message(WARNING "Qt5's buildsystem uses very long paths and may fail on your system.\n" + "We recommend moving vcpkg to a short path such as 'C:\\src\\vcpkg' or using the subst command." + ) +endif() + +if(VCPKG_LIBRARY_LINKAGE STREQUAL static) + message(FATAL_ERROR "Qt5 doesn't currently support static builds. Please use a dynamic triplet instead.") +endif() + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) + +set(SRCDIR_NAME "qtserial-5.9.2") +set(ARCHIVE_NAME "qtserialport-opensource-src-5.9.2") +set(ARCHIVE_EXTENSION ".tar.xz") + +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/${SRCDIR_NAME}) +vcpkg_download_distfile(ARCHIVE_FILE + URLS "http://download.qt.io/official_releases/qt/5.9/5.9.2/submodules/${ARCHIVE_NAME}${ARCHIVE_EXTENSION}" + FILENAME ${SRCDIR_NAME}${ARCHIVE_EXTENSION} + SHA512 cc8899c1ae2ed9fd8cf1c213ab7efaec12b3b16836006fdbf74cb7ea457705505a13e82c2f2873ee9426ae66473ec42259f4e728de64576ee44420f116cc433d +) +vcpkg_extract_source_archive(${ARCHIVE_FILE}) +if (EXISTS ${CURRENT_BUILDTREES_DIR}/src/${ARCHIVE_NAME}) + file(RENAME ${CURRENT_BUILDTREES_DIR}/src/${ARCHIVE_NAME} ${CURRENT_BUILDTREES_DIR}/src/${SRCDIR_NAME}) +endif() + +# This fixes issues on machines with default codepages that are not ASCII compatible, such as some CJK encodings +set(ENV{_CL_} "/utf-8") + +vcpkg_configure_qmake_debug( + SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/${SRCDIR_NAME} +) + +vcpkg_build_qmake_debug() + +vcpkg_configure_qmake_release( + SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/${SRCDIR_NAME} +) + +vcpkg_build_qmake_release() + +vcpkg_find_acquire_program(PYTHON3) +get_filename_component(PYTHON3_EXE_PATH ${PYTHON3} DIRECTORY) +set(ENV{PATH} "${PYTHON3_EXE_PATH};$ENV{PATH}") +set(_path "$ENV{PATH}") + +set(DEBUG_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg") +set(RELEASE_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel") + +vcpkg_execute_required_process( + COMMAND ${PYTHON3} ${CMAKE_CURRENT_LIST_DIR}/fixcmake.py + WORKING_DIRECTORY ${RELEASE_DIR}/lib/cmake + LOGNAME fix-cmake +) + +set(ENV{PATH} "${_path}") + +file(INSTALL ${DEBUG_DIR}/bin DESTINATION ${CURRENT_PACKAGES_DIR}/debug) +file(INSTALL ${DEBUG_DIR}/lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug) +file(INSTALL ${DEBUG_DIR}/include DESTINATION ${CURRENT_PACKAGES_DIR}/share/qt5/debug) +file(INSTALL ${DEBUG_DIR}/mkspecs DESTINATION ${CURRENT_PACKAGES_DIR}/share/qt5/debug) + +file(INSTALL ${RELEASE_DIR}/bin DESTINATION ${CURRENT_PACKAGES_DIR}) +file(INSTALL ${RELEASE_DIR}/lib DESTINATION ${CURRENT_PACKAGES_DIR}) +file(INSTALL ${RELEASE_DIR}/include DESTINATION ${CURRENT_PACKAGES_DIR}) +file(INSTALL ${RELEASE_DIR}/mkspecs DESTINATION ${CURRENT_PACKAGES_DIR}/share/qt5) + +file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake ${CURRENT_PACKAGES_DIR}/share/cmake) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/cmake) + +file(GLOB RELEASE_DLLS "${CURRENT_PACKAGES_DIR}/lib/*.dll") +file(GLOB DEBUG_DLLS "${CURRENT_PACKAGES_DIR}/debug/lib/*.dll") +file(REMOVE ${RELEASE_DLLS} ${DEBUG_DLLS}) + +file(INSTALL ${SOURCE_PATH}/LICENSE.LGPLv3 DESTINATION ${CURRENT_PACKAGES_DIR}/share/qt5serial RENAME copyright) \ No newline at end of file diff --git a/ports/qt5svg/CONTROL b/ports/qt5svg/CONTROL new file mode 100644 index 00000000000..f56df4b5196 --- /dev/null +++ b/ports/qt5svg/CONTROL @@ -0,0 +1,4 @@ +Source: qt5svg +Version: 5.9.2-0 +Description: Qt5 SVG Module - provides classes for displaying the contents of SVG files +Build-Depends: qt5base \ No newline at end of file diff --git a/ports/qt5svg/fixcmake.py b/ports/qt5svg/fixcmake.py new file mode 100644 index 00000000000..923e600bc32 --- /dev/null +++ b/ports/qt5svg/fixcmake.py @@ -0,0 +1,57 @@ +import os +import re +from glob import glob + +files = [y for x in os.walk('.') for y in glob(os.path.join(x[0], '*.cmake'))] + +for f in files: + openedfile = open(f, "r") + builder = "" + dllpattern = re.compile("_install_prefix}/bin/Qt5.*d.dll") + libpattern = re.compile("_install_prefix}/lib/Qt5.*d.lib") + exepattern = re.compile("_install_prefix}/bin/[a-z]+.exe") + tooldllpattern = re.compile("_install_prefix}/tools/qt5/Qt5.*d.dll") + for line in openedfile: + if "_install_prefix}/tools/qt5/${LIB_LOCATION}" in line: + builder += " if (${Configuration} STREQUAL \"RELEASE\")" + builder += "\n " + line.replace("/tools/qt5/", "/bin/") + builder += " else()" + builder += "\n " + line.replace("/tools/qt5/", "/debug/bin/") + builder += " endif()\n" + elif "_install_prefix}/bin/${LIB_LOCATION}" in line: + builder += " if (${Configuration} STREQUAL \"RELEASE\")" + builder += "\n " + line + builder += " else()" + builder += "\n " + line.replace("/bin/", "/debug/bin/") + builder += " endif()\n" + elif "_install_prefix}/lib/${LIB_LOCATION}" in line: + builder += " if (${Configuration} STREQUAL \"RELEASE\")" + builder += "\n " + line + builder += " else()" + builder += "\n " + line.replace("/lib/", "/debug/lib/") + builder += " endif()\n" + elif "_install_prefix}/lib/${IMPLIB_LOCATION}" in line: + builder += " if (${Configuration} STREQUAL \"RELEASE\")" + builder += "\n " + line + builder += " else()" + builder += "\n " + line.replace("/lib/", "/debug/lib/") + builder += " endif()\n" + elif "_install_prefix}/plugins/${PLUGIN_LOCATION}" in line: + builder += " if (${Configuration} STREQUAL \"RELEASE\")" + builder += "\n " + line + builder += " else()" + builder += "\n " + line.replace("/plugins/", "/debug/plugins/") + builder += " endif()\n" + elif dllpattern.search(line) != None: + builder += line.replace("/bin/", "/debug/bin/") + elif libpattern.search(line) != None: + builder += line.replace("/lib/", "/debug/lib/") + elif tooldllpattern.search(line) != None: + builder += line.replace("/tools/qt5/", "/debug/bin/") + elif exepattern.search(line) != None: + builder += line.replace("/bin/", "/tools/qt5/") + else: + builder += line + new_file = open(f, "w") + new_file.write(builder) + new_file.close() \ No newline at end of file diff --git a/ports/qt5svg/portfile.cmake b/ports/qt5svg/portfile.cmake new file mode 100644 index 00000000000..e06c6ef85c0 --- /dev/null +++ b/ports/qt5svg/portfile.cmake @@ -0,0 +1,81 @@ +include(vcpkg_common_functions) + +string(LENGTH "${CURRENT_BUILDTREES_DIR}" BUILDTREES_PATH_LENGTH) +if(BUILDTREES_PATH_LENGTH GREATER 27) + message(WARNING "Qt5's buildsystem uses very long paths and may fail on your system.\n" + "We recommend moving vcpkg to a short path such as 'C:\\src\\vcpkg' or using the subst command." + ) +endif() + +if(VCPKG_LIBRARY_LINKAGE STREQUAL static) + message(FATAL_ERROR "Qt5 doesn't currently support static builds. Please use a dynamic triplet instead.") +endif() + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) + +set(SRCDIR_NAME "qtsvg-5.9.2") +set(ARCHIVE_NAME "qtsvg-opensource-src-5.9.2") +set(ARCHIVE_EXTENSION ".tar.xz") + +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/${SRCDIR_NAME}) +vcpkg_download_distfile(ARCHIVE_FILE + URLS "http://download.qt.io/official_releases/qt/5.9/5.9.2/submodules/${ARCHIVE_NAME}${ARCHIVE_EXTENSION}" + FILENAME ${SRCDIR_NAME}${ARCHIVE_EXTENSION} + SHA512 c21c5a12fa10ff9f91deda88c99c995ee2138bdffa21c793b0c42f25155f01f87ede5206624b9d82713649f8cf1cfdb95f1d5b7e792de62f3848d3a9ec665fdd +) +vcpkg_extract_source_archive(${ARCHIVE_FILE}) +if (EXISTS ${CURRENT_BUILDTREES_DIR}/src/${ARCHIVE_NAME}) + file(RENAME ${CURRENT_BUILDTREES_DIR}/src/${ARCHIVE_NAME} ${CURRENT_BUILDTREES_DIR}/src/${SRCDIR_NAME}) +endif() + +# This fixes issues on machines with default codepages that are not ASCII compatible, such as some CJK encodings +set(ENV{_CL_} "/utf-8") + +vcpkg_configure_qmake_debug( + SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/${SRCDIR_NAME} +) + +vcpkg_build_qmake_debug() + +vcpkg_configure_qmake_release( + SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/${SRCDIR_NAME} +) + +vcpkg_build_qmake_release() + +vcpkg_find_acquire_program(PYTHON3) +get_filename_component(PYTHON3_EXE_PATH ${PYTHON3} DIRECTORY) +set(ENV{PATH} "${PYTHON3_EXE_PATH};$ENV{PATH}") +set(_path "$ENV{PATH}") + +set(DEBUG_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg") +set(RELEASE_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel") + +vcpkg_execute_required_process( + COMMAND ${PYTHON3} ${CMAKE_CURRENT_LIST_DIR}/fixcmake.py + WORKING_DIRECTORY ${RELEASE_DIR}/lib/cmake + LOGNAME fix-cmake +) + +set(ENV{PATH} "${_path}") + +file(INSTALL ${DEBUG_DIR}/bin DESTINATION ${CURRENT_PACKAGES_DIR}/debug) +file(INSTALL ${DEBUG_DIR}/lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug) +file(INSTALL ${DEBUG_DIR}/plugins DESTINATION ${CURRENT_PACKAGES_DIR}/debug) +file(INSTALL ${DEBUG_DIR}/include DESTINATION ${CURRENT_PACKAGES_DIR}/share/qt5/debug) +file(INSTALL ${DEBUG_DIR}/mkspecs DESTINATION ${CURRENT_PACKAGES_DIR}/share/qt5/debug) + +file(INSTALL ${RELEASE_DIR}/bin DESTINATION ${CURRENT_PACKAGES_DIR}) +file(INSTALL ${RELEASE_DIR}/lib DESTINATION ${CURRENT_PACKAGES_DIR}) +file(INSTALL ${RELEASE_DIR}/plugins DESTINATION ${CURRENT_PACKAGES_DIR}) +file(INSTALL ${RELEASE_DIR}/include DESTINATION ${CURRENT_PACKAGES_DIR}) +file(INSTALL ${RELEASE_DIR}/mkspecs DESTINATION ${CURRENT_PACKAGES_DIR}/share/qt5) + +file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake ${CURRENT_PACKAGES_DIR}/share/cmake) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/cmake) + +file(GLOB RELEASE_DLLS "${CURRENT_PACKAGES_DIR}/lib/*.dll") +file(GLOB DEBUG_DLLS "${CURRENT_PACKAGES_DIR}/debug/lib/*.dll") +file(REMOVE ${RELEASE_DLLS} ${DEBUG_DLLS}) + +file(INSTALL ${SOURCE_PATH}/LICENSE.LGPLv3 DESTINATION ${CURRENT_PACKAGES_DIR}/share/qt5svg RENAME copyright) \ No newline at end of file