Merge branch 'qt5-add' of https://github.com/Barath-Kannan/vcpkg into Barath-Kannan-qt5-add

This commit is contained in:
Robert Schumacher 2016-11-07 16:28:14 -08:00
commit 1bc75b551d
9 changed files with 287 additions and 1 deletions

4
ports/qt5/CONTROL Normal file
View File

@ -0,0 +1,4 @@
Source: qt5
Version: 5.7
Build-Depends:
Description: Qt5 application framework main components. Webengine, examples and tests not included.

44
ports/qt5/fixcmake.py Normal file
View File

@ -0,0 +1,44 @@
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 = ""
exepattern = re.compile("_install_prefix}/bin/[a-z]+.exe")
for line in openedfile:
if "_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}/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()

159
ports/qt5/portfile.cmake Normal file
View File

@ -0,0 +1,159 @@
include(${CMAKE_TRIPLET_FILE})
include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/qt-5.7.0)
set(OUTPUT_PATH ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET})
set(ENV{QTDIR} ${OUTPUT_PATH}/qtbase)
set(ENV{PATH} "${OUTPUT_PATH}/qtbase/bin;$ENV{PATH}")
find_program(NMAKE nmake)
vcpkg_find_acquire_program(JOM)
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};${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"
FILENAME "qt-5.7.0.7z"
SHA512 96f0b6bd221be0ed819bc9b52eefcee1774945e25b89169fa927148c1c4a2d85faf63b1d09ef5067573bda9bbf1270fce5f181d086bfe585ddbad4cd77f7f418
)
vcpkg_extract_source_archive(${ARCHIVE_FILE})
if (EXISTS ${CURRENT_BUILDTREES_DIR}/src/qt-everywhere-opensource-src-5.7.0)
file(RENAME ${CURRENT_BUILDTREES_DIR}/src/qt-everywhere-opensource-src-5.7.0 ${CURRENT_BUILDTREES_DIR}/src/qt-5.7.0)
endif()
file(MAKE_DIRECTORY ${OUTPUT_PATH})
if(DEFINED VCPKG_CRT_LINKAGE AND VCPKG_CRT_LINKAGE STREQUAL static)
list(APPEND QT_RUNTIME_LINKAGE "-static")
list(APPEND QT_RUNTIME_LINKAGE "-static-runtime")
vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES "${CMAKE_CURRENT_LIST_DIR}/set-static-qmakespec.patch"
)
else()
vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES "${CMAKE_CURRENT_LIST_DIR}/set-shared-qmakespec.patch"
)
endif()
message(STATUS "Configuring ${TARGET_TRIPLET}")
vcpkg_execute_required_process(
COMMAND "${SOURCE_PATH}/configure.bat"
-confirm-license -opensource -platform win32-msvc2015
-debug-and-release -force-debug-info ${QT_RUNTIME_LINKAGE}
-nomake examples -nomake tests -skip webengine
-prefix ${CURRENT_PACKAGES_DIR}
-bindir ${CURRENT_PACKAGES_DIR}/bin
-hostbindir ${CURRENT_PACKAGES_DIR}/tools
-archdatadir ${CURRENT_PACKAGES_DIR}/share/qt5
-datadir ${CURRENT_PACKAGES_DIR}/share/qt5
WORKING_DIRECTORY ${OUTPUT_PATH}
LOGNAME configure-${TARGET_TRIPLET}
)
message(STATUS "Configure ${TARGET_TRIPLET} done")
message(STATUS "Building ${TARGET_TRIPLET}")
vcpkg_execute_required_process_repeat(
COUNT 5
COMMAND ${JOM}
WORKING_DIRECTORY ${OUTPUT_PATH}
LOGNAME build-${TARGET_TRIPLET}
)
message(STATUS "Build ${TARGET_TRIPLET} done")
message(STATUS "Installing ${TARGET_TRIPLET}")
vcpkg_execute_required_process(
COMMAND ${JOM} install
WORKING_DIRECTORY ${OUTPUT_PATH}
LOGNAME install-${TARGET_TRIPLET}
)
message(STATUS "Install ${TARGET_TRIPLET} done")
message(STATUS "Packaging ${TARGET_TRIPLET}")
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug)
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/lib)
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/bin)
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake ${CURRENT_PACKAGES_DIR}/share/cmake)
if(DEFINED VCPKG_CRT_LINKAGE AND VCPKG_CRT_LINKAGE STREQUAL dynamic)
file(INSTALL ${CURRENT_PACKAGES_DIR}/bin
DESTINATION ${CURRENT_PACKAGES_DIR}/debug
FILES_MATCHING PATTERN "*d.dll"
)
file(INSTALL ${CURRENT_PACKAGES_DIR}/bin
DESTINATION ${CURRENT_PACKAGES_DIR}/debug
FILES_MATCHING PATTERN "*d.pdb"
)
file(GLOB DEBUG_BIN_FILES "${CURRENT_PACKAGES_DIR}/bin/*d.dll")
file(REMOVE ${DEBUG_BIN_FILES})
file(GLOB DEBUG_BIN_FILES "${CURRENT_PACKAGES_DIR}/bin/*d.pdb")
file(REMOVE ${DEBUG_BIN_FILES})
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/bin/Qt5Gamepad.dll ${CURRENT_PACKAGES_DIR}/bin/Qt5Gamepad.dll)
endif()
file(INSTALL ${CURRENT_PACKAGES_DIR}/lib
DESTINATION ${CURRENT_PACKAGES_DIR}/debug
FILES_MATCHING PATTERN "*d.lib"
)
file(INSTALL ${CURRENT_PACKAGES_DIR}/lib
DESTINATION ${CURRENT_PACKAGES_DIR}/debug
FILES_MATCHING PATTERN "*d.prl"
)
file(INSTALL ${CURRENT_PACKAGES_DIR}/lib
DESTINATION ${CURRENT_PACKAGES_DIR}/debug
FILES_MATCHING PATTERN "*d.pdb"
)
file(GLOB DEBUG_LIB_FILES "${CURRENT_PACKAGES_DIR}/lib/*d.lib")
file(REMOVE ${DEBUG_LIB_FILES})
file(GLOB DEBUG_LIB_FILES "${CURRENT_PACKAGES_DIR}/lib/*d.prl")
file(REMOVE ${DEBUG_LIB_FILES})
file(GLOB DEBUG_LIB_FILES "${CURRENT_PACKAGES_DIR}/lib/*d.pdb")
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
OUTPUT_VARIABLE PDB_LINE
ERROR_QUIET
RESULT_VARIABLE error_code
)
if(NOT error_code AND PDB_LINE MATCHES "PDB file found at")
string(REGEX MATCH '.*' PDB_PATH ${PDB_LINE}) # Extract the path which is in single quotes
string(REPLACE ' "" PDB_PATH ${PDB_PATH}) # Remove single quotes
file(INSTALL ${PDB_PATH} DESTINATION ${CURRENT_PACKAGES_DIR}/tools)
file(REMOVE ${PDB_PATH})
endif()
endforeach()
file(INSTALL ${BINARY_TOOLS} DESTINATION ${CURRENT_PACKAGES_DIR}/tools)
file(REMOVE ${BINARY_TOOLS})
if(DEFINED VCPKG_CRT_LINKAGE AND VCPKG_CRT_LINKAGE STREQUAL dynamic)
file(GLOB RELEASE_DLLS "${CURRENT_PACKAGES_DIR}/bin/*.dll")
file(INSTALL ${RELEASE_DLLS} DESTINATION ${CURRENT_PACKAGES_DIR}/tools)
endif()
vcpkg_execute_required_process(
COMMAND ${PYTHON3} ${CMAKE_CURRENT_LIST_DIR}/fixcmake.py
WORKING_DIRECTORY ${CURRENT_PACKAGES_DIR}/share/cmake
LOGNAME fix-cmake
)
file(INSTALL ${SOURCE_PATH}/LICENSE.LGPLv3 DESTINATION ${CURRENT_PACKAGES_DIR}/share/qt5 RENAME copyright)
vcpkg_copy_pdbs()

View File

@ -0,0 +1,18 @@
diff --git a/qtbase/mkspecs/common/msvc-desktop.conf b/qtbase/mkspecs/common/msvc-desktop.conf
index 80fcd9b..1b9d57b 100644
--- a/qtbase/mkspecs/common/msvc-desktop.conf
+++ b/qtbase/mkspecs/common/msvc-desktop.conf
@@ -29,9 +29,9 @@
QMAKE_YACCFLAGS = -d
QMAKE_CFLAGS = -nologo -Zc:wchar_t
QMAKE_CFLAGS_WARN_ON = -W3
QMAKE_CFLAGS_WARN_OFF = -W0
-QMAKE_CFLAGS_RELEASE = -O2 -MT
-QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MT -Zi
-QMAKE_CFLAGS_DEBUG = -Zi -MTd
+QMAKE_CFLAGS_RELEASE = -O2 -MD
+QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MD -Zi
+QMAKE_CFLAGS_DEBUG = -Zi -MDd
QMAKE_CFLAGS_YACC =
QMAKE_CFLAGS_LTCG = -GL

View File

@ -0,0 +1,18 @@
diff --git a/qtbase/mkspecs/common/msvc-desktop.conf b/qtbase/mkspecs/common/msvc-desktop.conf
index 1b9d57b..80fcd9b 100644
--- a/qtbase/mkspecs/common/msvc-desktop.conf
+++ b/qtbase/mkspecs/common/msvc-desktop.conf
@@ -29,9 +29,9 @@
QMAKE_YACCFLAGS = -d
QMAKE_CFLAGS = -nologo -Zc:wchar_t
QMAKE_CFLAGS_WARN_ON = -W3
QMAKE_CFLAGS_WARN_OFF = -W0
-QMAKE_CFLAGS_RELEASE = -O2 -MD
-QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MD -Zi
-QMAKE_CFLAGS_DEBUG = -Zi -MDd
+QMAKE_CFLAGS_RELEASE = -O2 -MT
+QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MT -Zi
+QMAKE_CFLAGS_DEBUG = -Zi -MTd
QMAKE_CFLAGS_YACC =
QMAKE_CFLAGS_LTCG = -GL

View File

@ -53,12 +53,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)

View File

@ -1,10 +1,11 @@
include(vcpkg_download_distfile)
include(vcpkg_extract_source_archive)
include(vcpkg_execute_required_process)
include(vcpkg_execute_required_process_repeat)
include(vcpkg_find_acquire_program)
include(vcpkg_build_cmake)
include(vcpkg_build_msbuild)
include(vcpkg_install_cmake)
include(vcpkg_configure_cmake)
include(vcpkg_apply_patches)
include(vcpkg_copy_pdbs)
include(vcpkg_copy_pdbs)

View File

@ -0,0 +1,28 @@
# Usage: vcpkg_execute_required_process_repeat(COUNT <num> COMMAND <cmd> [<args>...] WORKING_DIRECTORY </path/to/dir> LOGNAME <my_log_name>)
function(vcpkg_execute_required_process_repeat)
cmake_parse_arguments(vcpkg_execute_required_process_repeat "" "COUNT;WORKING_DIRECTORY;LOGNAME" "COMMAND" ${ARGN})
#debug_message("vcpkg_execute_required_process_repeat(${vcpkg_execute_required_process_repeat_COMMAND})")
foreach(loop_count RANGE ${vcpkg_execute_required_process_repeat_COUNT})
execute_process(
COMMAND ${vcpkg_execute_required_process_repeat_COMMAND}
OUTPUT_FILE ${CURRENT_BUILDTREES_DIR}/${vcpkg_execute_required_process_repeat_LOGNAME}-out.log
ERROR_FILE ${CURRENT_BUILDTREES_DIR}/${vcpkg_execute_required_process_repeat_LOGNAME}-err.log
RESULT_VARIABLE error_code
WORKING_DIRECTORY ${vcpkg_execute_required_process_repeat_WORKING_DIRECTORY})
#debug_message("error_code=${error_code}")
file(TO_NATIVE_PATH "${CURRENT_BUILDTREES_DIR}" NATIVE_BUILDTREES_DIR)
if(NOT error_code)
set(SUCCESSFUL_EXECUTION TRUE)
break()
endif()
endforeach(loop_count)
if (NOT ${SUCCESSFUL_EXECUTION})
message(FATAL_ERROR
" Command failed: ${vcpkg_execute_required_process_repeat_COMMAND}\n"
" Working Directory: ${vcpkg_execute_required_process_repeat_WORKING_DIRECTORY}\n"
" See logs for more information:\n"
" ${NATIVE_BUILDTREES_DIR}\\${vcpkg_execute_required_process_repeat_LOGNAME}-out.log\n"
" ${NATIVE_BUILDTREES_DIR}\\${vcpkg_execute_required_process_repeat_LOGNAME}-err.log\n"
)
endif()
endfunction()

View File

@ -24,6 +24,18 @@ 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)
set(URL "http://download.qt.io/official_releases/jom/jom_1_1_1.zip")
set(ARCHIVE "jom_1_1_1.zip")
set(HASH 23a26dc7e29979bec5dcd3bfcabf76397b93ace64f5d46f2254d6420158bac5eff1c1a8454e3427e7a2fe2c233c5f2cffc87b376772399e12e40b51be2c065f4)
else()
message(FATAL "unknown tool ${VAR} -- unable to acquire.")
endif()