From b25c13c1551456dc89ca959c7133b1cc6117532e Mon Sep 17 00:00:00 2001 From: Charles Barto Date: Tue, 1 Nov 2016 19:19:05 -0400 Subject: [PATCH] made some qt5 fixes --- ports/qt5/fixcmake.py | 10 +++++++++- ports/qt5/portfile.cmake | 20 ++++++++++++++++--- scripts/buildsystems/vcpkg.cmake | 2 ++ .../cmake/vcpkg_find_acquire_program.cmake | 6 ++++++ tests/qt5/CMakeLists.txt | 10 ++++++++++ tests/qt5/main.cpp | 9 +++++++++ 6 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 tests/qt5/CMakeLists.txt create mode 100644 tests/qt5/main.cpp diff --git a/ports/qt5/fixcmake.py b/ports/qt5/fixcmake.py index dbee0ed16..bd37c1e54 100644 --- a/ports/qt5/fixcmake.py +++ b/ports/qt5/fixcmake.py @@ -27,10 +27,18 @@ for f in files: builder += " else()" builder += "\n " + line.replace("/lib/", "/debug/lib/") builder += " endif()\n" + elif "_install_prefix}/lib/qtmaind.lib" in line: + builder += line.replace("/lib/", "/debug/lib/") + 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 exepattern.search(line) != None: builder += line.replace("/bin/", "/tools/") else: builder += line new_file = open(f, "w") new_file.write(builder) - new_file.close() + new_file.close() \ No newline at end of file diff --git a/ports/qt5/portfile.cmake b/ports/qt5/portfile.cmake index 81b30767c..d1181911b 100644 --- a/ports/qt5/portfile.cmake +++ b/ports/qt5/portfile.cmake @@ -7,9 +7,12 @@ set(ENV{PATH} "${OUTPUT_PATH}/qtbase/bin;$ENV{PATH}") find_program(NMAKE nmake) vcpkg_find_acquire_program(JOM) -find_program(PYTHON python) +vcpkg_find_acquire_program(PERL) +vcpkg_find_acquire_program(PYTHON3) +get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY) +get_filename_component(PYTHON3_EXE_PATH ${PYTHON3} DIRECTORY) get_filename_component(JOM_EXE_PATH ${JOM} DIRECTORY) -set(ENV{PATH} "${JOM_EXE_PATH};$ENV{PATH}") +set(ENV{PATH} "${JOM_EXE_PATH};${PYTHON3_EXE_PATH};${PERL_EXE_PATH};$ENV{PATH}") vcpkg_download_distfile(ARCHIVE_FILE URLS "http://download.qt.io/official_releases/qt/5.7/5.7.0/single/qt-everywhere-opensource-src-5.7.0.7z" @@ -112,6 +115,17 @@ file(REMOVE ${DEBUG_LIB_FILES}) file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/Qt5Gamepad.lib ${CURRENT_PACKAGES_DIR}/lib/Qt5Gamepad.lib) file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/Qt5Gamepad.prl ${CURRENT_PACKAGES_DIR}/lib/Qt5Gamepad.prl) file(GLOB BINARY_TOOLS "${CURRENT_PACKAGES_DIR}/bin/*.exe") +file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/plugins") +file(GLOB_RECURSE DEBUG_PLUGINS + "${CURRENT_PACKAGES_DIR}/plugins/*d.dll" + "${CURRENT_PACKAGES_DIR}/plugins/*d.pdb") +foreach(file ${DEBUG_PLUGINS}) + get_filename_component(file_n ${file} NAME) + file(RELATIVE_PATH file_rel "${CURRENT_PACKAGES_DIR}/plugins" ${file}) + get_filename_component(rel_dir ${file_rel} DIRECTORY) + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/plugins/${rel_dir}") + file(RENAME ${file} "${CURRENT_PACKAGES_DIR}/debug/plugins/${rel_dir}/${file_n}") +endforeach() foreach(BINARY ${BINARY_TOOLS}) execute_process(COMMAND dumpbin /PDBPATH ${BINARY} COMMAND findstr PDB @@ -135,7 +149,7 @@ if(DEFINED VCPKG_CRT_LINKAGE AND VCPKG_CRT_LINKAGE STREQUAL dynamic) endif() vcpkg_execute_required_process( - COMMAND ${PYTHON} ${CMAKE_CURRENT_LIST_DIR}/fixcmake.py + COMMAND ${PYTHON3} ${CMAKE_CURRENT_LIST_DIR}/fixcmake.py WORKING_DIRECTORY ${CURRENT_PACKAGES_DIR}/share/cmake LOGNAME fix-cmake ) diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake index 88acc8436..4f6805457 100644 --- a/scripts/buildsystems/vcpkg.cmake +++ b/scripts/buildsystems/vcpkg.cmake @@ -42,12 +42,14 @@ if(NOT VCPKG_TOOLCHAIN) if(OVERRIDE_ADD_EXECUTABLE) function(add_executable name) _add_executable(${ARGV}) + if(NOT "IMPORTED" IN_LIST ARGV) add_custom_command(TARGET ${name} POST_BUILD COMMAND powershell -noprofile -executionpolicy UnRestricted -file ${_VCPKG_TOOLCHAIN_DIR}/msbuild/applocal.ps1 -targetBinary $ -installedDir "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$:/debug>/bin" -OutVariable out ) + endif() endfunction() endif() set(VCPKG_TOOLCHAIN ON) diff --git a/scripts/cmake/vcpkg_find_acquire_program.cmake b/scripts/cmake/vcpkg_find_acquire_program.cmake index 337cc04a5..633721f0e 100644 --- a/scripts/cmake/vcpkg_find_acquire_program.cmake +++ b/scripts/cmake/vcpkg_find_acquire_program.cmake @@ -24,6 +24,12 @@ function(vcpkg_find_acquire_program VAR) set(ARCHIVE "yasm.exe") set(NOEXTRACT ON) set(HASH 850b26be5bbbdaeaf45ac39dd27f69f1a85e600c35afbd16b9f621396b3c7a19863ea3ff316b025b578fce0a8280eef2203306a2b3e46ee1389abb65313fb720) + elseif(VAR MATCHES "PYTHON3") + set(PROGNAME python) + set(PATHS ${DOWNLOADS}/tools/python) + set(URL "https://www.python.org/ftp/python/3.5.2/python-3.5.2-embed-amd64.zip") + set(ARCHIVE "python-3.5.2-embed-amd64.zip") + set(HASH 48bdcb6f94c993acad6782ee33ad4a07a0ea3b9b1bfcdeadf446d459a9224336837e2e7b518d54d8d99c5c3f4e9f8877ea1789cae513fa2eda2a3cad9e4dfd8f) elseif(VAR MATCHES "JOM") set(PROGNAME jom) set(PATHS ${DOWNLOADS}/tools/jom) diff --git a/tests/qt5/CMakeLists.txt b/tests/qt5/CMakeLists.txt new file mode 100644 index 000000000..98667ef11 --- /dev/null +++ b/tests/qt5/CMakeLists.txt @@ -0,0 +1,10 @@ + +cmake_minimum_required(VERSION 3.6) +project(qt5-base-test) +set(CMAKE_AUTOMOC ON) +find_package(Qt5Widgets) +find_package(ZLIB) +find_library(PCRE_LIBRARY NAMES pcre16) +add_executable(test_qt main.cpp) + +target_link_libraries(test_qt Qt5::Widgets ZLIB::ZLIB ${PCRE_LIBRARY}) \ No newline at end of file diff --git a/tests/qt5/main.cpp b/tests/qt5/main.cpp new file mode 100644 index 000000000..cec294069 --- /dev/null +++ b/tests/qt5/main.cpp @@ -0,0 +1,9 @@ +#include +#include +#include +int main(int argc, char** argv) { + auto buildABI = QSysInfo::buildAbi().toStdString(); + fprintf(stdout, "%s\n", buildABI.c_str()); + printf("%d\n", QSysInfo::windowsVersion()); + return 0; +} \ No newline at end of file