diff --git a/.gitignore b/.gitignore index 3a539ff..c9622e8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ -/.rsconscache -/build +/build/ /doxygen/ +/.waf* +/.lock-waf* diff --git a/Rakefile b/Rakefile deleted file mode 100644 index 25ae11b..0000000 --- a/Rakefile +++ /dev/null @@ -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 diff --git a/wscript b/wscript new file mode 100644 index 0000000..02f927e --- /dev/null +++ b/wscript @@ -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"])