Revision | 7d92fc216f401590ec02574d5500592e05a4af20 (tree) |
---|---|
Time | 2022-11-19 18:56:23 |
Author | Fs <Fsu0413@vip....> |
Commiter | Fs |
CMake tweak of cross builds
@@ -29,13 +29,15 @@ if [ ! -e "${PATH_TO_HOST}/bin/qt-cmake" ]; then | ||
29 | 29 | exit 1 |
30 | 30 | fi |
31 | 31 | |
32 | -mkdir $PATH_TO_TARGET/host | |
33 | -cp -R $PATH_TO_HOST/bin $PATH_TO_TARGET/host/ | |
34 | -[ -d "${PATH_TO_HOST}/libexec" ] && cp -R ${PATH_TO_HOST}/libexec $PATH_TO_TARGET/host/ | |
35 | -mkdir $PATH_TO_TARGET/host/lib | |
36 | -cp -R $PATH_TO_HOST/lib/cmake $PATH_TO_TARGET/host/lib/ | |
37 | -cp -R $PATH_TO_HOST/lib/metatypes $PATH_TO_TARGET/host/lib/ | |
38 | -find $PATH_TO_HOST/lib/ -name \*.prl -maxdepth 1 -exec cp '{}' $PATH_TO_TARGET/host/lib ';' | |
32 | +mkdir "${PATH_TO_TARGET}/host" | |
33 | +cp -R "${PATH_TO_HOST}/bin" "${PATH_TO_TARGET}/host/" | |
34 | +[ -d "${PATH_TO_HOST}/libexec" ] && cp -R "${PATH_TO_HOST}/libexec" "${PATH_TO_TARGET}/host/" | |
35 | +mkdir "${PATH_TO_TARGET}/host/lib" | |
36 | +cp -R "${PATH_TO_HOST}/lib/cmake" "${PATH_TO_TARGET}/host/lib/" | |
37 | +cp -R "${PATH_TO_HOST}/lib/metatypes" "${PATH_TO_TARGET}/host/lib/" | |
38 | +find "${PATH_TO_HOST}/lib/" -name '*.prl' -maxdepth 1 -exec cp '{}' "${PATH_TO_TARGET}/host/lib" ';' | |
39 | + | |
40 | +# qmake tweak | |
39 | 41 | |
40 | 42 | ( |
41 | 43 | echo '#!/bin/sh' |
@@ -44,16 +46,26 @@ find $PATH_TO_HOST/lib/ -name \*.prl -maxdepth 1 -exec cp '{}' $PATH_TO_TARGET/h | ||
44 | 46 | echo "script_dir_path=\`(cd \"\$script_dir_path\"; /bin/pwd)\`" |
45 | 47 | echo |
46 | 48 | echo "\$script_dir_path/../host/bin/qmake -qtconf \"\$script_dir_path/target_qt.conf\" \$*" |
47 | -) > $PATH_TO_TARGET/bin/qmake | |
49 | +) > "${PATH_TO_TARGET}/bin/qmake" | |
50 | + | |
51 | +chmod +x "${PATH_TO_TARGET}/bin/qmake" | |
52 | + | |
53 | +( | |
54 | + echo '#!/bin/sh' | |
55 | + echo | |
56 | + echo "script_dir_path=\`dirname \$0\`" | |
57 | + echo "script_dir_path=\`(cd \"\$script_dir_path\"; /bin/pwd)\`" | |
58 | + echo | |
59 | + echo "\$script_dir_path/../host/bin/qtpaths -qtconf \"\$script_dir_path/target_qt.conf\" \$*" | |
60 | +) > "${PATH_TO_TARGET}/bin/qtpaths" | |
61 | + | |
62 | +chmod +x "${PATH_TO_TARGET}/bin/qtpaths" | |
48 | 63 | |
49 | -chmod +x $PATH_TO_TARGET/bin/qmake | |
64 | +sed -i -e 's,^HostPrefix=.*$,HostPrefix=../host,g' "${PATH_TO_TARGET}/bin/target_qt.conf" | |
65 | +sed -i -e 's,^HostData=.*$,HostData=..,g' "${PATH_TO_TARGET}/bin/target_qt.conf" | |
50 | 66 | |
51 | -sed -i -e 's,^HostPrefix=.*$,HostPrefix=../host,g' $PATH_TO_TARGET/bin/target_qt.conf | |
52 | -sed -i -e 's,^HostData=.*$,HostData=..,g' $PATH_TO_TARGET/bin/target_qt.conf | |
67 | +# CMake tweak | |
53 | 68 | |
54 | -# CMake is broken even if we have tried to tweak it | |
55 | -# Temporarily put these things off until we found a solution | |
69 | +sed -i -e 's,^set(__qt_platform_initial_qt_host_path[[:space:]].*$,set(__qt_platform_initial_qt_host_path "${Qt6_DIR}/../../../host"),' "${PATH_TO_TARGET}/lib/cmake/Qt6/Qt6Dependencies.cmake" | |
70 | +sed -i -e 's,^set(__qt_platform_initial_qt_host_path_cmake_dir[[:space:]].*$,set(__qt_platform_initial_qt_host_path "${Qt6_DIR}/../../../host/lib/cmake"),' "${PATH_TO_TARGET}/lib/cmake/Qt6/Qt6Dependencies.cmake" | |
56 | 71 | |
57 | -# Currently all we know is that: | |
58 | -# Qt provides toolchain file which we'd use | |
59 | -# some variable should be modified using 'sed'-like program |
@@ -26,6 +26,7 @@ End If | ||
26 | 26 | |
27 | 27 | fso.CreateFolder PATH_TO_TARGET & "\host" |
28 | 28 | fso.CopyFolder PATH_TO_HOST & "\bin", PATH_TO_TARGET & "\host\bin" |
29 | +If fso.FolderExists(PATH_TO_HOST & "\libexec") Then fso.CopyFolder PATH_TO_HOST & "\libexec", PATH_TO_TARGET & "\host\libexec" | |
29 | 30 | fso.CreateFolder PATH_TO_TARGET & "\host\lib" |
30 | 31 | fso.CopyFolder PATH_TO_HOST & "\lib\cmake", PATH_TO_TARGET & "\host\lib\cmake" |
31 | 32 | fso.CopyFolder PATH_TO_HOST & "\lib\metatypes", PATH_TO_TARGET & "\host\lib\metatypes" |
@@ -38,6 +39,8 @@ For Each hostlibfile In hostlibdir.Files | ||
38 | 39 | End If |
39 | 40 | Next |
40 | 41 | |
42 | +' qmake tweak | |
43 | + | |
41 | 44 | fso.DeleteFile PATH_TO_TARGET & "\bin\qmake.bat" |
42 | 45 | |
43 | 46 | Dim qmake |
@@ -45,6 +48,13 @@ Set qmake = fso.OpenTextFile(PATH_TO_TARGET & "\bin\qmake.bat", 2, True) | ||
45 | 48 | qmake.WriteLine """%~dp0\..\host\bin\qmake"" -qtconf ""%~dp0\target_qt.conf"" %*" |
46 | 49 | qmake.Close |
47 | 50 | |
51 | +fso.DeleteFile PATH_TO_TARGET & "\bin\qtpaths.bat" | |
52 | + | |
53 | +Dim qtpaths | |
54 | +Set qtpaths = fso.OpenTextFile(PATH_TO_TARGET & "\bin\qtpaths.bat", 2, True) | |
55 | +qtpaths.WriteLine """%~dp0\..\host\bin\qtpaths"" -qtconf ""%~dp0\target_qt.conf"" %*" | |
56 | +qtpaths.Close | |
57 | + | |
48 | 58 | Dim target_qtconf |
49 | 59 | Dim target_qtconfold |
50 | 60 | Set target_qtconf = fso.OpenTextFile(PATH_TO_TARGET & "\bin\target_qt.conf.new", 2, True) |
@@ -64,6 +74,28 @@ target_qtconfold.Close | ||
64 | 74 | fso.DeleteFile PATH_TO_TARGET & "\bin\target_qt.conf" |
65 | 75 | fso.MoveFile PATH_TO_TARGET & "\bin\target_qt.conf.new", PATH_TO_TARGET & "\bin\target_qt.conf" |
66 | 76 | |
67 | -' CMake is broken even if we have tried to tweak it | |
68 | -' Temporarily put these things off until we found a solution | |
77 | +' CMake tweak | |
78 | + | |
79 | +Dim Qt6Dependencies_cmake | |
80 | +Dim Qt6Dependencies_cmakeold | |
81 | +Set Qt6Dependencies_cmake = fso.OpenTextFile(PATH_TO_TARGET & "\lib\cmake\Qt6\Qt6Dependencies.cmake.new", 2, True) | |
82 | +Set Qt6Dependencies_cmakeold = fso.OpenTextFile(PATH_TO_TARGET & "\lib\cmake\Qt6\Qt6Dependencies.cmake", 1, False) | |
83 | + | |
84 | +Do until Qt6Dependencies_cmakeold.AtEndOfStream | |
85 | + Dim line | |
86 | + line = Qt6Dependencies_cmakeold.ReadLine | |
87 | + If Left(Trim(line), 38) = "set(__qt_platform_initial_qt_host_path" Then line = "set(__qt_platform_initial_qt_host_path ""${Qt6_DIR}/../../../host"")" | |
88 | + If Left(Trim(line), 48) = "set(__qt_platform_initial_qt_host_path_cmake_dir" Then line = "set(__qt_platform_initial_qt_host_path_cmake_dir ""${Qt6_DIR}/../../../host/lib/cmake"")" | |
89 | + Qt6Dependencies_cmake.WriteLine line | |
90 | +Loop | |
91 | + | |
92 | +Qt6Dependencies_cmake.Close | |
93 | +Qt6Dependencies_cmakeold.Close | |
94 | + | |
95 | +fso.DeleteFile PATH_TO_TARGET & "\lib\cmake\Qt6\Qt6Dependencies.cmake" | |
96 | +fso.MoveFile PATH_TO_TARGET & "\lib\cmake\Qt6\Qt6Dependencies.cmake.new", PATH_TO_TARGET & "\lib\cmake\Qt6\Qt6Dependencies.cmake" | |
69 | 97 | |
98 | +' lib/cmake/Qt6/QtBuildInternalsExtra.cmake | |
99 | +' Is this need to be modified? This is the install directory! | |
100 | +' Our Qt builds are relocatable so it seems like there is no need for modifying it | |
101 | +' set(qtbi_orig_staging_prefix "") |