aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Karatarakis <alex@karatarakis.com>2017-01-06 13:41:01 -0800
committerGitHub <noreply@github.com>2017-01-06 13:41:01 -0800
commitd4d3133afcf58e68f3272189b6376043cee7fb11 (patch)
tree34ee83a00d81a2acba03a98b00b478a6647ed9d5
parent4be24efa52605ea97076137e150a1d4e307f680e (diff)
parent3cad0111fbe288da3ee0dd525447125bbf76f707 (diff)
downloadvcpkg-d4d3133afcf58e68f3272189b6376043cee7fb11.tar.gz
vcpkg-d4d3133afcf58e68f3272189b6376043cee7fb11.zip
Merge pull request #494 from traversaro/add-qwt
Add qwt port
-rw-r--r--ports/qwt/CONTROL4
-rw-r--r--ports/qwt/build-shared-lib.patch13
-rw-r--r--ports/qwt/build-static-lib.patch13
-rw-r--r--ports/qwt/portfile.cmake61
-rw-r--r--scripts/cmake/vcpkg_apply_patches.cmake25
-rw-r--r--scripts/cmake/vcpkg_build_qmake.cmake36
-rw-r--r--scripts/cmake/vcpkg_common_functions.cmake2
-rw-r--r--scripts/cmake/vcpkg_configure_qmake.cmake44
8 files changed, 196 insertions, 2 deletions
diff --git a/ports/qwt/CONTROL b/ports/qwt/CONTROL
new file mode 100644
index 000000000..b457bdead
--- /dev/null
+++ b/ports/qwt/CONTROL
@@ -0,0 +1,4 @@
+Source: qwt
+Version: 6.1.3
+Description: Qt widgets library for technical applications
+Build-Depends: qt5
diff --git a/ports/qwt/build-shared-lib.patch b/ports/qwt/build-shared-lib.patch
new file mode 100644
index 000000000..2a8447d52
--- /dev/null
+++ b/ports/qwt/build-shared-lib.patch
@@ -0,0 +1,13 @@
+diff --git a/qwtconfig.pri b/qwtconfig.pri
+index 756231a..2dc3715 100644
+--- a/qwtconfig.pri
++++ b/qwtconfig.pri
+@@ -72,7 +72,7 @@ QWT_INSTALL_FEATURES = $${QWT_INSTALL_PREFIX}/features
+ # it will be a static library.
+ ######################################################################
+
+-# QWT_CONFIG += QwtDll
++QWT_CONFIG += QwtDll
+
+ ######################################################################
+ # QwtPlot enables all classes, that are needed to use the QwtPlot
diff --git a/ports/qwt/build-static-lib.patch b/ports/qwt/build-static-lib.patch
new file mode 100644
index 000000000..3e1b462ac
--- /dev/null
+++ b/ports/qwt/build-static-lib.patch
@@ -0,0 +1,13 @@
+diff --git a/qwtconfig.pri b/qwtconfig.pri
+index 2dc3715..756231a 100644
+--- a/qwtconfig.pri
++++ b/qwtconfig.pri
+@@ -72,7 +72,7 @@ QWT_INSTALL_FEATURES = $${QWT_INSTALL_PREFIX}/features
+ # it will be a static library.
+ ######################################################################
+
+-QWT_CONFIG += QwtDll
++# QWT_CONFIG += QwtDll
+
+ ######################################################################
+ # QwtPlot enables all classes, that are needed to use the QwtPlot
diff --git a/ports/qwt/portfile.cmake b/ports/qwt/portfile.cmake
new file mode 100644
index 000000000..94cb2af91
--- /dev/null
+++ b/ports/qwt/portfile.cmake
@@ -0,0 +1,61 @@
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/qwt-6.1.3)
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://sourceforge.net/projects/qwt/files/qwt/6.1.3/qwt-6.1.3.zip"
+ FILENAME "qwt-6.1.3.zip"
+ SHA512 8f249e23d50f71d14fca37776ea40d8d6931db14d9602e03a343bfb7a9bf55502202103135b77f583c3890a7924220e8a142a01c448dbde311860d89a3b10fc8
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ vcpkg_apply_patches(
+ SOURCE_PATH ${SOURCE_PATH}
+ PATCHES "${CMAKE_CURRENT_LIST_DIR}/build-shared-lib.patch"
+ QUIET
+ )
+else()
+ vcpkg_apply_patches(
+ SOURCE_PATH ${SOURCE_PATH}
+ PATCHES "${CMAKE_CURRENT_LIST_DIR}/build-static-lib.patch"
+ QUIET
+ )
+endif()
+
+vcpkg_configure_qmake(
+ SOURCE_PATH ${SOURCE_PATH}
+)
+
+vcpkg_build_qmake()
+
+# Install following vcpkg conventions
+set(BUILD_DIR ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET})
+
+file(GLOB HEADER_FILES ${SOURCE_PATH}/src/*.h)
+file(INSTALL ${HEADER_FILES} DESTINATION ${CURRENT_PACKAGES_DIR}/include)
+
+file(INSTALL
+ ${BUILD_DIR}/lib/qwt.lib
+ DESTINATION ${CURRENT_PACKAGES_DIR}/lib
+)
+
+file(INSTALL
+ ${BUILD_DIR}/lib/qwtd.lib
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib
+)
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ file(INSTALL
+ ${BUILD_DIR}/lib/qwt.dll
+ DESTINATION ${CURRENT_PACKAGES_DIR}/bin
+ )
+
+ file(INSTALL
+ ${BUILD_DIR}/lib/qwtd.dll
+ ${BUILD_DIR}/lib/qwtd.pdb
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin
+ )
+endif()
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/qwt)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/qwt/COPYING ${CURRENT_PACKAGES_DIR}/share/qwt/copyright)
diff --git a/scripts/cmake/vcpkg_apply_patches.cmake b/scripts/cmake/vcpkg_apply_patches.cmake
index cd3026b6a..d509e36ec 100644
--- a/scripts/cmake/vcpkg_apply_patches.cmake
+++ b/scripts/cmake/vcpkg_apply_patches.cmake
@@ -1,5 +1,26 @@
+#.rst:
+# .. command:: vcpkg_apply_patches
+#
+# Apply a set of patches to a source tree.
+#
+# ::
+# vcpkg_apply_patches(SOURCE_PATH <source_path>
+# PATCHES patch1 [patch ...]
+# )
+#
+# ``SOURCE_PATH``
+# The source path in which apply the patches.
+# ``PATCHES``
+# A list of patches that are applied to the source tree
+# ``QUIET``
+# If this option is passed, the warning message when applyng
+# a patch failes is not printed. This is convenient for patches
+# that are known to fail even on a clean source tree, and for
+# which the standard warning message would be confusing for the user.
+#
+
function(vcpkg_apply_patches)
- cmake_parse_arguments(_ap "" "SOURCE_PATH" "PATCHES" ${ARGN})
+ cmake_parse_arguments(_ap "QUIET" "SOURCE_PATH" "PATCHES" ${ARGN})
find_program(GIT git)
set(PATCHNUM 0)
@@ -14,7 +35,7 @@ function(vcpkg_apply_patches)
RESULT_VARIABLE error_code
)
- if(error_code)
+ if(error_code AND NOT ${_ap_QUIET})
message(STATUS "Applying patch failed. This is expected if this patch was previously applied.")
endif()
diff --git a/scripts/cmake/vcpkg_build_qmake.cmake b/scripts/cmake/vcpkg_build_qmake.cmake
new file mode 100644
index 000000000..263200423
--- /dev/null
+++ b/scripts/cmake/vcpkg_build_qmake.cmake
@@ -0,0 +1,36 @@
+#.rst:
+# .. command:: vcpkg_build_qmake
+#
+# Build a qmake-based project, previously configured using vcpkg_configure_qmake .
+# As the CONFIG qmake option is assumed to be "debug_and_release" (the default value on Windows, see [1]),
+# both the debug and release libraries are build in the same build tree.
+#
+# ::
+# vcpkg_build_qmake()
+#
+#
+# [1] : http://doc.qt.io/qt-5/qmake-variable-reference.html
+
+function(vcpkg_build_qmake)
+ vcpkg_find_acquire_program("JOM")
+
+ if(NOT JOM)
+ BUILD_ERROR("vcpkg_install_qmake: impossible to find jom.")
+ endif()
+
+ # Make sure that the linker finds the libraries used
+ set(ENV_LIB_BACKUP ENV{LIB})
+ set(ENV{LIB} "${CURRENT_INSTALLED_DIR}/lib;${CURRENT_INSTALLED_DIR}/debug/lib;$ENV{LIB}")
+
+ message(STATUS "Package ${TARGET_TRIPLET}")
+ vcpkg_execute_required_process_repeat(
+ COUNT 2
+ COMMAND ${JOM}
+ WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}
+ LOGNAME package-${TARGET_TRIPLET}
+ )
+ message(STATUS "Package ${TARGET_TRIPLET} done")
+
+ # Restore the original value of ENV{LIB}
+ set(ENV{LIB} ENV_LIB_BACKUP)
+endfunction()
diff --git a/scripts/cmake/vcpkg_common_functions.cmake b/scripts/cmake/vcpkg_common_functions.cmake
index f1bbdb9e3..ff1fae953 100644
--- a/scripts/cmake/vcpkg_common_functions.cmake
+++ b/scripts/cmake/vcpkg_common_functions.cmake
@@ -5,7 +5,9 @@ include(vcpkg_execute_required_process_repeat)
include(vcpkg_find_acquire_program)
include(vcpkg_build_cmake)
include(vcpkg_build_msbuild)
+include(vcpkg_build_qmake)
include(vcpkg_install_cmake)
include(vcpkg_configure_cmake)
+include(vcpkg_configure_qmake)
include(vcpkg_apply_patches)
include(vcpkg_copy_pdbs)
diff --git a/scripts/cmake/vcpkg_configure_qmake.cmake b/scripts/cmake/vcpkg_configure_qmake.cmake
new file mode 100644
index 000000000..f51a2f4fb
--- /dev/null
+++ b/scripts/cmake/vcpkg_configure_qmake.cmake
@@ -0,0 +1,44 @@
+#.rst:
+# .. command:: vcpkg_configure_qmake
+#
+# Configure a qmake-based project.
+# It is assume that the qmake project CONFIG variable is
+# "debug_and_release" (the default value on Windows, see [1]).
+# Using this option, only one Makefile for building both Release and Debug
+# libraries is generated, that then can be run using the vcpkg_install_qmake
+# command.
+#
+# ::
+# vcpkg_configure_qmake(SOURCE_PATH <pro_file_path>
+# [OPTIONS arg1 [arg2 ...]]
+# )
+#
+# ``PROJECT_PATH``
+# The path to the *.pro qmake project file.
+# ``OPTIONS``
+# The options passed to qmake.
+#
+# [1] : http://doc.qt.io/qt-5/qmake-variable-reference.html
+
+function(vcpkg_configure_qmake)
+ cmake_parse_arguments(_csc "" "SOURCE_PATH" "OPTIONS" ${ARGN})
+
+ # Find qmake exectuable
+ find_program(QMAKE_COMMAND NAMES qmake)
+
+ if(NOT QMAKE_COMMAND)
+ BUILD_ERROR("vcpkg_configure_qmake: impossible to find qmake.")
+ endif()
+
+ # Cleanup build directories
+ file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET})
+
+ message(STATUS "Configuring ${TARGET_TRIPLET}")
+ file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET})
+ vcpkg_execute_required_process(
+ COMMAND ${QMAKE_COMMAND} ${_csc_SOURCE_PATH} ${_csc_OPTIONS}
+ WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}
+ LOGNAME config-${TARGET_TRIPLET}
+ )
+ message(STATUS "Configuring ${TARGET_TRIPLET} done")
+endfunction() \ No newline at end of file