Mxx_ru 1.3.2 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +4 -3
- data/bin/mxxrugen +197 -0
- data/lib/mxx_ru/cmd_line_option_processor.rb +126 -0
- data/lib/mxx_ru/cpp.rb +1 -0
- data/lib/mxx_ru/cpp/composite.rb +2 -12
- data/lib/mxx_ru/cpp/lib_collection.rb +96 -0
- data/lib/mxx_ru/cpp/mode.rb +72 -10
- data/lib/mxx_ru/cpp/target.rb +85 -136
- data/lib/mxx_ru/cpp/toolset.rb +96 -9
- data/lib/mxx_ru/cpp/toolsets/bcc_win32_family.rb +5 -5
- data/lib/mxx_ru/cpp/toolsets/c89_nsk_family.rb +5 -5
- data/lib/mxx_ru/cpp/toolsets/gcc_family.rb +5 -5
- data/lib/mxx_ru/cpp/toolsets/gcc_mingw.rb +2 -2
- data/lib/mxx_ru/cpp/toolsets/vc8.rb +6 -1
- data/lib/mxx_ru/cpp/toolsets/vc_family.rb +4 -4
- data/lib/mxx_ru/generators/bin-unittest/g.rb +200 -0
- data/lib/mxx_ru/generators/bin-unittest/template.erb +16 -0
- data/lib/mxx_ru/generators/cpp-composite/g.rb +37 -0
- data/lib/mxx_ru/generators/cpp-dll/g.rb +37 -0
- data/lib/mxx_ru/generators/cpp-exe/g.rb +37 -0
- data/lib/mxx_ru/generators/cpp-lib-collection/g.rb +37 -0
- data/lib/mxx_ru/generators/cpp-lib/g.rb +37 -0
- data/lib/mxx_ru/generators/impl/cpp/generation.rb +291 -0
- data/lib/mxx_ru/generators/impl/cpp/template.erb +27 -0
- data/lib/mxx_ru/generators/impl/std_receiver.rb +80 -0
- data/lib/mxx_ru/util.rb +110 -22
- data/lib/mxx_ru/version.rb +38 -0
- data/tests/mxx_ru/generators/cpp/tc_generator.rb +34 -0
- data/tests/mxx_ru/generators/cpp/tc_options.rb +79 -0
- data/tests/mxx_ru/generators/cpp/tc_template_params.rb +45 -0
- data/tests/mxx_ru/lib_collection/a.cpp +8 -0
- data/tests/mxx_ru/lib_collection/a.hpp +8 -0
- data/tests/mxx_ru/lib_collection/a.rb +8 -0
- data/tests/mxx_ru/lib_collection/b.cpp +8 -0
- data/tests/mxx_ru/lib_collection/b.hpp +8 -0
- data/tests/mxx_ru/lib_collection/b.rb +8 -0
- data/tests/mxx_ru/lib_collection/c.cpp +8 -0
- data/tests/mxx_ru/lib_collection/c.hpp +8 -0
- data/tests/mxx_ru/lib_collection/c.rb +8 -0
- data/tests/mxx_ru/lib_collection/collection_a_b.rb +7 -0
- data/tests/mxx_ru/lib_collection/collection_c_d.rb +7 -0
- data/tests/mxx_ru/lib_collection/collection_c_d_e.rb +7 -0
- data/tests/mxx_ru/lib_collection/collection_f.rb +6 -0
- data/tests/mxx_ru/lib_collection/collection_i.rb +6 -0
- data/tests/mxx_ru/lib_collection/d.cpp +8 -0
- data/tests/mxx_ru/lib_collection/d.hpp +8 -0
- data/tests/mxx_ru/lib_collection/d.rb +8 -0
- data/tests/mxx_ru/lib_collection/e.cpp +8 -0
- data/tests/mxx_ru/lib_collection/e.hpp +8 -0
- data/tests/mxx_ru/lib_collection/e.rb +8 -0
- data/tests/mxx_ru/lib_collection/f.cpp +8 -0
- data/tests/mxx_ru/lib_collection/f.hpp +8 -0
- data/tests/mxx_ru/lib_collection/f.rb +7 -0
- data/tests/mxx_ru/lib_collection/g.cpp +8 -0
- data/tests/mxx_ru/lib_collection/g.hpp +8 -0
- data/tests/mxx_ru/lib_collection/g.rb +7 -0
- data/tests/mxx_ru/lib_collection/i.cpp +10 -0
- data/tests/mxx_ru/lib_collection/i.hpp +16 -0
- data/tests/mxx_ru/lib_collection/i.rb +17 -0
- data/tests/mxx_ru/lib_collection/main.cpp +18 -0
- data/tests/mxx_ru/lib_collection/main.rb +12 -0
- data/tests/mxx_ru/lib_collection/tc_lib_collection.rb +17 -0
- data/tests/mxx_ru/toolset/tc_tag_search.rb +68 -0
- data/tests/test_with_compilation.rb +1 -1
- metadata +67 -14
- data/tests/cpp/mswin_res_dll/o/dll.o +0 -0
- data/tests/cpp/mswin_res_exe/o/main.o +0 -0
data/Rakefile
CHANGED
@@ -4,9 +4,11 @@ Gem::manage_gems
|
|
4
4
|
require 'rake/gempackagetask'
|
5
5
|
require 'rake/testtask'
|
6
6
|
|
7
|
+
require 'lib/mxx_ru/version'
|
8
|
+
|
7
9
|
spec = Gem::Specification.new do |s|
|
8
10
|
s.name = "Mxx_ru"
|
9
|
-
s.version =
|
11
|
+
s.version = MXX_RU_VERSION
|
10
12
|
s.author = "The Mxx_ru Project"
|
11
13
|
s.email = "eao197@yahoo.com"
|
12
14
|
s.homepage = "http://www.rubyforge.com/projects/mxx-ru"
|
@@ -14,9 +16,8 @@ spec = Gem::Specification.new do |s|
|
|
14
16
|
s.summary = "Mxx_ru (Make++ on Ruby) is a cross-platform build tool"
|
15
17
|
s.files = FileList[ "{bin,tests,lib,docs,examples}/**/*" ].
|
16
18
|
exclude( "rdoc" ).to_a + [ "THANKS" ]
|
19
|
+
s.executables = 'mxxrugen'
|
17
20
|
s.require_path = "lib"
|
18
|
-
# s.autorequire = "rucodegen"
|
19
|
-
# s.test_file = "tests/ts_rucodegen.rb"
|
20
21
|
s.has_rdoc = true
|
21
22
|
s.rdoc_options = [ '-S', '--main', 'README' ]
|
22
23
|
s.extra_rdoc_files = [ "README", "Rakefile", "COPYING", "NEWS" ] + FileList[ "docs/**/*" ].to_a
|
data/bin/mxxrugen
ADDED
@@ -0,0 +1,197 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 1996-2004, Yauheni Akhotnikau
|
3
|
+
# Copyright (c) 2004-2006, JSC Intervale
|
4
|
+
# Copyright (c) 2006, The Mxx_ru Project
|
5
|
+
# All rights reserved.
|
6
|
+
#
|
7
|
+
# Redistribution and use in source and binary forms, with or without modification,
|
8
|
+
# are permitted provided that the following conditions are met:
|
9
|
+
#
|
10
|
+
# 1. Redistributions of source code must retain the above copyright notice,
|
11
|
+
# this list of conditions and the following disclaimer.
|
12
|
+
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
13
|
+
# this list of conditions and the following disclaimer in the documentation
|
14
|
+
# and/or other materials provided with the distribution.
|
15
|
+
# 3. The name of the author may not be used to endorse or promote products derived
|
16
|
+
# from this software without specific prior written permission.
|
17
|
+
#
|
18
|
+
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
19
|
+
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
20
|
+
# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
|
21
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
22
|
+
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
23
|
+
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
24
|
+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
25
|
+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
26
|
+
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
27
|
+
#++
|
28
|
+
# This code is based on the code from RuCodeGen
|
29
|
+
# (http://www.rubyforge.org/projects/rucodegen) project.
|
30
|
+
# RuCodeGen is distributed under the following license:
|
31
|
+
#--
|
32
|
+
#
|
33
|
+
# Copyright (c) 2005-2006, Yauheni Akhotnikau
|
34
|
+
# All rights reserved.
|
35
|
+
#
|
36
|
+
# Redistribution and use in source and binary forms, with or without modification,
|
37
|
+
# are permitted provided that the following conditions are met:
|
38
|
+
#
|
39
|
+
# 1. Redistributions of source code must retain the above copyright notice,
|
40
|
+
# this list of conditions and the following disclaimer.
|
41
|
+
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
42
|
+
# this list of conditions and the following disclaimer in the documentation
|
43
|
+
# and/or other materials provided with the distribution.
|
44
|
+
# 3. The name of the author may not be used to endorse or promote products derived
|
45
|
+
# from this software without specific prior written permission.
|
46
|
+
#
|
47
|
+
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
48
|
+
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
49
|
+
# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
|
50
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
51
|
+
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
52
|
+
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
53
|
+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
54
|
+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
55
|
+
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
56
|
+
#
|
57
|
+
#++
|
58
|
+
|
59
|
+
|
60
|
+
# Since v.1.4.0
|
61
|
+
#
|
62
|
+
# Template generation scripts runner.
|
63
|
+
|
64
|
+
require 'optparse'
|
65
|
+
require 'ostruct'
|
66
|
+
|
67
|
+
module MxxRuGen
|
68
|
+
|
69
|
+
module Impl
|
70
|
+
|
71
|
+
# Standard name of generation script inside template.
|
72
|
+
STD_CODEGEN_SCRIPT_NAME = 'g.rb'
|
73
|
+
|
74
|
+
# Command-line argument parsing.
|
75
|
+
#
|
76
|
+
# Returns object with the following methods:
|
77
|
+
# template_name:: Name of template chosen.
|
78
|
+
# list:: Contains _true_ if list of templates must be shown.
|
79
|
+
# include_paths:: Contains list of addition path for templates.
|
80
|
+
#
|
81
|
+
# Finishes script work is --help specified.
|
82
|
+
#
|
83
|
+
def Impl.parse_args
|
84
|
+
result = OpenStruct.new(
|
85
|
+
:template_name => nil,
|
86
|
+
:list => false,
|
87
|
+
:include_paths => [] )
|
88
|
+
|
89
|
+
parser = OptionParser.new
|
90
|
+
|
91
|
+
parser.banner = <<BANNER
|
92
|
+
Mxx_ru Ad-Hoc generation runner
|
93
|
+
|
94
|
+
Usage:
|
95
|
+
|
96
|
+
mxxrugen [<options>] template-name [<template-options>]
|
97
|
+
|
98
|
+
BANNER
|
99
|
+
|
100
|
+
parser.on_head( '-l', '--list', 'Show list of available templates' ) do
|
101
|
+
result.list = true
|
102
|
+
end
|
103
|
+
|
104
|
+
parser.on_head( '-I', '--include-path PATH',
|
105
|
+
'Additional path to looking for templates' ) do |p|
|
106
|
+
result.include_paths << p
|
107
|
+
end
|
108
|
+
|
109
|
+
parser.on_head( '-h', '--help', 'Show this message' ) do
|
110
|
+
puts parser
|
111
|
+
exit( 1 )
|
112
|
+
end
|
113
|
+
|
114
|
+
parser.order!( ARGV ) do |nonarg|
|
115
|
+
# First non-option is a template name.
|
116
|
+
result.template_name = nonarg
|
117
|
+
parser.terminate
|
118
|
+
end
|
119
|
+
|
120
|
+
if !result.template_name && !result.list
|
121
|
+
$stderr.puts "template_name must be specified"
|
122
|
+
exit( 2 )
|
123
|
+
end
|
124
|
+
|
125
|
+
result
|
126
|
+
end
|
127
|
+
|
128
|
+
# Prints list of available templates.
|
129
|
+
def Impl.show_templates_list( include_paths )
|
130
|
+
include_paths.each do |path|
|
131
|
+
templates_found = []
|
132
|
+
Dir.glob( File.join( path, '*' ), File::FNM_PATHNAME ) do |dir|
|
133
|
+
probe_name = File.join( dir, STD_CODEGEN_SCRIPT_NAME )
|
134
|
+
if File.readable?( probe_name )
|
135
|
+
templates_found << File.basename( dir )
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
templates_found.sort.each do |template|
|
140
|
+
puts template + " (#{path})"
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
# Searches full path to a template by the template name.
|
146
|
+
#
|
147
|
+
# Returns nil if searching fails.
|
148
|
+
#
|
149
|
+
def Impl.find_full_template_path( template_name, include_paths )
|
150
|
+
include_paths.each do |path|
|
151
|
+
probe_name = File.join( path, template_name, STD_CODEGEN_SCRIPT_NAME )
|
152
|
+
if File.readable?( probe_name )
|
153
|
+
return probe_name
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
nil
|
158
|
+
end
|
159
|
+
|
160
|
+
# Searches and runs the template specified with option list is given.
|
161
|
+
def Impl.find_and_run_template( template_name, include_paths )
|
162
|
+
full_path = find_full_template_path( template_name, include_paths )
|
163
|
+
if full_path
|
164
|
+
require full_path
|
165
|
+
else
|
166
|
+
$stderr.puts "#{template_name}: template not found in:\n\t" +
|
167
|
+
include_paths.join( "\n\t" )
|
168
|
+
exit( 3 )
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
end # Impl
|
173
|
+
|
174
|
+
# Performs main work.
|
175
|
+
def MxxRuGen.run_ad_hoc_generation
|
176
|
+
options = Impl.parse_args
|
177
|
+
|
178
|
+
# Standard path to templates must be added.
|
179
|
+
options.include_paths << File.expand_path( File.join(
|
180
|
+
File.dirname( __FILE__ ),
|
181
|
+
'../lib/mxx_ru/generators' ) )
|
182
|
+
|
183
|
+
if options.list
|
184
|
+
Impl.show_templates_list( options.include_paths )
|
185
|
+
else
|
186
|
+
Impl.find_and_run_template(
|
187
|
+
options.template_name,
|
188
|
+
options.include_paths )
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
end # MxxRuGen
|
193
|
+
|
194
|
+
MxxRuGen.run_ad_hoc_generation
|
195
|
+
|
196
|
+
# vim:ft=ruby:
|
197
|
+
|
@@ -0,0 +1,126 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 1996-2004, Yauheni Akhotnikau
|
3
|
+
# Copyright (c) 2004-2006, JSC Intervale
|
4
|
+
# Copyright (c) 2006, The Mxx_ru Project
|
5
|
+
# All rights reserved.
|
6
|
+
#
|
7
|
+
# Redistribution and use in source and binary forms, with or without modification,
|
8
|
+
# are permitted provided that the following conditions are met:
|
9
|
+
#
|
10
|
+
# 1. Redistributions of source code must retain the above copyright notice,
|
11
|
+
# this list of conditions and the following disclaimer.
|
12
|
+
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
13
|
+
# this list of conditions and the following disclaimer in the documentation
|
14
|
+
# and/or other materials provided with the distribution.
|
15
|
+
# 3. The name of the author may not be used to endorse or promote products derived
|
16
|
+
# from this software without specific prior written permission.
|
17
|
+
#
|
18
|
+
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
19
|
+
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
20
|
+
# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
|
21
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
22
|
+
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
23
|
+
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
24
|
+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
25
|
+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
26
|
+
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
27
|
+
#++
|
28
|
+
|
29
|
+
require 'optparse'
|
30
|
+
require 'singleton'
|
31
|
+
|
32
|
+
require 'mxx_ru/version'
|
33
|
+
|
34
|
+
module MxxRu
|
35
|
+
|
36
|
+
# Singleton for centralized mechanizm of command line options parsing.
|
37
|
+
#
|
38
|
+
# Since v.1.4.0
|
39
|
+
#
|
40
|
+
# Each part of Mxx_ru which need some command line option must provider
|
41
|
+
# special option processor for CmdLineOptionProcessor singleton:
|
42
|
+
#
|
43
|
+
# module MxxRu
|
44
|
+
# module SomeLangSupport
|
45
|
+
# class OptionParser
|
46
|
+
# include Singleton
|
47
|
+
# ...
|
48
|
+
# def prepare( parser ) # Instance of OptionParser from stdlib.
|
49
|
+
# parser.separator ''
|
50
|
+
# parser.separator 'Some Language Support options:'
|
51
|
+
#
|
52
|
+
# parser.on( '-i', '--include PATH', 'Set up include path' ) do
|
53
|
+
# |path|
|
54
|
+
# ... some processig ...
|
55
|
+
# end
|
56
|
+
# ... setting another option handlers ...
|
57
|
+
# end
|
58
|
+
# end
|
59
|
+
# end
|
60
|
+
# end
|
61
|
+
#
|
62
|
+
# # OptionParser must be added to CmdLineOptionProcessor.
|
63
|
+
# MxxRu::CmdLineOptionProcessor.add_processor(
|
64
|
+
# MxxRu::SomeLangSupport::OptionParser.instance )
|
65
|
+
#
|
66
|
+
# See examples of using this technique in MxxRu::Util::Mode and
|
67
|
+
# MxxRu::Cpp::Mode classes.
|
68
|
+
#
|
69
|
+
class CmdLineOptionProcessor
|
70
|
+
include Singleton
|
71
|
+
|
72
|
+
def initialize
|
73
|
+
@processors = []
|
74
|
+
@parsed = false
|
75
|
+
end
|
76
|
+
|
77
|
+
# Add yet another option processor for processors list.
|
78
|
+
def add_processor( processor )
|
79
|
+
@processors << processor
|
80
|
+
@parsed = false
|
81
|
+
end
|
82
|
+
|
83
|
+
# Performs parsing of ARGV content by current processors.
|
84
|
+
#
|
85
|
+
# Finishes work of script if --help or --version found in ARGV.
|
86
|
+
def parse
|
87
|
+
unless @parsed
|
88
|
+
parser = OptionParser.new do |p|
|
89
|
+
prepare_option_parser( p )
|
90
|
+
end
|
91
|
+
|
92
|
+
begin
|
93
|
+
parser.parse( ARGV )
|
94
|
+
rescue => x
|
95
|
+
$stderr.puts "command line parsing error '#{x.message}'"
|
96
|
+
exit( 2 )
|
97
|
+
end
|
98
|
+
|
99
|
+
@parsed = true
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
protected
|
104
|
+
# Calls preparse() method for each processor. And then add common
|
105
|
+
# command line options to the parser.
|
106
|
+
def prepare_option_parser( parser )
|
107
|
+
@processors.each do |p| p.prepare( parser ) end
|
108
|
+
|
109
|
+
parser.separator ''
|
110
|
+
parser.separator 'Auxilary options:'
|
111
|
+
|
112
|
+
parser.on_tail( '-h', '--help', 'Show usage help and options summary' ) do
|
113
|
+
puts parser
|
114
|
+
exit
|
115
|
+
end
|
116
|
+
|
117
|
+
parser.on_tail( '--version', 'Show version' ) do
|
118
|
+
puts 'Mxx_ru v.' + MXX_RU_VERSION
|
119
|
+
exit
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
end
|
124
|
+
|
125
|
+
end
|
126
|
+
|
data/lib/mxx_ru/cpp.rb
CHANGED
data/lib/mxx_ru/cpp/composite.rb
CHANGED
@@ -59,12 +59,7 @@ module MxxRu
|
|
59
59
|
def build
|
60
60
|
if nil == @mxx_last_build_result
|
61
61
|
|
62
|
-
|
63
|
-
# It's required for toolset to define all required options
|
64
|
-
# taking all current modes into account.
|
65
|
-
MxxRu::Cpp::toolset.setup_mandatory_options( self )
|
66
|
-
@mxx_all_options_defined = true
|
67
|
-
end
|
62
|
+
check_all_options_definition
|
68
63
|
|
69
64
|
@mxx_last_build_result = build_required_projects
|
70
65
|
end
|
@@ -76,12 +71,7 @@ module MxxRu
|
|
76
71
|
def clean
|
77
72
|
if nil == @mxx_last_build_result
|
78
73
|
|
79
|
-
|
80
|
-
# It's required for toolset to define all required options
|
81
|
-
# taking all current modes into account.
|
82
|
-
MxxRu::Cpp::toolset.setup_mandatory_options( self )
|
83
|
-
@mxx_all_options_defined = true
|
84
|
-
end
|
74
|
+
check_all_options_definition
|
85
75
|
|
86
76
|
clean_required_prjs
|
87
77
|
|
@@ -0,0 +1,96 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 1996-2004, Yauheni Akhotnikau
|
3
|
+
# Copyright (c) 2004-2006, JSC Intervale
|
4
|
+
# Copyright (c) 2006, The Mxx_ru Project
|
5
|
+
# All rights reserved.
|
6
|
+
#
|
7
|
+
# Redistribution and use in source and binary forms, with or without modification,
|
8
|
+
# are permitted provided that the following conditions are met:
|
9
|
+
#
|
10
|
+
# 1. Redistributions of source code must retain the above copyright notice,
|
11
|
+
# this list of conditions and the following disclaimer.
|
12
|
+
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
13
|
+
# this list of conditions and the following disclaimer in the documentation
|
14
|
+
# and/or other materials provided with the distribution.
|
15
|
+
# 3. The name of the author may not be used to endorse or promote products derived
|
16
|
+
# from this software without specific prior written permission.
|
17
|
+
#
|
18
|
+
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
19
|
+
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
20
|
+
# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
|
21
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
22
|
+
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
23
|
+
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
24
|
+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
25
|
+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
26
|
+
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
27
|
+
#++
|
28
|
+
|
29
|
+
require 'mxx_ru/cpp/composite'
|
30
|
+
require 'mxx_ru/cpp/toolset'
|
31
|
+
|
32
|
+
module MxxRu
|
33
|
+
module Cpp
|
34
|
+
|
35
|
+
# Target type is a collection of all required libraries from subprojects.
|
36
|
+
#
|
37
|
+
# Since v.1.4.0
|
38
|
+
class LibCollectionTargetType < TargetType
|
39
|
+
TYPE = "lib_collection"
|
40
|
+
|
41
|
+
def name
|
42
|
+
return TYPE
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# Collection of all required libraries form subprojects.
|
47
|
+
#
|
48
|
+
# Since v.1.4.0
|
49
|
+
class LibCollectionTarget < CompositeTarget
|
50
|
+
def initialize( a_alias, &block )
|
51
|
+
super( a_alias )
|
52
|
+
|
53
|
+
instance_eval( &block ) if block
|
54
|
+
end
|
55
|
+
|
56
|
+
def target_type
|
57
|
+
return LibCollectionTargetType.new
|
58
|
+
end
|
59
|
+
|
60
|
+
def build
|
61
|
+
if nil == @mxx_last_build_result
|
62
|
+
# Let base class makes all necessary building actions.
|
63
|
+
super
|
64
|
+
|
65
|
+
# We must collect names of all required libraries from
|
66
|
+
# all subprojects.
|
67
|
+
mxx_required_prjs.each do |d|
|
68
|
+
if Toolset::has_linkable_dependecies?( d )
|
69
|
+
mxx_add_required_libs( d.mxx_required_libs )
|
70
|
+
mxx_add_required_lib_paths( d.mxx_required_lib_paths )
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
@mxx_last_build_result
|
76
|
+
end
|
77
|
+
|
78
|
+
end # class LibCollectionTarget
|
79
|
+
|
80
|
+
# Simple method to define libraries collection target.
|
81
|
+
#
|
82
|
+
# Example:
|
83
|
+
# MxxRu::Cpp::lib_collection_target {
|
84
|
+
# required_prj 'some_project.rb'
|
85
|
+
# required_prj 'some_another_project.rb'
|
86
|
+
# }
|
87
|
+
#
|
88
|
+
# Since v.1.4.0
|
89
|
+
def Cpp.lib_collection_target( prj_alias = nil, &block )
|
90
|
+
prj_alias = MxxRu::Util::prj_alias_form_caller( caller ) unless prj_alias
|
91
|
+
MxxRu::setup_target LibCollectionTarget.new( prj_alias, &block )
|
92
|
+
end
|
93
|
+
|
94
|
+
end # module Cpp
|
95
|
+
end # module MxxRu
|
96
|
+
|