From 0ef3951c03ee2061cfa536e10e810a85ebf25864 Mon Sep 17 00:00:00 2001 From: Tony Theodore Date: Sat, 9 Nov 2019 04:15:59 +1100 Subject: [PATCH] qttools: standardise cmake test --- Makefile | 10 ++++++ src/qttools-test.cmake | 15 ++++++++ ...e-cmake-qtuitools.cpp => qttools-test.cpp} | 0 src/qttools-test/CMakeLists.txt | 36 ------------------- src/qttools.mk | 8 +---- 5 files changed, 26 insertions(+), 43 deletions(-) create mode 100644 src/qttools-test.cmake rename src/{qttools-test/mxe-cmake-qtuitools.cpp => qttools-test.cpp} (100%) delete mode 100644 src/qttools-test/CMakeLists.txt diff --git a/Makefile b/Makefile index 928b2a0f..3de81dab 100644 --- a/Makefile +++ b/Makefile @@ -208,6 +208,16 @@ define AUTOTOOLS_BUILD $(AUTOTOOLS_MAKE) endef +define CMAKE_TEST + # test cmake + mkdir '$(BUILD_DIR).test-cmake' + cd '$(BUILD_DIR).test-cmake' && '$(TARGET)-cmake' \ + -DPKG=$(PKG) \ + -DPKG_VERSION=$($(PKG)_VERSION) \ + '$(PWD)/src/cmake/test' + $(MAKE) -C '$(BUILD_DIR).test-cmake' -j 1 install +endef + # include github related functions include $(PWD)/mxe.github.mk diff --git a/src/qttools-test.cmake b/src/qttools-test.cmake new file mode 100644 index 00000000..7291eb8e --- /dev/null +++ b/src/qttools-test.cmake @@ -0,0 +1,15 @@ +# This file is part of MXE. See LICENSE.md for licensing information. + +# partial module - included by src/cmake/CMakeLists.txt + +set(TGT test-${PKG}-cmake) + +enable_language(CXX) +add_executable(${TGT} ${CMAKE_CURRENT_LIST_DIR}/${PKG}-test.cpp) + +find_package(Qt5 ${PKG_VERSION} EXACT REQUIRED COMPONENTS UiTools) + +# still requires extra Qt5::Gui since cmake gets the ordering wrong +target_link_libraries(${TGT} Qt5::UiTools Qt5::Gui) + +install(TARGETS ${TGT} DESTINATION bin) diff --git a/src/qttools-test/mxe-cmake-qtuitools.cpp b/src/qttools-test.cpp similarity index 100% rename from src/qttools-test/mxe-cmake-qtuitools.cpp rename to src/qttools-test.cpp diff --git a/src/qttools-test/CMakeLists.txt b/src/qttools-test/CMakeLists.txt deleted file mode 100644 index d4d03c83..00000000 --- a/src/qttools-test/CMakeLists.txt +++ /dev/null @@ -1,36 +0,0 @@ -# This file is part of MXE. See LICENSE.md for licensing information. - -# Source: https://github.com/mxe/mxe/issues/1185 - -cmake_minimum_required(VERSION 3.0) -find_package(Qt5 REQUIRED COMPONENTS Core Widgets Gui UiTools) - -include_directories(${Qt5UiTools_INCLUDE_DIRS}) -add_executable(mxe-cmake-qtuitools mxe-cmake-qtuitools.cpp) -# NB: Qt5Widgets, Qt5Gui, Qt5Core must be given separately; otherwise they are -# appended automatically at the end, making it impossible to satisfy all the -# other implicit dependencies (opengl, harfbuzz, etc.) -target_link_libraries( - mxe-cmake-qtuitools - ${Qt5UiTools_LIBRARIES} - ${Qt5Widgets_LIBRARIES} - ${Qt5Gui_LIBRARIES} - ${Qt5Core_LIBRARIES} - netapi32 - userenv - opengl32 - harfbuzz - jpeg - png - glib-2.0 - winmm - dwmapi - uxtheme - ws2_32 - intl - iconv - pcre2-16 - version - z - zstd -) diff --git a/src/qttools.mk b/src/qttools.mk index d54567b6..5fdc2587 100644 --- a/src/qttools.mk +++ b/src/qttools.mk @@ -12,8 +12,6 @@ $(PKG)_URL = $(subst qtbase,qttools,$(qtbase_URL)) $(PKG)_DEPS := cc qtactiveqt qtbase qtdeclarative $(PKG)_TARGETS := $(BUILD) $(MXE_TARGETS) -$(PKG)_TEST_DIR := $(dir $(lastword $(MAKEFILE_LIST)))/qttools-test - define $(PKG)_UPDATE echo $(qtbase_VERSION) endef @@ -24,11 +22,7 @@ define $(PKG)_BUILD $(MAKE) -C '$(1)' -j 1 install # test QUiLoader - mkdir '$(1)'.test - cd '$(1)'.test && '$(TARGET)-cmake' '$($(PKG)_TEST_DIR)' - $(MAKE) -C '$(1)'.test - cp '$(1)'.test/mxe-cmake-qtuitools.exe \ - '$(PREFIX)/$(TARGET)/bin/test-qttools.exe' + $(CMAKE_TEST) endef define $(PKG)_BUILD_$(BUILD)