Compare commits
172
Commits
v1.11.0
...
784bbd471b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
784bbd471b | ||
|
|
c60589a9c9 | ||
|
|
04fc9866c4 | ||
|
|
7a807575b2 | ||
|
|
787b3249a7 | ||
|
|
3115e55739 | ||
|
|
0c07ea0437 | ||
|
|
0e7c976089 | ||
|
|
921f0d2cb1 | ||
|
|
c23426c5aa | ||
|
|
ea2b1e73d1 | ||
|
|
9bf4b8fa96 | ||
|
|
008fa4844d | ||
|
|
568b78e2e2 | ||
|
|
3b00016278 | ||
|
|
a655d04541 | ||
|
|
5534878f68 | ||
|
|
1efee50b2c | ||
|
|
3ff09978f4 | ||
|
|
ac1fc6d106 | ||
|
|
06b9c98ed0 | ||
|
|
f58744d31f | ||
|
|
bf136e79f2 | ||
|
|
ab2fa1662f | ||
|
|
68118c2707 | ||
|
|
6ce3d59ad9 | ||
|
|
983862a528 | ||
|
|
658b73e4de | ||
|
|
b882f8de99 | ||
|
|
8426a54a57 | ||
|
|
ee1640008c | ||
|
|
7cfd23e16f | ||
|
|
5c3b615aee | ||
|
|
935848c3b5 | ||
|
|
d047a1bf29 | ||
|
|
016bf5eac7 | ||
|
|
33504f586b | ||
|
|
86594c62b6 | ||
|
|
ea25f62f7c | ||
|
|
f2cfc25604 | ||
|
|
a1f5f022d1 | ||
|
|
7992450383 | ||
|
|
b41a368da1 | ||
|
|
1b63dc7503 | ||
|
|
db788cdd35 | ||
|
|
3f8b4d616f | ||
|
|
aac32d20b0 | ||
|
|
12f1909d35 | ||
|
|
31ef45258f | ||
|
|
9f9b7f0bf4 | ||
|
|
918c629435 | ||
|
|
eaac473f44 | ||
|
|
fa5aa51daa | ||
|
|
347d651ab6 | ||
|
|
08085f09c4 | ||
|
|
5915ac2b95 | ||
|
|
a98c111cd2 | ||
|
|
93ffed2eb2 | ||
|
|
f8e6666a2c | ||
|
|
5720662b7c | ||
|
|
432d221be2 | ||
|
|
a1efb1c1b3 | ||
|
|
7c7ee142e0 | ||
|
|
ba69f05e99 | ||
|
|
6180410cc4 | ||
|
|
2d44a88fb6 | ||
|
|
28e3781331 | ||
|
|
c0a28d0207 | ||
|
|
0e27e967d0 | ||
|
|
1ecce7e99e | ||
|
|
25b73ebd8f | ||
|
|
bca963af5c | ||
|
|
ba5377a1ce | ||
|
|
8d7fd4bda8 | ||
|
|
e3e2e46d6e | ||
|
|
9e0ce5a55c | ||
|
|
b88131eb2f | ||
|
|
dff80587ac | ||
|
|
cd2696dd0b | ||
|
|
36643c1ab1 | ||
|
|
778d9ed8b2 | ||
|
|
660d30558a | ||
|
|
82fbd34149 | ||
|
|
e0b82d37af | ||
|
|
7a90325b67 | ||
|
|
49116e6b59 | ||
|
|
90300a1606 | ||
|
|
1eb07e9a22 | ||
|
|
9975eec165 | ||
|
|
04c0a6a86f | ||
|
|
bfdf3a12fd | ||
|
|
6dd9c835ce | ||
|
|
cfec0dcadc | ||
|
|
a1c1cc1855 | ||
|
|
add9f9c50d | ||
|
|
ba3d656110 | ||
|
|
ab4ca71ac7 | ||
|
|
aba11155a4 | ||
|
|
3b586cb476 | ||
|
|
88fd4bd405 | ||
|
|
7869d38dd8 | ||
|
|
e8990199ef | ||
|
|
6078cb0977 | ||
|
|
85b0111a6e | ||
|
|
6bb0a55a55 | ||
|
|
95d5ada865 | ||
|
|
cd9fffd828 | ||
|
|
30511a3443 | ||
|
|
d656df5407 | ||
|
|
d54d363a25 | ||
|
|
697db2a987 | ||
|
|
daa90e431c | ||
|
|
bdeaec11ba | ||
|
|
7eeb6312ba | ||
|
|
07d9b97ddc | ||
|
|
af033ee4e0 | ||
|
|
c9de4f37e6 | ||
|
|
64caaa9a53 | ||
|
|
d196845c85 | ||
|
|
5288a47bfb | ||
|
|
9bd9abcad1 | ||
|
|
b5a8b6f628 | ||
|
|
7edcef2b30 | ||
|
|
c34821864e | ||
|
|
97c24eec6b | ||
|
|
053df2360f | ||
|
|
8d766e4804 | ||
|
|
e29ec5a126 | ||
|
|
de46bb0cc1 | ||
|
|
084080a682 | ||
|
|
3a564c0ca2 | ||
|
|
ac89a122d8 | ||
|
|
ea6ae1be10 | ||
|
|
a649c7f4cb | ||
|
|
2f83f36659 | ||
|
|
a46936bc0b | ||
|
|
95ee63292e | ||
|
|
bcd33fe098 | ||
|
|
5cf77f1f58 | ||
|
|
b4cc45c381 | ||
|
|
750506201f | ||
|
|
284312a21c | ||
|
|
d081a4695f | ||
|
|
c7f66694ab | ||
|
|
57de94a3fb | ||
|
|
53ba7dad41 | ||
|
|
8cb02a7e34 | ||
|
|
dbbce9e476 | ||
|
|
0dc3a90660 | ||
|
|
d48c7587d6 | ||
|
|
70d4740a69 | ||
|
|
aaae845d60 | ||
|
|
e900e74342 | ||
|
|
62ae3f162d | ||
|
|
099d26f33c | ||
|
|
89562c584a | ||
|
|
a9aeaf2356 | ||
|
|
5409b3cb34 | ||
|
|
6d04500c13 | ||
|
|
45e30662d2 | ||
|
|
8f7e044bfd | ||
|
|
dbea6f0a26 | ||
|
|
c923eb5c7c | ||
|
|
529d9aacaa | ||
|
|
65c1bac4f9 | ||
|
|
775363ddbd | ||
|
|
2a96495e83 | ||
|
|
15e52e488c | ||
|
|
c0b12132f0 | ||
|
|
9141cf91e7 | ||
|
|
7f7e6ef3da | ||
|
|
60b3fdbcac |
No files matched your search
@@ -3,5 +3,7 @@
|
||||
/_yardoc/
|
||||
/build_test_run/
|
||||
/coverage/
|
||||
/dist/
|
||||
/doc/
|
||||
/pkg/
|
||||
/test/
|
||||
+210
@@ -0,0 +1,210 @@
|
||||
## ChangeLog
|
||||
|
||||
### v1.17.0
|
||||
|
||||
#### New Features
|
||||
|
||||
- allow construction variable expansion on `true` and `false` values.
|
||||
- remove makefile target name check when parsing dependencies
|
||||
|
||||
### v1.16.0
|
||||
|
||||
#### New Features
|
||||
|
||||
- Add `Rscons.glob`
|
||||
- Support command-line variables
|
||||
- improve debuggability of cache.up_to_date?
|
||||
- allow passing a VarSet into cache methods
|
||||
|
||||
#### Fixes
|
||||
|
||||
- generate dependencies for D builds
|
||||
|
||||
### v1.15.0
|
||||
|
||||
- allow json 1.x or 2.x
|
||||
|
||||
### v1.14.0
|
||||
|
||||
#### New Features
|
||||
|
||||
- #45 - Add Rscons::VarSet#values_at
|
||||
|
||||
#### Fixes
|
||||
|
||||
- #44 - Environment#print_builder_run_message should support string commands
|
||||
|
||||
### v1.13.0
|
||||
|
||||
#### New Features
|
||||
|
||||
- #43 - Add ability to record side-effect file production
|
||||
|
||||
### v1.12.0
|
||||
|
||||
#### New Features
|
||||
|
||||
- #40 - env.depends should imply env.build_after
|
||||
- #41 - be more colorful
|
||||
|
||||
#### Fixes
|
||||
|
||||
- #39 - wait for in-progress subcommands to complete on build failure
|
||||
- #42 - cloned Environments should inherit n_threads
|
||||
|
||||
### v1.11.1
|
||||
|
||||
#### Fixes
|
||||
|
||||
- fix the circular build dependency detection logic
|
||||
|
||||
### v1.11.0
|
||||
|
||||
#### New Features
|
||||
|
||||
- Change default Environment :clone option to :all to clone all attributes
|
||||
- #38 - raise error when circular dependencies are found
|
||||
- #34 - Allow overriding n_threads on a per-Environment level
|
||||
|
||||
#### Fixes
|
||||
|
||||
- #35 - env.build_after should expand paths
|
||||
- #36 - SHCFLAGS and SHCXXFLAGS should inherit non-SH flags by default
|
||||
- #37 - Fix non-blocking thread-wait if Rscons.n_threads is set to 0
|
||||
|
||||
### v1.10.0
|
||||
|
||||
#### New Features
|
||||
|
||||
- #23 - add parallelization - builds are now parallelized by default
|
||||
- #31 - add LEXSUFFIX, YACCSUFFIX construction variables
|
||||
- #30 - place object files for absolute source paths under build_root
|
||||
- #28 - support redirecting standard output using the Command builder
|
||||
- Always use a build root and default it to "build"
|
||||
- Add builder features
|
||||
- #8 - add SharedObject and SharedLibrary builders
|
||||
|
||||
#### Fixes
|
||||
|
||||
- expand target and source paths before calling Builder#create_build_target
|
||||
- #29 - fix PROGSUFFIX handling
|
||||
- #32 - Pre-build hooks do not respect modified key values
|
||||
|
||||
### v1.9.3
|
||||
|
||||
- Environment#parse_flags should put -std=XXX flags in CCFLAGS, not CFLAGS
|
||||
|
||||
### v1.9.2
|
||||
|
||||
- allow phony targets in conjunction with build roots
|
||||
|
||||
### v1.9.1
|
||||
|
||||
- change *SUFFIX defaults to arrays
|
||||
- add various C++ file suffixes
|
||||
- use ${INCPREFIX} instead of hard-coded "-I" in Preprocess builder
|
||||
|
||||
### v1.9.0
|
||||
|
||||
#### New Features
|
||||
|
||||
- #6 - add Install and Copy builders
|
||||
- #22 - allow overriding Command builder short description with CMD_DESC variable
|
||||
- #24 - add "rscons" executable
|
||||
- #25 - add support for phony targets given as Symbols instead of Strings
|
||||
- #26 - support registering multiple build targets with the same target name
|
||||
- #27 - add Directory builder
|
||||
|
||||
#### Fixes
|
||||
|
||||
- #20 - fix variable references that expand to arrays in build target sources
|
||||
- #21 - rework Preprocess builder to consider deep dependencies
|
||||
- fix Rscons.set_suffix to append the given suffix if the filename has none
|
||||
- remove ${CFLAGS} from default CPP_CMD
|
||||
|
||||
### v1.8.1
|
||||
|
||||
- fix Environment#dump when construction variables are symbols
|
||||
|
||||
### v1.8.0
|
||||
|
||||
- new Command builder to execute arbitrary user commands
|
||||
- new SimpleBuilder class
|
||||
- create new builders quickly by passing a block to Environment#add_builder
|
||||
- improved YARD documentation
|
||||
- add Environment#dump to debug Environment construction variables
|
||||
|
||||
### v1.7.0
|
||||
|
||||
- allow build hooks to register new build targets
|
||||
- add post-build hooks (register with Environment#add_post_build_hook)
|
||||
- clear all build targets after processing an Environment
|
||||
- allow trailing slashes in arguments to Environment#build_dir
|
||||
|
||||
### v1.6.1
|
||||
|
||||
- add DEPFILESUFFIX construction variable to override dependency file suffix
|
||||
- fix Environment#depends to expand its arguments for construction variables
|
||||
|
||||
### v1.6.0
|
||||
|
||||
- support lambdas as construction variable values
|
||||
|
||||
### v1.5.0
|
||||
|
||||
- add "json" as a runtime dependency
|
||||
- update construction variables to match SCons more closely
|
||||
- add CPPDEFPREFIX, INCPREFIX, CPPDEFINES, CCFLAGS, LIBDIRPREFIX, and LIBLINKPREFIX
|
||||
- add Environment#shell
|
||||
- add Environment#parse_flags, #parse_flags!, #merge_flags
|
||||
- unbuffer $stdout by default
|
||||
- add PROGSUFFIX construction variable (defaults to .exe on MinGW/Cygwin)
|
||||
- add Rscons::BuildTarget and Builder#create_build_target
|
||||
- update specs to RSpec 3.x and fix to run on MinGW/Cygwin/Linux
|
||||
- add YARD documentation to get to 100% coverage
|
||||
|
||||
### v1.4.3
|
||||
|
||||
- fix builders properly using construction variable overrides
|
||||
- expand nil construction variables to empty strings
|
||||
|
||||
### v1.4.2
|
||||
|
||||
- add Environment#expand_path
|
||||
- expand construction variable references in builder targets and sources before invoking builder
|
||||
|
||||
### v1.4.1
|
||||
|
||||
- fix invoking a builder with no sources while a build root defined
|
||||
|
||||
### v1.4.0
|
||||
|
||||
- add CFile builder
|
||||
- add Disassemble builder
|
||||
- add Preprocess builder
|
||||
- pass the Environment object to build hooks in the :env key of the build_op parameter
|
||||
- expand target/source paths beginning with "^/" to be relative to the Environment's build root
|
||||
- many performance improvements, including:
|
||||
- use JSON instead of YAML for the cache to improve loading speed (Issue #7)
|
||||
- store a hash of the build command instead of the full command contents in the cache
|
||||
- implement copy-on-write semantics for construction variables when cloning Environments
|
||||
- only load the cache once instead of on each Environment#process
|
||||
- only write the cache when something has changed
|
||||
- fix Cache#mkdir_p to handle relative paths (Issue #5)
|
||||
- flush the cache to disk if a builder raises an exception (Issue #4)
|
||||
|
||||
### v1.3.0
|
||||
|
||||
- change Environment#execute() options parameter to accept the following options keys:
|
||||
- :env to pass an environment Hash to Kernel#system
|
||||
- :options to pass an options Hash to Kernel#system
|
||||
|
||||
### v1.2.0
|
||||
|
||||
- add :clone option to Environment#clone to control exactly which Environment attributes are cloned
|
||||
- allow nil to be passed in to Environment#build_root=
|
||||
|
||||
### v1.1.0
|
||||
|
||||
- Change Cache#up_to_date?() and #register_build() to accept a single target
|
||||
file or an array of target file names
|
||||
@@ -1,4 +1,8 @@
|
||||
source 'https://rubygems.org'
|
||||
|
||||
# Specify your gem's dependencies in rscons.gemspec
|
||||
gemspec
|
||||
gem "json"
|
||||
gem "rspec"
|
||||
gem "rake"
|
||||
gem "simplecov"
|
||||
gem "yard"
|
||||
gem "rdoc"
|
||||
+21
-30
@@ -1,51 +1,42 @@
|
||||
PATH
|
||||
remote: .
|
||||
specs:
|
||||
rscons (1.11.0)
|
||||
json (~> 1.0)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
diff-lcs (1.2.5)
|
||||
diff-lcs (1.3)
|
||||
docile (1.1.5)
|
||||
json (1.8.3)
|
||||
rake (10.4.2)
|
||||
rdoc (4.2.0)
|
||||
json (~> 1.4)
|
||||
redcarpet (3.3.3)
|
||||
rspec (3.4.0)
|
||||
rspec-core (~> 3.4.0)
|
||||
rspec-expectations (~> 3.4.0)
|
||||
rspec-mocks (~> 3.4.0)
|
||||
rspec-core (3.4.1)
|
||||
rspec-support (~> 3.4.0)
|
||||
rspec-expectations (3.4.0)
|
||||
json (2.1.0)
|
||||
rake (12.3.1)
|
||||
rdoc (5.1.0)
|
||||
rspec (3.6.0)
|
||||
rspec-core (~> 3.6.0)
|
||||
rspec-expectations (~> 3.6.0)
|
||||
rspec-mocks (~> 3.6.0)
|
||||
rspec-core (3.6.0)
|
||||
rspec-support (~> 3.6.0)
|
||||
rspec-expectations (3.6.0)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.4.0)
|
||||
rspec-mocks (3.4.0)
|
||||
rspec-support (~> 3.6.0)
|
||||
rspec-mocks (3.6.0)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.4.0)
|
||||
rspec-support (3.4.1)
|
||||
simplecov (0.11.1)
|
||||
rspec-support (~> 3.6.0)
|
||||
rspec-support (3.6.0)
|
||||
simplecov (0.15.0)
|
||||
docile (~> 1.1.0)
|
||||
json (~> 1.8)
|
||||
json (>= 1.8, < 3)
|
||||
simplecov-html (~> 0.10.0)
|
||||
simplecov-html (0.10.0)
|
||||
yard (0.8.7.6)
|
||||
simplecov-html (0.10.2)
|
||||
yard (0.9.12)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
x86-mingw32
|
||||
|
||||
DEPENDENCIES
|
||||
json
|
||||
rake
|
||||
rdoc
|
||||
redcarpet
|
||||
rscons!
|
||||
rspec
|
||||
simplecov
|
||||
yard
|
||||
|
||||
BUNDLED WITH
|
||||
1.10.6
|
||||
1.16.2
|
||||
@@ -1,13 +1,13 @@
|
||||
# Rscons
|
||||
|
||||
Rscons is a software construction framework inspired by SCons and implemented
|
||||
in Ruby.
|
||||
|
||||
[](http://badge.fury.io/rb/rscons)
|
||||
Rscons (https://github.com/holtrop/rscons) is a software construction framework
|
||||
inspired by SCons and waf but implemented in Ruby.
|
||||
|
||||
## Installation
|
||||
|
||||
$ gem install rscons
|
||||
Rscons is distributed as a standalone Ruby script named ``rscons``. This file
|
||||
(containing the complete rscons build system) can be checked into your project
|
||||
and versioned along with your project.
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -30,7 +30,7 @@ task block or split among multiple tasks.
|
||||
```ruby
|
||||
Rscons::Environment.new do |env|
|
||||
env["CFLAGS"] << "-Wall"
|
||||
env.Program("program", Dir["src/**/*.c"])
|
||||
env.Program("program", Rscons.glob("src/**/*.c"))
|
||||
end
|
||||
```
|
||||
|
||||
@@ -39,7 +39,7 @@ end
|
||||
```ruby
|
||||
Rscons::Environment.new do |env|
|
||||
env["DFLAGS"] << "-Wall"
|
||||
env.Program("program", Dir["src/**/*.d"])
|
||||
env.Program("program", Rscons.glob("src/**/*.d"))
|
||||
end
|
||||
```
|
||||
|
||||
@@ -51,7 +51,7 @@ main_env = Rscons::Environment.new do |env|
|
||||
env.build_dir("src", "build/main")
|
||||
env["CFLAGS"] = ["-DSOME_DEFINE", "-O3"]
|
||||
env["LIBS"] = ["SDL"]
|
||||
env.Program("program", Dir["src/**/*.cc"])
|
||||
env.Program("program", Rscons.glob("src/**/*.cc"))
|
||||
end
|
||||
|
||||
debug_env = main_env.clone do |env|
|
||||
@@ -59,7 +59,7 @@ debug_env = main_env.clone do |env|
|
||||
env.build_dir("src", "build/debug")
|
||||
env["CFLAGS"] -= ["-O3"]
|
||||
env["CFLAGS"] += ["-g", "-O0"]
|
||||
env.Program("program-debug", Dir["src/**/*.cc"])
|
||||
env.Program("program-debug", Rscons.glob("src/**/*.cc"))
|
||||
end
|
||||
```
|
||||
|
||||
@@ -86,7 +86,7 @@ end
|
||||
Rscons::Environment.new do |env|
|
||||
env.add_builder(GenerateFoo.new)
|
||||
env.GenerateFoo("foo.h", [])
|
||||
env.Program("a.out", Dir["*.c"])
|
||||
env.Program("a.out", Rscons.glob("*.c"))
|
||||
end
|
||||
```
|
||||
|
||||
@@ -111,6 +111,15 @@ Rscons::Environment.new do |env|
|
||||
end
|
||||
```
|
||||
|
||||
The `Cache#up_to_date?` method accepts an optional 5th parameter which is an
|
||||
options Hash. The `:debug` option can be specified in this Hash with a value
|
||||
of `true` to aid in debugging builders while developing them. For example:
|
||||
|
||||
```ruby
|
||||
unless cache.up_to_date?(target, cmd, sources, env, debug: true)
|
||||
end
|
||||
```
|
||||
|
||||
### Example: Custom Builder That Generates Multiple Output Files
|
||||
|
||||
```ruby
|
||||
@@ -191,7 +200,7 @@ Rscons::Environment.new do |env|
|
||||
end
|
||||
end
|
||||
env.build_dir("src", "build")
|
||||
env.Program("program", Dir["**/*.cc"])
|
||||
env.Program("program", Rscons.glob("**/*.cc"))
|
||||
end
|
||||
```
|
||||
|
||||
@@ -199,7 +208,7 @@ end
|
||||
|
||||
```ruby
|
||||
Rscons::Environment.new do |env|
|
||||
env.Library("mylib.a", Dir["src/**/*.c"])
|
||||
env.Library("mylib.a", Rscons.glob("src/**/*.c"))
|
||||
end
|
||||
```
|
||||
|
||||
@@ -327,7 +336,7 @@ env.Install("dist/share", "share")
|
||||
```ruby
|
||||
env.Library(target, sources)
|
||||
# Example
|
||||
env.Library("lib.a", Dir["src/**/*.c"])
|
||||
env.Library("lib.a", Rscons.glob("src/**/*.c"))
|
||||
```
|
||||
|
||||
The Library builder creates a static library archive from the given source
|
||||
@@ -362,7 +371,7 @@ preprocessed output to the target file.
|
||||
```ruby
|
||||
env.Program(target, sources)
|
||||
# Example
|
||||
env.Program("myprog", Dir["src/**/*.cc"])
|
||||
env.Program("myprog", Rscons.glob("src/**/*.cc"))
|
||||
```
|
||||
|
||||
The Program builder compiles and links the given sources to an executable file.
|
||||
@@ -375,7 +384,7 @@ This can be controlled with the `PROGSUFFIX` construction variable.
|
||||
```ruby
|
||||
env.SharedLibrary(target, sources)
|
||||
# Example
|
||||
env.SharedLibrary("mydll", Dir["src/**/*.cc"])
|
||||
env.SharedLibrary("mydll", Rscons.glob("src/**/*.cc"))
|
||||
```
|
||||
|
||||
The SharedLibrary builder compiles and links the given sources to a dynamically
|
||||
@@ -411,14 +420,14 @@ construction variables can be overridden by the user.
|
||||
| ARFLAGS | Array | Static library archiver flags | ["rcs"] |
|
||||
| AS | String | Assembler executable | "${CC}" |
|
||||
| ASCMD | Array | Assembler command line | ["${AS}", "-c", "-o", "${_TARGET}", "${ASDEPGEN}", "${INCPREFIX}${ASPPPATH}", "${ASPPFLAGS}", "${ASFLAGS}", "${_SOURCES}"] |
|
||||
| ASDEPGEN | Array | Assembly dependency generation flags | ["-MMD", "-MF", "${_DEPFILE}"] |
|
||||
| ASDEPGEN | Array | Assembly dependency generation flags | ["-MMD", "-MF", "${_DEPFILE}", "-MT", "TARGET"] |
|
||||
| ASFLAGS | Array | Assembler flags | [] |
|
||||
| ASPPFLAGS | Array | Assembler preprocessor flags | ["${CPPFLAGS}"] |
|
||||
| ASPPPATH | Array | Assembler preprocessor path | ["${CPPPATH}"] |
|
||||
| ASSUFFIX | Array | Assembly file suffixes | [".S"] |
|
||||
| CC | String | C compiler executable | "gcc" |
|
||||
| CCCMD | Array | C compiler command line | ["${CC}", "-c", "-o", "${_TARGET}", "${CCDEPGEN}", "${INCPREFIX}${CPPPATH}", "${CPPFLAGS}", "${CFLAGS}", "${CCFLAGS}", "${_SOURCES}"] |
|
||||
| CCDEPGEN | Array | C compiler dependency generation flags | ["-MMD", "-MF", "${_DEPFILE}"] |
|
||||
| CCDEPGEN | Array | C compiler dependency generation flags | ["-MMD", "-MF", "${_DEPFILE}", "-MT", "TARGET"] |
|
||||
| CCFLAGS | Array | Common flags for both C and C++ compiler | [] |
|
||||
| CFLAGS | Array | C compiler flags | [] |
|
||||
| CPP_CMD | Array | Preprocess command line | ["${_PREPROCESS_CC}", "-E", "${_PREPROCESS_DEPGEN}", "-o", "${_TARGET}", "${INCPREFIX}${CPPPATH}", "${CPPFLAGS}", "${_SOURCES}"] |
|
||||
@@ -430,12 +439,13 @@ construction variables can be overridden by the user.
|
||||
| CSUFFIX | Array | C source file suffixes | [".c"] |
|
||||
| CXX | String | C++ compiler executable | "g++" |
|
||||
| CXXCMD | Array | C++ compiler command line | ["${CXX}", "-c", "-o", "${_TARGET}", "${CXXDEPGEN}", "${INCPREFIX}${CPPPATH}", "${CPPFLAGS}", "${CXXFLAGS}", "${CCFLAGS}", "${_SOURCES}"] |
|
||||
| CXXDEPGEN | Array | C++ compiler dependency generation flags | ["-MMD", "-MF", "${_DEPFILE}"] |
|
||||
| CXXDEPGEN | Array | C++ compiler dependency generation flags | ["-MMD", "-MF", "${_DEPFILE}", "-MT", "TARGET"] |
|
||||
| CXXFLAGS | Array | C++ compiler flags | [] |
|
||||
| CXXSUFFIX | Array | C++ source file suffixes | [".cc", ".cpp", ".cxx", ".C"] |
|
||||
| D_IMPORT_PATH | Array | D compiler import path | [] |
|
||||
| DC | String | D compiler executable | "gdc" |
|
||||
| DCCMD | Array | D compiler command line | ["${DC}", "-c", "-o", "${_TARGET}", "${INCPREFIX}${D_IMPORT_PATH}", "${DFLAGS}", "${_SOURCES}"] |
|
||||
| DCCMD | Array | D compiler command line | ["${DC}", "-c", "-o", "${_TARGET}", "${DDEPGEN}", "${INCPREFIX}${D_IMPORT_PATH}", "${DFLAGS}", "${_SOURCES}"] |
|
||||
| DDEPGEN | Array | D compiler dependency generation flags | ["-MMD", "-MF", "${_DEPFILE}", "-MT", "TARGET"] |
|
||||
| DEPFILESUFFIX | String | Dependency file suffix for Makefile-style dependency rules emitted by the compiler (used internally for temporary dependency files used to determine a source file's dependencies) | ".mf" |
|
||||
| DFLAGS | Array | D compiler flags | [] |
|
||||
| DISASM_CMD | Array | Disassemble command line | ["${OBJDUMP}", "${DISASM_FLAGS}", "${_SOURCES}"] |
|
||||
@@ -548,9 +558,19 @@ end
|
||||
You can pass multiple dependency files to `Environment#depends`:
|
||||
|
||||
```ruby
|
||||
env.depends("my_app", "config/link.ld", "README.txt", *Dir.glob("assets/**/*"))
|
||||
env.depends("my_app", "config/link.ld", "README.txt", *Rscons.glob("assets/**/*"))
|
||||
```
|
||||
|
||||
### Command-Line Variables
|
||||
|
||||
Variables can be specified on the rscons command line. For example:
|
||||
|
||||
```
|
||||
rscons VAR=val
|
||||
```
|
||||
|
||||
These variables are accessible in a global VarSet called `Rscons.vars`.
|
||||
|
||||
### Construction Variable Naming
|
||||
|
||||
* uppercase strings - the default construction variables that Rscons uses
|
||||
@@ -560,160 +580,7 @@ env.depends("my_app", "config/link.ld", "README.txt", *Dir.glob("assets/**/*"))
|
||||
### API documentation
|
||||
|
||||
Documentation for the complete Rscons API can be found at
|
||||
http://rubydoc.info/github/holtrop/rscons/frames.
|
||||
|
||||
## Release Notes
|
||||
|
||||
### v1.11.0
|
||||
|
||||
#### New Features
|
||||
|
||||
- Change default Environment :clone option to :all to clone all attributes
|
||||
- #38 - raise error when circular dependencies are found
|
||||
- #34 - Allow overriding n_threads on a per-Environment level
|
||||
|
||||
#### Fixes
|
||||
|
||||
- #35 - env.build_after should expand paths
|
||||
- #36 - SHCFLAGS and SHCXXFLAGS should inherit non-SH flags by default
|
||||
- #37 - Fix non-blocking thread-wait if Rscons.n_threads is set to 0
|
||||
|
||||
### v1.10.0
|
||||
|
||||
#### New Features
|
||||
|
||||
- #23 - add parallelization - builds are now parallelized by default
|
||||
- #31 - add LEXSUFFIX, YACCSUFFIX construction variables
|
||||
- #30 - place object files for absolute source paths under build_root
|
||||
- #28 - support redirecting standard output using the Command builder
|
||||
- Always use a build root and default it to "build"
|
||||
- Add builder features
|
||||
- #8 - add SharedObject and SharedLibrary builders
|
||||
|
||||
#### Fixes
|
||||
|
||||
- expand target and source paths before calling Builder#create_build_target
|
||||
- #29 - fix PROGSUFFIX handling
|
||||
- #32 - Pre-build hooks do not respect modified key values
|
||||
|
||||
### v1.9.3
|
||||
|
||||
- Environment#parse_flags should put -std=XXX flags in CCFLAGS, not CFLAGS
|
||||
|
||||
### v1.9.2
|
||||
|
||||
- allow phony targets in conjunction with build roots
|
||||
|
||||
### v1.9.1
|
||||
|
||||
- change *SUFFIX defaults to arrays
|
||||
- add various C++ file suffixes
|
||||
- use ${INCPREFIX} instead of hard-coded "-I" in Preprocess builder
|
||||
|
||||
### v1.9.0
|
||||
|
||||
#### New Features
|
||||
|
||||
- #6 - add Install and Copy builders
|
||||
- #22 - allow overriding Command builder short description with CMD_DESC variable
|
||||
- #24 - add "rscons" executable
|
||||
- #25 - add support for phony targets given as Symbols instead of Strings
|
||||
- #26 - support registering multiple build targets with the same target name
|
||||
- #27 - add Directory builder
|
||||
|
||||
#### Fixes
|
||||
|
||||
- #20 - fix variable references that expand to arrays in build target sources
|
||||
- #21 - rework Preprocess builder to consider deep dependencies
|
||||
- fix Rscons.set_suffix to append the given suffix if the filename has none
|
||||
- remove ${CFLAGS} from default CPP_CMD
|
||||
|
||||
### v1.8.1
|
||||
|
||||
- fix Environment#dump when construction variables are symbols
|
||||
|
||||
### v1.8.0
|
||||
|
||||
- new Command builder to execute arbitrary user commands
|
||||
- new SimpleBuilder class
|
||||
- create new builders quickly by passing a block to Environment#add_builder
|
||||
- improved YARD documentation
|
||||
- add Environment#dump to debug Environment construction variables
|
||||
|
||||
### v1.7.0
|
||||
|
||||
- allow build hooks to register new build targets
|
||||
- add post-build hooks (register with Environment#add_post_build_hook)
|
||||
- clear all build targets after processing an Environment
|
||||
- allow trailing slashes in arguments to Environment#build_dir
|
||||
|
||||
### v1.6.1
|
||||
|
||||
- add DEPFILESUFFIX construction variable to override dependency file suffix
|
||||
- fix Environment#depends to expand its arguments for construction variables
|
||||
|
||||
### v1.6.0
|
||||
|
||||
- support lambdas as construction variable values
|
||||
|
||||
### v1.5.0
|
||||
|
||||
- add "json" as a runtime dependency
|
||||
- update construction variables to match SCons more closely
|
||||
- add CPPDEFPREFIX, INCPREFIX, CPPDEFINES, CCFLAGS, LIBDIRPREFIX, and LIBLINKPREFIX
|
||||
- add Environment#shell
|
||||
- add Environment#parse_flags, #parse_flags!, #merge_flags
|
||||
- unbuffer $stdout by default
|
||||
- add PROGSUFFIX construction variable (defaults to .exe on MinGW/Cygwin)
|
||||
- add Rscons::BuildTarget and Builder#create_build_target
|
||||
- update specs to RSpec 3.x and fix to run on MinGW/Cygwin/Linux
|
||||
- add YARD documentation to get to 100% coverage
|
||||
|
||||
### v1.4.3
|
||||
|
||||
- fix builders properly using construction variable overrides
|
||||
- expand nil construction variables to empty strings
|
||||
|
||||
### v1.4.2
|
||||
|
||||
- add Environment#expand_path
|
||||
- expand construction variable references in builder targets and sources before invoking builder
|
||||
|
||||
### v1.4.1
|
||||
|
||||
- fix invoking a builder with no sources while a build root defined
|
||||
|
||||
### v1.4.0
|
||||
|
||||
- add CFile builder
|
||||
- add Disassemble builder
|
||||
- add Preprocess builder
|
||||
- pass the Environment object to build hooks in the :env key of the build_op parameter
|
||||
- expand target/source paths beginning with "^/" to be relative to the Environment's build root
|
||||
- many performance improvements, including:
|
||||
- use JSON instead of YAML for the cache to improve loading speed (Issue #7)
|
||||
- store a hash of the build command instead of the full command contents in the cache
|
||||
- implement copy-on-write semantics for construction variables when cloning Environments
|
||||
- only load the cache once instead of on each Environment#process
|
||||
- only write the cache when something has changed
|
||||
- fix Cache#mkdir_p to handle relative paths (Issue #5)
|
||||
- flush the cache to disk if a builder raises an exception (Issue #4)
|
||||
|
||||
### v1.3.0
|
||||
|
||||
- change Environment#execute() options parameter to accept the following options keys:
|
||||
- :env to pass an environment Hash to Kernel#system
|
||||
- :options to pass an options Hash to Kernel#system
|
||||
|
||||
### v1.2.0
|
||||
|
||||
- add :clone option to Environment#clone to control exactly which Environment attributes are cloned
|
||||
- allow nil to be passed in to Environment#build_root=
|
||||
|
||||
### v1.1.0
|
||||
|
||||
- Change Cache#up_to_date?() and #register_build() to accept a single target
|
||||
file or an array of target file names
|
||||
http://www.rubydoc.info/github/holtrop/rscons/master.
|
||||
|
||||
## Contributing
|
||||
|
||||
|
||||
+20
-3
@@ -5,13 +5,17 @@ rescue Bundler::BundlerError => e
|
||||
raise LoadError.new("Unable to setup Bundler; you might need to `bundle install`: #{e.message}")
|
||||
end
|
||||
|
||||
require "bundler/gem_tasks"
|
||||
require "rspec/core/rake_task"
|
||||
require "yard"
|
||||
require "rake/clean"
|
||||
require "fileutils"
|
||||
|
||||
CLEAN.include %w[build_test_run .yardoc doc coverage]
|
||||
CLOBBER.include %w[pkg]
|
||||
CLEAN.include %w[build_test_run .yardoc doc coverage test]
|
||||
CLOBBER.include %w[dist pkg]
|
||||
|
||||
task :build_dist do
|
||||
sh "ruby rb/build_dist.rb"
|
||||
end
|
||||
|
||||
RSpec::Core::RakeTask.new(:spec, :example_string) do |task, args|
|
||||
if args.example_string
|
||||
@@ -19,6 +23,19 @@ RSpec::Core::RakeTask.new(:spec, :example_string) do |task, args|
|
||||
task.rspec_opts = %W[-e "#{args.example_string}" -f documentation]
|
||||
end
|
||||
end
|
||||
task :spec => :build_dist
|
||||
|
||||
# dspec task is useful to test the distributable release script, but is not
|
||||
# useful for coverage information.
|
||||
desc "Dist Specs"
|
||||
task :dspec, [:example_string] => :build_dist do |task, args|
|
||||
FileUtils.mkdir_p("test")
|
||||
FileUtils.cp("dist/rscons", "test/rscons.rb")
|
||||
ENV["dist_specs"] = "1"
|
||||
Rake::Task["spec"].invoke(args.example_string)
|
||||
ENV.delete("dist_specs")
|
||||
FileUtils.rm_f(Dir.glob(".rscons-*"))
|
||||
end
|
||||
|
||||
YARD::Rake::YardocTask.new do |yard|
|
||||
yard.files = ['lib/**/*.rb']
|
||||
|
||||
+5
-1
@@ -1,3 +1,7 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require "rscons/cli"
|
||||
|
||||
Rscons::Cli.run(ARGV)
|
||||
if __FILE__ == $0
|
||||
Rscons::Cli.run(ARGV)
|
||||
end
|
||||
@@ -1,5 +0,0 @@
|
||||
Rscons::Environment.new do |env|
|
||||
env.append('CPPPATH' => Dir['src/**/*/'].sort)
|
||||
env.build_dir(%r{^src/([^/]+)/}, 'build_\\1/')
|
||||
env.Program('build_dir.exe', Dir['src/**/*.c'])
|
||||
end
|
||||
@@ -1,22 +0,0 @@
|
||||
class MyObject < Rscons::Builder
|
||||
def run(target, sources, cache, env, vars)
|
||||
env.run_builder(env.builders["Object"], target, sources, cache, vars)
|
||||
end
|
||||
end
|
||||
|
||||
Rscons::Environment.new(echo: :command) do |env|
|
||||
env.add_builder(MyObject.new)
|
||||
env.append('CPPPATH' => Dir['src/**/*/'].sort)
|
||||
env.add_build_hook do |build_op|
|
||||
if build_op[:builder].name == "MyObject" && build_op[:sources].first =~ %r{one\.c}
|
||||
build_op[:vars]["CFLAGS"] << "-O1"
|
||||
build_op[:sources] = ['src/two/two.c']
|
||||
elsif build_op[:builder].name == "MyObject" && build_op[:target] =~ %r{two\.o}
|
||||
new_vars = build_op[:vars].clone
|
||||
new_vars["CFLAGS"] << "-O2"
|
||||
build_op[:vars] = new_vars
|
||||
end
|
||||
end
|
||||
env.MyObject('one.o', 'src/one/one.c')
|
||||
env.MyObject('two.o', 'src/two/two.c')
|
||||
end
|
||||
@@ -1,6 +0,0 @@
|
||||
env = Rscons::Environment.new do |env|
|
||||
env.append('CPPPATH' => Dir['src/**/*/'].sort)
|
||||
env.build_dir("src", "build")
|
||||
env.build_root = "build_root"
|
||||
env.Program('build_dir.exe', Dir['src/**/*.c'])
|
||||
end
|
||||
@@ -1,12 +0,0 @@
|
||||
Rscons::Environment.new(echo: :command) do |env|
|
||||
env.append('CPPPATH' => Dir['src/**/*/'].sort)
|
||||
env.build_dir(%r{^src/([^/]+)/}, 'build_\\1/')
|
||||
env.add_build_hook do |build_op|
|
||||
if build_op[:target] =~ %r{build_one/.*\.o}
|
||||
build_op[:vars]["CFLAGS"] << "-O1"
|
||||
elsif build_op[:target] =~ %r{build_two/.*\.o}
|
||||
build_op[:vars]["CFLAGS"] << "-O2"
|
||||
end
|
||||
end
|
||||
env.Program('build_hook.exe', Dir['src/**/*.c'].sort)
|
||||
end
|
||||
@@ -1,8 +0,0 @@
|
||||
Rscons::Environment.new(echo: :command) do |env|
|
||||
env.append('CPPPATH' => Dir['src/**/*/'].sort)
|
||||
env.build_root = "build_root"
|
||||
FileUtils.mkdir_p(env.build_root)
|
||||
FileUtils.mv("src/one/one.c", "build_root")
|
||||
env.Object("^/one.o", "^/one.c")
|
||||
env.Program("build_dir.exe", Dir['src/**/*.c'] + ["^/one.o"])
|
||||
end
|
||||
@@ -1,3 +0,0 @@
|
||||
Rscons::Environment.new do |env|
|
||||
env.Copy("inst.exe", "copy.rb")
|
||||
end
|
||||
@@ -1,6 +0,0 @@
|
||||
Rscons::Environment.new do |env|
|
||||
env["CSUFFIX"] = %w[.yargh .c]
|
||||
env["CFLAGS"] += %w[-x c]
|
||||
env["CPPPATH"] += Dir["src/**/"]
|
||||
env.Program("build_dir.exe", Dir["src/**/*.{c,yargh}"])
|
||||
end
|
||||
@@ -1,3 +0,0 @@
|
||||
Rscons::Environment.new do |env|
|
||||
env.Install("inst.exe", "install.rb")
|
||||
end
|
||||
@@ -1,9 +0,0 @@
|
||||
Rscons::Environment.new do |env|
|
||||
env.Directory("inst")
|
||||
env.Install("inst", "install_directory.rb")
|
||||
|
||||
env.Install("noexist/src", "src")
|
||||
|
||||
env.Directory("exist/src")
|
||||
env.Install("exist/src", "src")
|
||||
end
|
||||
@@ -1,5 +0,0 @@
|
||||
Rscons::Environment.new do |env|
|
||||
env["CPPPATH"] << "src/two"
|
||||
env.Object("one.o", "src/one/one.c")
|
||||
env.Object("one.o", "src/two/two.c")
|
||||
end
|
||||
@@ -1,6 +0,0 @@
|
||||
Rscons::Environment.new do |env|
|
||||
env.append('CPPPATH' => Dir['src/**/*/'].sort)
|
||||
env.build_dir("src2", "build")
|
||||
env.build_root = "build_root"
|
||||
env.Program('build_dir.exe', Dir['src/**/*.c'])
|
||||
end
|
||||
@@ -1,10 +0,0 @@
|
||||
Rscons::Environment.new do |env|
|
||||
env["CPPPATH"] << "src/two"
|
||||
env.Object("one.o", "src/one/one.c")
|
||||
env.add_post_build_hook do |build_op|
|
||||
if build_op[:target] == "one.o"
|
||||
env["MODULE"] = "two"
|
||||
env.Object("${MODULE}.o", "src/${MODULE}/${MODULE}.c")
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,6 +0,0 @@
|
||||
Rscons::Environment.new do |env|
|
||||
env.append("CPPPATH" => Dir["src/**/*/"].sort)
|
||||
env.build_dir("src/one/", "build_one/")
|
||||
env.build_dir("src/two", "build_two")
|
||||
env.Program("build_dir.exe", Dir["src/**/*.c"])
|
||||
end
|
||||
@@ -0,0 +1,6 @@
|
||||
build do
|
||||
Environment.new do |env|
|
||||
env.CFile("lexer.c", "lexer.l")
|
||||
env.CFile("parser.c", "parser.y")
|
||||
end
|
||||
end
|
||||
@@ -1,4 +0,0 @@
|
||||
Rscons::Environment.new do |env|
|
||||
env.CFile("lexer.c", "lexer.l")
|
||||
env.CFile("parser.c", "parser.y")
|
||||
end
|
||||
@@ -1,3 +1,5 @@
|
||||
Rscons::Environment.new do |env|
|
||||
env.CFile("file.c", "foo.bar")
|
||||
build do
|
||||
Environment.new do |env|
|
||||
env.CFile("file.c", "foo.bar")
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,12 @@
|
||||
build do
|
||||
debug = Environment.new(echo: :command) do |env|
|
||||
env['CFLAGS'] = '-O2'
|
||||
env['CPPFLAGS'] = '-DSTRING="Debug Version"'
|
||||
env.Program('program-debug.exe', Dir['src/*.c'])
|
||||
end
|
||||
|
||||
release = debug.clone do |env|
|
||||
env["CPPFLAGS"] = '-DSTRING="Release Version"'
|
||||
env.Program('program-release.exe', Dir['src/*.c'])
|
||||
end
|
||||
end
|
||||
@@ -1,12 +0,0 @@
|
||||
debug = Rscons::Environment.new(echo: :command) do |env|
|
||||
env.build_dir('src', 'debug')
|
||||
env['CFLAGS'] = '-O2'
|
||||
env['CPPFLAGS'] = '-DSTRING="Debug Version"'
|
||||
env.Program('program-debug.exe', Dir['src/*.c'])
|
||||
end
|
||||
|
||||
release = debug.clone do |env|
|
||||
env["CPPFLAGS"] = '-DSTRING="Release Version"'
|
||||
env.build_dir('src', 'release')
|
||||
env.Program('program-release.exe', Dir['src/*.c'])
|
||||
end
|
||||
@@ -1,15 +1,16 @@
|
||||
env1 = Rscons::Environment.new(echo: :command) do |env|
|
||||
env.build_dir('src', 'build')
|
||||
env['CFLAGS'] = '-O2'
|
||||
env.add_build_hook do |build_op|
|
||||
build_op[:vars]['CPPFLAGS'] = '-DSTRING="Hello"'
|
||||
build do
|
||||
env1 = Environment.new(echo: :command) do |env|
|
||||
env['CFLAGS'] = '-O2'
|
||||
env.add_build_hook do |builder|
|
||||
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
|
||||
env.add_post_build_hook do |build_op|
|
||||
$stdout.puts "post #{build_op[:target]}"
|
||||
end
|
||||
env.Program('program.exe', Dir['src/*.c'])
|
||||
end
|
||||
|
||||
env2 = env1.clone do |env|
|
||||
env.Program('program2.exe', Dir['src/*.c'])
|
||||
env2 = env1.clone do |env|
|
||||
env.Program('program2.exe', Dir['src/*.c'])
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
configure do
|
||||
check_c_compiler "nope.nope"
|
||||
end
|
||||
@@ -0,0 +1 @@
|
||||
autoconf false
|
||||
@@ -0,0 +1,10 @@
|
||||
configure do
|
||||
check_c_compiler
|
||||
check_c_header "stdio.h"
|
||||
end
|
||||
|
||||
build do
|
||||
Environment.new do |env|
|
||||
env.Program("simple.exe", "simple.c")
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
configure do
|
||||
check_c_compiler
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
configure do
|
||||
check_c_compiler "mycompiler"
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
configure do
|
||||
check_c_compiler "gcc", "clang"
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
configure do
|
||||
check_c_header "not___found.h"
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
configure do
|
||||
check_c_header "not___found.h", fail: false
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
configure do
|
||||
check_c_header "not___found.h", fail: false, set_define: "HAVE_NOT___FOUND_H"
|
||||
end
|
||||
|
||||
build do
|
||||
Environment.new(echo: :command) do |env|
|
||||
env.Object("simple.o", "simple.c")
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
configure do
|
||||
check_c_header "string.h"
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
configure do
|
||||
check_c_header "string.h", set_define: "HAVE_STRING_H"
|
||||
end
|
||||
|
||||
build do
|
||||
Environment.new(echo: :command) do |env|
|
||||
env.Object("simple.o", "simple.c")
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
configure do
|
||||
check_cfg program: "my-config"
|
||||
end
|
||||
|
||||
build do
|
||||
Environment.new(echo: :command) do |env|
|
||||
env.Program("myconfigtest", "simple.c")
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
configure do
|
||||
check_cfg package: "mypackage"
|
||||
end
|
||||
|
||||
build do
|
||||
Environment.new(echo: :command) do |env|
|
||||
env.Program("myconfigtest", "simple.c")
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,15 @@
|
||||
configure do
|
||||
check_cfg package: "mypackage", use: "myp"
|
||||
end
|
||||
|
||||
build do
|
||||
Environment.new(echo: :command) do |env|
|
||||
env.Copy("myconfigtest1.c", "simple.c")
|
||||
env.Program("myconfigtest1.exe", "myconfigtest1.c")
|
||||
end
|
||||
|
||||
Environment.new(echo: :command, use: "myp") do |env|
|
||||
env.Copy("myconfigtest2.c", "simple.c")
|
||||
env.Program("myconfigtest2.exe", "myconfigtest2.c")
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
configure do
|
||||
check_cxx_compiler
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
configure do
|
||||
check_cxx_compiler "mycompiler"
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
configure do
|
||||
check_cxx_compiler "g++", "clang++"
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
configure do
|
||||
check_cxx_header "not___found.h"
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
configure do
|
||||
check_cxx_header "not___found.h", fail: false
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
configure do
|
||||
check_cxx_header "string.h"
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
configure do
|
||||
check_d_compiler
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
configure do
|
||||
check_d_compiler "mycompiler"
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
configure do
|
||||
check_d_compiler "gdc", "ldc2"
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
configure do
|
||||
check_d_import "not.found"
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
configure do
|
||||
check_d_import "not.found", fail: false
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
configure do
|
||||
check_d_import "std.stdio"
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
configure do
|
||||
check_lib "mfoofoo"
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
configure do
|
||||
check_lib "mfoofoo", fail: false
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
configure do
|
||||
check_lib "m"
|
||||
end
|
||||
|
||||
build do
|
||||
Environment.new(echo: :command) do |env|
|
||||
env.Program("simple.exe", "simple.c")
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,15 @@
|
||||
configure do
|
||||
check_lib "m", use: :m
|
||||
end
|
||||
|
||||
build do
|
||||
Environment.new(echo: :command) do |env|
|
||||
env.Copy("test1.c", "simple.c")
|
||||
env.Program("test2.exe", "test1.c")
|
||||
end
|
||||
|
||||
Environment.new(echo: :command, use: %w[m]) do |env|
|
||||
env.Copy("test2.c", "simple.c")
|
||||
env.Program("test2.exe", "test2.c")
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,10 @@
|
||||
configure do
|
||||
check_lib "m", use: false
|
||||
end
|
||||
|
||||
build do
|
||||
Environment.new(echo: :command) do |env|
|
||||
env.Copy("test1.c", "simple.c")
|
||||
env.Program("test2.exe", "test1.c")
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
configure do
|
||||
check_program "program-that-is-not-found"
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
configure do
|
||||
check_program "program-that-is-not-found", fail: false
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
configure do
|
||||
check_program "find"
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
Environment.new do |env|
|
||||
env.Object("simple.o", "simple.cc")
|
||||
end
|
||||
@@ -0,0 +1,13 @@
|
||||
project_name "configure test"
|
||||
autoconf false
|
||||
configure do
|
||||
check_c_compiler
|
||||
check_cxx_compiler
|
||||
check_d_compiler
|
||||
check_cfg package: "mypackage"
|
||||
check_c_header "stdio.h"
|
||||
check_cxx_header "iostream"
|
||||
check_d_import "std.stdio"
|
||||
check_lib "m"
|
||||
check_program "ls"
|
||||
end
|
||||
@@ -0,0 +1,10 @@
|
||||
configure do
|
||||
check_c_header "math.h", set_define: "HAVE_MATH_H"
|
||||
check_c_header "stdio.h", set_define: "HAVE_STDIO_H"
|
||||
end
|
||||
|
||||
build do
|
||||
Environment.new(echo: :command) do |env|
|
||||
env.Object("simple.o", "simple.c")
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1 @@
|
||||
check_c_compiler "gcc"
|
||||
@@ -0,0 +1,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
printf("This is a simple C program\n");
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
class MySource < Rscons::Builder
|
||||
def run(options)
|
||||
File.open(@target, 'w') do |fh|
|
||||
fh.puts <<EOF
|
||||
#define THE_VALUE 5678
|
||||
EOF
|
||||
end
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
build do
|
||||
Environment.new do |env|
|
||||
env.add_builder(MySource)
|
||||
env.MySource('inc.h', [])
|
||||
env.Program('program.exe', Dir['*.c'])
|
||||
end
|
||||
end
|
||||
@@ -1,16 +0,0 @@
|
||||
class MySource < Rscons::Builder
|
||||
def run(target, sources, cache, env, vars)
|
||||
File.open(target, 'w') do |fh|
|
||||
fh.puts <<EOF
|
||||
#define THE_VALUE 5678
|
||||
EOF
|
||||
end
|
||||
target
|
||||
end
|
||||
end
|
||||
|
||||
Rscons::Environment.new do |env|
|
||||
env.add_builder(MySource.new)
|
||||
env.MySource('inc.h', [])
|
||||
env.Program('program.exe', Dir['*.c'])
|
||||
end
|
||||
@@ -1,10 +1,12 @@
|
||||
Rscons::Environment.new do |env|
|
||||
env.Command("inc.c",
|
||||
[],
|
||||
"CMD" => %w[ruby gen.rb ${_TARGET}],
|
||||
"CMD_DESC" => "Generating")
|
||||
env["build_root"] = env.build_root
|
||||
env["inc_c"] = "inc.c"
|
||||
env.build_after("${build_root}/program.o", "${inc_c}")
|
||||
env.Program("program.exe", ["program.c", "inc.c"])
|
||||
build do
|
||||
Environment.new do |env|
|
||||
env.Command("inc.c",
|
||||
[],
|
||||
"CMD" => %w[ruby gen.rb ${_TARGET}],
|
||||
"CMD_DESC" => "Generating")
|
||||
env["build_root"] = env.build_root
|
||||
env["inc_c"] = "inc.c"
|
||||
env.build_after("${build_root}/program.o", "${inc_c}")
|
||||
env.Program("program.exe", ["program.c", "inc.c"])
|
||||
end
|
||||
end
|
||||
@@ -1,18 +1,20 @@
|
||||
class MySource < Rscons::Builder
|
||||
def run(target, sources, cache, env, vars)
|
||||
File.open(target, 'w') do |fh|
|
||||
def run(options)
|
||||
File.open(@target, 'w') do |fh|
|
||||
fh.puts <<EOF
|
||||
#define THE_VALUE 678
|
||||
EOF
|
||||
end
|
||||
target
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
env = Rscons::Environment.new do |env|
|
||||
env["hdr"] = "inc.h"
|
||||
env["src"] = "program.c"
|
||||
env.add_builder(MySource.new)
|
||||
env.MySource('${hdr}')
|
||||
env.Program('program.exe', "${src}")
|
||||
build do
|
||||
env = Environment.new do |env|
|
||||
env["hdr"] = "inc.h"
|
||||
env["src"] = "program.c"
|
||||
env.add_builder(MySource)
|
||||
env.MySource('${hdr}')
|
||||
env.Program('program.exe', "${src}")
|
||||
end
|
||||
end
|
||||
@@ -1,28 +1,30 @@
|
||||
class MySource < Rscons::Builder
|
||||
def run(target, sources, cache, env, vars)
|
||||
File.open(target, 'w') do |fh|
|
||||
def run(options)
|
||||
File.open(@target, 'w') do |fh|
|
||||
fh.puts <<EOF
|
||||
#define THE_VALUE #{env.expand_varref("${the_value}")}
|
||||
#define THE_VALUE #{@env.expand_varref("${the_value}")}
|
||||
EOF
|
||||
end
|
||||
target
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
e1 = Rscons::Environment.new do |env|
|
||||
env.add_builder(MySource.new)
|
||||
env["one"] = "5"
|
||||
env[:cfg] = {val: "9"}
|
||||
env["two"] = lambda do |args|
|
||||
args[:env][:cfg][:val]
|
||||
build do
|
||||
e1 = Environment.new do |env|
|
||||
env.add_builder(MySource)
|
||||
env["one"] = "5"
|
||||
env[:cfg] = {val: "9"}
|
||||
env["two"] = lambda do |args|
|
||||
args[:env][:cfg][:val]
|
||||
end
|
||||
env["the_value"] = lambda do |args|
|
||||
"${one}${two}78"
|
||||
end
|
||||
end
|
||||
env["the_value"] = lambda do |args|
|
||||
"${one}${two}78"
|
||||
end
|
||||
end
|
||||
|
||||
e1.clone do |env|
|
||||
env[:cfg][:val] = "6"
|
||||
env.MySource('inc.h', [])
|
||||
env.Program('program.exe', Dir['*.c'])
|
||||
e1.clone do |env|
|
||||
env[:cfg][:val] = "6"
|
||||
env.MySource('inc.h', [])
|
||||
env.Program('program.exe', Dir['*.c'])
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,8 @@
|
||||
build do
|
||||
Environment.new do |env|
|
||||
env.add_builder(:MyBuilder) do |options|
|
||||
"hi"
|
||||
end
|
||||
env.MyBuilder("foo")
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,8 @@
|
||||
build do
|
||||
Environment.new do |env|
|
||||
env.add_builder(:MyBuilder) do |options|
|
||||
wait_for(1)
|
||||
end
|
||||
env.MyBuilder("foo")
|
||||
end
|
||||
end
|
||||
@@ -1,19 +1,21 @@
|
||||
class CHGen < Rscons::Builder
|
||||
def run(target, sources, cache, env, vars)
|
||||
c_fname = target
|
||||
h_fname = target.sub(/\.c$/, ".h")
|
||||
unless cache.up_to_date?([c_fname, h_fname], "", sources, env)
|
||||
def run(options)
|
||||
c_fname = @target
|
||||
h_fname = @target.sub(/\.c$/, ".h")
|
||||
unless @cache.up_to_date?([c_fname, h_fname], "", @sources, @env)
|
||||
puts "CHGen #{c_fname}"
|
||||
File.open(c_fname, "w") {|fh| fh.puts "int THE_VALUE = 42;"}
|
||||
File.open(h_fname, "w") {|fh| fh.puts "extern int THE_VALUE;"}
|
||||
cache.register_build([c_fname, h_fname], "", sources, env)
|
||||
@cache.register_build([c_fname, h_fname], "", @sources, @env)
|
||||
end
|
||||
target
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
Rscons::Environment.new do |env|
|
||||
env.add_builder(CHGen.new)
|
||||
env.CHGen("inc.c", ["program.c"])
|
||||
env.Program("program.exe", %w[program.c inc.c])
|
||||
build do
|
||||
Environment.new do |env|
|
||||
env.add_builder(CHGen)
|
||||
env.CHGen("inc.c", ["program.c"])
|
||||
env.Program("program.exe", %w[program.c inc.c])
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,16 @@
|
||||
build do
|
||||
Environment.new do |env|
|
||||
env["build_root"] = env.build_root
|
||||
env["inc_h"] = "inc.h"
|
||||
|
||||
env.Copy("copy_inc.h", "${inc_h}")
|
||||
env.depends("${build_root}/program.o", "${inc_h}")
|
||||
env.Program("program.exe", ["program.c", "inc.c"])
|
||||
|
||||
env.Command("inc.c",
|
||||
[],
|
||||
"CMD" => %w[ruby gen.rb ${_TARGET}],
|
||||
"CMD_DESC" => "Generating")
|
||||
env.produces("inc.c", "inc.h")
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,21 @@
|
||||
class MyBuilder < Rscons::Builder
|
||||
def run(options)
|
||||
if @thread
|
||||
true
|
||||
else
|
||||
print_run_message("#{name} #{target}", nil)
|
||||
@thread = Thread.new do
|
||||
sleep 2
|
||||
FileUtils.touch(@target)
|
||||
end
|
||||
wait_for(@thread)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
build do
|
||||
Environment.new do |env|
|
||||
env.add_builder(MyBuilder)
|
||||
env.MyBuilder("foo")
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,5 @@
|
||||
build do
|
||||
Environment.new(echo: :command) do |env|
|
||||
env.Program("hello-d.exe", glob("*.d"))
|
||||
end
|
||||
end
|
||||
@@ -1,3 +0,0 @@
|
||||
Rscons::Environment.new(echo: :command) do |env|
|
||||
env.Program("hello-d.exe", Dir["*.d"])
|
||||
end
|
||||
@@ -0,0 +1,7 @@
|
||||
build do
|
||||
Environment.new(echo: :command) do |env|
|
||||
env.Object("main.o", "main.d")
|
||||
env.Object("mod.o", "mod.d")
|
||||
env.Program("hello-d.exe", ["main.o", "mod.o"])
|
||||
end
|
||||
end
|
||||
@@ -1,6 +1,7 @@
|
||||
import std.stdio;
|
||||
import mod;
|
||||
|
||||
void main()
|
||||
{
|
||||
writeln("Hello from D!");
|
||||
writeln("Hello from D, value is ", Klass.VAL, "!");
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
class Klass
|
||||
{
|
||||
enum VAL = 42;
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
build do
|
||||
Environment.new do |env|
|
||||
env.Program("test.exe", glob("*.c"), direct: true)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,7 @@
|
||||
build do
|
||||
Environment.new do |env|
|
||||
lib = env.SharedLibrary("mylib", ["two.c", "three.c"], direct: true)
|
||||
program = env.Program("test.exe", "main.c", "LIBS" => ["mylib"], "LIBPATH" => ["."])
|
||||
env.depends(program, lib)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,7 @@
|
||||
#include "two.h"
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
{
|
||||
two();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
#include "three.h"
|
||||
#include <stdio.h>
|
||||
|
||||
void three(void)
|
||||
{
|
||||
printf("three\n");
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
void three(void);
|
||||
@@ -0,0 +1,7 @@
|
||||
#include "two.h"
|
||||
#include "three.h"
|
||||
|
||||
void two(void)
|
||||
{
|
||||
three();
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
void two(void);
|
||||
@@ -0,0 +1,5 @@
|
||||
build do
|
||||
Environment.new do |env|
|
||||
env.Program('header.exe', Dir['*.c'])
|
||||
end
|
||||
end
|
||||
@@ -1,3 +0,0 @@
|
||||
Rscons::Environment.new do |env|
|
||||
env.Program('header.exe', Dir['*.c'])
|
||||
end
|
||||
@@ -0,0 +1,17 @@
|
||||
build do
|
||||
Environment.new do |env|
|
||||
require 'json'
|
||||
require 'yaml'
|
||||
env.add_builder(:JsonToYaml) do |params|
|
||||
unless @cache.up_to_date?(@target, :JsonToYaml, @sources, @env)
|
||||
@cache.mkdir_p(File.dirname(@target))
|
||||
File.open(@target, 'w') do |f|
|
||||
f.write(YAML.dump(JSON.load(IO.read(@sources.first))))
|
||||
end
|
||||
@cache.register_build(@target, :JsonToYaml, @sources, @env)
|
||||
end
|
||||
true
|
||||
end
|
||||
env.JsonToYaml('foo.yml', 'foo.json')
|
||||
end
|
||||
end
|
||||
@@ -1,15 +0,0 @@
|
||||
Rscons::Environment.new do |env|
|
||||
require 'json'
|
||||
require 'yaml'
|
||||
env.add_builder(:JsonToYaml) do |target, sources, cache, env, vars|
|
||||
unless cache.up_to_date?(target, :JsonToYaml, sources, env)
|
||||
cache.mkdir_p(File.dirname(target))
|
||||
File.open(target, 'w') do |f|
|
||||
f.write(YAML.dump(JSON.load(IO.read(sources.first))))
|
||||
end
|
||||
cache.register_build(target, :JsonToYaml, sources, env)
|
||||
end
|
||||
target
|
||||
end
|
||||
env.JsonToYaml('foo.yml', 'foo.json')
|
||||
end
|
||||
@@ -0,0 +1,6 @@
|
||||
build do
|
||||
Environment.new(echo: :command) do |env|
|
||||
env.Program('library.exe', ['lib.a', 'three.c'])
|
||||
env.Library("lib.a", ['one.c', 'two.c'], 'CPPFLAGS' => ['-Dmake_lib'])
|
||||
end
|
||||
end
|
||||
@@ -1,4 +0,0 @@
|
||||
Rscons::Environment.new(echo: :command) do |env|
|
||||
env.Program('library.exe', ['lib.a', 'three.c'])
|
||||
env.Library("lib.a", ['one.c', 'two.c'], 'CPPFLAGS' => ['-Dmake_lib'])
|
||||
end
|
||||
@@ -0,0 +1,7 @@
|
||||
build do
|
||||
Environment.new do |env|
|
||||
env.Program("library.exe", ["lib.a", "three.c"])
|
||||
env.Object("two.o", "two.c")
|
||||
env.Library("lib.a", ["one.c", "two.o"], 'CPPFLAGS' => ['-Dmake_lib'])
|
||||
end
|
||||
end
|
||||
@@ -1,4 +1,6 @@
|
||||
Rscons::Environment.new(echo: :command) do |env|
|
||||
env["ARCMD"] = %w[ar rcf ${_TARGET} ${_SOURCES}]
|
||||
env.Library("lib.a", Dir["*.c"].sort)
|
||||
build do
|
||||
Environment.new(echo: :command) do |env|
|
||||
env["ARCMD"] = %w[ar rcf ${_TARGET} ${_SOURCES}]
|
||||
env.Library("lib.a", glob("*.c"))
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,5 @@
|
||||
build do
|
||||
Environment.new do |env|
|
||||
env.Preprocess("pp", "foo.h")
|
||||
end
|
||||
end
|
||||
@@ -1,3 +0,0 @@
|
||||
Rscons::Environment.new do |env|
|
||||
env.Preprocess("pp", "foo.h")
|
||||
end
|
||||
@@ -0,0 +1,13 @@
|
||||
build do
|
||||
Environment.new do |env|
|
||||
env["CPPPATH"] << "src/lib"
|
||||
libmine = env.SharedLibrary("mine", glob("src/lib/*.c"))
|
||||
env.Program("test-shared.exe",
|
||||
glob("src/*.c"),
|
||||
"LIBPATH" => %w[.],
|
||||
"LIBS" => %w[mine])
|
||||
env.build_after("test-shared.exe", libmine)
|
||||
env.Program("test-static.exe",
|
||||
glob("src/**/*.c"))
|
||||
end
|
||||
end
|
||||
@@ -1,11 +0,0 @@
|
||||
Rscons::Environment.new do |env|
|
||||
env["CPPPATH"] << "src/lib"
|
||||
libmine = env.SharedLibrary("mine", Dir["src/lib/*.c"])
|
||||
env.Program("test-shared.exe",
|
||||
Dir["src/*.c"],
|
||||
"LIBPATH" => %w[.],
|
||||
"LIBS" => %w[mine])
|
||||
env.build_after("test-shared.exe", libmine.to_s)
|
||||
env.Program("test-static.exe",
|
||||
Dir["src/**/*.c"])
|
||||
end
|
||||
@@ -1,6 +1,8 @@
|
||||
Rscons::Environment.new do |env|
|
||||
File.open("foo.xyz", "wb") do |fh|
|
||||
fh.puts("hi")
|
||||
build do
|
||||
Environment.new do |env|
|
||||
File.open("foo.xyz", "wb") do |fh|
|
||||
fh.puts("hi")
|
||||
end
|
||||
env.SharedObject("foo.o", "foo.xyz")
|
||||
end
|
||||
env.SharedObject("foo.o", "foo.xyz")
|
||||
end
|
||||
Loaded 100 of 230 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user