Mercurial > fife-parpg
comparison engine/SConscript @ 47:b3838661971f
* Applying code::blocks for linux support patch by amo-ej1
* Close #224
* Close #326
author | mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Sun, 13 Jul 2008 11:20:39 +0000 |
parents | 4a0efb7baf70 |
children | ab8b11adfb70 |
comparison
equal
deleted
inserted
replaced
46:90005975cdbb | 47:b3838661971f |
---|---|
193 print "FIFE msvc9 project file already up-to-date (%s)" % os.path.abspath(str(target[0])) | 193 print "FIFE msvc9 project file already up-to-date (%s)" % os.path.abspath(str(target[0])) |
194 | 194 |
195 msvc_project_builder9 = Builder(action = generate_msvc_project9, suffix = '.vcproj') | 195 msvc_project_builder9 = Builder(action = generate_msvc_project9, suffix = '.vcproj') |
196 env.Append(BUILDERS = {'MSVCProject9': msvc_project_builder9}) | 196 env.Append(BUILDERS = {'MSVCProject9': msvc_project_builder9}) |
197 | 197 |
198 cbbuildpath = joinpath('build', 'win32', 'build_environments', 'code_blocks') | 198 cbbuildpath_win32 = joinpath('build', 'win32', 'build_environments', 'code_blocks') |
199 | 199 |
200 def generate_codeblocks_project(target, source, env): | 200 def generate_codeblocks_project_win32(target, source, env): |
201 codeblocksHeaderDef = \ | 201 codeblocksHeaderDef = \ |
202 ''' <Unit filename="..\..\..\engine\%s"> | 202 ''' <Unit filename="..\..\..\engine\%s"> |
203 <Option compilerVar=""/> | 203 <Option compilerVar=""/> |
204 <Option compile="0"/> | 204 <Option compile="0"/> |
205 <Option link="0"/> | 205 <Option link="0"/> |
217 newf = newf.replace('/', '\\') | 217 newf = newf.replace('/', '\\') |
218 if str(f) in headerfiles: | 218 if str(f) in headerfiles: |
219 xmlstr.append(codeblocksHeaderDef % newf) | 219 xmlstr.append(codeblocksHeaderDef % newf) |
220 else: | 220 else: |
221 xmlstr.append(codeblocksCppDef % newf) | 221 xmlstr.append(codeblocksCppDef % newf) |
222 projtxt = open(joinpath(cbbuildpath, 'engine_template.xml'), 'r').read() | 222 projtxt = open(joinpath(cbbuildpath_win32, 'engine_template.xml'), 'r').read() |
223 projtxt = projtxt.replace('__FILE_INSERTION_POINT__', '\n'.join(xmlstr)) | 223 projtxt = projtxt.replace('__FILE_INSERTION_POINT__', '\n'.join(xmlstr)) |
224 open(str(target[0]), 'w').write(projtxt) | 224 open(str(target[0]), 'w').write(projtxt) |
225 print "FIFE code::blocks project file succesfully created (%s)" % os.path.abspath(str(target[0])) | 225 print "FIFE code::blocks project file succesfully created (%s)" % os.path.abspath(str(target[0])) |
226 | 226 |
227 codeblocks_project_builder = Builder(action = generate_codeblocks_project, suffix = '.cbp') | 227 codeblocks_project_builder_win32 = Builder(action = generate_codeblocks_project_win32, suffix = '.cbp') |
228 env.Append(BUILDERS = {'CodeblocksProject': codeblocks_project_builder}) | 228 env.Append(BUILDERS = {'CodeblocksProject': codeblocks_project_builder_win32}) |
229 | |
230 | |
231 cbbuildpath_linux = joinpath('build', 'linux', 'code_blocks') | |
232 | |
233 def generate_codeblocks_project_linux(target, source, env): | |
234 codeblocksHeaderDef = \ | |
235 ''' <Unit filename="../../../engine/%s"> | |
236 <Option compilerVar=""/> | |
237 <Option compile="0"/> | |
238 <Option link="0"/> | |
239 <Option target="default"/> | |
240 </Unit>''' | |
241 | |
242 codeblocksCppDef = \ | |
243 ''' <Unit filename="../../../engine/%s"> | |
244 <Option compilerVar="CPP"/> | |
245 <Option target="default"/> | |
246 </Unit>''' | |
247 xmlstr = [] | |
248 for f in source: | |
249 newf = os.path.abspath(str(f)).split('%sengine%s' % (_sep, _sep))[-1] | |
250 newf = newf.replace('/', '\\') | |
251 if str(f) in headerfiles: | |
252 xmlstr.append(codeblocksHeaderDef % newf) | |
253 else: | |
254 xmlstr.append(codeblocksCppDef % newf) | |
255 projtxt = open(joinpath(cbbuildpath_linux, 'engine_template.xml'), 'r').read() | |
256 projtxt = projtxt.replace('__FILE_INSERTION_POINT__', '\n'.join(xmlstr)) | |
257 open(str(target[0]), 'w').write(projtxt) | |
258 print "FIFE code::blocks project file succesfully created (%s)" % os.path.abspath(str(target[0])) | |
259 | |
260 codeblocks_project_builder_linux = Builder(action = generate_codeblocks_project_linux, suffix = '.cbp') | |
261 env.Append(BUILDERS = {'CodeblocksProject': codeblocks_project_builder_linux}) | |
262 | |
229 | 263 |
230 variated_dirs = eval(open(joinpath('config', 'variated_dirs'), 'r').read()) | 264 variated_dirs = eval(open(joinpath('config', 'variated_dirs'), 'r').read()) |
231 # filter out swigwrappers. fife_wrap.cxx is appended manually | 265 # filter out swigwrappers. fife_wrap.cxx is appended manually |
232 # as it might not exist yet during SConscript parsing | 266 # as it might not exist yet during SConscript parsing |
233 filteredpaths = ['swigwrappers'] | 267 filteredpaths = ['swigwrappers'] |
260 | 294 |
261 projectfiles.append('./swigwrappers/%s/fife_wrap.cxx' % env['script']) | 295 projectfiles.append('./swigwrappers/%s/fife_wrap.cxx' % env['script']) |
262 | 296 |
263 msvcproj = env.MSVCProject(joinpath('..', msvcbuildpath, 'fife'), projectfiles) | 297 msvcproj = env.MSVCProject(joinpath('..', msvcbuildpath, 'fife'), projectfiles) |
264 msvcproj9 = env.MSVCProject9(joinpath('..', msvcbuildpath9, 'fife'), projectfiles) | 298 msvcproj9 = env.MSVCProject9(joinpath('..', msvcbuildpath9, 'fife'), projectfiles) |
265 cbproj = env.CodeblocksProject(joinpath('..', cbbuildpath, 'fife_engine'), projectfiles) | 299 cbproj_win32 = env.CodeblocksProject(joinpath('..', cbbuildpath_win32, 'fife_engine'), projectfiles) |
300 cbproj_linux = env.CodeblocksProject(joinpath('..', cbbuildpath_linux, 'fife_engine'), projectfiles) | |
266 | 301 |
267 if not env['projectfiles_only']: | 302 if not env['projectfiles_only']: |
268 env.Append(CPPPATH = ['#/engine/core', '#/engine/swigwrappers']) | 303 env.Append(CPPPATH = ['#/engine/core', '#/engine/swigwrappers']) |
269 compilefiles = [str(f) for f in remove_based_on_dir_filter(filteredpaths, implfiles)] | 304 compilefiles = [str(f) for f in remove_based_on_dir_filter(filteredpaths, implfiles)] |
270 compilefiles.append('./swigwrappers/%s/fife_wrap.cxx' % env['script']) | 305 compilefiles.append('./swigwrappers/%s/fife_wrap.cxx' % env['script']) |