Skip to content

Commit

Permalink
made some qt5 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
barcharcraz committed Nov 1, 2016
1 parent a79c348 commit b25c13c
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 4 deletions.
10 changes: 9 additions & 1 deletion ports/qt5/fixcmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,18 @@
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()
20 changes: 17 additions & 3 deletions ports/qt5/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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
)
Expand Down
2 changes: 2 additions & 0 deletions scripts/buildsystems/vcpkg.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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 $<TARGET_FILE:${name}>
-installedDir "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$<CONFIG:Debug>:/debug>/bin"
-OutVariable out
)
endif()
endfunction()
endif()
set(VCPKG_TOOLCHAIN ON)
Expand Down
6 changes: 6 additions & 0 deletions scripts/cmake/vcpkg_find_acquire_program.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 10 additions & 0 deletions tests/qt5/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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})
9 changes: 9 additions & 0 deletions tests/qt5/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include <qsysinfo.h>
#include <qstring.h>
#include <cstdio>
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;
}

0 comments on commit b25c13c

Please sign in to comment.