summaryrefslogtreecommitdiffstats
path: root/frameworks/qt6/cmake.mk
blob: 4774fd3d01df03682869a012da8d2a71b1cf0510 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#
# Copyright (C) 2026 OpenWrt
# Author: Mirko Vogt <mirko-openwrt@nanl.de>
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/cmake.mk

# the bin-path should be determined correctly via cmake or qmake queries,
# but in case scripts call it relying on it in $PATH, add bin/qt6/ to it.
export PATH:=$(STAGING_DIR_HOSTPKG)/bin/qt6:$(PATH)

CMAKE_OPTIONS += \
  -DQT_HOST_PATH="$(STAGING_DIR_HOSTPKG)" \
  -DQT_QMAKE_TARGET_MKSPEC="linux-openwrt-g++"

# The rpath is needed for the host libraries and executables to find shared
# objects from STAGING_DIR_HOSTPKG (e.g. libdouble-conversion) when linking and
# running. It is passed at the end of the link command, so it comes after the
# build tree's lib dir; otherwise the executables run during the build would
# load a previously installed Qt from STAGING_DIR_HOSTPKG.
# qmake based host builds get it from Qt's rpath feature instead.
CMAKE_HOST_OPTIONS += \
  -DBUILD_SHARED_LIBS=ON \
  -DCMAKE_SKIP_RPATH=FALSE \
  -DCMAKE_C_STANDARD_LIBRARIES="-Wl,-rpath,$(STAGING_DIR_HOSTPKG)/lib" \
  -DCMAKE_CXX_STANDARD_LIBRARIES="-Wl,-rpath,$(STAGING_DIR_HOSTPKG)/lib" \
  -DQT_QMAKE_TARGET_MKSPEC="linux-openwrt-host-g++"