2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-11-26 11:51:20 +01:00
This commit is contained in:
Simon 2015-07-15 12:53:30 +02:00
parent 20c0b72cbb
commit 70fa79b181
2 changed files with 25 additions and 29 deletions

View File

@ -1,13 +1,15 @@
from waflib import Task, TaskGen
top = '.'
out = 'build'
APPNAME = 'Avocada'
APPNAME = 'TestProject'
VERSION = '1.0'
def options(opt):
opt.load('xcode')
def configure(conf):
conf.env.FRAMEWORK_VERSION = '1.0'
conf.env.CONFIG_NAME = 'Kuk'
conf.env.ARCHS = 'x86_64'
conf.env.MACOSX_DEPLOYMENT_TARGET = '10.9'
conf.env.SDKROOT = 'macosx10.9'
@ -16,24 +18,20 @@ def configure(conf):
def build(bld):
tg = bld(
features='cxx',
tg = bld.framework(
source=bld.path.ant_glob('src/MyLib/*.cpp'),
includes='include',
group_files={
'Include': bld.path.ant_glob('include/MyLib/*.h')
},
target='MyLib',
target_type='framework'
)
bld.env.LIB_SDL2 = '/Library/Frameworks/SDL2.framework/SDL2'
tg2 = bld(
features='cxx cxxprogram',
tg2 = bld.app(
source=bld.path.ant_glob('src/*.cpp|'),
includes=tg.includes,
target='MyApp',
target_type='app',
use='MyLib Yolo',
uselib='SDL2',
cxxflags='-O3',
@ -57,6 +55,5 @@ def build(bld):
source=tg.source,
includes=tg.includes,
target='MyStaticLib',
target_type='stlib'
)

View File

@ -20,9 +20,8 @@ from waflib import Context, TaskGen, Build, Utils, ConfigSet, Configure, Errors
from waflib.Build import BuildContext
import os, sys, random, time
@TaskGen.extension('.m', '.mm', '.cpp','.cc','.cxx','.C','.c++', '.c')
def dummy(self, node):
pass
def options(opt):
opt.load('cxx')
HEADERS_GLOB = '**/(*.h|*.hpp|*.H|*.inl)'
@ -89,23 +88,6 @@ TARGET_TYPES = {
'exe' :TARGET_TYPE_EXECUTABLE,
}
""" Provide user-friendly methods to build different target types
E.g. bld.framework(source='..', ...) to build a Framework target.
E.g. bld.dylib(source='..', ...) to build a Dynamic library target.
etc...
"""
def build_target(self, tgtype, *k, **kw):
self.load('ccroot')
kw['features'] = 'cxx cxxprogram'
kw['target_type'] = tgtype
return self(*k, **kw)
BuildContext.app = lambda self, *k, **kw: build_target(self, 'app', *k, **kw)
BuildContext.framework = lambda self, *k, **kw: build_target(self, 'framework', *k, **kw)
BuildContext.dylib = lambda self, *k, **kw: build_target(self, 'dylib', *k, **kw)
BuildContext.stlib = lambda self, *k, **kw: build_target(self, 'stlib', *k, **kw)
BuildContext.exe = lambda self, *k, **kw: build_target(self, 'exe', *k, **kw)
""" Configuration of the global project settings. Sets an environment variable 'PROJ_CONFIGURATION'
which is a dictionary of configuration name and buildsettings pair.
E.g.:
@ -530,3 +512,20 @@ class xcode(Build.BuildContext):
node.mkdir()
node = node.make_node('project.pbxproj')
p.write(open(node.abspath(), 'w'))
def build_target(self, tgtype, *k, **kw):
""" Provide user-friendly methods to build different target types
E.g. bld.framework(source='..', ...) to build a Framework target.
E.g. bld.dylib(source='..', ...) to build a Dynamic library target.
etc...
"""
self.load('ccroot')
kw['features'] = 'cxx cxxprogram'
kw['target_type'] = tgtype
return self(*k, **kw)
def app(self, *k, **kw): return self.build_target('app', *k, **kw)
def framework(self, *k, **kw): return self.build_target('framework', *k, **kw)
def dylib(self, *k, **kw): return self.build_target('dylib', *k, **kw)
def stlib(self, *k, **kw): return self.build_target('stlib', *k, **kw)
def exe(self, *k, **kw): return self.build_target('exe', *k, **kw)