switch to waf build system

This commit is contained in:
Josh Holtrop 2018-01-15 20:50:27 -05:00
parent 188427b99d
commit 7ee6efe574
9 changed files with 6249 additions and 20 deletions

4
.gitignore vendored
View File

@ -1 +1,3 @@
/sdl-game-controller
/build/
/.waf*
/.lock-waf*

3630
GL3/gl3.h Normal file

File diff suppressed because it is too large Load Diff

1251
GL3/gl3w.c Normal file

File diff suppressed because it is too large Load Diff

1146
GL3/gl3w.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,21 +1,11 @@
FILE := sdl-game-controller
TARGET := $(FILE)
CFLAGS := $(shell pkg-config --cflags sdl2)
ifeq (MINGW,$(findstring MINGW,$(shell uname)))
LIBS := -lopengl32 -lglu32 -lmingw32
CC := mingw32-gcc
TARGET := $(TARGET).exe
else
LIBS := -lGL -lGLU `pkg-config --libs sdl2`
endif
LDFLAGS := $(LIBS) $(shell pkg-config --libs sdl2)
all: $(TARGET)
$(TARGET): $(FILE).c
$(CC) -o $(TARGET) $(CFLAGS) $< $(LDFLAGS)
.PHONY: build
build:
./waf build
.PHONY: clean
clean:
-rm -f $(TARGET) *~ *.o
./waf clean
.PHONY: distclean
distclean:
./waf distclean

2
configure vendored Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
exec ./waf configure "$@"

170
waf vendored Executable file

File diff suppressed because one or more lines are too long

38
wscript Normal file
View File

@ -0,0 +1,38 @@
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 += ["."]
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 = ["sdl-game-controller.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 = "sdl-game-controller",
uselib = "SDL2",
lib = libs,
linkflags = ["-Wl,-rpath,$ORIGIN"],
install_path = None)