2016-11-25 18:40:29 +08:00
|
|
|
# For now only x[64|86]-windows triplet and dynamic linking is supported
|
|
|
|
#
|
|
|
|
|
|
|
|
if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
|
|
|
message(STATUS "Warning: Static building not supported yet. Building dynamic.")
|
|
|
|
set(VCPKG_LIBRARY_LINKAGE dynamic)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
include(vcpkg_common_functions)
|
|
|
|
|
|
|
|
find_program(GIT git)
|
|
|
|
|
|
|
|
# Set git variables to qca version 2.2.0 commit
|
|
|
|
set(GIT_URL "git://anongit.kde.org/qca.git")
|
|
|
|
set(GIT_REF "19ec49f89a0a560590ec733c549b92e199792837") # Commit
|
|
|
|
|
|
|
|
# Prepare source dir
|
|
|
|
if(NOT EXISTS "${DOWNLOADS}/qca.git")
|
|
|
|
message(STATUS "Cloning")
|
|
|
|
vcpkg_execute_required_process(
|
|
|
|
COMMAND ${GIT} clone --bare ${GIT_URL} ${DOWNLOADS}/qca.git
|
|
|
|
WORKING_DIRECTORY ${DOWNLOADS}
|
|
|
|
LOGNAME clone
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
message(STATUS "Cloning done")
|
|
|
|
|
|
|
|
if(NOT EXISTS "${CURRENT_BUILDTREES_DIR}/src/.git")
|
|
|
|
message(STATUS "Adding worktree")
|
|
|
|
file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR})
|
|
|
|
vcpkg_execute_required_process(
|
|
|
|
COMMAND ${GIT} worktree add -f --detach ${CURRENT_BUILDTREES_DIR}/src ${GIT_REF}
|
|
|
|
WORKING_DIRECTORY ${DOWNLOADS}/qca.git
|
|
|
|
LOGNAME worktree
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
message(STATUS "Adding worktree done")
|
|
|
|
|
|
|
|
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/)
|
|
|
|
|
2016-11-26 20:51:09 +08:00
|
|
|
# Apply the patch to install to the expected folders
|
2016-11-25 18:40:29 +08:00
|
|
|
vcpkg_apply_patches(
|
|
|
|
SOURCE_PATH ${SOURCE_PATH}
|
|
|
|
PATCHES ${CMAKE_CURRENT_LIST_DIR}/0001-fix-path-for-vcpkg.patch
|
|
|
|
)
|
|
|
|
|
2016-11-26 20:51:09 +08:00
|
|
|
# Configure and build
|
2016-11-25 18:40:29 +08:00
|
|
|
vcpkg_configure_cmake(
|
|
|
|
SOURCE_PATH ${SOURCE_PATH}
|
|
|
|
CURRENT_PACKAGES_DIR ${CURRENT_PACKAGES_DIR}
|
|
|
|
OPTIONS
|
|
|
|
-DBUILD_SHARED_LIBS=ON
|
|
|
|
-DUSE_RELATIVE_PATHS=ON
|
|
|
|
-DQT4_BUILD=OFF
|
|
|
|
-DBUILD_TESTS=OFF
|
|
|
|
-DBUILD_TOOLS=OFF
|
2016-11-26 20:51:09 +08:00
|
|
|
-DQCA_SUFFIX=OFF #
|
2016-11-25 18:40:29 +08:00
|
|
|
OPTIONS_DEBUG
|
2016-11-26 20:51:09 +08:00
|
|
|
-DQCA_PLUGINS_INSTALL_DIR=${CURRENT_PACKAGES_DIR}/debug/bin/Qca #
|
2016-11-25 18:40:29 +08:00
|
|
|
OPTIONS_RELEASE
|
2016-11-26 20:51:09 +08:00
|
|
|
-DQCA_PLUGINS_INSTALL_DIR=${CURRENT_PACKAGES_DIR}/bin/Qca #
|
2016-11-25 18:40:29 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
vcpkg_install_cmake()
|
|
|
|
|
2016-11-26 20:51:09 +08:00
|
|
|
# Patch and copy cmake files
|
2016-11-25 18:40:29 +08:00
|
|
|
message(STATUS "Patching files")
|
|
|
|
|
2016-11-26 20:51:09 +08:00
|
|
|
file(READ
|
|
|
|
${CURRENT_PACKAGES_DIR}/debug/share/qca/cmake/QcaTargets-debug.cmake
|
|
|
|
QCA_DEBUG_CONFIG
|
2016-11-25 18:40:29 +08:00
|
|
|
)
|
|
|
|
string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" QCA_DEBUG_CONFIG "${QCA_DEBUG_CONFIG}")
|
2016-11-26 20:51:09 +08:00
|
|
|
file(WRITE
|
|
|
|
${CURRENT_PACKAGES_DIR}/share/qca/cmake/QcaTargets-debug.cmake
|
|
|
|
"${QCA_DEBUG_CONFIG}"
|
|
|
|
)
|
2016-11-25 18:40:29 +08:00
|
|
|
|
2016-11-26 20:51:09 +08:00
|
|
|
file(READ ${CURRENT_PACKAGES_DIR}/share/qca/cmake/QcaTargets.cmake
|
|
|
|
QCA_TARGET_CONFIG
|
|
|
|
)
|
2016-11-25 18:40:29 +08:00
|
|
|
string(REPLACE "packages/qca_" "installed/" QCA_TARGET_CONFIG "${QCA_TARGET_CONFIG}")
|
2016-11-26 20:51:09 +08:00
|
|
|
file(WRITE ${CURRENT_PACKAGES_DIR}/share/qca/cmake/QcaTargets.cmake
|
|
|
|
"${QCA_TARGET_CONFIG}"
|
|
|
|
)
|
2016-11-25 18:40:29 +08:00
|
|
|
|
|
|
|
# Remove unneeded dirs
|
|
|
|
file(REMOVE_RECURSE
|
|
|
|
${CURRENT_BUILDTREES_DIR}/share/man
|
|
|
|
${CURRENT_PACKAGES_DIR}/share/man
|
|
|
|
${CURRENT_PACKAGES_DIR}/debug/include
|
|
|
|
${CURRENT_PACKAGES_DIR}/debug/share
|
|
|
|
)
|
|
|
|
|
|
|
|
message(STATUS "Patching files done")
|
|
|
|
|
|
|
|
# Handle copyright
|
|
|
|
file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/qca)
|
|
|
|
file(RENAME ${CURRENT_PACKAGES_DIR}/share/qca/COPYING ${CURRENT_PACKAGES_DIR}/share/qca/copyright)
|