42 lines
1.3 KiB
Python
42 lines
1.3 KiB
Python
import os
|
|
|
|
def options(opt):
|
|
opt.load("compiler_c compiler_cxx")
|
|
|
|
def configure(conf):
|
|
conf.load("compiler_c compiler_cxx")
|
|
conf.env.INCLUDES += ["libs/glcxx/include"]
|
|
conf.env.INCLUDES += ["libs/glm"]
|
|
conf.env.INCLUDES += ["src"]
|
|
conf.env.DEFINES += ['''GLCXX_GL_INCLUDE="GL3/gl3w.h"''']
|
|
conf.env.CXXFLAGS += ["-Wall"]
|
|
conf.env.CXXFLAGS += ["-std=gnu++14"]
|
|
conf.check_cfg(package = "sdl2", args = "--cflags --libs")
|
|
conf.check_cfg(package = "freetype2", uselib_store = "FreeType2", args = "--cflags --libs")
|
|
if "MINGW" in os.popen("uname").read():
|
|
# TODO: set CXX to mingw32-g++
|
|
pass
|
|
if os.listdir("libs/glcxx") == []:
|
|
print("Fetching git submodules...")
|
|
from subprocess import Popen
|
|
Popen(["git", "submodule", "update", "--init"]).wait()
|
|
|
|
def build(bld):
|
|
sources = \
|
|
bld.path.ant_glob("src/**/*.cc") + \
|
|
bld.path.ant_glob("libs/glcxx/src/**/*.cpp") + \
|
|
bld.path.ant_glob("src/GL3/**/*.c")
|
|
|
|
libs = []
|
|
if "MINGW" in os.popen("uname").read():
|
|
libs += ["opengl32", "mingw32"]
|
|
else:
|
|
libs += ["dl", "GL"]
|
|
bld.program(
|
|
source = sources,
|
|
target = "app",
|
|
uselib = ["SDL2", "FreeType2"],
|
|
lib = libs,
|
|
linkflags = ["-Wl,-rpath,$ORIGIN"],
|
|
install_path = None)
|