@@ -71,7 +71,7 @@ const flaggedList = (flag: string, listArgs: readonly string[]): string[] => {
71
71
return listArgs . length ? [ flag , ...listArgs ] : [ ] ;
72
72
} ;
73
73
74
- const locateQtArchDir = ( installDir : string ) : string => {
74
+ const locateQtArchDir = ( installDir : string ) : [ string , boolean ] => {
75
75
// For 6.4.2/gcc, qmake is at 'installDir/6.4.2/gcc_64/bin/qmake'.
76
76
// This makes a list of all the viable arch directories that contain a qmake file.
77
77
const qtArchDirs = glob
@@ -84,16 +84,18 @@ const locateQtArchDir = (installDir: string): string => {
84
84
const requiresParallelDesktop = qtArchDirs . filter ( ( archPath ) => {
85
85
const archDir = path . basename ( archPath ) ;
86
86
const versionDir = path . basename ( path . join ( archPath , ".." ) ) ;
87
- return versionDir . match ( / ^ 6 \. \d + \. \d + $ / ) && archDir . match ( / ^ ( a n d r o i d * | i o s | w a s m * | m s v c * _ a r m 6 4 ) $ / ) ;
87
+ return (
88
+ versionDir . match ( / ^ 6 \. \d + \. \d + $ / ) && archDir . match ( / ^ ( a n d r o i d .* | i o s | w a s m .* | m s v c .* _ a r m 6 4 ) $ / )
89
+ ) ;
88
90
} ) ;
89
91
if ( requiresParallelDesktop . length ) {
90
92
// NOTE: if multiple mobile/wasm installations coexist, this may not select the desired directory
91
- return requiresParallelDesktop [ 0 ] ;
93
+ return [ requiresParallelDesktop [ 0 ] , true ] ;
92
94
} else if ( ! qtArchDirs . length ) {
93
95
throw Error ( `Failed to locate a Qt installation directory in ${ installDir } ` ) ;
94
96
} else {
95
97
// NOTE: if multiple Qt installations exist, this may not select the desired directory
96
- return qtArchDirs [ 0 ] ;
98
+ return [ qtArchDirs [ 0 ] , false ] ;
97
99
}
98
100
} ;
99
101
@@ -455,7 +457,7 @@ const run = async (): Promise<void> => {
455
457
}
456
458
// Set environment variables/outputs for binaries
457
459
if ( inputs . isInstallQtBinaries ) {
458
- const qtPath = locateQtArchDir ( inputs . dir ) ;
460
+ const [ qtPath , requiresParallelDesktop ] = locateQtArchDir ( inputs . dir ) ;
459
461
// Set outputs
460
462
core . setOutput ( "qtPath" , qtPath ) ;
461
463
@@ -474,6 +476,15 @@ const run = async (): Promise<void> => {
474
476
core . exportVariable ( "QT_ROOT_DIR" , qtPath ) ;
475
477
core . exportVariable ( "QT_PLUGIN_PATH" , path . resolve ( qtPath , "plugins" ) ) ;
476
478
core . exportVariable ( "QML2_IMPORT_PATH" , path . resolve ( qtPath , "qml" ) ) ;
479
+ if ( requiresParallelDesktop ) {
480
+ const hostPrefix = await fs . promises
481
+ . readFile ( path . join ( qtPath , "bin" , "target_qt.conf" ) , "utf8" )
482
+ . then ( ( data ) => data . match ( / ^ H o s t P r e f i x = ( .* ) $ / m) ?. [ 1 ] . trim ( ) ?? "" )
483
+ . catch ( ( ) => "" ) ;
484
+ if ( hostPrefix ) {
485
+ core . exportVariable ( "QT_HOST_PATH" , path . resolve ( qtPath , "bin" , hostPrefix ) ) ;
486
+ }
487
+ }
477
488
core . addPath ( path . resolve ( qtPath , "bin" ) ) ;
478
489
}
479
490
}
0 commit comments