Compare commits
143 Commits
v2.0.0beta
...
master
Author | SHA1 | Date | |
---|---|---|---|
8f0f320a07 | |||
12f6936084 | |||
866b40d872 | |||
f06d37c8b9 | |||
21f8e2435e | |||
97c4f7c757 | |||
b3df37e9ea | |||
1bf1c30242 | |||
b932380b3b | |||
e3ea429253 | |||
dca4c49770 | |||
b068fe7574 | |||
ecd91e1171 | |||
f36b71af3f | |||
90c3867cae | |||
20b5020284 | |||
cb540741a4 | |||
bc17a9b38f | |||
cec1331054 | |||
bb4657e465 | |||
29ca9b3f13 | |||
5ab982b84c | |||
e6e860e3c1 | |||
3cfffed7ec | |||
b2d47cd439 | |||
6a10d68fac | |||
88a8f2395d | |||
b82d6f2e62 | |||
150943f23f | |||
59f1a89f4f | |||
ea66501311 | |||
e9e3c6711f | |||
8269a98d01 | |||
19dee2b2a5 | |||
5b6353395d | |||
7e5c6e6b12 | |||
44f61da571 | |||
5c28e557bd | |||
ef7e9259cb | |||
6d5f44d4e5 | |||
8b2387f7a3 | |||
7b746db64e | |||
3aca248e9d | |||
3914dd896c | |||
df120af953 | |||
b745ae1153 | |||
693f8cec64 | |||
e12acccd33 | |||
bd9cf55b85 | |||
f5ab51c477 | |||
b0f2bbb7d5 | |||
c1dcfa297f | |||
034dbcd9a6 | |||
b5d5fe7a7b | |||
610b8f1266 | |||
a316c4f922 | |||
97dbaeb82d | |||
a2f72c6b87 | |||
7055cad73c | |||
4548f4e3c9 | |||
19dbab3426 | |||
69f5bea2b2 | |||
2ee9dda49d | |||
f011b23499 | |||
80d52f25b8 | |||
0face546e3 | |||
ca747232cd | |||
a7b46093e9 | |||
09892eed63 | |||
117df43f64 | |||
acc12822b6 | |||
8c7b43f60c | |||
7c8becc3f9 | |||
d1a35501ef | |||
28a245f0ab | |||
87a6d9f04f | |||
556c821cc6 | |||
441fc9bc65 | |||
1861874f5c | |||
|
6d51c5cbde | ||
73af83803a | |||
353f4f45bc | |||
5bac91f92f | |||
bbe9563ceb | |||
5ec74604c6 | |||
8e06efe61e | |||
0756874ddb | |||
dded5e2648 | |||
fbe60f6ba2 | |||
8dd9799666 | |||
f2c755c8bb | |||
01ca86de8b | |||
943fabd0d1 | |||
d08e2f6b5c | |||
90365dd197 | |||
8d05516c40 | |||
db49d86866 | |||
e667455c32 | |||
e62332aba6 | |||
397639849d | |||
96d5caf2e5 | |||
f4b10a30af | |||
cf52c3fc6f | |||
5378afb6f8 | |||
48d9273cc6 | |||
efea4f1181 | |||
b4fa6d965c | |||
ac56ad34f6 | |||
2fd533a32a | |||
c938ed71d1 | |||
ec60201a62 | |||
0cafb8c5b3 | |||
004810386b | |||
a15ee9daaf | |||
cd33405697 | |||
efa77066bf | |||
a1bb9d81fd | |||
0344f02cb1 | |||
d52bdaf046 | |||
ad7ccb771d | |||
044ee343ca | |||
eb54a2b64a | |||
2dd1ce9f1d | |||
1e157c79ec | |||
2385874f4a | |||
c5c42e6f4a | |||
9a627b2150 | |||
937c964c3e | |||
a2a1d08014 | |||
0ccf43cc96 | |||
d202e15a57 | |||
94f808b1fc | |||
51a9dd365f | |||
6e590b62a6 | |||
3aac190ad6 | |||
d6b9487e65 | |||
66d2700faa | |||
ba98af1424 | |||
cf4f80c9ae | |||
d74785d579 | |||
4fd822fb95 | |||
b39fd80d8c | |||
ef00c9f377 |
115
CHANGELOG.md
115
CHANGELOG.md
@ -1,3 +1,118 @@
|
|||||||
|
## v3.0.2
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
- #159 - Compiler check configure methods should respect :use flag
|
||||||
|
- #160 - Configure parameters should not be stored as unscoped construction variables
|
||||||
|
|
||||||
|
## v3.0.1
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
- #156 - Avoid running configure operation twice
|
||||||
|
- #157 - Load configure task arguments before early configure operations
|
||||||
|
- #158 - Do not configure for clean tasks when not yet configured
|
||||||
|
|
||||||
|
## v3.0.0
|
||||||
|
|
||||||
|
- #136 - Move rsconscache into build directory
|
||||||
|
- #140 - Support naming environments
|
||||||
|
- #143 - Add Size builder
|
||||||
|
- #142 - Add 'sh' script DSL method
|
||||||
|
- #144 - Add FileUtils class methods to script DSL
|
||||||
|
- #145 - Support environment variable to set rscons build directory
|
||||||
|
- #146 - Add ^^/ shortcut to top-level build directory
|
||||||
|
- #139 - Add tasks
|
||||||
|
- #147 - Add task options
|
||||||
|
- #148 - Add license/copyright to distributable script
|
||||||
|
- #150 - Add env.expand() shortcut method to expand paths and construction variables
|
||||||
|
- #152 - Add download script method
|
||||||
|
- #153 - Allow passing spawn options to sh
|
||||||
|
- #154 - Record build directory absolute path
|
||||||
|
- #149 - Add shortcut method for creating environments
|
||||||
|
- #131 - Only configure if necessary
|
||||||
|
- #151 - Store configure task parameters in configuration cache data
|
||||||
|
- #137 - Add variants
|
||||||
|
- #155 - Add build_dir script method
|
||||||
|
|
||||||
|
## v2.3.0
|
||||||
|
|
||||||
|
### New Features
|
||||||
|
|
||||||
|
- #125 - Support subsidiary Rsconscript files
|
||||||
|
- #126 - Add PATH manipulation methods
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
- #121 - env.depends() does not work with build-root-relative "^/" paths
|
||||||
|
- #130 - Document -f command line option
|
||||||
|
- #133 - Clarify failed command error message indicating to run -F
|
||||||
|
- #134 - Document CMD_STDOUT variable for Command builder
|
||||||
|
- #135 - Write dependency file to build directory when user invokes Object builder directly
|
||||||
|
- #141 - Document phony targets
|
||||||
|
|
||||||
|
## v2.2.0
|
||||||
|
|
||||||
|
### New Features
|
||||||
|
|
||||||
|
- #120 - improve support for MSYS2
|
||||||
|
- #119 - add failure messages for failed configuration checks
|
||||||
|
- #118 - compiler checks should support cross-compilers and freestanding compilers
|
||||||
|
|
||||||
|
## v2.1.0
|
||||||
|
|
||||||
|
### New Features
|
||||||
|
|
||||||
|
- #117 - ruby 2.7 compatibility
|
||||||
|
|
||||||
|
## v2.0.2
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
- #113 - distinguish object files built from multiple sources with the same base name but different extensions
|
||||||
|
|
||||||
|
## v2.0.1
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
- #112 - Install builder cannot replace a currently executing binary on Linux
|
||||||
|
|
||||||
|
## v2.0.0
|
||||||
|
|
||||||
|
- convert rscons from a Ruby gem to a standalone script
|
||||||
|
- compress rscons distributable script
|
||||||
|
- add configure operation to detect compilers, check for headers/libraries, etc... (invoked automatically if needed)
|
||||||
|
- Environments store builder classes instead of instances of builder classes
|
||||||
|
- use a separate Builder instance for each build operation
|
||||||
|
- load Rsconscript from Rsconscript/Rsconscript.rb instead of Rsconsfile
|
||||||
|
- drop support for builder run methods using the old 5 parameter signature
|
||||||
|
- remove Environment#build_dir
|
||||||
|
- set Environment build root in configure step
|
||||||
|
- remove Builder#finalize (now #run called repeatedly until builder completes)
|
||||||
|
- remove Builder#setup
|
||||||
|
- remove Builder#features and Builder#produces?
|
||||||
|
- add functionality to allow builders to wait on Ruby threads or other builders
|
||||||
|
- add install/uninstall/distclean command-line operations
|
||||||
|
- preserve makefile dependency files under build directory
|
||||||
|
- remove a few deprecated methods
|
||||||
|
- pass a Builder instance to build hooks instead of a build operation Hash
|
||||||
|
- support a basic markup syntax in builder run messages to colorize target/source files
|
||||||
|
- hide (but store) failed compilation command by default so the user doesn't have to scroll back as much to see compiler output
|
||||||
|
- refactor to remove some redundancy among built-in builders
|
||||||
|
- track object file source language (correctly determine linker when only passed object files previously built by particular toolchains)
|
||||||
|
- add barriers
|
||||||
|
- add InstallDirectory builder
|
||||||
|
- change Install builder to copy files on 'install' operation
|
||||||
|
- add "prefix" construction variable based on configured installation prefix
|
||||||
|
- allow passing builder objects as sources to build targets
|
||||||
|
- differentiate 'build' targets from 'install' targets in cache contents
|
||||||
|
- add verbose mode
|
||||||
|
- show build progress as a percentage in builder output messages
|
||||||
|
- various performance improvements
|
||||||
|
- wrote a new user guide
|
||||||
|
- added new website ([https://holtrop.github.io/rscons/](https://holtrop.github.io/rscons/))
|
||||||
|
- added new logo
|
||||||
|
|
||||||
## v1.17.0
|
## v1.17.0
|
||||||
|
|
||||||
### New Features
|
### New Features
|
||||||
|
14
DEVELOPING.md
Normal file
14
DEVELOPING.md
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# Developing
|
||||||
|
|
||||||
|
# Specs
|
||||||
|
|
||||||
|
To run the rscons specs, the following commands must be available:
|
||||||
|
|
||||||
|
* gcc
|
||||||
|
* clang
|
||||||
|
* g++
|
||||||
|
* clang++
|
||||||
|
* gdc
|
||||||
|
* ldc
|
||||||
|
* flex
|
||||||
|
* bison
|
16
Gemfile
16
Gemfile
@ -1,10 +1,14 @@
|
|||||||
source 'https://rubygems.org'
|
source 'https://rubygems.org'
|
||||||
|
|
||||||
gem "json"
|
|
||||||
gem "rspec"
|
gem "rspec"
|
||||||
gem "rake"
|
gem "rake"
|
||||||
gem "simplecov"
|
gem "simplecov", "~> 0.15.0"
|
||||||
gem "yard"
|
if RbConfig::CONFIG["host"]["msys"]
|
||||||
gem "rdoc"
|
gem "json", "2.1.0"
|
||||||
gem "redcarpet"
|
else
|
||||||
gem "syntax"
|
gem "json"
|
||||||
|
gem "yard"
|
||||||
|
gem "rdoc"
|
||||||
|
gem "redcarpet"
|
||||||
|
gem "syntax"
|
||||||
|
end
|
||||||
|
48
Gemfile.lock
48
Gemfile.lock
@ -1,32 +1,38 @@
|
|||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
diff-lcs (1.3)
|
diff-lcs (1.5.0)
|
||||||
docile (1.3.2)
|
docile (1.1.5)
|
||||||
json (2.2.0)
|
json (2.6.1)
|
||||||
rake (12.3.2)
|
psych (4.0.3)
|
||||||
rdoc (6.1.1)
|
stringio
|
||||||
redcarpet (3.4.0)
|
rake (13.0.6)
|
||||||
rspec (3.8.0)
|
rdoc (6.4.0)
|
||||||
rspec-core (~> 3.8.0)
|
psych (>= 4.0.0)
|
||||||
rspec-expectations (~> 3.8.0)
|
redcarpet (3.5.1)
|
||||||
rspec-mocks (~> 3.8.0)
|
rspec (3.11.0)
|
||||||
rspec-core (3.8.2)
|
rspec-core (~> 3.11.0)
|
||||||
rspec-support (~> 3.8.0)
|
rspec-expectations (~> 3.11.0)
|
||||||
rspec-expectations (3.8.4)
|
rspec-mocks (~> 3.11.0)
|
||||||
|
rspec-core (3.11.0)
|
||||||
|
rspec-support (~> 3.11.0)
|
||||||
|
rspec-expectations (3.11.0)
|
||||||
diff-lcs (>= 1.2.0, < 2.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
rspec-support (~> 3.8.0)
|
rspec-support (~> 3.11.0)
|
||||||
rspec-mocks (3.8.1)
|
rspec-mocks (3.11.0)
|
||||||
diff-lcs (>= 1.2.0, < 2.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
rspec-support (~> 3.8.0)
|
rspec-support (~> 3.11.0)
|
||||||
rspec-support (3.8.2)
|
rspec-support (3.11.0)
|
||||||
simplecov (0.15.0)
|
simplecov (0.15.1)
|
||||||
docile (~> 1.1.0)
|
docile (~> 1.1.0)
|
||||||
json (>= 1.8, < 3)
|
json (>= 1.8, < 3)
|
||||||
simplecov-html (~> 0.10.0)
|
simplecov-html (~> 0.10.0)
|
||||||
simplecov-html (0.10.2)
|
simplecov-html (0.10.2)
|
||||||
|
stringio (3.0.1)
|
||||||
syntax (1.2.2)
|
syntax (1.2.2)
|
||||||
yard (0.9.20)
|
webrick (1.7.0)
|
||||||
|
yard (0.9.27)
|
||||||
|
webrick (~> 1.7.0)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
@ -38,9 +44,9 @@ DEPENDENCIES
|
|||||||
rdoc
|
rdoc
|
||||||
redcarpet
|
redcarpet
|
||||||
rspec
|
rspec
|
||||||
simplecov
|
simplecov (~> 0.15.0)
|
||||||
syntax
|
syntax
|
||||||
yard
|
yard
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
1.17.3
|
2.2.31
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2013-2019 Josh Holtrop
|
Copyright (c) 2013-2022 Josh Holtrop
|
||||||
|
|
||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
|
38
README.md
38
README.md
@ -1,6 +1,42 @@
|
|||||||
# Rscons
|
# Rscons
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
Rscons (https://github.com/holtrop/rscons) is an open-source build system
|
Rscons (https://github.com/holtrop/rscons) is an open-source build system
|
||||||
for developers.
|
for developers.
|
||||||
|
It supports the following features:
|
||||||
|
|
||||||
Rscons is written in Ruby, and is inspired by [SCons](https://scons.org/) and [waf](https://waf.io/).
|
* multi-threaded job execution
|
||||||
|
* auto-configuration
|
||||||
|
* built-in builders for several common operations
|
||||||
|
* out-of-the-box support for C, C++, and D languages
|
||||||
|
* extensibility for other languages or custom builders
|
||||||
|
* compatible with Windows, Linux, OS X, and FreeBSD
|
||||||
|
* colorized output with build progress
|
||||||
|
* build hooks
|
||||||
|
* user-defined tasks with dependencies and custom parameters
|
||||||
|
* build variants
|
||||||
|
|
||||||
|
At its core, Rscons is mainly an engine to:
|
||||||
|
|
||||||
|
* determine the proper order to perform build steps,
|
||||||
|
* determine whether each build target is up to date or in need of rebuild, and
|
||||||
|
* schedule those build steps across multiple threads as efficiently as possible.
|
||||||
|
|
||||||
|
Along the way, Rscons provides a concise syntax for specifying common types of
|
||||||
|
build steps, but also provides an extensible framework for performing
|
||||||
|
custom build operations as well.
|
||||||
|
|
||||||
|
Rscons takes inspiration from:
|
||||||
|
|
||||||
|
* [SCons](https://scons.org/)
|
||||||
|
* [waf](https://waf.io/)
|
||||||
|
* [rake](https://github.com/ruby/rake)
|
||||||
|
* [CMake](https://cmake.org/)
|
||||||
|
* [Autoconf](https://www.gnu.org/software/autoconf/)
|
||||||
|
|
||||||
|
Rscons is written in Ruby.
|
||||||
|
The only requirement to run Rscons is that the system has a Ruby interpreter
|
||||||
|
installed.
|
||||||
|
|
||||||
|
See [https://holtrop.github.io/rscons/index.html](https://holtrop.github.io/rscons/index.html) for User Guide and Installation instructions.
|
||||||
|
37
Rakefile.rb
37
Rakefile.rb
@ -6,24 +6,27 @@ rescue Bundler::BundlerError => e
|
|||||||
end
|
end
|
||||||
|
|
||||||
require "rspec/core/rake_task"
|
require "rspec/core/rake_task"
|
||||||
require "yard"
|
|
||||||
require "rake/clean"
|
require "rake/clean"
|
||||||
require "fileutils"
|
require "fileutils"
|
||||||
|
|
||||||
CLEAN.include %w[build_test_run .yardoc yard coverage test]
|
CLEAN.include %w[build_test_run .yardoc yard coverage test]
|
||||||
CLOBBER.include %w[dist pkg]
|
CLOBBER.include %w[dist gen large_project pkg]
|
||||||
|
|
||||||
task :build_dist do
|
task :build_dist do
|
||||||
sh "ruby rb/build_dist.rb"
|
sh "ruby rb/build_dist.rb"
|
||||||
end
|
end
|
||||||
|
|
||||||
RSpec::Core::RakeTask.new(:spec, :example_string) do |task, args|
|
RSpec::Core::RakeTask.new(:spec, :example_string) do |task, args|
|
||||||
|
ENV["specs"] = "1"
|
||||||
if args.example_string
|
if args.example_string
|
||||||
ENV["partial_specs"] = "1"
|
ENV["partial_specs"] = "1"
|
||||||
task.rspec_opts = %W[-e "#{args.example_string}" -f documentation]
|
task.rspec_opts = %W[-e "#{args.example_string}" -f documentation]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
task :spec => :build_dist
|
task :spec => :build_dist
|
||||||
|
task :spec do
|
||||||
|
ENV.delete("specs")
|
||||||
|
end
|
||||||
|
|
||||||
# dspec task is useful to test the distributable release script, but is not
|
# dspec task is useful to test the distributable release script, but is not
|
||||||
# useful for coverage information.
|
# useful for coverage information.
|
||||||
@ -32,16 +35,11 @@ task :dspec, [:example_string] => :build_dist do |task, args|
|
|||||||
FileUtils.mkdir_p("test")
|
FileUtils.mkdir_p("test")
|
||||||
FileUtils.cp("dist/rscons", "test/rscons.rb")
|
FileUtils.cp("dist/rscons", "test/rscons.rb")
|
||||||
ENV["dist_specs"] = "1"
|
ENV["dist_specs"] = "1"
|
||||||
Rake::Task["spec"].invoke(args.example_string)
|
Rake::Task["spec"].execute(args)
|
||||||
ENV.delete("dist_specs")
|
ENV.delete("dist_specs")
|
||||||
FileUtils.rm_f(Dir.glob(".rscons-*"))
|
FileUtils.rm_f(Dir.glob(".rscons-*"))
|
||||||
end
|
end
|
||||||
|
|
||||||
YARD::Rake::YardocTask.new do |yard|
|
|
||||||
yard.files = ['lib/**/*.rb']
|
|
||||||
yard.options = ["-ogen/yard"]
|
|
||||||
end
|
|
||||||
|
|
||||||
task :gen_large_project, [:size] => :build_dist do |task, args|
|
task :gen_large_project, [:size] => :build_dist do |task, args|
|
||||||
size = (args.size || 10000).to_i
|
size = (args.size || 10000).to_i
|
||||||
FileUtils.rm_rf("large_project")
|
FileUtils.rm_rf("large_project")
|
||||||
@ -78,7 +76,7 @@ task :gen_large_project, [:size] => :build_dist do |task, args|
|
|||||||
end
|
end
|
||||||
File.open("large_project/Rsconscript", "w") do |fh|
|
File.open("large_project/Rsconscript", "w") do |fh|
|
||||||
fh.puts <<EOF
|
fh.puts <<EOF
|
||||||
build do
|
default do
|
||||||
Environment.new do |env|
|
Environment.new do |env|
|
||||||
env.Program("project", glob("src/*.c"))
|
env.Program("project", glob("src/*.c"))
|
||||||
end
|
end
|
||||||
@ -88,8 +86,25 @@ EOF
|
|||||||
FileUtils.cp("dist/rscons", "large_project")
|
FileUtils.cp("dist/rscons", "large_project")
|
||||||
end
|
end
|
||||||
|
|
||||||
task :user_guide do
|
unless RbConfig::CONFIG["host"]["msys"]
|
||||||
system("ruby", "-Ilib", "rb/gen_user_guide.rb")
|
require "yard"
|
||||||
|
YARD::Rake::YardocTask.new do |yard|
|
||||||
|
yard.files = ['lib/**/*.rb']
|
||||||
|
yard.options = ["-ogen/yard"]
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Build user guide"
|
||||||
|
task :user_guide do
|
||||||
|
system("ruby", "-Ilib", "rb/gen_user_guide.rb")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
task :default => :spec
|
task :default => :spec
|
||||||
|
|
||||||
|
task :all => [
|
||||||
|
:build_dist,
|
||||||
|
:spec,
|
||||||
|
:dspec,
|
||||||
|
:yard,
|
||||||
|
:user_guide,
|
||||||
|
]
|
||||||
|
@ -3,5 +3,5 @@
|
|||||||
require "rscons/cli"
|
require "rscons/cli"
|
||||||
|
|
||||||
if __FILE__ == $0
|
if __FILE__ == $0
|
||||||
Rscons::Cli.run(ARGV)
|
Rscons::Cli.new.run(ARGV)
|
||||||
end
|
end
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
env.CFile("lexer.c", "lexer.l")
|
||||||
env.CFile("lexer.c", "lexer.l")
|
env.CFile("parser.c", "parser.y")
|
||||||
env.CFile("parser.c", "parser.y")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
env.CFile("file.c", "foo.bar")
|
||||||
env.CFile("file.c", "foo.bar")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
build do
|
debug = env(echo: :command) do |env|
|
||||||
debug = Environment.new(echo: :command) do |env|
|
env['CFLAGS'] = '-O2'
|
||||||
env['CFLAGS'] = '-O2'
|
env['CPPFLAGS'] = '-DSTRING="Debug Version"'
|
||||||
env['CPPFLAGS'] = '-DSTRING="Debug Version"'
|
env.Program('program-debug.exe', Dir['src/*.c'])
|
||||||
env.Program('program-debug.exe', Dir['src/*.c'])
|
end
|
||||||
end
|
|
||||||
|
release = debug.clone do |env|
|
||||||
release = debug.clone do |env|
|
env["CPPFLAGS"] = '-DSTRING="Release Version"'
|
||||||
env["CPPFLAGS"] = '-DSTRING="Release Version"'
|
env.Program('program-release.exe', Dir['src/*.c'])
|
||||||
env.Program('program-release.exe', Dir['src/*.c'])
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -1,16 +1,14 @@
|
|||||||
build do
|
env1 = env(echo: :command) do |env|
|
||||||
env1 = Environment.new(echo: :command) do |env|
|
env['CFLAGS'] = '-O2'
|
||||||
env['CFLAGS'] = '-O2'
|
env.add_build_hook do |builder|
|
||||||
env.add_build_hook do |builder|
|
builder.vars['CPPFLAGS'] = '-DSTRING="Hello"'
|
||||||
builder.vars['CPPFLAGS'] = '-DSTRING="Hello"'
|
|
||||||
end
|
|
||||||
env.add_post_build_hook do |builder|
|
|
||||||
$stdout.puts "post #{builder.target}"
|
|
||||||
end
|
|
||||||
env.Program('program.exe', Dir['src/*.c'])
|
|
||||||
end
|
end
|
||||||
|
env.add_post_build_hook do |builder|
|
||||||
env2 = env1.clone do |env|
|
$stdout.puts "post #{builder.target}"
|
||||||
env.Program('program2.exe', Dir['src/*.c'])
|
|
||||||
end
|
end
|
||||||
|
env.Program('program.exe', Dir['src/*.c'])
|
||||||
|
end
|
||||||
|
|
||||||
|
env2 = env1.clone do |env|
|
||||||
|
env.Program('program2.exe', Dir['src/*.c'])
|
||||||
end
|
end
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
configure do
|
configure do
|
||||||
check_c_compiler "nope.nope"
|
check_c_compiler "nope.nope"
|
||||||
end
|
end
|
||||||
|
default
|
||||||
|
@ -1 +1,3 @@
|
|||||||
autoconf false
|
autoconf false
|
||||||
|
env do |env|
|
||||||
|
end
|
||||||
|
@ -3,8 +3,6 @@ configure do
|
|||||||
check_c_header "stdio.h"
|
check_c_header "stdio.h"
|
||||||
end
|
end
|
||||||
|
|
||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
env.Program("simple.exe", "simple.c")
|
||||||
env.Program("simple.exe", "simple.c")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
configure do
|
configure do
|
||||||
check_c_compiler
|
check_c_compiler
|
||||||
end
|
end
|
||||||
|
default
|
||||||
|
6
build_tests/configure/check_c_compiler_non_default.rb
Normal file
6
build_tests/configure/check_c_compiler_non_default.rb
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
configure do
|
||||||
|
check_c_compiler "clang"
|
||||||
|
end
|
||||||
|
env do |env|
|
||||||
|
env.Program("simple.exe", "simple.c")
|
||||||
|
end
|
12
build_tests/configure/check_c_compiler_use.rb
Normal file
12
build_tests/configure/check_c_compiler_use.rb
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
configure do
|
||||||
|
check_c_compiler "clang", use: "clang"
|
||||||
|
check_c_compiler
|
||||||
|
end
|
||||||
|
|
||||||
|
env "t1" do |env|
|
||||||
|
env.Program("test_gcc.exe", "simple.c")
|
||||||
|
end
|
||||||
|
|
||||||
|
env "t2", use: "clang" do |env|
|
||||||
|
env.Program("test_clang.exe", "simple.c")
|
||||||
|
end
|
8
build_tests/configure/check_c_header_cpppath.rb
Normal file
8
build_tests/configure/check_c_header_cpppath.rb
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
configure do
|
||||||
|
check_c_header "string.h", check_cpppath: ["./usr1"]
|
||||||
|
check_c_header "frobulous.h", check_cpppath: ["./usr2"]
|
||||||
|
end
|
||||||
|
|
||||||
|
env do |env|
|
||||||
|
env.Object("test.o", "test.c")
|
||||||
|
end
|
@ -1,9 +1,7 @@
|
|||||||
configure do
|
configure do
|
||||||
check_c_header "not___found.h", fail: false, set_define: "HAVE_NOT___FOUND_H"
|
check_c_header "not___found.h", set_define: "HAVE_NOT___FOUND_H"
|
||||||
end
|
end
|
||||||
|
|
||||||
build do
|
env(echo: :command) do |env|
|
||||||
Environment.new(echo: :command) do |env|
|
env.Object("simple.o", "simple.c")
|
||||||
env.Object("simple.o", "simple.c")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -2,8 +2,6 @@ configure do
|
|||||||
check_c_header "string.h", set_define: "HAVE_STRING_H"
|
check_c_header "string.h", set_define: "HAVE_STRING_H"
|
||||||
end
|
end
|
||||||
|
|
||||||
build do
|
env(echo: :command) do |env|
|
||||||
Environment.new(echo: :command) do |env|
|
env.Object("simple.o", "simple.c")
|
||||||
env.Object("simple.o", "simple.c")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -2,8 +2,6 @@ configure do
|
|||||||
check_cfg program: "my-config"
|
check_cfg program: "my-config"
|
||||||
end
|
end
|
||||||
|
|
||||||
build do
|
env(echo: :command) do |env|
|
||||||
Environment.new(echo: :command) do |env|
|
env.Program("myconfigtest", "simple.c")
|
||||||
env.Program("myconfigtest", "simple.c")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -2,8 +2,6 @@ configure do
|
|||||||
check_cfg package: "mypackage"
|
check_cfg package: "mypackage"
|
||||||
end
|
end
|
||||||
|
|
||||||
build do
|
env(echo: :command) do |env|
|
||||||
Environment.new(echo: :command) do |env|
|
env.Program("myconfigtest", "simple.c")
|
||||||
env.Program("myconfigtest", "simple.c")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -2,14 +2,12 @@ configure do
|
|||||||
check_cfg package: "mypackage", use: "myp"
|
check_cfg package: "mypackage", use: "myp"
|
||||||
end
|
end
|
||||||
|
|
||||||
build do
|
env(echo: :command) do |env|
|
||||||
Environment.new(echo: :command) do |env|
|
env.Copy("myconfigtest1.c", "simple.c")
|
||||||
env.Copy("myconfigtest1.c", "simple.c")
|
env.Program("myconfigtest1.exe", "myconfigtest1.c")
|
||||||
env.Program("myconfigtest1.exe", "myconfigtest1.c")
|
end
|
||||||
end
|
|
||||||
|
env(echo: :command, use: "myp") do |env|
|
||||||
Environment.new(echo: :command, use: "myp") do |env|
|
env.Copy("myconfigtest2.c", "simple.c")
|
||||||
env.Copy("myconfigtest2.c", "simple.c")
|
env.Program("myconfigtest2.exe", "myconfigtest2.c")
|
||||||
env.Program("myconfigtest2.exe", "myconfigtest2.c")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
12
build_tests/configure/check_cxx_compiler_use.rb
Normal file
12
build_tests/configure/check_cxx_compiler_use.rb
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
configure do
|
||||||
|
check_cxx_compiler "clang++", use: "clang"
|
||||||
|
check_cxx_compiler
|
||||||
|
end
|
||||||
|
|
||||||
|
env "t1" do |env|
|
||||||
|
env.Program("test_gcc.exe", "simple.cc")
|
||||||
|
end
|
||||||
|
|
||||||
|
env "t2", use: "clang" do |env|
|
||||||
|
env.Program("test_clang.exe", "simple.cc")
|
||||||
|
end
|
8
build_tests/configure/check_cxx_header_cpppath.rb
Normal file
8
build_tests/configure/check_cxx_header_cpppath.rb
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
configure do
|
||||||
|
check_cxx_header "string.h", check_cpppath: ["./usr1"]
|
||||||
|
check_cxx_header "frobulous.h", check_cpppath: ["./usr2"]
|
||||||
|
end
|
||||||
|
|
||||||
|
env do |env|
|
||||||
|
env.Object("test.o", "test.cc")
|
||||||
|
end
|
12
build_tests/configure/check_d_compiler_use.rb
Normal file
12
build_tests/configure/check_d_compiler_use.rb
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
configure do
|
||||||
|
check_d_compiler "ldc2", use: "ldc2"
|
||||||
|
check_d_compiler
|
||||||
|
end
|
||||||
|
|
||||||
|
env "t1" do |env|
|
||||||
|
env.Program("test_gcc.exe", "simple.d")
|
||||||
|
end
|
||||||
|
|
||||||
|
env "t2", use: "ldc2" do |env|
|
||||||
|
env.Program("test_ldc2.exe", "simple.d")
|
||||||
|
end
|
9
build_tests/configure/check_d_import_d_import_path.rb
Normal file
9
build_tests/configure/check_d_import_d_import_path.rb
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
configure do
|
||||||
|
check_d_compiler
|
||||||
|
check_d_import "std.stdio", check_d_import_path: ["./usr1"]
|
||||||
|
check_d_import "frobulous", check_d_import_path: ["./usr2"]
|
||||||
|
end
|
||||||
|
|
||||||
|
env do |env|
|
||||||
|
env.Object("test.o", "test.d")
|
||||||
|
end
|
@ -1,3 +1,4 @@
|
|||||||
configure do
|
configure do
|
||||||
|
check_d_compiler
|
||||||
check_d_import "std.stdio"
|
check_d_import "std.stdio"
|
||||||
end
|
end
|
||||||
|
3
build_tests/configure/check_lib_libpath1.rb
Normal file
3
build_tests/configure/check_lib_libpath1.rb
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
env(echo: :command) do |env|
|
||||||
|
env.Library("usr2/libfrobulous.a", "two.c")
|
||||||
|
end
|
8
build_tests/configure/check_lib_libpath2.rb
Normal file
8
build_tests/configure/check_lib_libpath2.rb
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
configure do
|
||||||
|
check_lib "m", check_libpath: ["./usr1"]
|
||||||
|
check_lib "frobulous", check_libpath: ["./usr2"]
|
||||||
|
end
|
||||||
|
|
||||||
|
env(echo: :command) do |env|
|
||||||
|
env.Program("simple.exe", "simple.c")
|
||||||
|
end
|
@ -2,8 +2,6 @@ configure do
|
|||||||
check_lib "m"
|
check_lib "m"
|
||||||
end
|
end
|
||||||
|
|
||||||
build do
|
env(echo: :command) do |env|
|
||||||
Environment.new(echo: :command) do |env|
|
env.Program("simple.exe", "simple.c")
|
||||||
env.Program("simple.exe", "simple.c")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -2,14 +2,12 @@ configure do
|
|||||||
check_lib "m", use: :m
|
check_lib "m", use: :m
|
||||||
end
|
end
|
||||||
|
|
||||||
build do
|
env(echo: :command) do |env|
|
||||||
Environment.new(echo: :command) do |env|
|
env.Copy("test1.c", "simple.c")
|
||||||
env.Copy("test1.c", "simple.c")
|
env.Program("test2.exe", "test1.c")
|
||||||
env.Program("test2.exe", "test1.c")
|
end
|
||||||
end
|
|
||||||
|
env(echo: :command, use: %w[m]) do |env|
|
||||||
Environment.new(echo: :command, use: %w[m]) do |env|
|
env.Copy("test2.c", "simple.c")
|
||||||
env.Copy("test2.c", "simple.c")
|
env.Program("test2.exe", "test2.c")
|
||||||
env.Program("test2.exe", "test2.c")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -2,9 +2,7 @@ configure do
|
|||||||
check_lib "m", use: false
|
check_lib "m", use: false
|
||||||
end
|
end
|
||||||
|
|
||||||
build do
|
env(echo: :command) do |env|
|
||||||
Environment.new(echo: :command) do |env|
|
env.Copy("test1.c", "simple.c")
|
||||||
env.Copy("test1.c", "simple.c")
|
env.Program("test2.exe", "test1.c")
|
||||||
env.Program("test2.exe", "test1.c")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
6
build_tests/configure/configure_with_top_level_env.rb
Normal file
6
build_tests/configure/configure_with_top_level_env.rb
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
configure do
|
||||||
|
check_c_compiler
|
||||||
|
end
|
||||||
|
env do |env|
|
||||||
|
puts "Prefix is #{Task["configure"]["prefix"]}"
|
||||||
|
end
|
28
build_tests/configure/custom_config_check.rb
Normal file
28
build_tests/configure/custom_config_check.rb
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
configure do
|
||||||
|
custom_check("Checking 'grep' version") do |op|
|
||||||
|
stdout, stderr, status = op.log_and_test_command(%w[grep --version])
|
||||||
|
should_fail = true
|
||||||
|
if status != 0
|
||||||
|
fail_message = "error executing grep"
|
||||||
|
elsif stdout =~ /^grep \(GNU grep\) 1\./
|
||||||
|
fail_message = "too old!"
|
||||||
|
status = 1
|
||||||
|
elsif stdout =~ /^grep \(GNU grep\) 2\./
|
||||||
|
fail_message = "we'll work with it but you should upgrade"
|
||||||
|
status = 1
|
||||||
|
should_fail = false
|
||||||
|
op.store_merge("CPPDEFINES" => "GREP_WORKAROUND")
|
||||||
|
else
|
||||||
|
op.store_append("CPPDEFINES" => "GREP_FULL")
|
||||||
|
end
|
||||||
|
op.complete(status, success_message: "good!", fail_message: fail_message, fail: should_fail)
|
||||||
|
end
|
||||||
|
custom_check("Checking sed -E flag") do |op|
|
||||||
|
stdout, stderr, status = op.log_and_test_command(%w[sed -E -e s/ab+/rep/], stdin: "abbbc")
|
||||||
|
op.complete(stdout =~ /repc/ ? 0 : 1, success_message: "good", fail_message: "fail")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
env do |env|
|
||||||
|
puts env["CPPDEFINES"]
|
||||||
|
end
|
@ -1,3 +0,0 @@
|
|||||||
Environment.new do |env|
|
|
||||||
env.Object("simple.o", "simple.cc")
|
|
||||||
end
|
|
@ -3,8 +3,6 @@ configure do
|
|||||||
check_c_header "stdio.h", set_define: "HAVE_STDIO_H"
|
check_c_header "stdio.h", set_define: "HAVE_STDIO_H"
|
||||||
end
|
end
|
||||||
|
|
||||||
build do
|
env(echo: :command) do |env|
|
||||||
Environment.new(echo: :command) do |env|
|
env.Object("simple.o", "simple.c")
|
||||||
env.Object("simple.o", "simple.c")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
3
build_tests/configure/no_configure_output.rb
Normal file
3
build_tests/configure/no_configure_output.rb
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
default do
|
||||||
|
puts "default"
|
||||||
|
end
|
5
build_tests/configure/on_fail.rb
Normal file
5
build_tests/configure/on_fail.rb
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
configure do
|
||||||
|
check_c_compiler "foo123c", fail: false, on_fail: "Install the foo123 package"
|
||||||
|
check_d_compiler "foo123d", fail: false
|
||||||
|
check_cxx_compiler "foo123cxx", on_fail: lambda {puts "Install the foo123cxx package"}
|
||||||
|
end
|
6
build_tests/configure/simple.cc
Normal file
6
build_tests/configure/simple.cc
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
std::cout << "Hi" << std::endl;
|
||||||
|
}
|
7
build_tests/configure/simple.d
Normal file
7
build_tests/configure/simple.d
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import std.stdio;
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
writeln("Hello");
|
||||||
|
return 0;
|
||||||
|
}
|
4
build_tests/configure/two.c
Normal file
4
build_tests/configure/two.c
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
int two(void)
|
||||||
|
{
|
||||||
|
return 42;
|
||||||
|
}
|
@ -9,10 +9,8 @@ EOF
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
env.add_builder(MySource)
|
||||||
env.add_builder(MySource)
|
env.MySource('inc.h', [])
|
||||||
env.MySource('inc.h', [])
|
env.Program('program.exe', Dir['*.c'])
|
||||||
env.Program('program.exe', Dir['*.c'])
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
env.Command("inc.c",
|
||||||
env.Command("inc.c",
|
[],
|
||||||
[],
|
"CMD" => %w[ruby gen.rb ${_TARGET}],
|
||||||
"CMD" => %w[ruby gen.rb ${_TARGET}],
|
"CMD_DESC" => "Generating")
|
||||||
"CMD_DESC" => "Generating")
|
env["build_root"] = env.build_root
|
||||||
env["build_root"] = env.build_root
|
env["inc_c"] = "inc.c"
|
||||||
env["inc_c"] = "inc.c"
|
env.Object("program.o", "program.c")
|
||||||
env.build_after("${build_root}/program.o", "${inc_c}")
|
env.build_after("program.o", "${inc_c}")
|
||||||
env.Program("program.exe", ["program.c", "inc.c"])
|
env.Program("program.exe", ["program.o", "inc.c"])
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -9,12 +9,10 @@ EOF
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
build do
|
env = env do |env|
|
||||||
env = Environment.new do |env|
|
env["hdr"] = "inc.h"
|
||||||
env["hdr"] = "inc.h"
|
env["src"] = "program.c"
|
||||||
env["src"] = "program.c"
|
env.add_builder(MySource)
|
||||||
env.add_builder(MySource)
|
env.MySource('${hdr}')
|
||||||
env.MySource('${hdr}')
|
env.Program('program.exe', "${src}")
|
||||||
env.Program('program.exe', "${src}")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -9,22 +9,20 @@ EOF
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
build do
|
e1 = env do |env|
|
||||||
e1 = Environment.new do |env|
|
env.add_builder(MySource)
|
||||||
env.add_builder(MySource)
|
env["one"] = "5"
|
||||||
env["one"] = "5"
|
env[:cfg] = {val: "9"}
|
||||||
env[:cfg] = {val: "9"}
|
env["two"] = lambda do |args|
|
||||||
env["two"] = lambda do |args|
|
args[:env][:cfg][:val]
|
||||||
args[:env][:cfg][:val]
|
|
||||||
end
|
|
||||||
env["the_value"] = lambda do |args|
|
|
||||||
"${one}${two}78"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
env["the_value"] = lambda do |args|
|
||||||
e1.clone do |env|
|
"${one}${two}78"
|
||||||
env[:cfg][:val] = "6"
|
|
||||||
env.MySource('inc.h', [])
|
|
||||||
env.Program('program.exe', Dir['*.c'])
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
e1.clone do |env|
|
||||||
|
env[:cfg][:val] = "6"
|
||||||
|
env.MySource('inc.h', [])
|
||||||
|
env.Program('program.exe', Dir['*.c'])
|
||||||
|
end
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
env.add_builder(:MyBuilder) do |options|
|
||||||
env.add_builder(:MyBuilder) do |options|
|
"hi"
|
||||||
"hi"
|
|
||||||
end
|
|
||||||
env.MyBuilder("foo")
|
|
||||||
end
|
end
|
||||||
|
env.MyBuilder("foo")
|
||||||
end
|
end
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
env.add_builder(:MyBuilder) do |options|
|
||||||
env.add_builder(:MyBuilder) do |options|
|
wait_for(1)
|
||||||
wait_for(1)
|
|
||||||
end
|
|
||||||
env.MyBuilder("foo")
|
|
||||||
end
|
end
|
||||||
|
env.MyBuilder("foo")
|
||||||
end
|
end
|
||||||
|
@ -12,10 +12,8 @@ class CHGen < Rscons::Builder
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
env.add_builder(CHGen)
|
||||||
env.add_builder(CHGen)
|
env.CHGen("inc.c", ["program.c"])
|
||||||
env.CHGen("inc.c", ["program.c"])
|
env.Program("program.exe", %w[program.c inc.c])
|
||||||
env.Program("program.exe", %w[program.c inc.c])
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -1,16 +1,15 @@
|
|||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
env["build_root"] = env.build_root
|
||||||
env["build_root"] = env.build_root
|
env["inc_h"] = "inc.h"
|
||||||
env["inc_h"] = "inc.h"
|
|
||||||
|
|
||||||
env.Copy("copy_inc.h", "${inc_h}")
|
env.Copy("copy_inc.h", "${inc_h}")
|
||||||
env.depends("${build_root}/program.o", "${inc_h}")
|
env.depends("program.o", "${inc_h}")
|
||||||
env.Program("program.exe", ["program.c", "inc.c"])
|
env.Object("program.o", "program.c")
|
||||||
|
env.Program("program.exe", ["program.o", "inc.c"])
|
||||||
|
|
||||||
inc_c = env.Command("inc.c",
|
inc_c = env.Command("inc.c",
|
||||||
[],
|
[],
|
||||||
"CMD" => %w[ruby gen.rb ${_TARGET}],
|
"CMD" => %w[ruby gen.rb ${_TARGET}],
|
||||||
"CMD_DESC" => "Generating")
|
"CMD_DESC" => "Generating")
|
||||||
inc_c.produces("inc.h")
|
inc_c.produces("inc.h")
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -1,16 +1,15 @@
|
|||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
env["build_root"] = env.build_root
|
||||||
env["build_root"] = env.build_root
|
env["inc_h"] = "inc.h"
|
||||||
env["inc_h"] = "inc.h"
|
|
||||||
|
|
||||||
env.Copy("copy_inc.h", "${inc_h}")
|
env.Copy("copy_inc.h", "${inc_h}")
|
||||||
env.depends("${build_root}/program.o", "${inc_h}")
|
env.depends("program.o", "${inc_h}")
|
||||||
env.Program("program.exe", ["program.c", "inc.c"])
|
env.Object("program.o", "program.c")
|
||||||
|
env.Program("program.exe", ["program.o", "inc.c"])
|
||||||
|
|
||||||
env.Command("inc.c",
|
env.Command("inc.c",
|
||||||
[],
|
[],
|
||||||
"CMD" => %w[ruby gen.rb ${_TARGET}],
|
"CMD" => %w[ruby gen.rb ${_TARGET}],
|
||||||
"CMD_DESC" => "Generating")
|
"CMD_DESC" => "Generating")
|
||||||
env.produces("inc.c", "inc.h")
|
env.produces("inc.c", "inc.h")
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -13,9 +13,7 @@ class MyBuilder < Rscons::Builder
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
env.add_builder(MyBuilder)
|
||||||
env.add_builder(MyBuilder)
|
env.MyBuilder("foo")
|
||||||
env.MyBuilder("foo")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
build do
|
configure do
|
||||||
Environment.new(echo: :command) do |env|
|
check_d_compiler "gdc"
|
||||||
env.Program("hello-d.exe", glob("*.d"))
|
end
|
||||||
end
|
|
||||||
|
env(echo: :command) do |env|
|
||||||
|
env.Program("hello-d.exe", glob("*.d"))
|
||||||
end
|
end
|
||||||
|
7
build_tests/d/build-ldc2.rb
Normal file
7
build_tests/d/build-ldc2.rb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
configure do
|
||||||
|
check_d_compiler "ldc2"
|
||||||
|
end
|
||||||
|
|
||||||
|
env(echo: :command) do |env|
|
||||||
|
env.Program("hello-d.exe", glob("*.d"))
|
||||||
|
end
|
@ -1,7 +1,5 @@
|
|||||||
build do
|
env(echo: :command) do |env|
|
||||||
Environment.new(echo: :command) do |env|
|
env.Object("main.o", "main.d")
|
||||||
env.Object("main.o", "main.d")
|
env.Object("mod.o", "mod.d")
|
||||||
env.Object("mod.o", "mod.d")
|
env.Program("hello-d.exe", ["main.o", "mod.o"])
|
||||||
env.Program("hello-d.exe", ["main.o", "mod.o"])
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
env.Program("test.exe", glob("*.c"), direct: true)
|
||||||
env.Program("test.exe", glob("*.c"), direct: true)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
lib = env.SharedLibrary("mylib", ["two.c", "three.c"], direct: true)
|
||||||
lib = env.SharedLibrary("mylib", ["two.c", "three.c"], direct: true)
|
program = env.Program("test.exe", "main.c", "LIBS" => ["mylib"], "LIBPATH" => ["."])
|
||||||
program = env.Program("test.exe", "main.c", "LIBS" => ["mylib"], "LIBPATH" => ["."])
|
env.depends(program, lib)
|
||||||
env.depends(program, lib)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
env.Program('header.exe', Dir['*.c'])
|
||||||
env.Program('header.exe', Dir['*.c'])
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -1,17 +1,16 @@
|
|||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
require 'json'
|
||||||
require 'json'
|
require 'yaml'
|
||||||
require 'yaml'
|
env.add_builder(:JsonToYaml) do |params|
|
||||||
env.add_builder(:JsonToYaml) do |params|
|
unless @cache.up_to_date?(@target, :JsonToYaml, @sources, @env)
|
||||||
unless @cache.up_to_date?(@target, :JsonToYaml, @sources, @env)
|
print_run_message("JsonToYaml #{@target}", nil)
|
||||||
@cache.mkdir_p(File.dirname(@target))
|
@cache.mkdir_p(File.dirname(@target))
|
||||||
File.open(@target, 'w') do |f|
|
File.open(@target, 'w') do |f|
|
||||||
f.write(YAML.dump(JSON.load(IO.read(@sources.first))))
|
f.write(YAML.dump(JSON.load(IO.read(@sources.first))))
|
||||||
end
|
|
||||||
@cache.register_build(@target, :JsonToYaml, @sources, @env)
|
|
||||||
end
|
end
|
||||||
true
|
@cache.register_build(@target, :JsonToYaml, @sources, @env)
|
||||||
end
|
end
|
||||||
env.JsonToYaml('foo.yml', 'foo.json')
|
true
|
||||||
end
|
end
|
||||||
|
env.JsonToYaml('foo.yml', 'foo.json')
|
||||||
end
|
end
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
build do
|
env(echo: :command) do |env|
|
||||||
Environment.new(echo: :command) do |env|
|
env["LIBS"] << "mylib"
|
||||||
env.Program('library.exe', ['lib.a', 'three.c'])
|
env["LIBPATH"] << "."
|
||||||
env.Library("lib.a", ['one.c', 'two.c'], 'CPPFLAGS' => ['-Dmake_lib'])
|
env.Program("library.exe", "one.c")
|
||||||
end
|
env.depends("library.exe", "libmylib.a")
|
||||||
|
env.Library("libmylib.a", ["two.c", "three.c"], "CPPFLAGS" => ["-Dmake_lib"])
|
||||||
end
|
end
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
env.Program("library.exe", ["lib.a", "three.c"])
|
||||||
env.Program("library.exe", ["lib.a", "three.c"])
|
env.Object("two.o", "two.c")
|
||||||
env.Object("two.o", "two.c")
|
env.Library("lib.a", ["one.c", "two.o"], 'CPPFLAGS' => ['-Dmake_lib'])
|
||||||
env.Library("lib.a", ["one.c", "two.o"], 'CPPFLAGS' => ['-Dmake_lib'])
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#ifdef make_lib
|
void two();
|
||||||
|
void three();
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
two();
|
||||||
printf("Library\n");
|
printf("Library\n");
|
||||||
|
three();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
build do
|
env(echo: :command) do |env|
|
||||||
Environment.new(echo: :command) do |env|
|
env["ARCMD"] = %w[ar rc ${_TARGET} ${_SOURCES}]
|
||||||
env["ARCMD"] = %w[ar rcf ${_TARGET} ${_SOURCES}]
|
env.Library("lib.a", glob("*.c"))
|
||||||
env.Library("lib.a", glob("*.c"))
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
void three(void)
|
||||||
|
{
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
void two(void)
|
||||||
|
{
|
||||||
|
}
|
3
build_tests/multiple_basename/Rsconscript
Normal file
3
build_tests/multiple_basename/Rsconscript
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
env do |env|
|
||||||
|
env.Program("foo.exe", glob("*.cc", "*.c"))
|
||||||
|
end
|
6
build_tests/multiple_basename/foo.c
Normal file
6
build_tests/multiple_basename/foo.c
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
void foo(void)
|
||||||
|
{
|
||||||
|
printf("foo\n");
|
||||||
|
}
|
12
build_tests/multiple_basename/foo.cc
Normal file
12
build_tests/multiple_basename/foo.cc
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
void foo(void);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char * argv[])
|
||||||
|
{
|
||||||
|
foo();
|
||||||
|
std::cout << "main" << std::endl;
|
||||||
|
return 0;
|
||||||
|
}
|
@ -1,5 +1,3 @@
|
|||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
env.Preprocess("pp", "foo.h")
|
||||||
env.Preprocess("pp", "foo.h")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
env["CPPPATH"] << "src/lib"
|
||||||
env["CPPPATH"] << "src/lib"
|
libmine = env.SharedLibrary("mine", glob("src/lib/*.c"))
|
||||||
libmine = env.SharedLibrary("mine", glob("src/lib/*.c"))
|
env.Program("test-shared.exe",
|
||||||
env.Program("test-shared.exe",
|
glob("src/*.c"),
|
||||||
glob("src/*.c"),
|
"LIBPATH" => %w[.],
|
||||||
"LIBPATH" => %w[.],
|
"LIBS" => %w[mine])
|
||||||
"LIBS" => %w[mine])
|
env.build_after("test-shared.exe", libmine)
|
||||||
env.build_after("test-shared.exe", libmine)
|
env.Program("test-static.exe",
|
||||||
env.Program("test-static.exe",
|
glob("src/**/*.c"))
|
||||||
glob("src/**/*.c"))
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
File.open("foo.xyz", "wb") do |fh|
|
||||||
File.open("foo.xyz", "wb") do |fh|
|
fh.puts("hi")
|
||||||
fh.puts("hi")
|
|
||||||
end
|
|
||||||
env.SharedObject("foo.o", "foo.xyz")
|
|
||||||
end
|
end
|
||||||
|
env.SharedObject("foo.o", "foo.xyz")
|
||||||
end
|
end
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
env["CPPPATH"] << "src/lib"
|
||||||
env["CPPPATH"] << "src/lib"
|
env.Object("file.S", "src/lib/one.c", "CFLAGS" => env["CFLAGS"] + ["-S"])
|
||||||
env.Object("file.S", "src/lib/one.c", "CFLAGS" => env["CFLAGS"] + ["-S"])
|
libmine = env.SharedLibrary("mine", "file.S")
|
||||||
libmine = env.SharedLibrary("mine", "file.S")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
env["CPPPATH"] << "src/lib"
|
||||||
env["CPPPATH"] << "src/lib"
|
libmine = env.SharedLibrary("mine", glob("src/lib/*.cc"))
|
||||||
libmine = env.SharedLibrary("mine", glob("src/lib/*.cc"))
|
env.Program("test-shared.exe",
|
||||||
env.Program("test-shared.exe",
|
glob("src/*.cc"),
|
||||||
glob("src/*.cc"),
|
"LIBPATH" => %w[.],
|
||||||
"LIBPATH" => %w[.],
|
"LIBS" => %w[mine])
|
||||||
"LIBS" => %w[mine])
|
env.build_after("test-shared.exe", libmine)
|
||||||
env.build_after("test-shared.exe", libmine)
|
env.Program("test-static.exe",
|
||||||
env.Program("test-static.exe",
|
glob("src/**/*.cc"))
|
||||||
glob("src/**/*.cc"))
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
env["CPPPATH"] << "src/lib"
|
||||||
env["CPPPATH"] << "src/lib"
|
libmine = env.SharedLibrary("mine", glob("src/lib/*.d"))
|
||||||
libmine = env.SharedLibrary("mine", glob("src/lib/*.d"))
|
env.Program("test-shared.exe",
|
||||||
env.Program("test-shared.exe",
|
glob("src/*.c"),
|
||||||
glob("src/*.c"),
|
"LIBPATH" => %w[.],
|
||||||
"LIBPATH" => %w[.],
|
"LIBS" => %w[mine])
|
||||||
"LIBS" => %w[mine])
|
env.build_after("test-shared.exe", libmine)
|
||||||
env.build_after("test-shared.exe", libmine)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
env["CPPPATH"] << "src/lib"
|
||||||
env["CPPPATH"] << "src/lib"
|
env.SharedObject("one.o", "src/lib/one.c")
|
||||||
env.SharedObject("one.o", "src/lib/one.c")
|
libmine = env.SharedLibrary("mine", ["one.o", "src/lib/two.c"])
|
||||||
libmine = env.SharedLibrary("mine", ["one.o", "src/lib/two.c"])
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
env["CPPPATH"] << "src/lib"
|
||||||
env["CPPPATH"] << "src/lib"
|
env["SHLD"] = "gcc"
|
||||||
env["SHLD"] = "gcc"
|
libmine = env.SharedLibrary("mine", glob("src/lib/*.c"))
|
||||||
libmine = env.SharedLibrary("mine", glob("src/lib/*.c"))
|
env.Program("test-shared.exe",
|
||||||
env.Program("test-shared.exe",
|
glob("src/*.c"),
|
||||||
glob("src/*.c"),
|
"LIBPATH" => %w[.],
|
||||||
"LIBPATH" => %w[.],
|
"LIBS" => %w[mine])
|
||||||
"LIBS" => %w[mine])
|
env.build_after("test-shared.exe", libmine)
|
||||||
env.build_after("test-shared.exe", libmine)
|
env.Program("test-static.exe",
|
||||||
env.Program("test-static.exe",
|
glob("src/**/*.c"))
|
||||||
glob("src/**/*.c"))
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
env.Program('simple.exe', Dir['*.c'])
|
||||||
env.Program('simple.exe', Dir['*.c'])
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
build do
|
env(echo: :command) do |env|
|
||||||
Environment.new(echo: :command) do |env|
|
tempdir = ENV["TEMP"] || ENV["TMP"] || "/tmp"
|
||||||
tempdir = ENV["TEMP"] || ENV["TMP"] || "/tmp"
|
source_file = File.join(tempdir, "abs.c")
|
||||||
source_file = File.join(tempdir, "abs.c")
|
File.open(source_file, "w") do |fh|
|
||||||
File.open(source_file, "w") do |fh|
|
fh.puts(<<-EOF)
|
||||||
fh.puts(<<-EOF)
|
int main()
|
||||||
int main()
|
{
|
||||||
{
|
return 29;
|
||||||
return 29;
|
}
|
||||||
}
|
EOF
|
||||||
EOF
|
|
||||||
end
|
|
||||||
env.Program("abs.exe", source_file)
|
|
||||||
end
|
end
|
||||||
|
env.Program("abs.exe", source_file)
|
||||||
end
|
end
|
||||||
|
@ -10,15 +10,13 @@ class ThreadedTestBuilder < Rscons::Builder
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
env.add_builder(ThreadedTestBuilder)
|
||||||
env.add_builder(ThreadedTestBuilder)
|
env.ThreadedTestBuilder("T3", [], "delay" => 3)
|
||||||
env.ThreadedTestBuilder("T3", [], "delay" => 3)
|
env.ThreadedTestBuilder("T2", [], "delay" => 1.0)
|
||||||
env.ThreadedTestBuilder("T2", [], "delay" => 1.0)
|
env.ThreadedTestBuilder("T1", [], "delay" => 0.5)
|
||||||
env.ThreadedTestBuilder("T1", [], "delay" => 0.5)
|
env.barrier
|
||||||
env.barrier
|
env.ThreadedTestBuilder("T6", [], "delay" => 1.5)
|
||||||
env.ThreadedTestBuilder("T6", [], "delay" => 1.5)
|
env.ThreadedTestBuilder("T5", [], "delay" => 1.0)
|
||||||
env.ThreadedTestBuilder("T5", [], "delay" => 1.0)
|
env.ThreadedTestBuilder("T4", [], "delay" => 0.5)
|
||||||
env.ThreadedTestBuilder("T4", [], "delay" => 0.5)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
object = env.Object("simple.o", "simple.c")
|
||||||
object = env.Object("simple.o", "simple.c")
|
env.Program("simple.exe", object)
|
||||||
env.Program("simple.exe", object)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -3,9 +3,8 @@ class TestBuilder < Rscons::Builder
|
|||||||
true
|
true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
build do
|
|
||||||
Environment.new do |env|
|
env do |env|
|
||||||
env.add_builder(TestBuilder)
|
env.add_builder(TestBuilder)
|
||||||
env.TestBuilder("file")
|
env.TestBuilder("file")
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -14,10 +14,8 @@ class MyObject < Rscons::Builder
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
env.add_builder(MyObject)
|
||||||
env.add_builder(MyObject)
|
env.MyObject("simple.o", "simple.c")
|
||||||
env.MyObject("simple.o", "simple.c")
|
env.Program("simple.exe", "simple.o")
|
||||||
env.Program("simple.exe", "simple.o")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
env["LIBS"] += ["m"]
|
||||||
env["LIBS"] += ["c"]
|
env.Program('simple.exe', Dir['*.c'])
|
||||||
env.Program('simple.exe', Dir['*.c'])
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -4,17 +4,17 @@ class DebugBuilder < Rscons::Builder
|
|||||||
finalize_command
|
finalize_command
|
||||||
else
|
else
|
||||||
@command = %W[gcc -c -o #{@target} #{@sources.first}]
|
@command = %W[gcc -c -o #{@target} #{@sources.first}]
|
||||||
if Rscons.vars["command_change"]
|
if ENV["test"] == "command_change"
|
||||||
@command += %w[-Wall]
|
@command += %w[-Wall]
|
||||||
end
|
end
|
||||||
if Rscons.vars["new_dep"]
|
if ENV["test"] == "new_dep"
|
||||||
@sources += ["extra"]
|
@sources += ["extra"]
|
||||||
end
|
end
|
||||||
if Rscons.vars["strict_deps1"]
|
if ENV["test"] == "strict_deps1"
|
||||||
@sources += ["extra"]
|
@sources += ["extra"]
|
||||||
strict_deps = true
|
strict_deps = true
|
||||||
end
|
end
|
||||||
if Rscons.vars["strict_deps2"]
|
if ENV["test"] == "strict_deps2"
|
||||||
@sources = ["extra"] + @sources
|
@sources = ["extra"] + @sources
|
||||||
strict_deps = true
|
strict_deps = true
|
||||||
end
|
end
|
||||||
@ -27,12 +27,10 @@ class DebugBuilder < Rscons::Builder
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
env.add_builder(DebugBuilder)
|
||||||
env.add_builder(DebugBuilder)
|
if ENV["test"] == "new_user_dep"
|
||||||
if Rscons.vars["new_user_dep"]
|
env.depends("foo.o", "new_dep")
|
||||||
env.depends("foo.o", "new_dep")
|
|
||||||
end
|
|
||||||
env.DebugBuilder("foo.o", "simple.c")
|
|
||||||
end
|
end
|
||||||
|
env.DebugBuilder("foo.o", "simple.c")
|
||||||
end
|
end
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
env.Copy("simple.copy", "simple.c")
|
||||||
env.Copy("simple.copy", "simple.c")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
env.Object("simple.o", "simple.c")
|
||||||
env.Object("simple.o", "simple.c")
|
env.process
|
||||||
env.process
|
env["LDCMD"] = %w[gcc -o ${_TARGET} simple.o]
|
||||||
env["LDCMD"] = %w[gcc -o ${_TARGET} simple.o]
|
env.Program('simple.exe', [])
|
||||||
env.Program('simple.exe', [])
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
env.Object("simple.o", "simple.c")
|
||||||
env.Object("simple.o", "simple.c")
|
env["LDCMD"] = %w[gcc -o ${_TARGET} simple.o]
|
||||||
env["LDCMD"] = %w[gcc -o ${_TARGET} simple.o]
|
env.Program('simple.exe', ["simple.o"])
|
||||||
env.Program('simple.exe', ["simple.o"])
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
env.Object("simple.o", "simple.c")
|
||||||
env.Object("simple.o", "simple.c")
|
env.Object("two.o", "two.c")
|
||||||
env.Object("two.o", "two.c")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
target = env.Program("simple.exe", "simple.c")
|
||||||
target = env.Program("simple.exe", "simple.c")
|
user_deps = File.read("user_deps", mode: "rb").split(" ")
|
||||||
user_deps = File.read("user_deps", mode: "rb").split(" ")
|
target.depends(*user_deps)
|
||||||
target.depends(*user_deps)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -13,9 +13,7 @@ class TestBuilder < Rscons::Builder
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
env.add_builder(TestBuilder)
|
||||||
env.add_builder(TestBuilder)
|
env.TestBuilder("foo")
|
||||||
env.TestBuilder("foo")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
7
build_tests/simple/clean.rb
Normal file
7
build_tests/simple/clean.rb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
env do |env|
|
||||||
|
env.Program('simple.exe', Dir['*.c'])
|
||||||
|
end
|
||||||
|
|
||||||
|
clean do
|
||||||
|
puts "custom clean action"
|
||||||
|
end
|
@ -1,6 +1,4 @@
|
|||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
env.Program("simple.exe", "simple.c")
|
||||||
env.Program("simple.exe", "simple.c")
|
env.clear_targets
|
||||||
env.clear_targets
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
build do
|
base_env = env do |env|
|
||||||
base_env = Environment.new do |env|
|
env.n_threads = 165
|
||||||
env.n_threads = 165
|
end
|
||||||
end
|
|
||||||
|
my_env = base_env.clone do |env|
|
||||||
my_env = base_env.clone
|
puts env.n_threads
|
||||||
|
|
||||||
puts my_env.n_threads
|
|
||||||
end
|
end
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
build do
|
env(echo: :command) do |env|
|
||||||
Environment.new(echo: :command) do |env|
|
env["LD"] = "gcc"
|
||||||
env["LD"] = "gcc"
|
env.Program('simple.exe', Dir['*.c'])
|
||||||
env.Program('simple.exe', Dir['*.c'])
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
command = %W[gcc -o ${_TARGET} ${_SOURCES}]
|
||||||
command = %W[gcc -o ${_TARGET} ${_SOURCES}]
|
env.Command("simple.exe",
|
||||||
env.Command("simple.exe",
|
"simple.c",
|
||||||
"simple.c",
|
"CMD" => command,
|
||||||
"CMD" => command,
|
"CMD_DESC" => "BuildIt")
|
||||||
"CMD_DESC" => "BuildIt")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
env.Object("simple.o", "simple.c")
|
||||||
env.Object("simple.o", "simple.c")
|
env.Command("simple.txt",
|
||||||
env.Command("simple.txt",
|
"simple.o",
|
||||||
"simple.o",
|
"CMD" => %w[objdump --disassemble --source ${_SOURCES}],
|
||||||
"CMD" => %w[objdump --disassemble --source ${_SOURCES}],
|
"CMD_STDOUT" => "${_TARGET}",
|
||||||
"CMD_STDOUT" => "${_TARGET}",
|
"CMD_DESC" => "My Disassemble")
|
||||||
"CMD_DESC" => "My Disassemble")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
env["sources"] = glob("*.c")
|
||||||
env["sources"] = glob("*.c")
|
env.Program("simple.exe", "${sources}")
|
||||||
env.Program("simple.exe", "${sources}")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
env.Directory("teh_dir")
|
||||||
env.Directory("teh_dir")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
build do
|
env do |env|
|
||||||
Environment.new do |env|
|
env.Object("simple.o", "simple.c")
|
||||||
env.Object("simple.o", "simple.c")
|
env.Disassemble("simple.txt", "simple.o")
|
||||||
env.Disassemble("simple.txt", "simple.o")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user