switch from waf to rscons
This commit is contained in:
parent
a0b2f660a2
commit
ddb905351a
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,5 +1,5 @@
|
|||||||
/.lock-waf*
|
/.rscons*
|
||||||
/.waf*
|
|
||||||
/build/
|
/build/
|
||||||
/test/tmp/
|
/test/tmp/
|
||||||
/coverage/
|
/coverage/
|
||||||
|
/jes
|
||||||
|
19
Makefile
19
Makefile
@ -1,20 +1,7 @@
|
|||||||
|
.PHONY: all
|
||||||
all:
|
all:
|
||||||
./waf build --targets jes
|
./rscons build
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
./waf clean
|
./rscons clean
|
||||||
|
|
||||||
ifneq ($(FILTER),)
|
|
||||||
GTEST_FILTER := --gtest_filter=$(FILTER)
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: build_tests
|
|
||||||
build_tests:
|
|
||||||
./waf build --targets tests
|
|
||||||
|
|
||||||
.PHONY: test
|
|
||||||
test: build_tests
|
|
||||||
./build/tests $(GTEST_FILTER)
|
|
||||||
@-rm -rf coverage
|
|
||||||
-gcovinator -b build -s src
|
|
||||||
|
39
Rsconscript
Normal file
39
Rsconscript
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
project_name "jes"
|
||||||
|
|
||||||
|
configure do
|
||||||
|
check_c_compiler
|
||||||
|
check_cxx_compiler
|
||||||
|
check_d_compiler
|
||||||
|
check_c_header "getopt.h"
|
||||||
|
check_c_header "X11/Xlib.h"
|
||||||
|
check_cfg package: "freetype2"
|
||||||
|
check_lib "GL"
|
||||||
|
check_lib "dl"
|
||||||
|
check_lib "X11"
|
||||||
|
end
|
||||||
|
|
||||||
|
build do
|
||||||
|
Environment.new do |env|
|
||||||
|
env["CPPDEFINES"] += %w[
|
||||||
|
APPNAME="jes"
|
||||||
|
VERSION="0.0.1"
|
||||||
|
GLCXX_GL_INCLUDE="gl3w.h"
|
||||||
|
PLATFORM_LINUX
|
||||||
|
JTK_X
|
||||||
|
]
|
||||||
|
env["CPPPATH"] += glob("src/**", "libs/glcxx/include")
|
||||||
|
env["CCFLAGS"] += %w[
|
||||||
|
-Wall
|
||||||
|
-O2
|
||||||
|
-Wno-switch
|
||||||
|
]
|
||||||
|
env["CXXFLAGS"] += %w[
|
||||||
|
-std=gnu++14
|
||||||
|
]
|
||||||
|
sources = glob("src/**/*.{c,cc,cxx}", "libs/glcxx/src/glcxx/*")
|
||||||
|
env.Program("jes", sources)
|
||||||
|
env.InstallDirectory("${prefix}/bin")
|
||||||
|
env.Install("${prefix}/bin", "jes")
|
||||||
|
env.Install("${prefix}/share", "share")
|
||||||
|
end
|
||||||
|
end
|
2
configure
vendored
2
configure
vendored
@ -5,4 +5,4 @@ if [ ! -e libs/glcxx/src ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec ./waf configure "$@"
|
exec "$(dirname "$0")"/rscons configure "$@"
|
||||||
|
66
wscript
66
wscript
@ -1,66 +0,0 @@
|
|||||||
import platform
|
|
||||||
import re
|
|
||||||
import os.path
|
|
||||||
|
|
||||||
APPNAME = "jes"
|
|
||||||
VERSION = "0.0.1"
|
|
||||||
|
|
||||||
def options(opt):
|
|
||||||
opt.load("compiler_c compiler_cxx")
|
|
||||||
|
|
||||||
def configure(conf):
|
|
||||||
conf.load("compiler_c compiler_cxx")
|
|
||||||
conf.check(header_name = "getopt.h", global_define = False)
|
|
||||||
conf.check_cfg(package = "freetype2", uselib_store = "FreeType2", args = "--cflags --libs")
|
|
||||||
if platform.system() == "Linux":
|
|
||||||
conf.check(header_name = "X11/Xlib.h", global_define = False)
|
|
||||||
conf.check(lib = 'GL', global_define = False)
|
|
||||||
elif platform.system() == "Windows":
|
|
||||||
conf.check(header_name = "windows.h", global_define = False)
|
|
||||||
conf.check(lib = 'opengl32', global_define = False)
|
|
||||||
|
|
||||||
def build(bld):
|
|
||||||
defines = ['APPNAME="%s"' % APPNAME]
|
|
||||||
defines += ['VERSION="%s"' % VERSION]
|
|
||||||
includes = [p for p in bld.path.ant_glob("src/**", dir = True) if os.path.isdir(p.abspath())]
|
|
||||||
includes += ["libs/glcxx/include"]
|
|
||||||
libs = []
|
|
||||||
if platform.system() == "Linux":
|
|
||||||
defines += ["PLATFORM_LINUX"]
|
|
||||||
defines += ["JTK_X"]
|
|
||||||
libs += ["dl", "GL", "X11"]
|
|
||||||
elif platform.system() == "Windows":
|
|
||||||
defines += ["PLATFORM_WINDOWS"]
|
|
||||||
defines += ["JTK_WINDOWS"]
|
|
||||||
libs += ["opengl32"]
|
|
||||||
defines += ['GLCXX_GL_INCLUDE="gl3w.h"']
|
|
||||||
sources = bld.path.ant_glob(["src/**/*.cc", "src/**/*.c", "libs/glcxx/src/glcxx/*"])
|
|
||||||
bld(features = "c cprogram cxx cxxprogram",
|
|
||||||
target = APPNAME,
|
|
||||||
source = sources,
|
|
||||||
includes = includes,
|
|
||||||
defines = defines,
|
|
||||||
cxxflags = ["-Wall", "-std=gnu++14", "-O2", "-Wno-switch"],
|
|
||||||
lib = libs,
|
|
||||||
uselib = ["FreeType2"])
|
|
||||||
|
|
||||||
test_libs = libs + []
|
|
||||||
if platform.system() == "Linux":
|
|
||||||
test_libs += ["pthread"]
|
|
||||||
elif platform.system() == "Windows":
|
|
||||||
pass
|
|
||||||
import sys
|
|
||||||
test_sources = bld.path.ant_glob(["src/*/**/*.cc", "src/*/**/*.c", "libs/glcxx/src/glcxx/*"])
|
|
||||||
test_sources += bld.path.ant_glob("test/src/**/*.cc")
|
|
||||||
test_sources += ["libs/googletest/src/gtest-all.cc"]
|
|
||||||
test_includes = includes + ["libs/googletest/include", "libs/googletest"]
|
|
||||||
test_defines = defines + ["ENABLE_TESTING"]
|
|
||||||
bld(features = "cxx cxxprogram",
|
|
||||||
target = "tests",
|
|
||||||
source = test_sources,
|
|
||||||
includes = test_includes,
|
|
||||||
defines = test_defines,
|
|
||||||
lib = test_libs,
|
|
||||||
cxxflags = ["-Wall", "-std=gnu++14", "--coverage", "-Wno-switch", "-include", "iostream"],
|
|
||||||
linkflags = ["--coverage"],
|
|
||||||
uselib = ["FreeType2"])
|
|
Loading…
x
Reference in New Issue
Block a user