diff options
author | Antoine Fontaine <antoine.fontaine@epfl.ch> | 2020-02-08 13:49:55 +0100 |
---|---|---|
committer | Rasmus Thomsen <oss@cogitri.dev> | 2020-02-19 22:28:03 +0100 |
commit | 83c6036c3196c5218c9a63cb17989df5d0521bf2 (patch) | |
tree | de6d85bef1c8cbda4a454201e5705ab750e56d97 /testing | |
parent | fc977fc5144485bf89a593ca191cecfcfafa2530 (diff) | |
download | aports-83c6036c3196c5218c9a63cb17989df5d0521bf2.tar.bz2 aports-83c6036c3196c5218c9a63cb17989df5d0521bf2.tar.xz |
testing/cmake-extras: new aport
Diffstat (limited to 'testing')
-rw-r--r-- | testing/cmake-extras/APKBUILD | 29 | ||||
-rw-r--r-- | testing/cmake-extras/Use_gtest_cmake_from_mir.patch | 171 | ||||
-rw-r--r-- | testing/cmake-extras/qmlplugindump_path.patch | 13 |
3 files changed, 213 insertions, 0 deletions
diff --git a/testing/cmake-extras/APKBUILD b/testing/cmake-extras/APKBUILD new file mode 100644 index 0000000000..c7e0de9c3f --- /dev/null +++ b/testing/cmake-extras/APKBUILD @@ -0,0 +1,29 @@ +# Contributor: Bart Ribbers <bribbers@disroot.org> +# Maintainer: Luca Weiss <luca@z3ntu.xyz> +pkgname=cmake-extras +pkgver=0_git20190219 +_commit="365500ed7903180d034b64e06d0c0cdd9de2162f" +pkgrel=0 +pkgdesc="A collection of add-ons for the CMake build tool" +url="https://github.com/ubports/cmake-extras" +arch="noarch" +license="LGPL-3.0-only" +depends="cmake" +options="!check" # No testsuite +source="$pkgname-$_commit.tar.gz::https://github.com/ubports/cmake-extras/archive/$_commit.tar.gz + Use_gtest_cmake_from_mir.patch + qmlplugindump_path.patch" +builddir="$srcdir/$pkgname-$_commit" + +build() { + cmake \ + -DCMAKE_INSTALL_PREFIX:PATH=/usr + make +} + +package() { + DESTDIR="$pkgdir" make install +} +sha512sums="79c8224fd96368ca68534c90178c16178e668bc0655ea42d139fcee4a995c92bc9b6c20f2b6cd0df2bc38cc009f9e15306513d06a3f095c5f344994cae4cb01c cmake-extras-365500ed7903180d034b64e06d0c0cdd9de2162f.tar.gz +996334490e062868b2dd24a0d2d688d95877343ae2db6a06efc580d14ffe1d00f0c9277be0929b9c7c859aef2dea0be68ddc49a7495ad16eaa0a156838f8bca9 Use_gtest_cmake_from_mir.patch +e55bd3ae7372b33534d239f7e959af0eba5687aba0386613381e4f9fc840f89213f5ae92544b7e969943d46e815d49c66fd24c29c44fd4166bb3a6bf81e1ac7e qmlplugindump_path.patch" diff --git a/testing/cmake-extras/Use_gtest_cmake_from_mir.patch b/testing/cmake-extras/Use_gtest_cmake_from_mir.patch new file mode 100644 index 0000000000..915baf899f --- /dev/null +++ b/testing/cmake-extras/Use_gtest_cmake_from_mir.patch @@ -0,0 +1,171 @@ +diff --git a/src/GMock/GMockConfig.cmake b/src/GMock/GMockConfig.cmake +index 2078030..77ba4a3 100644 +--- a/src/GMock/GMockConfig.cmake ++++ b/src/GMock/GMockConfig.cmake +@@ -1,92 +1,77 @@ +-# Copyright (C) 2014 Canonical Ltd +-# +-# This program is free software: you can redistribute it and/or modify +-# it under the terms of the GNU Lesser General Public License version 3 as +-# published by the Free Software Foundation. +-# +-# This program is distributed in the hope that it will be useful, +-# but WITHOUT ANY WARRANTY; without even the implied warranty of +-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-# GNU Lesser General Public License for more details. +-# +-# You should have received a copy of the GNU Lesser General Public License +-# along with this program. If not, see <http://www.gnu.org/licenses/>. +- +-# Build with system gmock and embedded gtest +-# +-# Usage: +-# +-# find_package(GMock) +-# +-# ... +-# +-# target_link_libraries( +-# my-target +-# ${GTEST_BOTH_LIBRARIES} +-# ) +-# +-# NOTE: Due to the way this package finder is implemented, do not attempt +-# to find the GMock package more than once. +- +-find_package(Threads) +- +-if (EXISTS "/usr/src/googletest") +- # As of version 1.8.0 +- set(GMOCK_SOURCE_DIR "/usr/src/googletest/googlemock" CACHE PATH "gmock source directory") +- set(GMOCK_INCLUDE_DIRS "${GMOCK_SOURCE_DIR}/include" CACHE PATH "gmock source include directory") +- set(GTEST_INCLUDE_DIRS "/usr/src/googletest/googletest/include" CACHE PATH "gtest source include directory") ++include(FindPackageHandleStandardArgs) ++ ++find_package(GTest) ++ ++pkg_check_modules (GTEST REQUIRED "gtest >= 1.8.0") ++pkg_check_modules (GTEST_MAIN REQUIRED "gtest_main >= 1.8.0") ++if (GTEST_FOUND AND GTEST_MAIN_FOUND) ++ set(GTEST_LIBRARY ${GTEST_LIBRARIES}) ++ set(GTEST_MAIN_LIBRARY ${GTEST_MAIN_LIBRARIES}) ++ set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARY} ${GTEST_MAIN_LIBRARY}) ++endif() ++ ++if (NOT GTEST_FOUND) ++ include(ExternalProject) ++ ++ find_path(GTEST_ROOT ++ NAMES CMakeLists.txt ++ PATHS /usr/src/gtest /usr/src/googletest/googletest/ ++ DOC "Path to GTest CMake project") ++ ++ ExternalProject_Add(GTest PREFIX ./gtest ++ SOURCE_DIR ${GTEST_ROOT} ++ CMAKE_ARGS ++ -DCMAKE_CXX_COMPILER_WORKS=1 ++ -DCMAKE_CXX_FLAGS='${CMAKE_CXX_FLAGS}' ++ -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} ++ INSTALL_COMMAND true ++ BUILD_BYPRODUCTS ++ ${CMAKE_CURRENT_BINARY_DIR}/gtest/src/GTest-build/libgtest.a ++ ${CMAKE_CURRENT_BINARY_DIR}/gtest/src/GTest-build/libgtest_main.a ++ ${CMAKE_CURRENT_BINARY_DIR}/gtest/src/GMock-build/libgmock.a) ++ ++ ExternalProject_Get_Property(GTest binary_dir) ++ ++ add_library(gtest UNKNOWN IMPORTED) ++ set_target_properties(gtest PROPERTIES IMPORTED_LOCATION ${binary_dir}/libgtest.a) ++ add_dependencies(gtest GTest) ++ set(GTEST_LIBRARY "gtest") ++ ++ add_library(gtest_main UNKNOWN IMPORTED) ++ set_target_properties(gtest_main PROPERTIES IMPORTED_LOCATION ${binary_dir}/libgtest_main.a) ++ add_dependencies(gtest_main GTest) ++ set(GTEST_MAIN_LIBRARY "gtest_main") ++ ++ set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARY} ${GTEST_MAIN_LIBRARY}) ++ find_path(GTEST_INCLUDE_DIRS NAMES gtest/gtest.h) ++ find_package_handle_standard_args(GTest GTEST_LIBRARY GTEST_BOTH_LIBRARIES GTEST_INCLUDE_DIRS) ++endif() ++ ++find_file(GMOCK_SOURCE ++ NAMES gmock-all.cc ++ DOC "GMock source" ++ PATHS /usr/src/googletest/googlemock/src/ /usr/src/gmock/ /usr/src/gmock/src) ++ ++if (EXISTS ${GMOCK_SOURCE}) ++ find_path(GMOCK_INCLUDE_DIR gmock/gmock.h PATHS /usr/src/googletest/googlemock/include) ++ ++ add_library(GMock STATIC ${GMOCK_SOURCE}) ++ ++ if (EXISTS /usr/src/googletest/googlemock/src) ++ set_source_files_properties(${GMOCK_SOURCE} PROPERTIES COMPILE_FLAGS "-I/usr/src/googletest/googlemock") ++ endif() ++ ++ if (EXISTS /usr/src/gmock/src) ++ set_source_files_properties(${GMOCK_SOURCE} PROPERTIES COMPILE_FLAGS "-I/usr/src/gmock") ++ endif() ++ ++ find_package_handle_standard_args(GMock DEFAULT_MSG GMOCK_INCLUDE_DIR) ++ ++ set(GMOCK_LIBRARY GMock) + else() +- set(GMOCK_SOURCE_DIR "/usr/src/gmock" CACHE PATH "gmock source directory") +- set(GMOCK_INCLUDE_DIRS "/usr/include" CACHE PATH "gmock source include directory") +- set(GTEST_INCLUDE_DIRS "/usr/include" CACHE PATH "gtest source include directory") ++ # Assume gmock is no longer source, we'll find out soon enough if that's wrong ++ add_custom_target(GMock) ++ string(REPLACE gtest gmock GMOCK_LIBRARY ${GTEST_LIBRARY}) + endif() + +-# We add -g so we get debug info for the gtest stack frames with gdb. +-# The warnings are suppressed so we get a noise-free build for gtest and gmock if the caller +-# has these warnings enabled. +-set(findgmock_cxx_flags "${CMAKE_CXX_FLAGS} -g -Wno-old-style-cast -Wno-missing-field-initializers -Wno-ctor-dtor-privacy -Wno-switch-default") +- +-set(findgmock_bin_dir "${CMAKE_CURRENT_BINARY_DIR}/gmock") +-set(findgmock_gtest_lib "${findgmock_bin_dir}/gtest/libgtest.a") +-set(findgmock_gtest_main_lib "${findgmock_bin_dir}/gtest/libgtest_main.a") +-set(findgmock_gmock_lib "${findgmock_bin_dir}/libgmock.a") +-set(findgmock_gmock_main_lib "${findgmock_bin_dir}/libgmock_main.a") +- +-include(ExternalProject) +-ExternalProject_Add(GMock SOURCE_DIR "${GMOCK_SOURCE_DIR}" +- BINARY_DIR "${findgmock_bin_dir}" +- BUILD_BYPRODUCTS "${findgmock_gtest_lib}" +- "${findgmock_gtest_main_lib}" +- "${findgmock_gmock_lib}" +- "${findgmock_gmock_main_lib}" +- INSTALL_COMMAND "" +- CMAKE_ARGS "-DCMAKE_CXX_FLAGS=${findgmock_cxx_flags}") +- +-add_library(gtest INTERFACE) +-target_include_directories(gtest INTERFACE ${GTEST_INCLUDE_DIRS}) +-target_link_libraries(gtest INTERFACE ${findgmock_gtest_lib} ${CMAKE_THREAD_LIBS_INIT}) +-add_dependencies(gtest GMock) +- +-add_library(gtest_main INTERFACE) +-target_include_directories(gtest_main INTERFACE ${GTEST_INCLUDE_DIRS}) +-target_link_libraries(gtest_main INTERFACE ${findgmock_gtest_main_lib} gtest) +- +-add_library(gmock INTERFACE) +-target_include_directories(gmock INTERFACE ${GMOCK_INCLUDE_DIRS}) +-target_link_libraries(gmock INTERFACE ${findgmock_gmock_lib} gtest) +- +-add_library(gmock_main INTERFACE) +-target_include_directories(gmock_main INTERFACE ${GMOCK_INCLUDE_DIRS}) +-target_link_libraries(gmock_main INTERFACE ${findgmock_gmock_main_lib} gmock) +- +-set(GTEST_LIBRARIES gtest) +-set(GTEST_MAIN_LIBRARIES gtest_main) +-set(GMOCK_LIBRARIES gmock gmock_main) +-set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES}) +- +-unset(findgmock_cxx_flags) +-unset(findgmock_bin_dir) +-unset(findgmock_gtest_lib) +-unset(findgmock_gtest_main_lib) +-unset(findgmock_gmock_lib) +-unset(findgmock_gmock_main_lib) ++set(GMOCK_LIBRARIES ${GTEST_BOTH_LIBRARIES} ${GMOCK_LIBRARY}) diff --git a/testing/cmake-extras/qmlplugindump_path.patch b/testing/cmake-extras/qmlplugindump_path.patch new file mode 100644 index 0000000000..475b3826ae --- /dev/null +++ b/testing/cmake-extras/qmlplugindump_path.patch @@ -0,0 +1,13 @@ +diff --git a/src/QmlPlugins/QmlPluginsConfig.cmake b/src/QmlPlugins/QmlPluginsConfig.cmake +index f563330..7e326bf 100644 +--- a/src/QmlPlugins/QmlPluginsConfig.cmake ++++ b/src/QmlPlugins/QmlPluginsConfig.cmake +@@ -2,7 +2,7 @@ + # target before loading this plugin. + + if(NOT TARGET qmlplugindump) +- find_program(qmlplugindump_exe qmlplugindump) ++ find_program(qmlplugindump_exe qmlplugindump HINTS /usr/lib/qt5/bin/) + + if(NOT qmlplugindump_exe) + msg(FATAL_ERROR "Could not locate qmlplugindump.") |