citrun

watch C/C++ source code execute
Log | Files | Refs | LICENSE

commit 37ec7203bdee3a9ba0ea013ecb279ad70f8b363c
parent de5693de88742df3e6fdef0a9e0ab710d3548d8d
Author: Kyle Milz <kyle@0x30.net>
Date:   Wed, 21 Dec 2016 22:15:08 -0700

src: move some stuff into Jamrules.tail

Diffstat:
AJamrules.tail | 37+++++++++++++++++++++++++++++++++++++
Mconfigure | 52++++++++++++++++++++++++++++++++++++----------------
Msrc/Jamfile | 40+---------------------------------------
3 files changed, 74 insertions(+), 55 deletions(-)

diff --git a/Jamrules.tail b/Jamrules.tail @@ -0,0 +1,37 @@ +# Quote an entire file and add a variable declaration prefixing the string. +rule Stringize +{ + MakeLocate $(1) : $(LOCATE_SOURCE) ; + SEARCH on $(2) = $(SEARCH_SOURCE) ; + Depends $(1) : $(2) ; + Clean clean : $(1) ; +} + +actions Stringize +{ + # Quote the entire original source file and put it in the destination. + sed -e ' s/\\/\\\\/g; s/"/\\"/g; s/^/"/; s/$/\\n"/; ' < $(>) > $(<) + echo ";" >> $(<) + + # Add the declaration to the start of the file. + sed -e '1s/^/static const char *$(1:B) = /' -i.bak $(<) + rm $(<).bak +} + +# Create installation directories and setup quirky ../../citrun-inst links. +rule InstallSyms +{ + Depends install : $(PREFIX)/share/citrun/$(>) ; + MakeLocate $(PREFIX)/share/citrun/$(>) : $(<) ; + + for i in $(>) + { + SymLink $(PREFIX)/share/citrun/$(i) ; + } +} + +# Used by InstallSyms +actions SymLink +{ + $(RM) $(<) && $(LN) -s ../../bin/citrun-inst $(<) ; +} diff --git a/configure b/configure @@ -4,19 +4,25 @@ # ░█░░░░░░█░░░█░░░░█▀▄░█░█░█░█ # ░▀▀▀░░░▀▀▀░░▀░░░░▀░▀░▀▀▀░▀░▀ # -# Creates Jamrules. +# Creates Jamrules file. # type pkg-config type llvm-config -# stuff still not accounted for: -# - C++11 capable compiler -# - Curses -# - DejaVu Sans Mono -# - Jam -# - LLVM and Clang > 3.7 -# - OpenGLES >= 2.0 +# +# Check for C++11 compiler. +# +touch __test.cc +${CXX-c++} -std=c++11 -c __test.cc + +# +# llvm/clang versions must be >= 3.7 +# +llvm-config --version +# +# Check for pkg-config available software. Try and print a nice missing list. +# gl_pkgs="osmesa glfw3 glew freetype2" should_exit=0 @@ -28,12 +34,11 @@ for pkg in $gl_pkgs; do done test $should_exit -eq 0 || exit 1 -cat <<EOF > Jamrules # -# Generated by './configure' on `date` +# Write Jamrules which consists of {llvm,pkg}-config calls getting various flags +# and library names. Note any errors inside backticks will be ignored. # -echo ...build C It Run on \$(OS)... ; - +cat <<EOF > Jamrules CC = ${CC-cc} ; C++ = ${CXX-c++} ; @@ -52,20 +57,35 @@ INST_LDFLAGS = "`llvm-config --ldflags`" ; INST_LIBS = "`llvm-config --libs bitreader mcparser transformutils option`" ; INST_LIBS += "`llvm-config --system-libs`" ; +# Generated by './configure' on `date` +echo ...build C It Run on \$(OS)... ; + if \$(OS) = OPENBSD { LDGROUP_START = -Wl,--start-group ; LDGROUP_END = -Wl,--end-group ; + FONT_PATH = "/usr/X11R6/lib/X11/fonts/TTF/DejaVuSansMono.ttf" ; } - -if \$(OS) = MACOSX { +else if \$(OS) = MACOSX { LINKLIBS on citrun-gl = -framework OpenGL ; + FONT_PATH "/Library/Fonts/Andale Mono.ttf" ; } - -if \$(OS) = LINUX { +else if \$(OS) = LINUX { LINKLIBS on citrun-gl citrun-inst = -lbsd ; LDGROUP_START = -Wl,--start-group ; LDGROUP_END = -Wl,--end-group ; + FONT_PATH = "/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf" ; +} +else { + echo "WARNING: FONT_PATH not configured" ; } + EOF +cat Jamrules.tail >> Jamrules + +echo +echo === Configuration Summary ============================================== +head -n 8 Jamrules +echo ======================================================================== +echo echo "...call \`jam\` to build..." diff --git a/src/Jamfile b/src/Jamfile @@ -12,7 +12,6 @@ if $(PREFIX) { } else { CITRUN_SHARE = $(CITRUN_SRCDIR) ; - CFLAGS += -Wall -g ; } # Do a string replacement on the first argument. @@ -22,44 +21,6 @@ actions ReplaceTokens rm $(<).bak } -# Quote an entire file and add a variable declaration prefixing the string. -rule Stringize -{ - MakeLocate $(1) : $(LOCATE_SOURCE) ; - SEARCH on $(2) = $(SEARCH_SOURCE) ; - Depends $(1) : $(2) ; - Clean clean : $(1) ; -} - -actions Stringize -{ - # Quote the entire original source file and put it in the destination. - sed -e ' s/\\/\\\\/g; s/"/\\"/g; s/^/"/; s/$/\\n"/; ' < $(>) > $(<) - echo ";" >> $(<) - - # Add the declaration to the start of the file. - sed -e '1s/^/static const char *$(1:B) = /' -i.bak $(<) - rm $(<).bak -} - -# Create installation directories and setup quirky ../../citrun-inst links. -rule InstallSyms -{ - Depends install : $(PREFIX)/share/citrun/$(>) ; - MakeLocate $(PREFIX)/share/citrun/$(>) : $(<) ; - - for i in $(>) - { - SymLink $(PREFIX)/share/citrun/$(i) ; - } -} - -# Used by InstallSyms -actions SymLink -{ - $(RM) $(<) && $(LN) -s ../../bin/citrun-inst $(<) ; -} - # # libcitrun.a # @@ -103,6 +64,7 @@ Stringize demo_atlas_glsl.h : demo_atlas.glsl ; Stringize demo_vshader_glsl.h : demo_vshader.glsl ; Stringize demo_fshader_glsl.h : demo_fshader.glsl ; +ObjectDefines gl_font.cc : FONT_PATH=\\\"$(FONT_PATH)\\\" ; ObjectC++Flags gl_main.cc gl_testmain.cc $(GL_SRCS) : $(GL_CFLAGS) ; LINKLIBS on citrun-gl citrun-gltest += -lm $(GL_LIBS) ;