change build system to rscons

This commit is contained in:
Josh Holtrop 2019-10-12 17:25:38 -04:00
parent 612fd112ec
commit ad6e922e07
6 changed files with 21 additions and 110 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
/build/
/.rscons*
/dwscr
/LoadFile/LoadFile-gen.inc

View File

@ -1,17 +0,0 @@
GENLOADFILE := perl genLoadFile.pl
LOGO_PATH := ../logo
LOADFILES += dwlogo.obj
LOADFILES += dwlogo.mtl
ABSLOADFILES := $(foreach lf,$(LOADFILES),$(LOGO_PATH)/$(lf))
all: LoadFile.o
LoadFile.o: LoadFile.cc LoadFile-gen.inc
$(CXX) -c -o $@ $< $(CPPFLAGS) $(CXXFLAGS)
LoadFile-gen.inc: genLoadFile.pl $(ABSLOADFILES)
$(GENLOADFILE) --root=$(LOGO_PATH) $(LOADFILES)
clean:
-$(RM) -f *~ *.o LoadFile-gen.inc

View File

@ -1,77 +1,7 @@
# Author: Josh Holtrop
# DornerWorks screensaver
# set this to compile in "debug" mode
#DEBUG := 1
WINCHECK := $(shell which msys-1.0.dll >/dev/null 2>&1; if [ $$? -eq 0 ]; then echo MSYS; fi)
ifeq ($(strip $(WINCHECK)),)
WINDOWS := 0
else
WINDOWS := 1
endif
export CPPFLAGS += -I"$(shell pwd)"
OBJS = dwscr.o wfobj/WFObj.o LoadFile/LoadFile.o ss/ss.a
TARGET = dwscr
export CXXFLAGS := -O2 -Wall
export CPPFLAGS
ifdef DEBUG
CPPFLAGS += -DDEBUG
CPPFLAGS += -g
endif
ifeq ($(WINDOWS),1)
LDFLAGS += -lopengl32 -lglu32 -lmingw32
TARGET := $(TARGET).exe
SSNAME := dwscr.scr
INSTALLDIR := C:/WINDOWS
OBJS += displayinfo-win32.o
else
LDFLAGS += -lGL -lGLU
OBJS += displayinfo.o
endif
LDFLAGS += $(shell sdl-config --libs)
export CPPFLAGS += $(shell sdl-config --cflags)
ifdef WITHOUT_ODE
CPPFLAGS += -DWITHOUT_ODE
else
CPPFLAGS += $(shell ode-config --cflags)
LDFLAGS += $(shell ode-config --libs)
endif
all: $(TARGET)
$(TARGET): $(OBJS)
$(CXX) -o $@ $(OBJS) $(LDFLAGS)
.PHONY: wfobj/WFObj.o
wfobj/WFObj.o:
$(MAKE) -C wfobj
.PHONY: LoadFile/LoadFile.o
LoadFile/LoadFile.o:
$(MAKE) -C LoadFile
.PHONY: ss/ss.a
ss/ss.a:
$(MAKE) -C ss
ifeq ($(WINDOWS),1)
.PHONY: install
install:
cp $(TARGET) $(INSTALLDIR)/$(SSNAME)
endif
.PHONY: all
all:
./rscons build
.PHONY: clean
clean:
$(MAKE) -C wfobj clean
$(MAKE) -C LoadFile clean
$(MAKE) -C ss clean
-$(RM) -f *~ *.o $(TARGET)
./rscons clean

View File

@ -18,7 +18,15 @@ end
build do
Environment.new do |env|
system("make -C LoadFile")
env.add_builder(:GenLoadFile) do |params|
command = ["perl", "genLoadFile.pl", "--root=../logo", "dwlogo.obj", "dwlogo.mtl"]
unless @cache.up_to_date?(@target, command, @sources, @env)
print_run_message("GenLoadFile #{@target}", nil)
system(*command, chdir: "LoadFile")
@cache.register_build(@target, command, @sources, @env)
end
true
end
env["CCFLAGS"] = %w[-O2 -Wall]
env["CPPPATH"] += %w[.]
sources = ["dwscr.cc", "wfobj/WFObj.cc", "LoadFile/LoadFile.cc"] + glob("ss/*.{cc,cpp}")
@ -27,6 +35,11 @@ build do
else
sources += ["displayinfo.cc"]
end
loadfiles = %w[
logo/dwlogo.obj
logo/dwlogo.mtl
]
loadfile_gen = env.GenLoadFile("LoadFile/LoadFile-gen.inc", loadfiles + ["LoadFile/genLoadFile.pl"])
dwscr = env.Program("dwscr", sources)
if RUBY_PLATFORM =~ /mingw/
env.Install("C:/Windows/dwscr.scr", dwscr)

2
configure vendored Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
exec "$(dirname "$0")"/rscons "$@"

View File

@ -1,18 +0,0 @@
OBJS := SSMain.o
OBJS += SSMode.o
OBJS += LogoBox.o
OBJS += PlainSpin.o
OBJS += LightBounce.o
ifndef WITHOUT_ODE
OBJS += TumblingLogos.o
OBJS += Towers.o
endif
AROBJS := $(foreach o,$(OBJS),ss.a($(o)))
all: ss.a
ss.a: $(AROBJS)
clean:
-$(RM) -f *~ *.o *.a