convert build system to waf
This commit is contained in:
parent
9e7c523b48
commit
d04ef0dd20
4
.gitignore
vendored
4
.gitignore
vendored
@ -1 +1,3 @@
|
||||
/app
|
||||
/build/
|
||||
/.waf*
|
||||
/.lock-waf*
|
||||
|
53
Makefile
53
Makefile
@ -1,46 +1,11 @@
|
||||
TARGET := app
|
||||
OBJS := app.o GL3/gl3w.o
|
||||
OBJS += glcxx/src/glcxx/Array.o
|
||||
OBJS += glcxx/src/glcxx/Buffer.o
|
||||
OBJS += glcxx/src/glcxx/Program.o
|
||||
OBJS += glcxx/src/glcxx/Shader.o
|
||||
OBJS += glcxx/src/glcxx/Texture.o
|
||||
REPOS := glcxx glm
|
||||
|
||||
CCFLAGS := $(shell sdl2-config --cflags)
|
||||
ifeq (MINGW,$(findstring MINGW,$(shell uname)))
|
||||
LIBS := -lopengl32 -lmingw32
|
||||
CXX := mingw32-g++
|
||||
TARGET := $(TARGET).exe
|
||||
else
|
||||
LIBS := -lGL `sdl2-config --libs`
|
||||
endif
|
||||
LIBS += -ldl
|
||||
LDFLAGS := $(LIBS) $(shell sdl2-config --libs)
|
||||
CCFLAGS += -I glcxx/include -I glm -I.
|
||||
CXXFLAGS += -std=gnu++14
|
||||
CCFLAGS += -DGLCXX_GL_INCLUDE='"GL3/gl3w.h"'
|
||||
|
||||
|
||||
all: submodule_init $(TARGET)
|
||||
|
||||
$(TARGET): $(OBJS)
|
||||
$(CXX) -o $(TARGET) $^ $(LDFLAGS)
|
||||
|
||||
%.o: %.c
|
||||
$(CC) -c -o $@ $(CCFLAGS) $(CFLAGS) $<
|
||||
|
||||
%.o: %.cc
|
||||
$(CXX) -c -o $@ $(CCFLAGS) $(CXXFLAGS) $<
|
||||
|
||||
%.o: %.cpp
|
||||
$(CXX) -c -o $@ $(CCFLAGS) $(CXXFLAGS) $<
|
||||
|
||||
.PHONY: submodule_init
|
||||
submodule_init:
|
||||
@if [ ! -e glcxx ]; then \
|
||||
git submodule update --init; \
|
||||
fi
|
||||
.PHONY: build
|
||||
build:
|
||||
./waf build
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
-rm -f $(TARGET) *~ $(OBJS)
|
||||
./waf clean
|
||||
|
||||
.PHONY: distclean
|
||||
distclean:
|
||||
./waf distclean
|
||||
|
170
waf
vendored
Executable file
170
waf
vendored
Executable file
File diff suppressed because one or more lines are too long
39
wscript
Normal file
39
wscript
Normal file
@ -0,0 +1,39 @@
|
||||
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)
|
Loading…
x
Reference in New Issue
Block a user