jes/wscript

40 lines
1.4 KiB
Python

import platform
import re
import os.path
def options(opt):
opt.load("compiler_c compiler_cxx")
def configure(conf):
conf.load("compiler_c compiler_cxx")
conf.check(header_name = "getopt.h")
conf.check_cfg(package = "sdl2", args = "--cflags --libs")
def build(bld):
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 = "jes",
source = bld.path.ant_glob(["src/**/*.cc", "src/**/*.c", "libs/glcxx/src/glcxx/*"]),
includes = includes,
defines = ['GLCXX_GL_INCLUDE="gl3w.h"'],
cxxflags = ["-Wall", "-std=gnu++14"],
lib = ["dl", "GL"],
uselib = "SDL2")
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",
"libs/googletest/src/gtest_main.cc"]
test_includes = ["src/core"]
test_includes += ["libs/googletest/include", "libs/googletest"]
bld(features = "cxx cxxprogram",
target = "tests",
source = test_sources,
includes = test_includes,
lib = test_libs,
cxxflags = ["-Wall", "-std=gnu++14"])