@@ -69,12 +69,14 @@ def parseArgs():
6969 help = 'use xcode build system' )
7070 parser .add_argument ('--use-version' , metavar = 'VERSION' , nargs = '?' ,
7171 default = None ,
72- help = 'specify build system version'
73- )
72+ help = 'specify build system version' )
73+ parser .add_argument ('--target-platform' , metavar = 'TRIPLET' , nargs = '?' ,
74+ default = 'host-system' ,
75+ help = 'parameter for cross platform build. Supported values: '
76+ 'host-system, i386-linux-gnu' )
7477
7578 return parser .parse_args ()
7679
77-
7880def finalizeArgs (args ):
7981 if args .output != OUTPUT_DIR :
8082 if args .install_dir == INSTALL_DIR :
@@ -94,7 +96,6 @@ def finalizeArgs(args):
9496 if args .use_version == None :
9597 args .use_version = '18'
9698
97-
9899def goToOutputDir (args ):
99100 if not os .path .isdir (args .output ):
100101 try :
@@ -104,7 +105,6 @@ def goToOutputDir(args):
104105
105106 os .chdir (args .output )
106107
107-
108108def execCmake (args ):
109109 generator = str ()
110110 if args .gmake :
@@ -132,22 +132,28 @@ def execCmake(args):
132132
133133 com += [ '-DCMAKE_BUILD_TYPE={}' .format ('Release' if args .release else 'Debug' )
134134 , '-DVIPON_TOOLS_LIB_TYPE={}' .format ('STATIC' if args .static else 'SHARED' )
135- , '-DCMAKE_TOOLCHAIN_FILE={}' .format (args .c_toolchain )
136- , '-DCMAKE_INSTALL_PREFIX={}' .format (args .install_dir )
135+ ]
136+
137+ if args .target_platform != 'host-system' :
138+ path_to_toolchain = os .path .join (TOOLCHAIN_DIR ,
139+ f'{ args .target_platform } .cmake' )
140+ com += [ f'-DCMAKE_TOOLCHAIN_FILE={ path_to_toolchain } ' ]
141+ else :
142+ com += ['-DCMAKE_TOOLCHAIN_FILE={}' .format (args .c_toolchain ) ]
143+
144+ com += [ '-DCMAKE_INSTALL_PREFIX={}' .format (args .install_dir )
137145 , '-DCMAKE_EXPORT_COMPILE_COMMANDS=ON'
138146 , ROOT
139147 ]
140148
141149 execCmd (com )
142150
143-
144151def main ():
145152 args = parseArgs ()
146153 finalizeArgs (args )
147154 goToOutputDir (args )
148155 execCmake (args )
149156
150-
151157if __name__ == '__main__' :
152158 main ()
153159
0 commit comments