qttools: standardise cmake test

This commit is contained in:
Tony Theodore 2019-11-09 04:15:59 +11:00
parent 405b8ab227
commit 0ef3951c03
5 changed files with 26 additions and 43 deletions

View File

@ -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

15
src/qttools-test.cmake Normal file
View File

@ -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)

View File

@ -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
)

View File

@ -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)