cxx 0.1.15 → 0.1.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/lib/cxx.rb +20 -11
- data/lib/cxx/eval_context.rb +54 -14
- data/lib/cxx/version.rb +1 -1
- data/lib/cxx/wizard/Rakefile.rb.template +8 -6
- data/lib/cxx/wizard/project.rb.template +1 -1
- data/lib/cxx/wizard/project_wizard.rb +15 -11
- metadata +7 -13
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
M2JhZDYyM2Y0YzA0MTNkOGVlOWJjMjc1ZDcwMTdjYThjMjFmYTMyYw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MDQwZjdlZWQ0ZmJiZWEwMzA1YThkMGEzNzUwOWMwMjVlYzkzMWRkYg==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
OTIxNDZiY2RmNGU1MTFkZmI5MDhlYmRkZTJmODI2YjkxMzViODlhNTRlZjNl
|
10
|
+
MWExZTM5NDJlZTMwYmNjYjUxNDkxODYyNDlhMTg3Njg3N2MzOGZhOGIzZjdi
|
11
|
+
MjZhYTIxZDAwZjFmNzljMWMyZDk1NTRkODE5YjQxZmRjYWIxZjI=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
Mzk2MWViZDNlMDgxMDUxNGFhZWQzMGYxYWJkMDZlZjFiZjE1YTA1NzNlM2Vj
|
14
|
+
MjdiNDkwYWQ5ZGQ0NjIyYzIyMTllM2RkNTE0MDUwODE1ZmQyMWNlZDdhOTBi
|
15
|
+
OWM2MDViZTU2OWVjOTc4NTQ5MDM1YjQ2YTAxZjEyM2I5NGZjMWI=
|
data/lib/cxx.rb
CHANGED
@@ -5,14 +5,7 @@ require 'logger'
|
|
5
5
|
require 'pp'
|
6
6
|
require 'pathname'
|
7
7
|
require 'cxxproject/ext/rake'
|
8
|
-
require 'cxxproject/buildingblocks/
|
9
|
-
require 'cxxproject/buildingblocks/makefile'
|
10
|
-
require 'cxxproject/buildingblocks/executable'
|
11
|
-
require 'cxxproject/buildingblocks/source_library'
|
12
|
-
require 'cxxproject/buildingblocks/single_source'
|
13
|
-
require 'cxxproject/buildingblocks/binary_library'
|
14
|
-
require 'cxxproject/buildingblocks/custom_building_block'
|
15
|
-
require 'cxxproject/buildingblocks/command_line'
|
8
|
+
require 'cxxproject/buildingblocks/building_blocks'
|
16
9
|
require 'cxxproject/toolchain/colorizing_formatter'
|
17
10
|
require 'cxxproject/plugin_context'
|
18
11
|
require 'cxx/eval_context'
|
@@ -24,8 +17,8 @@ module Cxx
|
|
24
17
|
|
25
18
|
def initialize(projects, build_dir, toolchain_name, base_dir='.', &option_block)
|
26
19
|
@build_dir = build_dir
|
27
|
-
option_block.call if option_block
|
28
20
|
toolchain = Cxxproject::Toolchain::Provider[toolchain_name]
|
21
|
+
option_block.call(toolchain) if option_block
|
29
22
|
raise "no provider with name \"#{toolchain_name}\" found" unless toolchain
|
30
23
|
@base_dir = base_dir
|
31
24
|
cd(@base_dir, :verbose => false) do
|
@@ -38,6 +31,7 @@ module Cxx
|
|
38
31
|
@all_tasks = instantiate_tasks(toolchain, build_dir)
|
39
32
|
|
40
33
|
create_generic_tasks
|
34
|
+
create_tag_tasks
|
41
35
|
create_console_colorization
|
42
36
|
create_multitask
|
43
37
|
create_dont_bail_on_first_task
|
@@ -48,8 +42,11 @@ module Cxx
|
|
48
42
|
|
49
43
|
def load_nontoolchain_plugins
|
50
44
|
registry = Frazzle::Registry.new('cxxproject', '_', '-')
|
51
|
-
registry.get_all_plugins.select
|
52
|
-
|
45
|
+
plugins = registry.get_all_plugins.select do |name|
|
46
|
+
name.index('toolchain') == nil
|
47
|
+
end
|
48
|
+
plugins.each do |plugin|
|
49
|
+
registry.load_plugin(plugin, Cxxproject::PluginContext.create_three_args_context(self, Cxxproject::ALL_BUILDING_BLOCKS, @log))
|
53
50
|
end
|
54
51
|
end
|
55
52
|
|
@@ -105,6 +102,18 @@ module Cxx
|
|
105
102
|
tasks.each { |i| create_filter_task_with_namespace(i) }
|
106
103
|
end
|
107
104
|
|
105
|
+
def create_tag_tasks
|
106
|
+
desc 'invoke tagged building blocks'
|
107
|
+
task :tag, :tag do |t, args|
|
108
|
+
if args[:tag]
|
109
|
+
current_tag = args[:tag]
|
110
|
+
Rake::Task::tasks.select {|t|t.tags.include?(current_tag)}.each do |task|
|
111
|
+
task.invoke
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
108
117
|
def create_filter_task_with_namespace(basename)
|
109
118
|
if basename
|
110
119
|
desc "invoke #{basename} with filter"
|
data/lib/cxx/eval_context.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
require 'cxxproject'
|
2
2
|
require 'cxxproject/context'
|
3
3
|
require 'cxxproject/utils/utils'
|
4
|
+
require 'cxxproject/utils/deprecated'
|
4
5
|
|
5
6
|
module Cxx
|
6
7
|
class EvalContext
|
7
8
|
include Cxxproject
|
8
9
|
include Cxxproject::Context
|
10
|
+
extend Deprecated
|
9
11
|
|
10
12
|
attr_accessor :all_blocks
|
11
13
|
|
@@ -21,7 +23,7 @@ module Cxx
|
|
21
23
|
instance_eval(project_text)
|
22
24
|
end
|
23
25
|
|
24
|
-
def
|
26
|
+
def attach_sources(hash,bblock)
|
25
27
|
if hash.has_key?(:sources)
|
26
28
|
ss = hash[:sources]
|
27
29
|
if ss.class == Array || ss.class == Rake::FileList
|
@@ -32,10 +34,17 @@ module Cxx
|
|
32
34
|
end
|
33
35
|
end
|
34
36
|
|
35
|
-
def
|
37
|
+
def attach_includes(hash,bblock)
|
36
38
|
bblock.set_includes(get_as_array(hash, :includes)) if hash.has_key?(:includes)
|
37
39
|
end
|
38
40
|
|
41
|
+
def attach_tags(hash, bblock)
|
42
|
+
bblock.tags = Set.new
|
43
|
+
if hash.has_key?(:tags)
|
44
|
+
bblock.tags = hash[:tags].to_set
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
39
48
|
# specify an executable
|
40
49
|
# hash supports:
|
41
50
|
# * :sources
|
@@ -44,19 +53,44 @@ module Cxx
|
|
44
53
|
# * :output_dir
|
45
54
|
def exe(name, hash)
|
46
55
|
raise "not a hash" unless hash.is_a?(Hash)
|
47
|
-
check_hash(hash,[:sources,:includes,:dependencies,:libpath,:output_dir])
|
56
|
+
check_hash(hash,[:sources,:includes,:dependencies,:libpath,:output_dir, :tags])
|
48
57
|
bblock = Cxxproject::Executable.new(name)
|
49
|
-
|
50
|
-
|
58
|
+
attach_sources(hash,bblock)
|
59
|
+
attach_includes(hash,bblock)
|
60
|
+
attach_tags(hash, bblock)
|
51
61
|
if hash.has_key?(:dependencies)
|
52
62
|
bblock.set_dependencies(hash[:dependencies])
|
53
63
|
hash[:dependencies].each { |d| bblock.add_lib_element(Cxxproject::HasLibraries::DEPENDENCY, d) }
|
54
64
|
end
|
55
65
|
bblock.set_output_dir(hash[:output_dir]) if hash.has_key?(:output_dir)
|
56
66
|
all_blocks << bblock
|
67
|
+
bblock
|
57
68
|
end
|
58
69
|
|
59
|
-
# specify
|
70
|
+
# specify an executable
|
71
|
+
# hash supports:
|
72
|
+
# * :sources
|
73
|
+
# * :includes
|
74
|
+
# * :dependencies
|
75
|
+
# * :output_dir
|
76
|
+
# * :tags
|
77
|
+
def shared_lib(name, hash)
|
78
|
+
raise "not a hash" unless hash.is_a?(Hash)
|
79
|
+
check_hash(hash, [:sources, :includes, :dependencies, :output_dir, :tags])
|
80
|
+
bblock = Cxxproject::SharedLibrary.new(name)
|
81
|
+
attach_sources(hash,bblock)
|
82
|
+
attach_includes(hash,bblock)
|
83
|
+
attach_tags(hash, bblock)
|
84
|
+
if hash.has_key?(:dependencies)
|
85
|
+
bblock.set_dependencies(hash[:dependencies])
|
86
|
+
hash[:dependencies].each { |d| bblock.add_lib_element(Cxxproject::HasLibraries::DEPENDENCY, d) }
|
87
|
+
end
|
88
|
+
bblock.set_output_dir(hash[:output_dir]) if hash.has_key?(:output_dir)
|
89
|
+
all_blocks << bblock
|
90
|
+
bblock
|
91
|
+
end
|
92
|
+
|
93
|
+
# specify a static library
|
60
94
|
# hash supports:
|
61
95
|
# * :sources
|
62
96
|
# * :includes
|
@@ -64,13 +98,16 @@ module Cxx
|
|
64
98
|
# * :toolchain
|
65
99
|
# * :file_dependencies
|
66
100
|
# * :output_dir
|
67
|
-
|
101
|
+
# * :whole_archive
|
102
|
+
# * :tags
|
103
|
+
def static_lib(name, hash)
|
68
104
|
raise "not a hash" unless hash.is_a?(Hash)
|
69
|
-
check_hash(hash, [:sources, :includes, :dependencies, :toolchain, :file_dependencies, :output_dir, :whole_archive])
|
105
|
+
check_hash(hash, [:sources, :includes, :dependencies, :toolchain, :file_dependencies, :output_dir, :whole_archive, :tags])
|
70
106
|
raise ":sources need to be defined" unless hash.has_key?(:sources)
|
71
|
-
bblock = Cxxproject::
|
72
|
-
|
73
|
-
|
107
|
+
bblock = Cxxproject::StaticLibrary.new(name, hash[:whole_archive])
|
108
|
+
attach_sources(hash,bblock)
|
109
|
+
attach_includes(hash,bblock)
|
110
|
+
attach_tags(hash, bblock)
|
74
111
|
bblock.set_tcs(hash[:toolchain]) if hash.has_key?(:toolchain)
|
75
112
|
if hash.has_key?(:dependencies)
|
76
113
|
bblock.set_dependencies(hash[:dependencies])
|
@@ -79,14 +116,17 @@ module Cxx
|
|
79
116
|
bblock.file_dependencies = hash[:file_dependencies] if hash.has_key?(:file_dependencies)
|
80
117
|
bblock.set_output_dir(hash[:output_dir]) if hash.has_key?(:output_dir)
|
81
118
|
all_blocks << bblock
|
119
|
+
bblock
|
82
120
|
end
|
83
121
|
|
122
|
+
deprecated_alias :source_lib, :static_lib
|
123
|
+
|
84
124
|
def bin_lib(name, hash=Hash.new)
|
85
125
|
raise "not a hash" unless hash.is_a?(Hash)
|
86
126
|
check_hash(hash, [:includes, :lib_path])
|
87
127
|
|
88
128
|
bblock = Cxxproject::BinaryLibrary.new(name)
|
89
|
-
|
129
|
+
attach_includes(hash,bblock)
|
90
130
|
bblock.add_lib_element(Cxxproject::HasLibraries::SEARCH_PATH, hash[:lib_path], true) if hash.has_key?(:lib_path)
|
91
131
|
return bblock
|
92
132
|
end
|
@@ -105,8 +145,8 @@ module Cxx
|
|
105
145
|
raise "not a hash" unless hash.is_a?(Hash)
|
106
146
|
check_hash(hash,[:sources,:includes])
|
107
147
|
bblock = Cxxproject::SingleSource.new(name)
|
108
|
-
|
109
|
-
|
148
|
+
attach_sources(hash,bblock)
|
149
|
+
attach_includes(hash,bblock)
|
110
150
|
all_blocks << bblock
|
111
151
|
end
|
112
152
|
|
data/lib/cxx/version.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
require 'cxx'
|
2
2
|
|
3
|
-
|
4
|
-
:DEFINES => ['UNIT_TEST','
|
5
|
-
:FLAGS =>
|
3
|
+
flags = {
|
4
|
+
:DEFINES => ['UNIT_TEST','EXAMPLE=main'],
|
5
|
+
:FLAGS => ['-O0', '-g3', '-Wall']
|
6
6
|
}
|
7
7
|
|
8
|
-
cxx(Dir['**/project.rb'], 'out', "<%= toolchain %>", './') do
|
9
|
-
|
8
|
+
cxx(Dir['**/project.rb'], 'out', "<%= toolchain %>", './') do |tc|
|
9
|
+
tc[:COMPILER][:C].update(flags)
|
10
|
+
tc[:COMPILER][:CPP].update(flags)
|
11
|
+
tc[:LINKER].update(flags)
|
12
|
+
# tc[:TARGET_OS] = :UNIX | OSX | :WINDOWS
|
10
13
|
end
|
11
|
-
|
@@ -16,7 +16,7 @@ def prepare_project(dir_name)
|
|
16
16
|
end
|
17
17
|
say "This will create a new cxx-project in directory: '#{dir_name}'"
|
18
18
|
if confirm("Are you sure you want to continue") then
|
19
|
-
building_block = choose_building_block
|
19
|
+
building_block, whole_archive = choose_building_block
|
20
20
|
generate_makefile = confirm("Do you also whant to generate a rakefile", building_block.eql?("exe"))
|
21
21
|
|
22
22
|
toolchain = nil
|
@@ -25,7 +25,7 @@ def prepare_project(dir_name)
|
|
25
25
|
return unless toolchain
|
26
26
|
end
|
27
27
|
|
28
|
-
create_project(dir_name, building_block, toolchain, generate_makefile)
|
28
|
+
create_project(dir_name, building_block, whole_archive, toolchain, generate_makefile)
|
29
29
|
say "Completed project-setup ;-)"
|
30
30
|
else
|
31
31
|
say "Stopped project-setup!"
|
@@ -39,14 +39,18 @@ def prepare_project(dir_name)
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def choose_building_block
|
42
|
-
|
42
|
+
building_block = nil
|
43
|
+
whole_archive = nil
|
43
44
|
choose do |menu|
|
44
|
-
say
|
45
|
-
menu.choice(:exe) {
|
46
|
-
menu.choice(:lib)
|
47
|
-
|
45
|
+
say 'What building-block do you whant to create?'
|
46
|
+
menu.choice(:exe) { building_block = 'exe' }
|
47
|
+
menu.choice(:lib) do
|
48
|
+
building_block = 'source_lib'
|
49
|
+
whole_archive = confirm('Is this a test-library', false)
|
50
|
+
end
|
51
|
+
menu.prompt = 'Select a building-block: '
|
48
52
|
end
|
49
|
-
|
53
|
+
[building_block, whole_archive]
|
50
54
|
end
|
51
55
|
|
52
56
|
def choose_toolchain
|
@@ -74,10 +78,10 @@ def choose_toolchain
|
|
74
78
|
res
|
75
79
|
end
|
76
80
|
|
77
|
-
def create_project(dir_name, building_block, toolchain, generate_rakefile)
|
81
|
+
def create_project(dir_name, building_block, whole_archive, toolchain, generate_rakefile)
|
78
82
|
rakefile_template = IO.read(File.join(File.dirname(__FILE__),"Rakefile.rb.template"))
|
79
83
|
project_template = IO.read(File.join(File.dirname(__FILE__),"project.rb.template"))
|
80
|
-
binding = create_binding("new-item", building_block, toolchain)
|
84
|
+
binding = create_binding("new-item", building_block, whole_archive, toolchain)
|
81
85
|
|
82
86
|
if !File.directory?(dir_name) then
|
83
87
|
mkdir_p(dir_name, :verbose => false)
|
@@ -94,7 +98,7 @@ def create_project(dir_name, building_block, toolchain, generate_rakefile)
|
|
94
98
|
end
|
95
99
|
end
|
96
100
|
|
97
|
-
def create_binding(name, building_block, toolchain)
|
101
|
+
def create_binding(name, building_block, whole_archive, toolchain)
|
98
102
|
return binding()
|
99
103
|
end
|
100
104
|
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cxx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.16
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- christian koestlin
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-08-27 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: cxxproject
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ! '>='
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ! '>='
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,7 +27,6 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: highline
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ! '>='
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,7 +34,6 @@ dependencies:
|
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ! '>='
|
44
39
|
- !ruby/object:Gem::Version
|
@@ -51,34 +46,33 @@ extensions: []
|
|
51
46
|
extra_rdoc_files: []
|
52
47
|
files:
|
53
48
|
- bin/cxx
|
49
|
+
- lib/cxx/eval_context.rb
|
54
50
|
- lib/cxx/version.rb
|
51
|
+
- lib/cxx/wizard/Rakefile.rb.template
|
55
52
|
- lib/cxx/wizard/project.rb.template
|
56
53
|
- lib/cxx/wizard/project_wizard.rb
|
57
|
-
- lib/cxx/wizard/Rakefile.rb.template
|
58
|
-
- lib/cxx/eval_context.rb
|
59
54
|
- lib/cxx.rb
|
60
55
|
homepage:
|
61
56
|
licenses: []
|
57
|
+
metadata: {}
|
62
58
|
post_install_message:
|
63
59
|
rdoc_options: []
|
64
60
|
require_paths:
|
65
61
|
- lib
|
66
62
|
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
-
none: false
|
68
63
|
requirements:
|
69
64
|
- - ! '>='
|
70
65
|
- !ruby/object:Gem::Version
|
71
66
|
version: '0'
|
72
67
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
68
|
requirements:
|
75
69
|
- - ! '>='
|
76
70
|
- !ruby/object:Gem::Version
|
77
71
|
version: '0'
|
78
72
|
requirements: []
|
79
73
|
rubyforge_project:
|
80
|
-
rubygems_version:
|
74
|
+
rubygems_version: 2.0.6
|
81
75
|
signing_key:
|
82
|
-
specification_version:
|
76
|
+
specification_version: 4
|
83
77
|
summary: defines the method cxx_configuration
|
84
78
|
test_files: []
|