40 lines
1.2 KiB
Python
40 lines
1.2 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 += ["glcxx/include"]
|
|
conf.env.INCLUDES += ["glm"]
|
|
conf.env.INCLUDES += ["."]
|
|
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")
|
|
if "MINGW" in os.popen("uname").read():
|
|
# TODO: set CXX to mingw32-g++
|
|
pass
|
|
if os.listdir("glcxx") == []:
|
|
print("Fetching git submodules...")
|
|
from subprocess import Popen
|
|
Popen(["git", "submodule", "update", "--init"]).wait()
|
|
|
|
def build(bld):
|
|
sources = ["app.cc"] + \
|
|
bld.path.ant_glob("glcxx/src/**/*.cpp") + \
|
|
bld.path.ant_glob("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",
|
|
lib = libs,
|
|
linkflags = ["-Wl,-rpath,$ORIGIN"],
|
|
install_path = None)
|