]> git.mdlowis.com Git - proto/sclpl.git/commitdiff
integrated build-system module from github
authorMichael D. Lowis <mike@mdlowis.com>
Tue, 23 Sep 2014 20:28:57 +0000 (16:28 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Tue, 23 Sep 2014 20:28:57 +0000 (16:28 -0400)
.gitmodules [new file with mode: 0644]
Rakefile
build-system [new submodule]

diff --git a/.gitmodules b/.gitmodules
new file mode 100644 (file)
index 0000000..22d2a64
--- /dev/null
@@ -0,0 +1,3 @@
+[submodule "build-system"]
+       path = build-system
+       url = https://github.com/mikedlowis/build-system.git
index 9c95398b648ce0517c74dc9148f73c68b945899e..7c8ef6b5ec0a5d5bd3e5c24a3bdf6b1625407cd8 100644 (file)
--- a/Rakefile
+++ b/Rakefile
@@ -1,73 +1,41 @@
-#------------------------------------------------------------------------------
-# Bundler Setup
-#------------------------------------------------------------------------------
-require "bundler"
-begin
-  Bundler.setup(:default, :development)
-rescue Bundler::BundlerError => e
-  raise LoadError.new("Unable to Bundler.setup(): You probably need to run `bundle install`: #{e.message}")
-end
-require 'rscons'
-require 'rbconfig'
+require './build-system/setup'
 
-def windows?
-  RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|cygwin|bccwin|wince|emc/
+# Define the compiler environment
+BaseEnv = BuildEnv.new(echo: :command) do |env|
+  env.build_dir('source','build/obj/source')
+  env.set_toolset(:clang)
+#  env['CC'] = 'clang'
+#  env['CXX'] = 'clang'
+#  env['LD'] = 'clang'
+  env["CFLAGS"] += ['--std=gnu99', '-Wall', '-Wextra' ]#, '-Werror']
 end
 
 #------------------------------------------------------------------------------
 # Clang Toolchain Targets
 #------------------------------------------------------------------------------
-#CLANG_BUILD_DIR = 'build/llvm'
-#CLANG_BIN_DIR = 'build/llvm/bin'
-#CLANG_BIN_NAME = 'clang'
-#CLANG_SRC_DIR = 'source/vendor/llvm-3.4.2'
-#CLANG_CMAKE_GENERATOR = ENV['CMAKE_GENERATOR'] || "Unix Makefiles"
-#CLANG_CMAKE_OPTS = [ '-DCMAKE_BUILD_TYPE=Release' ]
-#CLANG_MAKE_CMD = windows? ? 'nmake' : 'make'
-#
-#file "#{CLANG_BUILD_DIR}/Makefile" => FileList["#{CLANG_SRC_DIR}/cmake/**/*"] do
-#    FileUtils.mkdir_p(CLANG_BUILD_DIR)
-#    FileUtils.cd(CLANG_BUILD_DIR) do
-#        sh "cmake #{CLANG_CMAKE_OPTS.join} -G\"#{CLANG_CMAKE_GENERATOR}\" ../../#{CLANG_SRC_DIR}"
-#    end
-#end
-#
-#file "#{CLANG_BIN_DIR}/#{CLANG_BIN_NAME}" => ["#{CLANG_BUILD_DIR}/Makefile"] + FileList["#{CLANG_SRC_DIR}/tools/clang/**/*.c"] do
-#    FileUtils.cd(CLANG_BUILD_DIR) do
-#        sh "#{CLANG_MAKE_CMD} clang"
-#    end
-#end
-#
-#task :clang => ["#{CLANG_BIN_DIR}/#{CLANG_BIN_NAME}"] do
-#    ENV['PATH'] = "#{CLANG_BIN_DIR}#{windows? ? ';':':'}#{ENV['PATH']}"
-#end
-task :clang
+CLANG_BUILD_DIR = 'build/llvm'
+CLANG_BIN_DIR = 'build/llvm/bin'
+CLANG_BIN_NAME = 'clang'
+CLANG_SRC_DIR = 'source/vendor/llvm-3.4.2'
+CLANG_CMAKE_GENERATOR = ENV['CMAKE_GENERATOR'] || "Unix Makefiles"
+CLANG_CMAKE_OPTS = [ '-DCMAKE_BUILD_TYPE=Release' ]
+CLANG_MAKE_CMD = windows? ? 'nmake' : 'make'
 
-#------------------------------------------------------------------------------
-# Envrionment Definitions
-#------------------------------------------------------------------------------
-class Environment < Rscons::Environment
-  @@environments = []
-  def initialize(args,&block)
-    super(args,&block)
-    @@environments << self
-  end
-
-  def self.process_all()
-    @@environments.each {|e| e.process }
-  end
+file "#{CLANG_BUILD_DIR}/Makefile" => FileList["#{CLANG_SRC_DIR}/cmake/**/*"] do
+    FileUtils.mkdir_p(CLANG_BUILD_DIR)
+    FileUtils.cd(CLANG_BUILD_DIR) do
+        sh "cmake #{CLANG_CMAKE_OPTS.join} -G\"#{CLANG_CMAKE_GENERATOR}\" ../../#{CLANG_SRC_DIR}"
+    end
 end
 
-# Process all environments so we actually build the targets
-at_exit { Environment.process_all }
+file "#{CLANG_BIN_DIR}/#{CLANG_BIN_NAME}" => ["#{CLANG_BUILD_DIR}/Makefile"] + FileList["#{CLANG_SRC_DIR}/tools/clang/**/*.c"] do
+    FileUtils.cd(CLANG_BUILD_DIR) do
+        sh "#{CLANG_MAKE_CMD} clang"
+    end
+end
 
-# Define the compiler environment
-BaseEnv = Environment.new(echo: :command) do |env|
-  env.build_dir('source','build/obj/source')
-#  env['CC'] = 'clang'
-#  env['CXX'] = 'clang'
-#  env['LD'] = 'clang'
-  env["CFLAGS"] += ['--std=gnu99', '-Wall', '-Wextra' ]#, '-Werror']
+task :clang => ["#{CLANG_BIN_DIR}/#{CLANG_BIN_NAME}"] do
+    ENV['PATH'] = "#{CLANG_BIN_DIR}#{windows? ? ';':':'}#{ENV['PATH']}"
 end
 
 #------------------------------------------------------------------------------
diff --git a/build-system b/build-system
new file mode 160000 (submodule)
index 0000000..59a4c26
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit 59a4c26c6762d38efe29e42b2f9929eb775d0e74