46 lines
1.6 KiB
Python
46 lines
1.6 KiB
Python
import platform
|
|
import re
|
|
import os.path
|
|
|
|
APPNAME = "jes"
|
|
VERSION = "0.0.1"
|
|
|
|
def options(opt):
|
|
opt.load("compiler_c compiler_cxx")
|
|
|
|
def configure(conf):
|
|
conf.load("compiler_c compiler_cxx")
|
|
conf.check(header_name = "getopt.h", global_define = False)
|
|
conf.check_cfg(package = "sdl2", args = "--cflags --libs")
|
|
conf.check_cfg(package = "freetype2", uselib_store = "FreeType2", args = "--cflags --libs")
|
|
|
|
def build(bld):
|
|
defines = ['APPNAME="%s"' % APPNAME]
|
|
defines += ['VERSION="%s"' % VERSION]
|
|
includes = [p for p in bld.path.ant_glob("src/**", dir = True) if os.path.isdir(p.abspath())]
|
|
includes += ["libs/glcxx/include"]
|
|
bld(features = "c cprogram cxx cxxprogram",
|
|
target = APPNAME,
|
|
source = bld.path.ant_glob(["src/**/*.cc", "src/**/*.c", "libs/glcxx/src/glcxx/*"]),
|
|
includes = includes,
|
|
defines = ['GLCXX_GL_INCLUDE="gl3w.h"'] + defines,
|
|
cxxflags = ["-Wall", "-std=gnu++14", "-O2", "-Wno-switch"],
|
|
lib = ["dl", "GL"],
|
|
uselib = ["SDL2", "FreeType2"])
|
|
|
|
test_libs = []
|
|
if re.search(r'linux', platform.platform(), re.IGNORECASE):
|
|
test_libs += ["pthread"]
|
|
test_sources = bld.path.ant_glob("src/core/**/*.cc")
|
|
test_sources += bld.path.ant_glob("test/src/**/*.cc")
|
|
test_sources += ["libs/googletest/src/gtest-all.cc"]
|
|
test_includes = ["src/core"]
|
|
test_includes += ["libs/googletest/include", "libs/googletest"]
|
|
bld(features = "cxx cxxprogram",
|
|
target = "tests",
|
|
source = test_sources,
|
|
includes = test_includes,
|
|
defines = defines,
|
|
lib = test_libs,
|
|
cxxflags = ["-Wall", "-std=gnu++14"])
|