Exemple #1
0
writer = generator.writer
toolchain = generator.toolchain

if target.is_windows():
  extralibs += ['gdi32', 'ws2_32', 'iphlpapi']
if target.is_linux():
  extralibs += ['X11', 'Xext', 'GL']

lua_lib = generator.lib(module = 'lua', sources = [
  'bind.c', 'call.c', 'compile.c', 'eval.c', 'event.c', 'foundation.c', 'import.c', 'lua.c', 'module.c', 'network.c',
  'read.c', 'resource.c', 'symbol.c', 'version.c', 'window.c'])

if not target.is_ios() and not target.is_android():
  configs = [config for config in toolchain.configs if config not in ['profile', 'deploy']]
  if not configs == []:
    generator.bin('lua', ['main.c'], 'lua', basepath = 'tools', implicit_deps = [lua_lib], dependlibs = dependlibs, libs = ['luajit'] + extralibs, configs = configs, variables = extravariables)
    generator.bin('luadump', ['main.c'], 'luadump', basepath = 'tools', implicit_deps = [lua_lib], dependlibs = dependlibs, libs = ['luajit'] + extralibs, configs = configs, variables = extravariables)
    generator.bin('luaimport', ['main.c'], 'luaimport', basepath = 'tools', implicit_deps = [lua_lib], dependlibs = dependlibs, libs = ['luajit'] + extralibs, configs = configs, variables = extravariables)
    generator.bin('luacompile', ['main.c'], 'luacompile', basepath = 'tools', implicit_deps = [lua_lib], dependlibs = dependlibs, libs = ['luajit'] + extralibs, configs = configs, variables = extravariables)
    generator.bin('', ['luacompile/main.c'], 'luacompile32', basepath = 'tools', implicit_deps = [lua_lib], dependlibs = dependlibs, libs = ['luajit32'] + extralibs, configs = configs, variables = dict({'support_lua': True}, **extravariables))

#No test cases if we're a submodule
if generator.is_subninja():
  sys.exit()

includepaths = generator.test_includepaths()

gllibs = []
glframeworks = []
if target.is_macos():
  glframeworks = ['OpenGL']
Exemple #2
0
    test_extrasources = [os.path.join('all', 'ios', item) for item in [
      'viewcontroller.m'
    ]]
  elif target.is_android():
    test_resources = [os.path.join('all', 'android', item) for item in [
      'AndroidManifest.xml', os.path.join('layout', 'main.xml'), os.path.join('values', 'strings.xml'),
      os.path.join('drawable-ldpi', 'icon.png'), os.path.join('drawable-mdpi', 'icon.png'), os.path.join('drawable-hdpi', 'icon.png'),
      os.path.join('drawable-xhdpi', 'icon.png'), os.path.join('drawable-xxhdpi', 'icon.png'), os.path.join('drawable-xxxhdpi', 'icon.png')
    ]]
    test_extrasources = [os.path.join('test', 'all', 'android', 'java', 'com', 'rampantpixels', 'memory', 'test', item) for item in [
      'TestActivity.java'
    ]]
  elif target.is_tizen():
    test_resources = [os.path.join('all', 'tizen', item) for item in [
      'tizen-manifest.xml', os.path.join('res', 'tizenapp.png')
    ]]
  sources = [os.path.join(module, 'main.c') for module in test_cases] + test_extrasources
  if target.is_ios() or target.is_android() or target.is_tizen():
    generator.app(module = '', sources = sources, binname = 'test-all', basepath = 'test', implicit_deps = [memory_lib], libs = ['test', 'memory', 'foundation'], resources = test_resources, includepaths = includepaths)
  else:
    generator.bin(module = '', sources = sources, binname = 'test-all', basepath = 'test', implicit_deps = [memory_lib], libs = ['test', 'memory', 'foundation'], includepaths = includepaths)
else:
  sources = ['main.c']
  #Build one binary per test case
  generator.bin(module = 'all', sources = sources, binname = 'test-all', basepath = 'test', implicit_deps = [memory_lib], libs = ['memory', 'foundation'], includepaths = includepaths)
  for test in test_cases:
    generator.bin(module = test, sources = sources, binname = 'test-' + test, basepath = 'test', implicit_deps = [memory_lib], libs = ['test', 'memory', 'foundation'], includepaths = includepaths)

  sources = ['main.c']
  generator.bin(module = 'alloc', sources = sources, binname = 'benchmark-alloc', basepath = 'benchmark', implicit_deps = [memory_lib], libs = ['memory', 'foundation'], includepaths = includepaths)
Exemple #3
0
  test_cases += ['all']
  if target.is_ios():
    test_resources = [os.path.join('all', 'ios', item) for item in ['test-all.plist', 'Images.xcassets', 'test-all.xib']]
    test_extrasources = [os.path.join('all', 'ios', 'viewcontroller.m')]
  elif target.is_android():
    test_resources = [os.path.join('all', 'android', item) for item in [
      'AndroidManifest.xml', os.path.join('layout', 'main.xml'), os.path.join('values', 'strings.xml'),
      os.path.join('drawable-ldpi', 'icon.png'), os.path.join('drawable-mdpi', 'icon.png'), os.path.join('drawable-hdpi', 'icon.png'),
      os.path.join('drawable-xhdpi', 'icon.png'), os.path.join('drawable-xxhdpi', 'icon.png'), os.path.join('drawable-xxxhdpi', 'icon.png')
    ]]
    test_extrasources = [os.path.join('all', 'android', 'java', 'com', 'rampantpixels', 'obj', 'test', item) for item in [
      'TestActivity.java'
    ]]
  elif target.is_tizen():
    test_resources = [os.path.join('all', 'tizen', item) for item in [
      'tizen-manifest.xml', os.path.join('res', 'tizenapp.png')
    ]]
  if target.is_macos() or target.is_ios() or target.is_android() or target.is_tizen():
    generator.app(module = '', sources = [os.path.join(module, 'main.c') for module in test_cases] + test_extrasources, binname = 'test-all', basepath = 'test', implicit_deps = [obj_lib], libs = linklibs, resources = test_resources, includepaths = includepaths)
  else:
    generator.bin(module = '', sources = [os.path.join(module, 'main.c') for module in test_cases] + test_extrasources, binname = 'test-all', basepath = 'test', implicit_deps = [obj_lib], libs = linklibs, resources = test_resources, includepaths = includepaths)
else:
  #Build one binary per test case
  generator.bin(module = 'all', sources = ['main.c'], binname = 'test-all', basepath = 'test', implicit_deps = [obj_lib], libs = ['obj'] + dependlibs, includepaths = includepaths)
  for test in test_cases:
    if target.is_macos():
      test_resources = [os.path.join('osx', item) for item in ['test-' + test + '.plist', 'Images.xcassets', 'test-' + test + '.xib']]
      generator.app(module = test, sources = ['main.c' ], binname = 'test-' + test, basepath = 'test', implicit_deps = [obj_lib], libs = linklibs, resources = test_resources, includepaths = includepaths)
    else:
      generator.bin(module = test, sources = ['main.c' ], binname = 'test-' + test, basepath = 'test', implicit_deps = [obj_lib], libs = linklibs, includepaths = includepaths)
libpaths = ['..'] # For foundation library

generator = generator.Generator(project = project, variables = [('bundleidentifier', 'com.rampantpixels.foundation.$(binname)')])

if generator.target.is_macosx() or generator.target.is_ios() or generator.target.is_android() or generator.target.is_tizen() or generator.target.is_pnacl():
  resources = []
  extrasources = []
  if generator.target.is_ios():
    resources = [os.path.join('ios', item) for item in [
      'example.plist', 'Images.xcassets', 'example.xib'
    ]]
    extrasources = [os.path.join('ios', item) for item in [
      'viewcontroller.m'
    ]]
  elif generator.target.is_android():
    resources = [os.path.join('android', item) for item in [
      'AndroidManifest.xml', os.path.join('layout', 'main.xml'), os.path.join('values', 'strings.xml'),
      os.path.join('drawable-ldpi', 'icon.png'), os.path.join('drawable-mdpi', 'icon.png'), os.path.join('drawable-hdpi', 'icon.png'),
      os.path.join('drawable-xhdpi', 'icon.png'), os.path.join('drawable-xxhdpi', 'icon.png'), os.path.join('drawable-xxxhdpi', 'icon.png')
    ]]
    extrasources = [os.path.join('android', 'java', 'com', 'rampantpixels', 'foundation', 'example', item) for item in [
      'ExampleActivity.java'
    ]]
  elif generator.target.is_tizen():
    resources = [os.path.join('tizen', item) for item in [
      'tizen-manifest.xml', os.path.join('res', 'tizenapp.png')
    ]]
  generator.app(module = project, sources = sources + extrasources, binname = project, libs = libs, resources = resources, includepaths = includepaths, libpaths = libpaths)
else:
  generator.bin(module = project, sources = sources, binname = project, libs = libs, includepaths = includepaths, libpaths = libpaths)
Exemple #5
0
if not target.is_android() and not target.is_ios():
    rpmallocwrap_lib = generator.lib(
        module='rpmalloc',
        libname='rpmallocwrap',
        sources=['rpmalloc.c', 'malloc.c', 'new.cc'],
        variables={'defines': ['ENABLE_PRELOAD=1']})

if not target.is_android() and not target.is_ios():
    rpmalloc_so = generator.sharedlib(module='rpmalloc',
                                      libname='rpmalloc',
                                      sources=['rpmalloc.c'])

if not target.is_windows() and not target.is_android() and not target.is_ios():
    rpmallocwrap_so = generator.sharedlib(
        module='rpmalloc',
        libname='rpmallocwrap',
        sources=['rpmalloc.c', 'malloc.c', 'new.cc'],
        variables={
            'runtime': 'c++',
            'defines': ['ENABLE_PRELOAD=1']
        })

if not target.is_ios() and not target.is_android():
    generator.bin(module='test',
                  sources=['thread.c', 'main.c'],
                  binname='rpmalloc-test',
                  implicit_deps=[rpmallocguard_lib],
                  libs=['rpmallocguard'],
                  includepaths=['rpmalloc', 'test'],
                  variables={'defines': ['ENABLE_GUARDS=1']})
Exemple #6
0
                                      sources=['rpmalloc.c'])

if not target.is_windows():
    if not target.is_android() and not target.is_ios():
        rpmallocwrap_lib = generator.lib(
            module='rpmalloc',
            libname='rpmallocwrap',
            sources=['rpmalloc.c', 'malloc.c', 'new.cc'],
            variables={'defines': ['ENABLE_PRELOAD=1']})

    if not target.is_windows() and not target.is_android(
    ) and not target.is_ios():
        rpmallocwrap_so = generator.sharedlib(
            module='rpmalloc',
            libname='rpmallocwrap',
            sources=['rpmalloc.c', 'malloc.c', 'new.cc'],
            variables={
                'runtime': 'c++',
                'defines': ['ENABLE_PRELOAD=1']
            })

if not target.is_ios() and not target.is_android():
    generator.bin(
        module='test',
        sources=['thread.c', 'main.c'],
        binname='rpmalloc-test',
        implicit_deps=[rpmalloc_lib],
        libs=['rpmalloc'],
        includepaths=['rpmalloc', 'test'],
        variables={'defines': ['ENABLE_ASSERTS=1', 'ENABLE_STATISTICS=1']})
Exemple #7
0
    sources = [os.path.join(module, 'main.c')
               for module in test_cases] + test_extrasources
    if target.is_ios() or target.is_android() or target.is_tizen():
        generator.app(module='',
                      sources=sources,
                      binname='test-all',
                      basepath='test',
                      implicit_deps=[image_lib],
                      libs=['test'] + dependlibs,
                      resources=test_resources,
                      includepaths=includepaths)
    else:
        generator.bin(module='',
                      sources=sources,
                      binname='test-all',
                      basepath='test',
                      implicit_deps=[image_lib],
                      libs=['test'] + dependlibs,
                      includepaths=includepaths)
else:
    sources = ['main.c']
    #Build one binary per test case
    generator.bin(module='all',
                  sources=sources,
                  binname='test-all',
                  basepath='test',
                  implicit_deps=[image_lib],
                  libs=dependlibs,
                  includepaths=includepaths)
    for test in test_cases:
        generator.bin(module=test,
Exemple #8
0
generator = generator.Generator(project = 'lua', dependlibs = dependlibs, variables = [('bundleidentifier', 'com.rampantpixels.lua.$(binname)')])
target = generator.target
writer = generator.writer
toolchain = generator.toolchain

if target.is_windows():
  extralibs += ['ws2_32', 'iphlpapi']

lua_lib = generator.lib(module = 'lua', sources = [
  'bind.c', 'compile.c', 'event.c', 'foundation.c', 'import.c', 'lua.c', 'module.c', 'network.c',
  'read.c', 'resource.c', 'symbol.c', 'version.c'])

if not target.is_ios() and not target.is_android():
  configs = [config for config in toolchain.configs if config not in ['profile', 'deploy']]
  if not configs == []:
    generator.bin('lua', ['main.c'], 'lua', basepath = 'tools', implicit_deps = [lua_lib], libs = ['lua', 'luajit'] + dependlibs + extralibs, configs = configs, variables = extravariables)
    generator.bin('luadump', ['main.c'], 'luadump', basepath = 'tools', implicit_deps = [lua_lib], libs = ['lua', 'luajit'] + dependlibs + extralibs, configs = configs, variables = extravariables)
    generator.bin('luaimport', ['main.c'], 'luaimport', basepath = 'tools', implicit_deps = [lua_lib], libs = ['lua', 'luajit'] + dependlibs + extralibs, configs = configs, variables = extravariables)
    generator.bin('luacompile', ['main.c'], 'luacompile', basepath = 'tools', implicit_deps = [lua_lib], libs = ['lua', 'luajit'] + dependlibs + extralibs, configs = configs, variables = extravariables)
    generator.bin('', ['luacompile/main.c'], 'luacompile32', basepath = 'tools', implicit_deps = [lua_lib], libs = ['lua', 'luajit32'] + dependlibs + extralibs, configs = configs, variables = dict({'support_lua': True}, **extravariables))

includepaths = generator.test_includepaths()

test_cases = [
  'bind', 'foundation'
]
if target.is_ios() or target.is_android():
  #Build one fat binary with all test cases
  test_resources = []
  test_extrasources = []
  test_cases += ['all']
glframeworks = []
if target.is_macos():
  glframeworks = ['OpenGL']
elif target.is_ios():
  glframeworks = ['QuartzCore', 'OpenGLES']
if target.is_windows():
  gllibs = ['opengl32', 'gdi32']
if target.is_linux():
  gllibs = ['GL', 'Xxf86vm', 'Xext', 'X11']

linklibs = ['render'] + dependlibs + gllibs

if not target.is_ios() and not target.is_android() and not target.is_tizen():
  configs = [config for config in toolchain.configs if config not in ['profile', 'deploy']]
  if not configs == []:
    generator.bin('renderimport', ['main.c'], 'renderimport', basepath = 'tools', implicit_deps = [render_lib], libs = linklibs, frameworks = glframeworks, configs = configs)
    generator.bin('rendercompile', ['main.c'], 'rendercompile', basepath = 'tools', implicit_deps = [render_lib], libs = linklibs, frameworks = glframeworks, configs = configs)

includepaths = generator.test_includepaths()

linklibs = ['test'] + linklibs

test_cases = [
  'render'
]
if toolchain.is_monolithic() or target.is_ios() or target.is_android() or target.is_tizen() or target.is_pnacl():
  #Build one fat binary with all test cases
  test_resources = []
  test_extrasources = []
  test_cases += ['all']
  if target.is_ios():
Exemple #10
0
import generator

dependlibs = ['foundation']

generator = generator.Generator(project = 'vector', dependlibs = dependlibs, variables = [('bundleidentifier', 'com.rampantpixels.vector.$(binname)')])
target = generator.target
writer = generator.writer
toolchain = generator.toolchain

vector_lib = generator.lib(module = 'vector', sources = [
  'vector.c', 'version.c'])

if not target.is_ios() and not target.is_android() and not target.is_tizen():
  configs = [config for config in toolchain.configs if config not in ['profile', 'deploy']]
  if not configs == []:
    generator.bin('maskgen', ['main.c'], 'maskgen', basepath = 'tools', implicit_deps = [vector_lib], libs = ['vector', 'foundation'], configs = configs)

#No test cases if we're a submodule
if generator.is_subninja():
  sys.exit()

includepaths = generator.test_includepaths()

test_cases = [
  'matrix', 'quaternion', 'vector'
]
if toolchain.is_monolithic() or target.is_ios() or target.is_android() or target.is_tizen() or target.is_pnacl():
  #Build one fat binary with all test cases
  test_resources = []
  test_extrasources = []
  test_cases += ['all']
Exemple #11
0
rpmalloc_lib = generator.lib(module='rpmalloc', sources=['rpmalloc.c'])

includepaths = ['test', 'benchmark']
test_lib = generator.lib(module='test',
                         sources=['thread.c', 'timer.c'],
                         includepaths=includepaths)
benchmark_lib = generator.lib(module='benchmark',
                              sources=['main.c'],
                              includepaths=includepaths)

#Build one binary per benchmark
generator.bin(module='rpmalloc',
              sources=['benchmark.c'],
              binname='benchmark-rpmalloc',
              basepath='benchmark',
              implicit_deps=[benchmark_lib, test_lib, rpmalloc_lib],
              libs=['benchmark', 'test', 'rpmalloc'],
              includepaths=includepaths)
generator.bin(module='crt',
              sources=['benchmark.c'],
              binname='benchmark-crt',
              basepath='benchmark',
              implicit_deps=[benchmark_lib, test_lib],
              libs=['benchmark', 'test'],
              includepaths=includepaths)
if not target.is_android():
    generator.bin(module='nedmalloc',
                  sources=['benchmark.c', 'nedmalloc.c'],
                  binname='benchmark-nedmalloc',
                  basepath='benchmark',
Exemple #12
0
  os.path.join( 'null', 'backend.c' )
] )

gllibs = []
glframeworks = []
if target.is_macosx():
  glframeworks = [ 'OpenGL' ]
elif target.is_ios():
  glframeworks = [ 'QuartzCore', 'OpenGLES' ]
if target.is_windows():
  gllibs = [ 'opengl32', 'gdi32' ]

if not target.is_ios() and not target.is_android() and not target.is_tizen():
  configs = [ config for config in toolchain.configs if config not in [ 'profile', 'deploy' ] ]
  if not configs == []:
    generator.bin( 'renderimport', [ 'main.c', 'glsl.c', 'program.c', 'shader.c' ], 'renderimport', basepath = 'tools', implicit_deps = [ render_lib ], libs = [ 'render', 'window', 'resource', 'foundation' ], configs = configs, extralibs = gllibs, extraframeworks = glframeworks )
    generator.bin( 'rendercompile', [ 'main.c' ], 'rendercompile', basepath = 'tools', implicit_deps = [ render_lib ], libs = [ 'render', 'window', 'resource', 'foundation' ], configs = configs, extralibs = gllibs, extraframeworks = glframeworks )

includepaths = generator.test_includepaths()

test_cases = [
  'render'
]
if toolchain.is_monolithic() or target.is_ios() or target.is_android() or target.is_tizen() or target.is_pnacl():
  #Build one fat binary with all test cases
  test_resources = []
  test_extrasources = []
  test_cases += [ 'all' ]
  if target.is_ios():
    test_resources = [ os.path.join( 'all', 'ios', item ) for item in [ 'test-all.plist', 'Images.xcassets', 'test-all.xib' ] ]
    test_extrasources = [ os.path.join( 'all', 'ios', 'viewcontroller.m' ) ]
includepaths = ['test', 'benchmark']
test_lib = generator.lib(module='test',
                         sources=['thread.c', 'timer.c'],
                         includepaths=includepaths,
                         variables=variables)
benchmark_lib = generator.lib(module='benchmark',
                              sources=['main.c'],
                              includepaths=includepaths,
                              variables=variables)

#Build one binary per benchmark
generator.bin(module='rpmalloc',
              sources=['benchmark.c', 'rpmalloc.c'],
              binname='benchmark-rpmalloc',
              basepath='benchmark',
              implicit_deps=[benchmark_lib, test_lib],
              libs=['benchmark', 'test'],
              includepaths=includepaths,
              variables=variables)

if target.is_android():
    resources = [
        os.path.join('all', 'android', item) for item in [
            'AndroidManifest.xml',
            os.path.join('layout', 'main.xml'),
            os.path.join('values', 'strings.xml'),
            os.path.join('drawable-ldpi', 'icon.png'),
            os.path.join('drawable-mdpi', 'icon.png'),
            os.path.join('drawable-hdpi', 'icon.png'),
            os.path.join('drawable-xhdpi', 'icon.png'),
            os.path.join('drawable-xxhdpi', 'icon.png'),
Exemple #14
0
            sources=[os.path.join(module, 'main.c')
                     for module in test_cases] + test_extrasources,
            binname='test-all',
            basepath='test',
            implicit_deps=[window_lib],
            libs=['test', 'window', 'foundation'] + gllibs,
            frameworks=glframeworks,
            resources=test_resources,
            includepaths=includepaths)
    else:
        generator.bin(
            module='',
            sources=[os.path.join(module, 'main.c')
                     for module in test_cases] + test_extrasources,
            binname='test-all',
            basepath='test',
            implicit_deps=[window_lib],
            libs=['test', 'window', 'foundation'] + gllibs,
            frameworks=glframeworks,
            resources=test_resources,
            includepaths=includepaths)
else:
    #Build one binary per test case
    generator.bin(module='all',
                  sources=['main.c'],
                  binname='test-all',
                  basepath='test',
                  implicit_deps=[window_lib],
                  libs=['window', 'foundation'],
                  includepaths=includepaths)
    for test in test_cases:
Exemple #15
0
                os.path.join('drawable-xhdpi', 'icon.png'),
                os.path.join('drawable-xxhdpi', 'icon.png'),
                os.path.join('drawable-xxxhdpi', 'icon.png')
            ]
        ]
        extrasources = [
            os.path.join('android', 'java', 'com', 'rampantpixels',
                         'foundation', 'example', item)
            for item in ['ExampleActivity.java']
        ]
    elif generator.target.is_tizen():
        resources = [
            os.path.join('tizen', item) for item in
            ['tizen-manifest.xml',
             os.path.join('res', 'tizenapp.png')]
        ]
    generator.app(module=project,
                  sources=sources + extrasources,
                  binname=project,
                  libs=libs,
                  resources=resources,
                  includepaths=includepaths,
                  libpaths=libpaths)
else:
    generator.bin(module=project,
                  sources=sources,
                  binname=project,
                  libs=libs,
                  includepaths=includepaths,
                  libpaths=libpaths)
Exemple #16
0
        'objectmap.c', 'path.c', 'pipe.c', 'pnacl.c', 'process.c', 'profile.c',
        'radixsort.c', 'random.c', 'regex.c', 'ringbuffer.c', 'semaphore.c',
        'stacktrace.c', 'stream.c', 'string.c', 'system.c', 'thread.c',
        'time.c', 'tizen.c', 'uuid.c', 'version.c', 'delegate.m',
        'environment.m', 'fs.m', 'system.m'
    ] + extrasources)

if not target.is_ios() and not target.is_android() and not target.is_tizen():
    configs = [
        config for config in toolchain.configs
        if config not in ['profile', 'deploy']
    ]
    if not configs == []:
        generator.bin('bin2hex', ['main.c'],
                      'bin2hex',
                      basepath='tools',
                      implicit_deps=[foundation_lib],
                      libs=['foundation'],
                      configs=configs)
        generator.bin('hashify', ['main.c'],
                      'hashify',
                      basepath='tools',
                      implicit_deps=[foundation_lib],
                      libs=['foundation'],
                      configs=configs)
        generator.bin('uuidgen', ['main.c'],
                      'uuidgen',
                      basepath='tools',
                      implicit_deps=[foundation_lib],
                      libs=['foundation'],
                      configs=configs)
foundation_sources = [
  'android.c', 'array.c', 'assert.c', 'assetstream.c', 'atomic.c', 'base64.c', 'beacon.c', 'bitbuffer.c', 'blowfish.c',
  'bufferstream.c', 'environment.c', 'error.c', 'event.c', 'exception.c', 'foundation.c', 'fs.c',
  'hash.c', 'hashmap.c', 'hashtable.c', 'json.c', 'library.c', 'log.c', 'main.c', 'md5.c', 'memory.c', 'mutex.c',
  'objectmap.c', 'path.c', 'pipe.c', 'pnacl.c', 'process.c', 'profile.c', 'radixsort.c', 'random.c', 'regex.c',
  'ringbuffer.c', 'sha.c', 'semaphore.c', 'stacktrace.c', 'stream.c', 'string.c', 'system.c', 'thread.c', 'time.c',
  'tizen.c', 'uuid.c', 'version.c', 'delegate.m', 'environment.m', 'fs.m', 'system.m' ]

foundation_lib = generator.lib(module = 'foundation', sources = foundation_sources + extrasources)
#foundation_so = generator.sharedlib( module = 'foundation', sources = foundation_sources + extrasources )

if not target.is_ios() and not target.is_android() and not target.is_tizen():
  configs = [config for config in toolchain.configs if config not in ['profile', 'deploy']]
  if not configs == []:
    generator.bin('bin2hex', ['main.c'], 'bin2hex', basepath = 'tools', implicit_deps = [foundation_lib], libs = ['foundation'], configs = configs)
    generator.bin('hashify', ['main.c'], 'hashify', basepath = 'tools', implicit_deps = [foundation_lib], libs = ['foundation'], configs = configs)
    generator.bin('uuidgen', ['main.c'], 'uuidgen', basepath = 'tools', implicit_deps = [foundation_lib], libs = ['foundation'], configs = configs)

includepaths = ['test']
test_lib = generator.lib(module = 'test', basepath = 'test', sources = ['test.c', 'test.m'], includepaths = includepaths)

test_cases = [
  'app', 'array', 'atomic', 'base64', 'beacon', 'bitbuffer', 'blowfish', 'bufferstream', 'environment', 'error',
  'event', 'exception', 'fs', 'hash', 'hashmap', 'hashtable', 'json', 'library', 'math', 'md5', 'mutex', 'objectmap',
  'path', 'pipe', 'process', 'profile', 'radixsort', 'random', 'regex', 'ringbuffer', 'semaphore', 'sha', 'stacktrace',
  'stream', 'string', 'system', 'time', 'uuid'
]
if toolchain.is_monolithic() or target.is_ios() or target.is_android() or target.is_tizen() or target.is_pnacl():
  #Build one fat binary with all test cases
  test_resources = []
Exemple #18
0
  test_cases += ['all']
  if target.is_ios():
    test_resources = [os.path.join('all', 'ios', item) for item in ['test-all.plist', 'Images.xcassets', 'test-all.xib']]
    test_extrasources = [os.path.join('all', 'ios', 'viewcontroller.m')]
  elif target.is_android():
    test_resources = [os.path.join('all', 'android', item) for item in [
      'AndroidManifest.xml', os.path.join('layout', 'main.xml'), os.path.join('values', 'strings.xml'),
      os.path.join('drawable-ldpi', 'icon.png'), os.path.join('drawable-mdpi', 'icon.png'), os.path.join('drawable-hdpi', 'icon.png'),
      os.path.join('drawable-xhdpi', 'icon.png'), os.path.join('drawable-xxhdpi', 'icon.png'), os.path.join('drawable-xxxhdpi', 'icon.png')
    ]]
    test_extrasources = [ os.path.join('test', 'all', 'android', 'java', 'com', 'rampantpixels', 'task', 'test', item) for item in [
      'TestActivity.java'
    ]]
  elif target.is_tizen():
    test_resources = [os.path.join('all', 'tizen', item) for item in [
      'tizen-manifest.xml', os.path.join('res', 'tizenapp.png')
    ] ]
  if target.is_macos() or target.is_ios() or target.is_android() or target.is_tizen():
    generator.app(module = '', sources = [os.path.join(module, 'main.c') for module in test_cases] + test_extrasources, binname = 'test-all', basepath = 'test', implicit_deps = [task_lib], libs = ['test', 'task', 'foundation'], resources = test_resources, includepaths = includepaths)
  else:
    generator.bin(module = '', sources = [os.path.join(module, 'main.c') for module in test_cases] + test_extrasources, binname = 'test-all', basepath = 'test', implicit_deps = [task_lib], libs = ['test', 'task', 'foundation'], resources = test_resources, includepaths = includepaths)
else:
  #Build one binary per test case
  generator.bin(module = 'all', sources = ['main.c'], binname = 'test-all', basepath = 'test', implicit_deps = [task_lib], libs = dependlibs, includepaths = includepaths)
  for test in test_cases:
    if target.is_macos():
      test_resources = [os.path.join('osx', item) for item in ['test-' + test + '.plist', 'Images.xcassets', 'test-' + test + '.xib']]
      generator.app(module = test, sources = ['main.c'], binname = 'test-' + test, basepath = 'test', implicit_deps = [task_lib], libs = linklibs, resources = test_resources, includepaths = includepaths)
    else:
      generator.bin(module = test, sources = ['main.c'], binname = 'test-' + test, basepath = 'test', implicit_deps = [task_lib], libs = linklibs, includepaths = includepaths)
Exemple #19
0
if target.is_android():
  extrasources += [ os.path.join( toolchain.android_ndkpath, 'sources', 'android', 'native_app_glue', 'android_native_app_glue.c' ),
                    os.path.join( toolchain.android_ndkpath, 'sources', 'android', 'cpufeatures', 'cpu-features.c' ) ]

foundation_lib = generator.lib( module = 'foundation', sources = [
  'android.c', 'array.c', 'assert.c', 'assetstream.c', 'atomic.c', 'base64.c', 'bitbuffer.c', 'blowfish.c',
  'bufferstream.c', 'config.c', 'crash.c', 'environment.c', 'error.c', 'event.c', 'foundation.c', 'fs.c',
  'hash.c', 'hashmap.c', 'hashtable.c', 'library.c', 'log.c', 'main.c', 'md5.c', 'memory.c', 'mutex.c',
  'objectmap.c', 'path.c', 'pipe.c', 'pnacl.c', 'process.c', 'profile.c', 'radixsort.c', 'random.c', 'regex.c',
  'ringbuffer.c', 'semaphore.c', 'stacktrace.c', 'stream.c', 'string.c', 'system.c', 'thread.c', 'time.c',
  'uuid.c', 'version.c', 'delegate.m', 'environment.m', 'fs.m', 'system.m' ] + extrasources )

if not target.is_ios() and not target.is_android():
  configs = [ config for config in toolchain.configs if config not in [ 'profile', 'deploy' ] ]
  if not configs == []:
    generator.bin( 'bin2hex', [ 'main.c' ], 'bin2hex', basepath = 'tools', implicit_deps = [ foundation_lib ], libs = [ 'foundation' ], configs = configs )
    generator.bin( 'hashify', [ 'main.c' ], 'hashify', basepath = 'tools', implicit_deps = [ foundation_lib ], libs = [ 'foundation' ], configs = configs )
    generator.bin( 'uuidgen', [ 'main.c' ], 'uuidgen', basepath = 'tools', implicit_deps = [ foundation_lib ], libs = [ 'foundation' ], configs = configs )

includepaths = [ 'test' ]
test_lib = generator.lib( module = 'test', basepath = 'test', sources = [ 'test.c', 'test.m' ], includepaths = includepaths )

test_cases = [
  'app', 'array', 'atomic', 'base64', 'bitbuffer', 'blowfish', 'bufferstream', 'config', 'crash', 'environment',
  'error', 'event', 'fs', 'hash', 'hashmap', 'hashtable', 'library', 'math', 'md5', 'mutex', 'objectmap',
  'path', 'pipe', 'process', 'profile', 'radixsort', 'random', 'regex', 'ringbuffer', 'semaphore', 'stacktrace',
  'stream', 'string', 'system', 'time', 'uuid'
]
if toolchain.is_monolithic() or target.is_ios() or target.is_android() or target.is_pnacl():
  #Build one fat binary with all test cases
  test_resources = []
Exemple #20
0
    'uuid.c', 'version.c', 'delegate.m', 'environment.m', 'fs.m', 'system.m'
]

foundation_lib = generator.lib(module='foundation',
                               sources=foundation_sources + extrasources)
#foundation_so = generator.sharedlib( module = 'foundation', sources = foundation_sources + extrasources )

if not target.is_ios() and not target.is_android() and not target.is_tizen():
    configs = [
        config for config in toolchain.configs
        if config not in ['profile', 'deploy']
    ]
    if not configs == []:
        generator.bin('bin2hex', ['main.c'],
                      'bin2hex',
                      basepath='tools',
                      implicit_deps=[foundation_lib],
                      libs=['foundation'],
                      configs=configs)
        generator.bin('hashify', ['main.c'],
                      'hashify',
                      basepath='tools',
                      implicit_deps=[foundation_lib],
                      libs=['foundation'],
                      configs=configs)
        generator.bin('uuidgen', ['main.c'],
                      'uuidgen',
                      basepath='tools',
                      implicit_deps=[foundation_lib],
                      libs=['foundation'],
                      configs=configs)
Exemple #21
0
  test_cases += ['all']
  if target.is_ios():
    test_resources = [os.path.join( 'all', 'ios', item) for item in ['test-all.plist', 'Images.xcassets', 'test-all.xib']]
    test_extrasources = [os.path.join('all', 'ios', 'viewcontroller.m')]
  elif target.is_android():
    test_resources = [os.path.join('all', 'android', item) for item in [
      'AndroidManifest.xml', os.path.join('layout', 'main.xml'), os.path.join('values', 'strings.xml'),
      os.path.join('drawable-ldpi', 'icon.png'), os.path.join('drawable-mdpi', 'icon.png'), os.path.join('drawable-hdpi', 'icon.png'),
      os.path.join('drawable-xhdpi', 'icon.png'), os.path.join('drawable-xxhdpi', 'icon.png'), os.path.join('drawable-xxxhdpi', 'icon.png')
    ]]
    test_extrasources = [os.path.join('all', 'android', 'java', 'com', 'rampantpixels', 'window', 'test', item) for item in [
      'TestActivity.java'
    ]]
  elif target.is_tizen():
    test_resources = [os.path.join('all', 'tizen', item) for item in [
      'tizen-manifest.xml', os.path.join( 'res', 'tizenapp.png')
    ]]
  if target.is_macosx() or target.is_ios() or target.is_android() or target.is_tizen():
    generator.app(module = '', sources = [os.path.join(module, 'main.c') for module in test_cases] + test_extrasources, binname = 'test-all', basepath = 'test', implicit_deps = [window_lib], libs = ['test', 'window', 'foundation'] + gllibs, frameworks = glframeworks, resources = test_resources, includepaths = includepaths)
  else:
    generator.bin(module = '', sources = [os.path.join(module, 'main.c') for module in test_cases] + test_extrasources, binname = 'test-all', basepath = 'test', implicit_deps = [window_lib], libs = ['test', 'window', 'foundation'] + gllibs, frameworks = glframeworks, resources = test_resources, includepaths = includepaths)
else:
  #Build one binary per test case
  generator.bin(module = 'all', sources = ['main.c'], binname = 'test-all', basepath = 'test', implicit_deps = [window_lib], libs = ['window', 'foundation'], includepaths = includepaths)
  for test in test_cases:
    if target.is_macosx():
      test_resources = [os.path.join('osx', item) for item in ['test-' + test + '.plist', 'Images.xcassets', 'test-' + test + '.xib']]
      generator.app(module = test, sources = ['main.c'], binname = 'test-' + test, basepath = 'test', implicit_deps = [window_lib], libs = ['test', 'window', 'foundation'] + gllibs, frameworks = glframeworks, resources = test_resources, includepaths = includepaths)
    else:
      generator.bin(module = test, sources = ['main.c'], binname = 'test-' + test, basepath = 'test', implicit_deps = [window_lib], libs = ['test', 'window', 'foundation'] + gllibs, frameworks = glframeworks, includepaths = includepaths)
Exemple #22
0
import generator

dependlibs = ['resource', 'foundation']

generator = generator.Generator(project = 'lua', dependlibs = dependlibs, variables = [('bundleidentifier', 'com.rampantpixels.lua.$(binname)')])
target = generator.target
writer = generator.writer
toolchain = generator.toolchain

lua_lib = generator.lib(module = 'lua', sources = [
  'bind.c', 'compile.c', 'foundation.c', 'import.c', 'lua.c', 'module.c', 'read.c', 'symbol.c', 'version.c'])

if not target.is_ios() and not target.is_android():
  configs = [config for config in toolchain.configs if config not in ['profile', 'deploy']]
  if not configs == []:
    generator.bin('lua', ['main.c'], 'lua', basepath = 'tools', implicit_deps = [lua_lib], libs = ['lua', 'luajit'] + dependlibs, configs = configs)
    generator.bin('luadump', ['main.c'], 'luadump', basepath = 'tools', implicit_deps = [lua_lib], libs = ['lua', 'luajit'] + dependlibs, configs = configs)
    generator.bin('luaimport', ['main.c'], 'luaimport', basepath = 'tools', implicit_deps = [lua_lib], libs = ['lua', 'luajit'] + dependlibs, configs = configs)
    generator.bin('luacompile', ['main.c'], 'luacompile', basepath = 'tools', implicit_deps = [lua_lib], libs = ['lua', 'luajit'] + dependlibs, configs = configs)

includepaths = generator.test_includepaths()

test_cases = [
  'bind', 'foundation'
]
if target.is_ios() or target.is_android():
  #Build one fat binary with all test cases
  test_resources = []
  test_extrasources = []
  test_cases += ['all']
  if target.is_ios():
Exemple #23
0
        libname='rpmallocwrap',
        sources=['rpmalloc.c'],
        variables={'defines': ['ENABLE_PRELOAD=1', 'ENABLE_OVERRIDE=1']})
    rpmallocwrap_lib = generator.lib(
        module='rpmalloc',
        libname='rpmallocwrap',
        sources=['rpmalloc.c'],
        variables={'defines': ['ENABLE_PRELOAD=1', 'ENABLE_OVERRIDE=1']})

    generator.bin(module='test',
                  sources=['thread.c', 'main.c'],
                  binname='rpmalloc-test',
                  implicit_deps=[rpmalloc_test_lib],
                  libs=['rpmalloc-test'],
                  includepaths=['rpmalloc', 'test'],
                  variables={
                      'defines': [
                          'ENABLE_ASSERTS=1', 'ENABLE_STATISTICS=1',
                          'RPMALLOC_FIRST_CLASS_HEAPS=1',
                          'RPMALLOC_CONFIGURABLE=1'
                      ]
                  })
    generator.bin(module='test',
                  sources=['thread.c', 'main-override.cc'],
                  binname='rpmallocwrap-test',
                  implicit_deps=[rpmallocwrap_lib],
                  libs=['rpmallocwrap'],
                  includepaths=['rpmalloc', 'test'],
                  variables={
                      'runtime': 'c++',
                      'defines': ['ENABLE_ASSERTS=1', 'ENABLE_STATISTICS=1']
writer = generator.writer
toolchain = generator.toolchain

includepaths = ['test', 'benchmark']
test_lib = generator.lib(module='test',
                         sources=['thread.c', 'timer.c'],
                         includepaths=includepaths)
benchmark_lib = generator.lib(module='benchmark',
                              sources=['main.c'],
                              includepaths=includepaths)

#Build one binary per benchmark
generator.bin(module='rpmalloc',
              sources=['benchmark.c', 'rpmalloc.c'],
              binname='benchmark-rpmalloc-unlimit',
              basepath='benchmark',
              implicit_deps=[benchmark_lib, test_lib],
              libs=['benchmark', 'test'],
              includepaths=includepaths,
              variables={'defines': ['ENABLE_UNLIMITED_CACHE=1']})
generator.bin(module='rpmalloc',
              sources=['benchmark.c', 'rpmalloc.c'],
              binname='benchmark-rpmalloc-size',
              basepath='benchmark',
              implicit_deps=[benchmark_lib, test_lib],
              libs=['benchmark', 'test'],
              includepaths=includepaths,
              variables={'defines': ['ENABLE_SPACE_PRIORITY_CACHE=1']})
generator.bin(module='rpmalloc',
              sources=['benchmark.c', 'rpmalloc.c'],
              binname='benchmark-rpmalloc',
              basepath='benchmark',
Exemple #25
0
             os.path.join('drawable-xhdpi', 'icon.png'),
             os.path.join('drawable-xxhdpi', 'icon.png'),
             os.path.join('drawable-xxxhdpi', 'icon.png')
         ]
     ]
     test_extrasources = [
         os.path.join('all', 'android', 'java', 'com', 'rampantpixels',
                      'foundation', 'test', item)
         for item in ['TestActivity.java']
     ]
 if target.is_pnacl():
     generator.bin(
         module='',
         sources=[os.path.join(module, 'main.c')
                  for module in test_cases] + test_extrasources,
         binname='test-all',
         basepath='test',
         implicit_deps=[mdns_lib],
         libs=['mdns', 'network', 'test', 'foundation'],
         resources=test_resources,
         includepaths=includepaths)
 else:
     generator.app(
         module='',
         sources=[os.path.join(module, 'main.c')
                  for module in test_cases] + test_extrasources,
         binname='test-all',
         basepath='test',
         implicit_deps=[mdns_lib],
         libs=['mdns', 'network', 'test', 'foundation'],
         resources=test_resources,
         includepaths=includepaths)