2021-10-01 04:03:56 +08:00
# Reminder for myself and everybody else:
2022-02-02 07:03:34 +08:00
# Qt cross module dependency information within the Qt respository is wrong and/or incomplete.
2021-10-01 04:03:56 +08:00
# Always check the toplevel CMakeLists.txt for the find_package call and search for linkage against the Qt:: targets
2022-02-02 07:03:34 +08:00
# Often enough certain (bigger) dependencies are only used to build examples and/or tests.
2021-10-01 04:03:56 +08:00
# As such getting the correct dependency information relevant for vcpkg requires a manual search/check
2022-04-22 02:42:59 +08:00
set ( QT_IS_LATEST ON )
2021-06-02 02:05:59 +08:00
## All above goes into the qt_port_hashes in the future
include ( "${CMAKE_CURRENT_LIST_DIR}/cmake/qt_install_submodule.cmake" )
2022-02-02 07:03:34 +08:00
set ( ${ PORT } _PATCHES
a l l o w _ o u t s i d e _ p r e f i x . p a t c h
2021-10-01 04:03:56 +08:00
c o n f i g _ i n s t a l l . p a t c h
f i x _ c m a k e _ b u i l d . p a t c h
h a r f b u z z . p a t c h
f i x _ e g l . p a t c h
2022-11-19 04:31:51 +08:00
f i x _ e g l _ 2 . p a t c h
2022-07-26 05:59:41 +08:00
i n s t a l l e d _ d i r . p a t c h
2022-11-19 04:31:51 +08:00
G L I B 2 - s t a t i c . p a t c h # alternative is to force pkg-config
2023-04-27 03:10:56 +08:00
c l a n g - c l _ s o u r c e _ l o c a t i o n . p a t c h
c l a n g - c l _ Q G A D G E T _ f i x . d i f f
2021-06-02 02:05:59 +08:00
)
2022-03-24 03:19:54 +08:00
if ( VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW )
list ( APPEND ${ PORT } _PATCHES env.patch )
endif ( )
2022-07-02 06:48:36 +08:00
list ( APPEND ${ PORT } _PATCHES
d o n t _ f o r c e _ c m a k e c a c h e _ l a t e s t . p a t c h
)
2021-06-02 02:05:59 +08:00
if ( VCPKG_TARGET_IS_WINDOWS AND NOT "doubleconversion" IN_LIST FEATURES )
message ( FATAL_ERROR "${PORT} requires feature doubleconversion on windows!" )
endif ( )
2023-04-15 05:13:05 +08:00
if ( VCPKG_TARGET_IS_LINUX )
message ( WARNING "qtbase currently requires packages from the system package manager. "
" T h e y c a n b e i n s t a l l e d o n U b u n t u s y s t e m s v i a s u d o a p t - g e t i n s t a l l "
" ' ^ l i b x c b . * - d e v ' l i b x 1 1 - x c b - d e v l i b g l u 1 - m e s a - d e v l i b x r e n d e r - d e v l i b x i - d e v l i b x k b c o m m o n - d e v "
" l i b x k b c o m m o n - x 1 1 - d e v . " )
endif ( )
2022-02-02 07:03:34 +08:00
# Features can be found via searching for qt_feature in all configure.cmake files in the source:
2021-06-02 02:05:59 +08:00
# The files also contain information about the Platform for which it is searched
2022-02-16 12:24:55 +08:00
# Always use FEATURE_<feature> in vcpkg_cmake_configure
2021-06-02 02:05:59 +08:00
# (using QT_FEATURE_X overrides Qts condition check for the feature.)
# Theoretically there is a feature for every widget to enable/disable it but that is way to much for vcpkg
set ( input_vars doubleconversion freetype harfbuzz libb2 jpeg libmd4c png sql-sqlite )
set ( INPUT_OPTIONS )
foreach ( _input IN LISTS input_vars )
if ( _input MATCHES "(png|jpeg)" )
list ( APPEND INPUT_OPTIONS -DINPUT_lib ${ _input } :STRING= )
2022-02-16 12:24:55 +08:00
elseif ( _input MATCHES "(sql-sqlite)" ) # Not yet used by the cmake build
2021-06-02 02:05:59 +08:00
else ( )
list ( APPEND INPUT_OPTIONS -DINPUT_ ${ _input } :STRING= )
endif ( )
if ( "${_input}" IN_LIST FEATURES )
string ( APPEND INPUT_OPTIONS system )
elseif ( _input STREQUAL "libb2" AND NOT VCPKG_TARGET_IS_WINDOWS )
string ( APPEND INPUT_OPTIONS system )
elseif ( _input STREQUAL "libmd4c" )
string ( APPEND INPUT_OPTIONS qt ) # libmd4c is not yet in VCPKG (but required by qtdeclarative)
else ( )
string ( APPEND INPUT_OPTIONS no )
endif ( )
endforeach ( )
# General features:
2022-03-24 03:19:54 +08:00
2021-06-02 02:05:59 +08:00
vcpkg_check_features ( OUT_FEATURE_OPTIONS FEATURE_OPTIONS
F E A T U R E S
2022-02-16 12:24:55 +08:00
" a p p s t o r e - c o m p l i a n t " F E A T U R E _ a p p s t o r e _ c o m p l i a n t
2021-06-02 02:05:59 +08:00
" z s t d " F E A T U R E _ z s t d
" f r a m e w o r k " F E A T U R E _ f r a m e w o r k
" c o n c u r r e n t " F E A T U R E _ c o n c u r r e n t
2021-10-01 04:03:56 +08:00
" c o n c u r r e n t " F E A T U R E _ f u t u r e
2021-06-02 02:05:59 +08:00
" d b u s " F E A T U R E _ d b u s
" g u i " F E A T U R E _ g u i
2022-05-28 07:46:07 +08:00
" t h r e a d " F E A T U R E _ t h r e a d
2021-06-02 02:05:59 +08:00
" n e t w o r k " F E A T U R E _ n e t w o r k
" s q l " F E A T U R E _ s q l
" w i d g e t s " F E A T U R E _ w i d g e t s
#"xml" FEATURE_xml # Required to build moc
" t e s t l i b " F E A T U R E _ t e s t l i b
2022-03-24 03:19:54 +08:00
" z s t d " C M A K E _ R E Q U I R E _ F I N D _ P A C K A G E _ z s t d
$ { r e q u i r e _ f e a t u r e s }
2021-06-02 02:05:59 +08:00
I N V E R T E D _ F E A T U R E S
" z s t d " C M A K E _ D I S A B L E _ F I N D _ P A C K A G E _ Z S T D
" d b u s " C M A K E _ D I S A B L E _ F I N D _ P A C K A G E _ W r a p D B u s 1
)
list ( APPEND FEATURE_OPTIONS -DCMAKE_DISABLE_FIND_PACKAGE_Libudev:BOOL=ON )
list ( APPEND FEATURE_OPTIONS -DFEATURE_xml:BOOL=ON )
2022-02-16 12:24:55 +08:00
if ( VCPKG_QT_NAMESPACE )
list ( APPEND FEATURE_OPTIONS "-DQT_NAMESPACE:STRING=${VCPKG_QT_NAMESPACE}" )
2022-02-02 07:03:34 +08:00
endif ( )
2021-06-02 02:05:59 +08:00
# Corelib features:
vcpkg_check_features ( OUT_FEATURE_OPTIONS FEATURE_CORE_OPTIONS
F E A T U R E S
" d o u b l e c o n v e r s i o n " F E A T U R E _ d o u b l e c o n v e r s i o n
" g l i b " F E A T U R E _ g l i b
" i c u " F E A T U R E _ i c u
" p c r e 2 " F E A T U R E _ p c r e 2
2022-03-24 03:19:54 +08:00
#"icu" CMAKE_REQUIRE_FIND_PACKAGE_ICU
" g l i b " C M A K E _ R E Q U I R E _ F I N D _ P A C K A G E _ G L I B 2
2021-06-02 02:05:59 +08:00
I N V E R T E D _ F E A T U R E S
#"doubleconversion" CMAKE_DISABLE_FIND_PACKAGE_WrapDoubleConversion # Required
#"pcre2" CMAKE_DISABLE_FIND_PACKAGE_WrapSystemPCRE2 # Bug in qt cannot be deactivated
2022-03-24 03:19:54 +08:00
" i c u " C M A K E _ D I S A B L E _ F I N D _ P A C K A G E _ I C U
2021-06-02 02:05:59 +08:00
" g l i b " C M A K E _ D I S A B L E _ F I N D _ P A C K A G E _ G L I B 2
)
list ( APPEND FEATURE_CORE_OPTIONS -DCMAKE_DISABLE_FIND_PACKAGE_LTTngUST:BOOL=ON )
list ( APPEND FEATURE_CORE_OPTIONS -DCMAKE_DISABLE_FIND_PACKAGE_PPS:BOOL=ON )
list ( APPEND FEATURE_CORE_OPTIONS -DCMAKE_DISABLE_FIND_PACKAGE_Slog2:BOOL=ON )
list ( APPEND FEATURE_CORE_OPTIONS -DCMAKE_DISABLE_FIND_PACKAGE_Libsystemd:BOOL=ON )
# Network features:
vcpkg_check_features ( OUT_FEATURE_OPTIONS FEATURE_NET_OPTIONS
F E A T U R E S
" o p e n s s l " F E A T U R E _ o p e n s s l
" b r o t l i " F E A T U R E _ b r o t l i
2022-03-24 03:19:54 +08:00
#"brotli" CMAKE_REQUIRE_FIND_PACKAGE_WrapBrotli
#"openssl" CMAKE_REQUIRE_FIND_PACKAGE_WrapOpenSSL
2021-06-02 02:05:59 +08:00
I N V E R T E D _ F E A T U R E S
" b r o t l i " C M A K E _ D I S A B L E _ F I N D _ P A C K A G E _ W r a p B r o t l i
" o p e n s s l " C M A K E _ D I S A B L E _ F I N D _ P A C K A G E _ W r a p O p e n S S L
)
if ( "openssl" IN_LIST FEATURES )
list ( APPEND FEATURE_NET_OPTIONS -DINPUT_openssl=linked )
else ( )
list ( APPEND FEATURE_NET_OPTIONS -DINPUT_openssl=no )
endif ( )
list ( APPEND FEATURE_NET_OPTIONS -DCMAKE_DISABLE_FIND_PACKAGE_Libproxy:BOOL=ON )
list ( APPEND FEATURE_NET_OPTIONS -DCMAKE_DISABLE_FIND_PACKAGE_GSSAPI:BOOL=ON )
# Gui features:
vcpkg_check_features ( OUT_FEATURE_OPTIONS FEATURE_GUI_OPTIONS
F E A T U R E S
" f r e e t y p e " F E A T U R E _ f r e e t y p e # required on windows
" h a r f b u z z " F E A T U R E _ h a r f b u z z
" f o n t c o n f i g " F E A T U R E _ f o n t c o n f i g # NOT WINDOWS
" j p e g " F E A T U R E _ j p e g
" p n g " F E A T U R E _ p n g
2022-11-19 04:31:51 +08:00
" o p e n g l " F E A T U R E _ o p e n g l
2022-02-16 12:24:55 +08:00
" x l i b " F E A T U R E _ x l i b
" x k b " F E A T U R E _ x k b c o m m o n
" x c b " F E A T U R E _ x c b
" x c b - x l i b " F E A T U R E _ x c b _ x l i b
" x k b c o m m o n - x 1 1 " F E A T U R E _ x k b c o m m o n _ x 1 1
" x r e n d e r " F E A T U R E _ x r e n d e r # requires FEATURE_xcb_native_painting; otherwise disabled.
" x r e n d e r " F E A T U R E _ x c b _ n a t i v e _ p a i n t i n g # experimental
2022-11-02 10:58:54 +08:00
" g l e s 2 " F E A T U R E _ o p e n g l e s 2
2022-03-24 03:19:54 +08:00
#"vulkan" CMAKE_REQUIRE_FIND_PACKAGE_Vulkan
2022-11-19 04:31:51 +08:00
" e g l " F E A T U R E _ e g l
2022-03-24 03:19:54 +08:00
#"fontconfig" CMAKE_REQUIRE_FIND_PACKAGE_Fontconfig
#"harfbuzz" CMAKE_REQUIRE_FIND_PACKAGE_WrapSystemHarfbuzz
#"jpeg" CMAKE_REQUIRE_FIND_PACKAGE_JPEG
#"png" CMAKE_REQUIRE_FIND_PACKAGE_PNG
#"xlib" CMAKE_REQUIRE_FIND_PACKAGE_X11
#"xkb" CMAKE_REQUIRE_FIND_PACKAGE_XKB
#"xcb" CMAKE_REQUIRE_FIND_PACKAGE_XCB
#"xcb-xlib" CMAKE_REQUIRE_FIND_PACKAGE_X11_XCB
#"xkbcommon-x11" CMAKE_REQUIRE_FIND_PACKAGE_XKB_COMMON_X11
#"xrender" CMAKE_REQUIRE_FIND_PACKAGE_XRender
2021-06-02 02:05:59 +08:00
I N V E R T E D _ F E A T U R E S
" v u l k a n " C M A K E _ D I S A B L E _ F I N D _ P A C K A G E _ V u l k a n
2022-11-19 04:31:51 +08:00
" o p e n g l " C M A K E _ D I S A B L E _ F I N D _ P A C K A G E _ W r a p O p e n G L
2021-06-02 02:05:59 +08:00
" e g l " C M A K E _ D I S A B L E _ F I N D _ P A C K A G E _ E G L
2022-11-02 10:58:54 +08:00
" g l e s 2 " C M A K E _ D I S A B L E _ F I N D _ P A C K A G E _ G L E S v 2
2021-06-02 02:05:59 +08:00
" f o n t c o n f i g " C M A K E _ D I S A B L E _ F I N D _ P A C K A G E _ F o n t c o n f i g
#"freetype" CMAKE_DISABLE_FIND_PACKAGE_WrapSystemFreetype # Bug in qt cannot be deactivated
" h a r f b u z z " C M A K E _ D I S A B L E _ F I N D _ P A C K A G E _ W r a p S y s t e m H a r f b u z z
" j p e g " C M A K E _ D I S A B L E _ F I N D _ P A C K A G E _ J P E G
" p n g " C M A K E _ D I S A B L E _ F I N D _ P A C K A G E _ P N G
" x l i b " C M A K E _ D I S A B L E _ F I N D _ P A C K A G E _ X 1 1
" x k b " C M A K E _ D I S A B L E _ F I N D _ P A C K A G E _ X K B
" x c b " C M A K E _ D I S A B L E _ F I N D _ P A C K A G E _ X C B
" x c b - x l i b " C M A K E _ D I S A B L E _ F I N D _ P A C K A G E _ X 1 1 _ X C B
" x k b c o m m o n - x 1 1 " C M A K E _ D I S A B L E _ F I N D _ P A C K A G E _ X K B _ C O M M O N _ X 1 1
" x r e n d e r " C M A K E _ D I S A B L E _ F I N D _ P A C K A G E _ X R e n d e r
# There are more X features but I am unsure how to safely disable them! Most of them seem to be found automaticall with find_package(X11)
)
2022-11-19 04:31:51 +08:00
if ( "gles2" IN_LIST FEATURES )
list ( APPEND FEATURE_GUI_OPTIONS -DINPUT_opengl='es2' )
list ( APPEND FEATURE_GUI_OPTIONS -DFEATURE_opengl_desktop=OFF )
endif ( )
if ( NOT "opengl" IN_LIST FEATURES AND NOT "gles2" IN_LIST FEATURES )
list ( APPEND FEATURE_GUI_OPTIONS -DINPUT_opengl='no' )
list ( APPEND FEATURE_GUI_OPTIONS -DFEATURE_opengl_desktop=OFF )
list ( APPEND FEATURE_GUI_OPTIONS -DFEATURE_opengl_dynamic=OFF )
endif ( )
2021-06-02 02:05:59 +08:00
if ( "xcb" IN_LIST FEATURES )
list ( APPEND FEATURE_GUI_OPTIONS -DINPUT_xcb=yes )
else ( )
list ( APPEND FEATURE_GUI_OPTIONS -DINPUT_xcb=no )
endif ( )
if ( "xkb" IN_LIST FEATURES )
list ( APPEND FEATURE_GUI_OPTIONS -DINPUT_xkbcommon=yes )
else ( )
list ( APPEND FEATURE_GUI_OPTIONS -DINPUT_xkbcommon=no )
endif ( )
2022-11-02 10:58:54 +08:00
# Disable GLES3
list ( APPEND FEATURE_GUI_OPTIONS -DFEATURE_opengles3:BOOL=OFF )
list ( APPEND FEATURE_GUI_OPTIONS -DFEATURE_opengles31:BOOL=OFF )
list ( APPEND FEATURE_GUI_OPTIONS -DFEATURE_opengles32:BOOL=OFF )
2021-06-02 02:05:59 +08:00
list ( APPEND FEATURE_GUI_OPTIONS -DCMAKE_DISABLE_FIND_PACKAGE_ATSPI2:BOOL=ON )
list ( APPEND FEATURE_GUI_OPTIONS -DCMAKE_DISABLE_FIND_PACKAGE_DirectFB:BOOL=ON )
list ( APPEND FEATURE_GUI_OPTIONS -DCMAKE_DISABLE_FIND_PACKAGE_Libdrm:BOOL=ON )
list ( APPEND FEATURE_GUI_OPTIONS -DCMAKE_DISABLE_FIND_PACKAGE_gbm:BOOL=ON )
list ( APPEND FEATURE_GUI_OPTIONS -DCMAKE_DISABLE_FIND_PACKAGE_Libinput:BOOL=ON )
list ( APPEND FEATURE_GUI_OPTIONS -DCMAKE_DISABLE_FIND_PACKAGE_Mtdev:BOOL=ON )
list ( APPEND FEATURE_GUI_OPTIONS -DCMAKE_DISABLE_FIND_PACKAGE_Tslib:BOOL=ON )
# sql-drivers features:
vcpkg_check_features ( OUT_FEATURE_OPTIONS FEATURE_SQLDRIVERS_OPTIONS
F E A T U R E S
" s q l - s q l i t e " F E A T U R E _ s y s t e m _ s q l i t e
2022-09-16 03:30:09 +08:00
" s q l - o d b c " F E A T U R E _ s q l _ o d b c
2022-11-19 04:31:51 +08:00
" s q l - m y s q l " F E A T U R E _ s q l _ m y s q l
" s q l - o c i " F E A T U R E _ s q l _ o c i
2022-03-24 03:19:54 +08:00
#"sql-psql" CMAKE_REQUIRE_FIND_PACKAGE_PostgreSQL
#"sql-sqlite" CMAKE_REQUIRE_FIND_PACKAGE_SQLite3
2021-06-02 02:05:59 +08:00
I N V E R T E D _ F E A T U R E S
" s q l - p s q l " C M A K E _ D I S A B L E _ F I N D _ P A C K A G E _ P o s t g r e S Q L
" s q l - s q l i t e " C M A K E _ D I S A B L E _ F I N D _ P A C K A G E _ S Q L i t e 3
2022-09-16 03:30:09 +08:00
" s q l - o d b c " C M A K E _ D I S A B L E _ F I N D _ P A C K A G E _ O D B C
2022-11-19 04:31:51 +08:00
" s q l - m y s q l " C M A K E _ D I S A B L E _ F I N D _ P A C K A G E _ M y S Q L
" s q l - o c i " C M A K E _ D I S A B L E _ F I N D _ P A C K A G E _ O r a c l e
2021-06-02 02:05:59 +08:00
)
2022-11-19 04:31:51 +08:00
set ( DB_LIST DB2 Interbase )
2021-06-02 02:05:59 +08:00
foreach ( _db IN LISTS DB_LIST )
list ( APPEND FEATURE_SQLDRIVERS_OPTIONS -DCMAKE_DISABLE_FIND_PACKAGE_ ${ _db } :BOOL=ON )
endforeach ( )
# printsupport features:
# vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_PRINTSUPPORT_OPTIONS
# )
list ( APPEND FEATURE_PRINTSUPPORT_OPTIONS -DCMAKE_DISABLE_FIND_PACKAGE_CUPS:BOOL=ON )
# widgets features:
# vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_WIDGETS_OPTIONS
# "gtk3" FEATURE_gtk3
2022-02-02 07:03:34 +08:00
# There are a lot of additional features here to deactivate parts of widgets.
2021-06-02 02:05:59 +08:00
# )
list ( APPEND FEATURE_WIDGETS_OPTIONS -DCMAKE_DISABLE_FIND_PACKAGE_GTK3:BOOL=ON )
2022-02-02 07:03:34 +08:00
set ( TOOL_NAMES
a n d r o i d d e p l o y q t
a n d r o i d t e s t r u n n e r
c m a k e _ a u t o m o c _ p a r s e r
m o c
q d b u s c p p 2 x m l
q d b u s x m l 2 c p p
q l a l r
q m a k e
q m a k e 6
q v k g e n
r c c
t r a c e g e n
2021-06-02 02:05:59 +08:00
u i c
2021-10-01 04:03:56 +08:00
q t p a t h s
q t p a t h s 6
2022-04-22 02:42:59 +08:00
w i n d e p l o y q t
2023-04-27 03:10:56 +08:00
w i n d e p l o y q t 6
2022-04-22 02:42:59 +08:00
m a c d e p l o y q t
2023-04-27 03:10:56 +08:00
m a c d e p l o y q t 6
a n d r o i d d e p l o y q t 6
s y n c q t
t r a c e p o i n t g e n
2021-06-02 02:05:59 +08:00
)
qt_install_submodule ( PATCHES ${ ${PORT } _PATCHES}
T O O L _ N A M E S $ { T O O L _ N A M E S }
C O N F I G U R E _ O P T I O N S
#--trace-expand
$ { F E A T U R E _ O P T I O N S }
$ { F E A T U R E _ C O R E _ O P T I O N S }
$ { F E A T U R E _ N E T _ O P T I O N S }
$ { F E A T U R E _ G U I _ O P T I O N S }
$ { F E A T U R E _ S Q L D R I V E R S _ O P T I O N S }
$ { F E A T U R E _ P R I N T S U P P O R T _ O P T I O N S }
$ { F E A T U R E _ W I D G E T S _ O P T I O N S }
$ { I N P U T _ O P T I O N S }
- D Q T _ U S E _ B U N D L E D _ B u n d l e d F r e e t y p e : B O O L = F A L S E
- D Q T _ U S E _ B U N D L E D _ B u n d l e d H a r f b u z z : B O O L = F A L S E
- D Q T _ U S E _ B U N D L E D _ B u n d l e d L i b p n g : B O O L = F A L S E
- D Q T _ U S E _ B U N D L E D _ B u n d l e d P c r e 2 : B O O L = F A L S E
- D I N P U T _ b u n d l e d _ x c b _ x i n p u t : S T R I N G = n o
- D F E A T U R E _ f o r c e _ d e b u g _ i n f o : B O O L = O N
- D F E A T U R E _ r e l o c a t a b l e : B O O L = O N
C O N F I G U R E _ O P T I O N S _ R E L E A S E
C O N F I G U R E _ O P T I O N S _ D E B U G
- D F E A T U R E _ d e b u g : B O O L = O N
2022-02-16 12:24:55 +08:00
C O N F I G U R E _ O P T I O N S _ M A Y B E _ U N U S E D
F E A T U R E _ a p p s t o r e _ c o m p l i a n t # only used for android/ios
2021-06-02 02:05:59 +08:00
)
# Install CMake helper scripts
file ( COPY
2022-07-02 06:48:36 +08:00
" $ { C M A K E _ C U R R E N T _ L I S T _ D I R } / c m a k e / "
2021-06-02 02:05:59 +08:00
D E S T I N A T I O N
" $ { C U R R E N T _ P A C K A G E S _ D I R } / s h a r e / $ { P O R T } "
)
2023-04-19 09:51:50 +08:00
file ( CONFIGURE OUTPUT "${CURRENT_PACKAGES_DIR}/share/${PORT}/port_status.cmake" CONTENT "set(qtbase_with_icu ${FEATURE_icu})\n" )
2022-07-02 06:48:36 +08:00
set ( other_files qt-cmake
q t - c m a k e - p r i v a t e
q t - c m a k e - s t a n d a l o n e - t e s t
q t - c o n f i g u r e - m o d u l e
q t - i n t e r n a l - c o n f i g u r e - t e s t s
)
2021-10-01 04:03:56 +08:00
if ( CMAKE_HOST_WIN32 )
2021-06-02 02:05:59 +08:00
set ( script_suffix .bat )
else ( )
set ( script_suffix )
endif ( )
2022-07-02 06:48:36 +08:00
list ( TRANSFORM other_files APPEND "${script_suffix}" )
list ( APPEND other_files
a n d r o i d _ c m a k e l i s t _ p a t c h e r . s h
a n d r o i d _ e m u l a t o r _ l a u n c h e r . s h
e n s u r e _ p r o _ f i l e . c m a k e
s y n c q t . p l
t a r g e t _ q t . c o n f
q t - c m a k e - p r i v a t e - i n s t a l l . c m a k e
q t - t e s t r u n n e r . p y
2023-04-27 03:10:56 +08:00
s a n i t i z e r - t e s t r u n n e r . p y
2022-07-02 06:48:36 +08:00
)
2021-06-02 02:05:59 +08:00
foreach ( _config debug release )
if ( _config MATCHES "debug" )
set ( path_suffix debug/ )
else ( )
set ( path_suffix )
endif ( )
if ( NOT EXISTS "${CURRENT_PACKAGES_DIR}/${path_suffix}bin" )
continue ( )
endif ( )
2021-06-22 04:45:33 +08:00
file ( MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/Qt6/bin/${path_suffix}" )
2022-07-02 06:48:36 +08:00
foreach ( other_file IN LISTS other_files )
if ( EXISTS "${CURRENT_PACKAGES_DIR}/${path_suffix}bin/${other_file}" )
set ( target_file "${CURRENT_PACKAGES_DIR}/tools/Qt6/bin/${path_suffix}${other_file}" )
file ( RENAME "${CURRENT_PACKAGES_DIR}/${path_suffix}bin/${other_file}" "${target_file}" )
file ( READ "${target_file}" _contents )
2021-06-02 02:05:59 +08:00
if ( _config MATCHES "debug" )
2022-07-02 06:48:36 +08:00
string ( REPLACE "..\\share\\" "..\\..\\..\\..\\share\\" _contents "${_contents}" )
string ( REPLACE "../share/" "../../../../share/" _contents "${_contents}" )
2021-06-02 02:05:59 +08:00
else ( )
2022-07-02 06:48:36 +08:00
string ( REPLACE "..\\share\\" "..\\..\\..\\share\\" _contents "${_contents}" )
string ( REPLACE "../share/" "../../../share/" _contents "${_contents}" )
2021-06-02 02:05:59 +08:00
endif ( )
2022-07-02 06:48:36 +08:00
string ( REGEX REPLACE "set cmake_path=[^\n]+\n" "set cmake_path=cmake\n" _contents "${_contents}" )
file ( WRITE "${target_file}" "${_contents}" )
2021-06-02 02:05:59 +08:00
endif ( )
endforeach ( )
endforeach ( )
2022-07-02 06:48:36 +08:00
# Fixup qt.toolchain.cmake
set ( qttoolchain "${CURRENT_PACKAGES_DIR}/share/Qt6/qt.toolchain.cmake" )
file ( READ "${qttoolchain}" toolchain_contents )
string ( REGEX REPLACE "set\\\(__qt_initially_configured_toolchain_file [^\\\n]+\\\n" "" toolchain_contents "${toolchain_contents}" )
string ( REGEX REPLACE "set\\\(__qt_chainload_toolchain_file [^\\\n]+\\\n" "set(__qt_chainload_toolchain_file \" \${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}\")" toolchain_contents "${toolchain_contents}" )
string ( REGEX REPLACE "set\\\(VCPKG_CHAINLOAD_TOOLCHAIN_FILE [^\\\n]+\\\n" "" toolchain_contents "${toolchain_contents}" )
string ( REGEX REPLACE "set\\\(__qt_initial_c_compiler [^\\\n]+\\\n" "" toolchain_contents "${toolchain_contents}" )
string ( REGEX REPLACE "set\\\(__qt_initial_cxx_compiler [^\\\n]+\\\n" "" toolchain_contents "${toolchain_contents}" )
2022-07-26 05:59:41 +08:00
string ( REPLACE "${CURRENT_HOST_INSTALLED_DIR}" "\${vcpkg_installed_dir}/${HOST_TRIPLET}" toolchain_contents "${toolchain_contents}" )
2022-07-02 06:48:36 +08:00
file ( WRITE "${qttoolchain}" "${toolchain_contents}" )
2022-07-12 07:27:05 +08:00
if ( VCPKG_LIBRARY_LINKAGE STREQUAL "static" OR NOT VCPKG_TARGET_IS_WINDOWS )
2021-10-01 04:03:56 +08:00
if ( VCPKG_CROSSCOMPILING )
file ( REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin/qmake" "${CURRENT_PACKAGES_DIR}/debug/bin/qmake" ) # qmake has been moved so this is the qmake helper script
endif ( )
2021-06-02 02:05:59 +08:00
file ( GLOB_RECURSE _bin_files "${CURRENT_PACKAGES_DIR}/bin/*" )
2022-02-02 07:03:34 +08:00
if ( NOT _bin_files ) # Only clean if empty otherwise let vcpkg throw and error.
2021-06-02 02:05:59 +08:00
file ( REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin/" "${CURRENT_PACKAGES_DIR}/debug/bin/" )
2022-07-02 06:48:36 +08:00
else ( )
message ( STATUS "Files in '/bin':${_bin_files}" )
2021-06-02 02:05:59 +08:00
endif ( )
endif ( )
file ( REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/Qt6/QtBuildInternals" )
if ( NOT VCPKG_TARGET_IS_OSX )
file ( REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/Qt6/macos" )
endif ( )
2021-06-22 04:45:33 +08:00
if ( NOT VCPKG_TARGET_IS_IOS )
file ( REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/Qt6/ios" )
2022-02-02 07:03:34 +08:00
endif ( )
2021-06-02 02:05:59 +08:00
2021-12-10 10:19:33 +08:00
file ( RELATIVE_PATH installed_to_host "${CURRENT_INSTALLED_DIR}" "${CURRENT_HOST_INSTALLED_DIR}" )
file ( RELATIVE_PATH host_to_installed "${CURRENT_HOST_INSTALLED_DIR}" "${CURRENT_INSTALLED_DIR}" )
if ( installed_to_host )
string ( APPEND installed_to_host "/" )
string ( APPEND host_to_installed "/" )
endif ( )
2021-06-02 02:05:59 +08:00
set ( _file "${CMAKE_CURRENT_LIST_DIR}/qt.conf.in" )
2021-12-10 10:19:33 +08:00
set ( REL_PATH "" )
2022-02-16 12:24:55 +08:00
set ( REL_HOST_TO_DATA "\${CURRENT_INSTALLED_DIR}/" )
2021-12-10 10:19:33 +08:00
configure_file ( "${_file}" "${CURRENT_PACKAGES_DIR}/tools/Qt6/qt_release.conf" @ONLY ) # For vcpkg-qmake
2021-06-02 02:05:59 +08:00
set ( BACKUP_CURRENT_INSTALLED_DIR "${CURRENT_INSTALLED_DIR}" )
set ( BACKUP_CURRENT_HOST_INSTALLED_DIR "${CURRENT_HOST_INSTALLED_DIR}" )
set ( CURRENT_INSTALLED_DIR "./../../../" )
2021-12-10 10:19:33 +08:00
set ( CURRENT_HOST_INSTALLED_DIR "${CURRENT_INSTALLED_DIR}${installed_to_host}" )
## Configure installed qt.conf
set ( REL_HOST_TO_DATA "${host_to_installed}" )
2021-06-22 04:45:33 +08:00
configure_file ( "${_file}" "${CURRENT_PACKAGES_DIR}/tools/Qt6/bin/qt.conf" )
2021-06-02 02:05:59 +08:00
set ( REL_PATH debug/ )
2021-06-22 04:45:33 +08:00
configure_file ( "${_file}" "${CURRENT_PACKAGES_DIR}/tools/Qt6/bin/qt.debug.conf" )
2021-12-10 10:19:33 +08:00
2021-06-02 02:05:59 +08:00
set ( CURRENT_INSTALLED_DIR "${BACKUP_CURRENT_INSTALLED_DIR}" )
set ( CURRENT_HOST_INSTALLED_DIR "${BACKUP_CURRENT_HOST_INSTALLED_DIR}" )
2022-02-16 12:24:55 +08:00
set ( REL_HOST_TO_DATA "\${CURRENT_INSTALLED_DIR}/" )
2021-12-10 10:19:33 +08:00
configure_file ( "${_file}" "${CURRENT_PACKAGES_DIR}/tools/Qt6/qt_debug.conf" @ONLY ) # For vcpkg-qmake
2021-06-02 02:05:59 +08:00
if ( VCPKG_TARGET_IS_WINDOWS )
set ( _DLL_FILES brotlicommon brotlidec bz2 freetype harfbuzz libpng16 )
2022-07-02 06:48:36 +08:00
set ( DLLS_TO_COPY "" )
2021-06-02 02:05:59 +08:00
foreach ( _file IN LISTS _DLL_FILES )
if ( EXISTS "${CURRENT_INSTALLED_DIR}/bin/${_file}.dll" )
list ( APPEND DLLS_TO_COPY "${CURRENT_INSTALLED_DIR}/bin/${_file}.dll" )
endif ( )
endforeach ( )
2021-06-22 04:45:33 +08:00
file ( COPY ${ DLLS_TO_COPY } DESTINATION "${CURRENT_PACKAGES_DIR}/tools/Qt6/bin" )
2021-06-02 02:05:59 +08:00
endif ( )
set ( hostinfofile "${CURRENT_PACKAGES_DIR}/share/Qt6HostInfo/Qt6HostInfoConfig.cmake" )
file ( READ "${hostinfofile}" _contents )
2021-06-22 04:45:33 +08:00
string ( REPLACE [[set(QT6_HOST_INFO_LIBEXECDIR "bin" ) ] ] [ [ set ( QT6_HOST_INFO_LIBEXECDIR "tools/Qt6/bin" ) ] ] _ c o n t e n t s " $ { _ c o n t e n t s } " )
string ( REPLACE [[set(QT6_HOST_INFO_BINDIR "bin" ) ] ] [ [ set ( QT6_HOST_INFO_BINDIR "tools/Qt6/bin" ) ] ] _ c o n t e n t s " $ { _ c o n t e n t s } " )
2021-06-02 02:05:59 +08:00
file ( WRITE "${hostinfofile}" "${_contents}" )
2023-04-27 03:10:56 +08:00
if ( NOT VCPKG_CROSSCOMPILING OR EXISTS "${CURRENT_PACKAGES_DIR}/share/Qt6CoreTools/Qt6CoreToolsAdditionalTargetInfo.cmake" )
vcpkg_replace_string ( "${CURRENT_PACKAGES_DIR}/share/Qt6CoreTools/Qt6CoreToolsAdditionalTargetInfo.cmake"
" P A C K A G E _ P R E F I X _ D I R } / b i n / s y n c q t "
" P A C K A G E _ P R E F I X _ D I R } / t o o l s / Q t 6 / b i n / s y n c q t " )
endif ( )
2022-07-02 06:48:36 +08:00
set ( configfile "${CURRENT_PACKAGES_DIR}/share/Qt6CoreTools/Qt6CoreToolsTargets-debug.cmake" )
if ( EXISTS "${configfile}" )
file ( READ "${configfile}" _contents )
if ( EXISTS "${CURRENT_PACKAGES_DIR}/tools/Qt6/bin/qmake.exe" )
file ( INSTALL "${CMAKE_CURRENT_LIST_DIR}/qmake.debug.bat" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/Qt6/bin" )
2022-05-06 02:00:03 +08:00
string ( REPLACE [[ "${_IMPORT_PREFIX}/tools/Qt6/bin/qmake.exe" ]] [[ "${_IMPORT_PREFIX}/tools/Qt6/bin/qmake.debug.bat" ]] _contents "${_contents}" )
endif ( )
2022-07-02 06:48:36 +08:00
if ( EXISTS "${CURRENT_PACKAGES_DIR}/tools/Qt6/bin/qtpaths.exe" )
file ( INSTALL "${CMAKE_CURRENT_LIST_DIR}/qtpaths.debug.bat" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/Qt6/bin" )
string ( REPLACE [[ "${_IMPORT_PREFIX}/tools/Qt6/bin/qtpaths.exe" ]] [[ "${_IMPORT_PREFIX}/tools/Qt6/bin/qtpaths.debug.bat" ]] _contents "${_contents}" )
endif ( )
if ( EXISTS "${CURRENT_PACKAGES_DIR}/tools/Qt6/bin/windeployqt.exe" )
file ( INSTALL "${CMAKE_CURRENT_LIST_DIR}/windeployqt.debug.bat" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/Qt6/bin" )
string ( REPLACE [[ "${_IMPORT_PREFIX}/tools/Qt6/bin/windeployqt.exe" ]] [[ "${_IMPORT_PREFIX}/tools/Qt6/bin/windeployqt.debug.bat" ]] _contents "${_contents}" )
endif ( )
file ( WRITE "${configfile}" "${_contents}" )
2021-06-02 02:05:59 +08:00
endif ( )
2022-07-02 06:48:36 +08:00
2022-12-29 08:52:28 +08:00
if ( VCPKG_CROSSCOMPILING )
vcpkg_replace_string ( "${CURRENT_PACKAGES_DIR}/share/Qt6/Qt6Dependencies.cmake" "${CURRENT_HOST_INSTALLED_DIR}" "\${CMAKE_CURRENT_LIST_DIR}/../../../${HOST_TRIPLET}" )
endif ( )
2023-06-09 02:17:29 +08:00
2023-06-14 05:37:40 +08:00
function ( remove_original_cmake_path file )
file ( READ "${file}" _contents )
string ( REGEX REPLACE "original_cmake_path=[^\n]*" "original_cmake_path=''" _contents "${_contents}" )
file ( WRITE "${file}" "${_contents}" )
endfunction ( )
if ( NOT VCPKG_TARGET_IS_WINDOWS )
foreach ( file "qt-cmake" "qt-cmake-private" )
remove_original_cmake_path ( "${CURRENT_PACKAGES_DIR}/tools/Qt6/bin/${file}" )
if ( NOT VCPKG_BUILD_TYPE )
remove_original_cmake_path ( "${CURRENT_PACKAGES_DIR}/tools/Qt6/bin/debug/${file}" )
endif ( )
endforeach ( )
endif ( )