change build system to waf

This commit is contained in:
Josh Holtrop 2016-04-05 22:50:31 -04:00
parent f6c3564694
commit 37a0617eb8
3 changed files with 28 additions and 39 deletions

5
.gitignore vendored
View File

@ -1,3 +1,4 @@
/.rsconscache
/build
/build/
/doxygen/
/.waf*
/.lock-waf*

View File

@ -1,37 +0,0 @@
require "rscons"
base_env = Rscons::Environment.new do |env|
env["build_root"] = lambda {|args| args[:env].build_root}
env["CPPPATH"] << "include"
env["CPPPATH"] << "test/gl3w"
env["CPPDEFINES"] << %[GLCXX_GL_INCLUDE="GL3/gl3w.h"]
env["CCFLAGS"] += %w[-Wall]
env["CXXFLAGS"] += %w[-std=gnu++11]
env["CXXSUFFIX"] = %w[.cc .cpp]
end
task :lib do
base_env.clone do |env|
env.build_root = "build/lib"
sources = Dir["src/**/*.cpp"]
env.Library("${build_root}/lib.a", sources)
end
end
task :doxygen do
sh(*%w[doxygen Doxyfile])
end
task :test do
base_env.clone do |env|
env.build_root = "build/test"
env.parse_flags!("!sdl2-config --cflags --libs")
sources = Dir["src/**/*.cpp", "test/**/*.{cpp,c}"]
env["LIBS"] += %w[dl GL]
env.Program("${build_root}/testapp", sources)
end
end
task :clean do
Rscons.clean
end

25
wscript Normal file
View File

@ -0,0 +1,25 @@
def options(opt):
opt.load("compiler_c compiler_cxx")
def configure(conf):
conf.load("compiler_c compiler_cxx")
conf.check(header_name = "stdio.h", features = "cxx cxxprogram")
conf.env.INCLUDES += ["include"]
conf.env.INCLUDES += ["test/gl3w"]
conf.env.DEFINES += ['''GLCXX_GL_INCLUDE="GL3/gl3w.h"''']
conf.env.CXXFLAGS += ["-Wall"]
conf.env.CXXFLAGS += ["-std=gnu++11"]
conf.check_cfg(package = "sdl2", args = "--cflags --libs")
def build(bld):
sources = bld.path.ant_glob("src/**/*.cpp")
bld.shlib(source = sources, target = "glcxx")
test_sources = bld.path.ant_glob("test/**/*.cpp") + \
bld.path.ant_glob("test/**/*.c")
bld.program(source = test_sources,
target = "glcxx-test",
use = "glcxx",
uselib = "SDL2",
lib = ["dl", "GL"],
linkflags = ["-Wl,-rpath,$ORIGIN"])