]> git.mdlowis.com Git - archive/parse-utils.git/commitdiff
Updated rake config to generate library artifacts
authorMike D. Lowis <mike@mdlowis.com>
Mon, 27 Feb 2012 03:18:46 +0000 (22:18 -0500)
committerMike D. Lowis <mike@mdlowis.com>
Mon, 27 Feb 2012 03:18:46 +0000 (22:18 -0500)
rakefile.rb
source/lexer/ilexer.cpp
source/parser/ast/ast.cpp
source/parser/iparser.cpp
source/parser/llkparser/llkparser.cpp

index 69518ea7a948c6a38c4bcc6d9c711b21da4cce9d..06f20f28dbbe8a14309efe82be1fdc053466b0f3 100644 (file)
@@ -1,22 +1,30 @@
 include Rake::DSL
-require 'tools/rake_utils/buildconfig.rb'
-require 'tools/rake_utils/testconfig.rb'
+require 'tools/rake_utils/source/library.rb'
 
 #------------------------------------------------------------------------------
 # Configuration Objects
 #------------------------------------------------------------------------------
-# Configuration for the binary artifact
-Binary = BuildConfig.new({
-       :name => 'binary',
-       :compiler_options => [ '-c', '-Wall', '-Werror' ],
-       :source_files => [ 'source/**/*.c*' ],
-       :include_dirs => [ 'source/**/' ],
+# Configuration for the static library
+ParseUtilsStatic = Library.new({
+    :name => 'libparse-utils.a',
+    :output_dir => 'build/static',
+    :compiler_options => [ '-c', '-Wall', '-Werror', '-o'],
+    :source_files => [ 'source/**/*.c*' ],
+    :include_dirs => [ 'source/**/' ],
 })
-
-# Configuration for the unit tests
-UnitTest = TestConfig.new({
-       :test_files => [ 'tests/source/**.h' ],
+ParseUtilsStatic.setup_default_rake_tasks()
+
+# Configuration for the shared library
+ParseUtilsShared = Library.new({
+    :name => 'libparse-utils.so',
+    :output_dir => 'build/shared',
+    :compiler_options => [ '-c', '-Wall', '-Werror', '-o'],
+    :linker_bin => 'c++',
+    :linker_options => ['-shared', '-o'],
+    :source_files => [ 'source/**/*.c*' ],
+    :include_dirs => [ 'source/**/' ],
 })
+ParseUtilsShared.setup_default_rake_tasks()
 
 #------------------------------------------------------------------------------
 # Release Tasks
@@ -24,45 +32,6 @@ UnitTest = TestConfig.new({
 desc 'Execute a complete build including unit tests and binary'
 task :default => [ :release ]
 
-desc 'Display build configuration info'
-task :config do
-       puts 'Release Configuration'
-       puts '---------------------'
-       puts Binary
-       puts ''
-       puts 'Unit Test Configuration'
-       puts '-----------------------'
-       puts UnitTest
-end
-
 desc 'Build and link the binary'
-task :release => [ Binary.binary_name() ]
-
-task Binary.binary_name() => Binary.directories() + Binary.objects() do
-       Binary.link()
-end
-
-rule(/obj\/.+.o$/ => Binary.obj_src_lookup()) do |t|
-       Binary.compile(t.source,t.name)
-end
-
-#------------------------------------------------------------------------------
-# Testing Tasks
-#------------------------------------------------------------------------------
-desc 'Execute all unit tests'
-task :test => UnitTest.directories() + UnitTest.runners() do
-       UnitTest.run_all_test_runners();
-end
-
-rule '_runner.exe' => UnitTest.bin_obj_lookup() do |t|
-       UnitTest.link([t.source],t.name)
-end
-
-rule( /test\/.+_runner.o$/ => UnitTest.obj_src_lookup() ) do |t|
-       UnitTest.compile(t.source,t.name)
-end
-
-rule '_runner.cpp' => UnitTest.src_test_lookup() do |t|
-       UnitTest.generate_test_runner(t.source,t.name)
-end
+task :release => [ ParseUtilsStatic.name(), ParseUtilsShared.name() ]
 
index 6d8cac58d53dcffcf7e40a461351336f6cb88b7d..25e260f694db0c16163b1ac4d806a87a3a4cf31e 100644 (file)
@@ -1,7 +1,6 @@
 #include <exception>
 #include "ilexer.h"
 #include "exception.h"
-#include "cork.h"
 
 using namespace std;
 
@@ -17,7 +16,7 @@ void ILexer::setInput(char* in)
 {
     line = 1;
     column = 0;
-    input = _new istringstream( string( in ) );
+    input = new istringstream( string( in ) );
     consume();
 }
 
@@ -25,7 +24,7 @@ void ILexer::setInput(string& in)
 {
     line = 1;
     column = 0;
-    input = _new istringstream( in );
+    input = new istringstream( in );
     consume();
 }
 
index d0904280e137c8d8b883f7739e498cc84c4898b4..44600f1cd70516a1c65d9af0895d8132f9f19053 100644 (file)
@@ -2,27 +2,26 @@
 #include <sstream>
 #include <string.h>
 #include <iostream>
-#include "cork.h"
 
 AST::AST(ASTNodeType type)
 {
     node_type = type;
     node_text = "";
-    node_children = _new list<AST*>();
+    node_children = new list<AST*>();
 }
 
 AST::AST(ASTNodeType type, const char* text)
 {
     node_type = type;
     node_text = string(text);
-    node_children = _new list<AST*>();
+    node_children = new list<AST*>();
 }
 
 AST::AST(ASTNodeType type, std::string text)
 {
     node_type = type;
     node_text = text;
-    node_children = _new list<AST*>();
+    node_children = new list<AST*>();
 }
 
 AST::AST(ASTNodeType type, int child_count, ...)
@@ -31,7 +30,7 @@ AST::AST(ASTNodeType type, int child_count, ...)
     int i = 0;
     node_type = type;
     node_text = "";
-    node_children = _new list<AST*>();
+    node_children = new list<AST*>();
     va_start (arg_list, child_count);
     for (i = 0; i < child_count ; i++)
     {
@@ -87,7 +86,7 @@ void AST::addChild(AST* node)
 
 AST* AST::clone(void)
 {
-    AST* new_clone = _new AST( node_type, node_text );
+    AST* new_clone = new AST( node_type, node_text );
     list<AST*>::iterator it = node_children->begin();
     for(; it != node_children->end(); it++)
     {
index 82829b77f6b2af01c6982defeb53ba73b009017d..a6ccb2a1188537b1b3dd812a064c0806e77d2bc9 100644 (file)
@@ -19,7 +19,6 @@
  *****************************************************************************/
 #include <stdio.h>
 #include "iparser.h"
-#include "cork.h"
 
 using namespace std;
 
@@ -40,12 +39,12 @@ IParser::~IParser()
 
 void IParser::setInput(char* in)
 {
-    input = _new istringstream( string( in ) );
+    input = new istringstream( string( in ) );
 }
 
 void IParser::setInput(string& in)
 {
-    input = _new istringstream( in );
+    input = new istringstream( in );
 }
 
 void IParser::setInput(istream* in)
index 4569dece833883eb69d000e02f770dbc46051a2f..d7a2469da725e2342d6f9f63ceb264675489a82a 100644 (file)
@@ -1,6 +1,5 @@
 #include "llkparser.h"
 #include "exception.h"
-#include "cork.h"
 
 LLKParser::LLKParser(int k_val, ILexer* lxer) : k(k_val), next(0), lexer(lxer)
 {