+++ /dev/null
-###############################################################################
-#
-# Name: Opts
-# Type: Library
-# Author: Mike Lowis
-# License: BSD 2-Clause
-#
-###############################################################################
-
-# Utility Function Definitions
-#-----------------------------
-# Function for generating an file list
-flist = $(shell env find $(1) -name *.$(strip $(2)) -print)
-
-# Function for generating an file list
-dlist = $(shell env find $(1) -type d -print)
-
-# Function for generating an include list
-incdirs = $(addprefix -I, $(call dlist, $(1)))
-
-# Function for generating file dependencies
-define make-depend
- $(CXX) $(CXXFLAGS) -M $1 | \
- sed -e 's,\($(notdir $2)\) *:,$(dir $2)\1 $(subst .o,.d,$2): ,' \
- > $(subst .o,.d,$2)
-endef
-
-# Project and Artifact Names
-#---------------------------
-PROJ_NAME = opts
-TEST_RUNNER = test_runner
-SHARED_NAME = lib$(PROJ_NAME).lib
-STATIC_NAME = lib$(PROJ_NAME).a
-
-# File and Directory Settings
-#----------------------------
-# Root Directories
-SRC_ROOT = source/
-TESTS_ROOT = tests/
-
-# File Extensions
-SRC_EXT = c
-TEST_EXT = cpp
-
-# Libraries to Link Against
-LIBS =
-TEST_LIBS = $(LIBS) \
- tools/UnitTest++/libUnitTest++.a
-
-# Source File Lists
-SRC_FILES = $(call flist, $(SRC_ROOT), $(SRC_EXT))
-TEST_FILES = $(call flist, $(TESTS_ROOT), $(TEST_EXT))
-
-# Object File Lists
-SRC_OBJS = $(SRC_FILES:%.$(SRC_EXT)=%.o)
-TEST_OBJS = $(TEST_FILES:%.$(TEST_EXT)=%.o)
-
-# Dependecy File Lists
-SRC_DEPS = $(SRC_OBJS:%.o=%.d)
-TEST_DEPS = $(TEST_OBJS:%.o=%.d)
-
-# Include Directories
-INC_DIRS = $(call incdirs, $(SRC_ROOT)) \
- $(call incdirs, tools/UnitTest++/src)
-
-# Compiler and Linker Options
-#----------------------------
-CXXFLAGS = $(INC_DIRS) -Wall -fPIC
-TEST_CXXFLAGS = $(INC_DIRS)
-ARFLAGS = rcs
-
-# Build Rules
-#------------
-all: release test
-
-release: $(SHARED_NAME) $(STATIC_NAME)
-
-test: $(TEST_RUNNER)
- @echo Running unit tests...
- @./$(TEST_RUNNER)
-
-# Binaries
-$(SHARED_NAME): $(SRC_OBJS)
- @echo Linking $@...
- @$(CXX) $(CXXFLAGS) -shared -o $@ $(SRC_OBJS) $(LIBS)
-
-$(STATIC_NAME): $(SRC_OBJS)
- @echo Linking $@...
- @$(AR) $(ARFLAGS) -o $@ $(SRC_OBJS) $(LIBS)
-
-$(TEST_RUNNER): unit_test_pp $(SRC_OBJS) $(TEST_OBJS)
- @echo Linking $@...
- @$(CXX) $(TEST_CXXFLAGS) -o $@ $(SRC_OBJS) $(TEST_OBJS) $(TEST_LIBS)
-
-# Libraries
-unit_test_pp:
- @$(MAKE) -C tools/UnitTest++
-
-# Object Files
-$(SRC_OBJS): %.o : %.$(SRC_EXT)
- @echo $<
- @$(call make-depend,$<,$@)
- @$(CXX) -c $(CXXFLAGS) -o $@ $<
-
-$(TEST_OBJS): %.o : %.$(TEST_EXT)
- @echo $<
- @$(call make-depend,$<,$@)
- @$(CXX) -c $(TEST_CXXFLAGS) -o $@ $<
-
-# Cleanup
-clean:
- @$(MAKE) -C tools/UnitTest++ clean
- @$(RM) $(SRC_OBJS)
- @$(RM) $(TEST_OBJS)
- @$(RM) $(SRC_DEPS)
- @$(RM) $(TEST_DEPS)
- @$(RM) $(SHARED_NAME)
- @$(RM) $(STATIC_NAME)
- @$(RM) $(TEST_RUNNER)*
-
Requirements For Building
----------------------------------------------
-
- * GNU Make
- * Unix sed and find utilities
- * A C and C++ compiler such as GCC
+The only external dependencies currently required to build this library are
+Premake 4 and a toolchain that is supported by Premake.
Build Instructions
----------------------------------------------
+This project uses Premake 4 in order to generate cross-platform build scripts.
+The first step in building the library is to generate the build scripts for
+your system. Premake supports a variety of different build environments and you
+will need to select the one that you wish to use. To list the available targets
+simply run the following command:
-You can build the project and run all unit tests with the following command:
+ premake4 --help
- make
+You should then be presented with a list of options for premake with a section
+at the end that looks like this:
+
+ ACTIONS
+
+ clean Remove all binaries and generated files
+ codeblocks Generate Code::Blocks project files
+ codelite Generate CodeLite project files
+ gmake Generate GNU makefiles for POSIX, MinGW, and Cygwin
+ vs2002 Generate Microsoft Visual Studio 2002 project files
+ vs2003 Generate Microsoft Visual Studio 2003 project files
+ vs2005 Generate Microsoft Visual Studio 2005 project files
+ vs2008 Generate Microsoft Visual Studio 2008 project files
+ vs2010 Generate Visual Studio 2010 project files (experimental)
+ xcode3 Generate Apple Xcode 3 project files (experimental)
-You can execute just the unit tests with the following command:
+This is the list of build script targets that are supported. To generate build
+scripts to use with GNU Make for instance, you could choose the gmake target
+by using the following command:
- make test
+ premake4 gmake
+
+Once the Make scripts are generated you can build the project and run all unit
+tests with the following command:
+
+ make
Project Files and Directories
----------------------------------------------
+ build/ This is the directory where all output files will be placed.
docs/ Documentation for the language and the source code.
source/ The source for the DLang parser
tests/ Unit test and mock files.
tools/ Tools required by the build system.
Doxyfile Doxygen documentation generator configuration.
LICENSE.md The software license notification.
+ premake4.lua A premake4 configuration file for generating build scripts.
README.md You're reading this file right now!
--- /dev/null
+-------------------------------------------------------------------------------
+-- Option Parsing Library Configuration
+-------------------------------------------------------------------------------
+solution "OPTS Option Parsing Library"
+configurations { "Release" }
+targetdir "build"
+
+---------------------------------------------------------------------------------
+---- Opts - A simple option parsing library
+---------------------------------------------------------------------------------
+project "opts"
+ kind "SharedLib"
+ language "C"
+ location "build"
+ files { "source/**.*" }
+
+project "opts-tests"
+ kind "ConsoleApp"
+ language "C++"
+ location "build"
+ links { "UnitTest++", "opts" }
+ includedirs { "source/", "tools/UnitTest++/**" }
+ files { "tests/**.c*", "source/**.c*" }
+ postbuildcommands { "./opts-tests" }
+
+-------------------------------------------------------------------------------
+-- UnitTest++ - A C++ unit testing library
+-------------------------------------------------------------------------------
+project "UnitTest++"
+ kind "SharedLib"
+ language "C++"
+ location "build"
+ files {
+ "tools/UnitTest++/src/*.*",
+ }
+ if os.is "windows" then
+ files { "tools/UnitTest++/src/Win32/**.*" }
+ else
+ files { "tools/UnitTest++/src/Posix/**.*" }
+ end
+
+-------------------------------------------------------------------------------
+-- Miscellaneous
+-------------------------------------------------------------------------------
+if _ACTION == "clean" then
+ os.rmdir("build")
+end
+
Result_T* results;
} StreamContext_T;
+#ifdef __cplusplus
+extern "C" {
+#endif
+
Result_T* OPTS_ParseOptions( OptionConfig_T* opts, int argc, char** argv );
void OPTS_InitContext( StreamContext_T* ctx, int argc, char** argv );
char* OPTS_AppendCharacter( char* str, char ch );
+#ifdef __cplusplus
+}
+#endif
+
#endif