From 495d3802e2a583b5185dc8ac009e8b872c8554ec Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Thu, 5 Sep 2013 21:58:58 -0700 Subject: [PATCH] Some code - A main() - A Scene type - Some functions on Scenes --- SConstruct | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/SConscript | 8 ++++++ src/charles.c | 14 ++++++++++ src/scene.c | 28 +++++++++++++++++++ src/scene.h | 22 +++++++++++++++ 5 files changed, 148 insertions(+) create mode 100644 SConstruct create mode 100644 src/SConscript create mode 100644 src/charles.c create mode 100644 src/scene.c create mode 100644 src/scene.h diff --git a/SConstruct b/SConstruct new file mode 100644 index 0000000..a24b2ea --- /dev/null +++ b/SConstruct @@ -0,0 +1,76 @@ +# SConstruct +# vim: set ft=python: +# +# Toplevel Scons build script for the Charles project. +# +# Eryn Wells + + +# +# DEFAULT CONFIGURATION VALUES +# + +# Enabling debugging does the following things: +# 1. Turns on debugging symbols +# 2. Turns off all optimization +# 3. Sets the DEBUG define +DEBUG = True + +# Show build commands ("cc [args] -o [out] [file], etc"). If this is False, show +# some nice messages for each step of the build. +BUILD_CMDS = False + +# Library directories. Where should scons look for .a files during linking? +lib_directories = Split(""" +""") + +# Source directories. New directories should contain a SConscript file and be +# added here. +source_directories = lib_directories + Split(""" + #src +""") + +# Include directories. Where should scons look for headers during preprocessing +# and compiling? +include_directories = Split(""" + #src +""") + + +# +# BUILD STUFF BELOW HERE +# + +import os.path + + +env = Environment(CC='clang', + CFLAGS='-Wall -fcolor-diagnostics', + CPPPATH=include_directories, + LINKFLAGS='', + LIBPATH=lib_directories) + + +# Handle command line variables +DEBUG = bool(int(ARGUMENTS.get('DEBUG', DEBUG))) +if DEBUG: + env.Append(CXXFLAGS=' -g -O0') + env.Append(CPPDEFINES=['DEBUG']) +else: + env.Append(CXXFLAGS=' -O2') + +BUILD_CMDS = bool(int(ARGUMENTS.get('BUILD_CMDS', BUILD_CMDS))) +if not BUILD_CMDS: + def generate_comstr(action): + return '%12s: $TARGET' % (action,) + env['CCCOMSTR'] = generate_comstr('Building'), + env['LINKCOMSTR'] = generate_comstr('Linking'), + env['ARCOMSTR'] = generate_comstr('Archiving'), + env['RANLIBCOMSTR'] = generate_comstr('Indexing') + + +# Build source subdirectories +env.SConscript([os.path.join(dir, 'SConscript') for dir in source_directories], + exports='env') + +Default('charles') diff --git a/src/SConscript b/src/SConscript new file mode 100644 index 0000000..4dfa91a --- /dev/null +++ b/src/SConscript @@ -0,0 +1,8 @@ +Import('env') + +files = Split(""" + charles.c +""") + +prog = env.Program('charles', files) +env.Alias('charles', prog) diff --git a/src/charles.c b/src/charles.c new file mode 100644 index 0000000..797f9ef --- /dev/null +++ b/src/charles.c @@ -0,0 +1,14 @@ +/* charles.c + * + * Entry point for Charles, including main(). + * + * Eryn Wells + */ + + +int +main(int argc, + const char *argv[]) +{ + return 0; +} diff --git a/src/scene.c b/src/scene.c new file mode 100644 index 0000000..f0ef41a --- /dev/null +++ b/src/scene.c @@ -0,0 +1,28 @@ +/* scene.c + * + * Definition of Scene-related functions. + * + * Eryn Wells + */ + + +#include "scene.h" + + +/* + * scene_init -- + */ +void +scene_init(Scene *scene) +{ + scene->height = 0; + scene->width = 0; +} + + +/* + * scene_destroy -- + */ +void +scene_destroy(Scene *scene) +{ } diff --git a/src/scene.h b/src/scene.h new file mode 100644 index 0000000..7f5732c --- /dev/null +++ b/src/scene.h @@ -0,0 +1,22 @@ +/* scene.h + * + * Definition of Scene type and related functions. + * + * Eryn Wells + */ + +#ifndef __SCENE_H__ +#define __SCENE_H__ + + +typedef struct _Scene +{ + int height, width; /* Pixel dimensions. */ +} Scene; + + +void scene_init(Scene *scene); +void scene_destroy(Scene *scene); + + +#endif