Mxx_ru 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +26 -26
- data/NEWS +107 -107
- data/README +21 -21
- data/Rakefile +56 -56
- data/examples/exe_and_lib/prj.rb +11 -11
- data/examples/exe_and_lib/say.rb +7 -7
- data/examples/exe_dll_lib/inout.rb +18 -18
- data/examples/exe_dll_lib/prj.rb +11 -11
- data/examples/exe_dll_lib/say.rb +9 -9
- data/examples/exe_dll_lib_2/build.rb +10 -10
- data/examples/exe_dll_lib_2/inout/prj.rb +16 -16
- data/examples/exe_dll_lib_2/main/prj.rb +9 -9
- data/examples/exe_dll_lib_2/say/prj.rb +8 -8
- data/examples/simple_exe/prj.rb +7 -7
- data/lib/mxx_ru/abstract_target.rb +335 -335
- data/lib/mxx_ru/binary_library.rb +106 -106
- data/lib/mxx_ru/binary_target.rb +173 -173
- data/lib/mxx_ru/binary_unittest.rb +143 -143
- data/lib/mxx_ru/compat.rb +33 -33
- data/lib/mxx_ru/cpp.rb +38 -38
- data/lib/mxx_ru/cpp/analyzer.rb +237 -237
- data/lib/mxx_ru/cpp/composite.rb +118 -118
- data/lib/mxx_ru/cpp/detect_toolset.rb +122 -122
- data/lib/mxx_ru/cpp/mode.rb +90 -90
- data/lib/mxx_ru/cpp/obj_placement.rb +330 -330
- data/lib/mxx_ru/cpp/obj_placements/custom_subdir.rb +155 -155
- data/lib/mxx_ru/cpp/qt.rb +366 -366
- data/lib/mxx_ru/cpp/rucodegen.rb +157 -157
- data/lib/mxx_ru/cpp/source_file.rb +79 -79
- data/lib/mxx_ru/cpp/target.rb +1523 -1523
- data/lib/mxx_ru/cpp/toolset.rb +1087 -1087
- data/lib/mxx_ru/cpp/toolsets/bcc_win32_5.rb +53 -53
- data/lib/mxx_ru/cpp/toolsets/bcc_win32_family.rb +460 -460
- data/lib/mxx_ru/cpp/toolsets/c89_etk_nsk.rb +59 -59
- data/lib/mxx_ru/cpp/toolsets/c89_nsk.rb +59 -59
- data/lib/mxx_ru/cpp/toolsets/c89_nsk_family.rb +277 -277
- data/lib/mxx_ru/cpp/toolsets/gcc_cygwin.rb +58 -58
- data/lib/mxx_ru/cpp/toolsets/gcc_family.rb +420 -420
- data/lib/mxx_ru/cpp/toolsets/gcc_linux.rb +64 -64
- data/lib/mxx_ru/cpp/toolsets/gcc_mingw.rb +149 -150
- data/lib/mxx_ru/cpp/toolsets/gcc_sparc_solaris.rb +91 -91
- data/lib/mxx_ru/cpp/toolsets/gcc_unix_family.rb +103 -103
- data/lib/mxx_ru/cpp/toolsets/vc7.rb +62 -62
- data/lib/mxx_ru/cpp/toolsets/vc8.rb +455 -455
- data/lib/mxx_ru/cpp/toolsets/vc_family.rb +448 -448
- data/lib/mxx_ru/ex.rb +165 -165
- data/lib/mxx_ru/makestyle_generator.rb +146 -146
- data/lib/mxx_ru/textfile_unittest.rb +303 -303
- data/lib/mxx_ru/util.rb +340 -340
- data/tests/c/pcre/chartables.c +183 -183
- data/tests/c/pcre/config.h +99 -99
- data/tests/c/pcre/dftables.c +167 -167
- data/tests/c/pcre/get.c +349 -349
- data/tests/c/pcre/internal.h +677 -677
- data/tests/c/pcre/maketables.c +140 -140
- data/tests/c/pcre/pcre.c +8304 -8304
- data/tests/c/pcre/pcre.h +193 -193
- data/tests/c/pcre/pcre.rb +14 -14
- data/tests/c/pcre/pcredemo.c +316 -316
- data/tests/c/pcre/pcregrep.c +642 -642
- data/tests/c/pcre/pcreposix.c +305 -305
- data/tests/c/pcre/pcreposix.h +88 -88
- data/tests/c/pcre/pcretest.c +1483 -1483
- data/tests/c/pcre/perltest +211 -211
- data/tests/c/pcre/printint.c +360 -360
- data/tests/c/pcre/study.c +472 -472
- data/tests/cpp/cpp_sources_glob/build.rb +7 -7
- data/tests/cpp/cpp_sources_glob/some/module/prj.rb +10 -10
- data/tests/cpp/cpp_sources_glob/tc_cpp_sources_glob.rb +18 -18
- data/tests/cpp/mswin_res_dll/build.rb +14 -14
- data/tests/cpp/mswin_res_dll/dll.cpp +17 -17
- data/tests/cpp/mswin_res_dll/dll.rb +29 -29
- data/tests/cpp/mswin_res_dll/dll.rc +48 -48
- data/tests/cpp/mswin_res_dll/h/dll.hpp +8 -8
- data/tests/cpp/mswin_res_dll/h/res.h +3 -3
- data/tests/cpp/mswin_res_dll/main.cpp +13 -13
- data/tests/cpp/mswin_res_dll/main.rb +19 -19
- data/tests/cpp/mswin_res_dll/o/dll.o +0 -0
- data/tests/cpp/mswin_res_dll/tc_mswin_res_dll.rb +18 -18
- data/tests/cpp/mswin_res_exe/build.rb +23 -23
- data/tests/cpp/mswin_res_exe/h/res.h +3 -3
- data/tests/cpp/mswin_res_exe/main.cpp +17 -17
- data/tests/cpp/mswin_res_exe/main.rc +48 -48
- data/tests/cpp/mswin_res_exe/o/main.o +0 -0
- data/tests/cpp/mswin_res_exe/tc_mswin_res_exe.rb +18 -18
- data/tests/cpp/rucodegen.embedded/host_config.cpp +32 -32
- data/tests/cpp/rucodegen.embedded/impl/conn_params.cpp +7 -7
- data/tests/cpp/rucodegen.embedded/impl/conn_params.rb +14 -14
- data/tests/cpp/rucodegen.embedded/impl/h/conn_params.hpp +10 -10
- data/tests/cpp/rucodegen.embedded/prj.rb +16 -16
- data/tests/cpp/rucodegen.embedded/tc_rucodegen.rb +18 -18
- data/tests/cpp/rucodegen/host_config.cpp +20 -20
- data/tests/cpp/rucodegen/host_config.rb +14 -14
- data/tests/cpp/rucodegen/impl/conn_params.cpp +7 -7
- data/tests/cpp/rucodegen/impl/conn_params.rb +14 -14
- data/tests/cpp/rucodegen/impl/h/conn_params.hpp +10 -10
- data/tests/cpp/rucodegen/prj.rb +16 -16
- data/tests/cpp/rucodegen/tc_rucodegen.rb +18 -18
- data/tests/cpp/textfile_unittest/build.rb +8 -8
- data/tests/cpp/textfile_unittest/etalons/out_1.txt +1 -1
- data/tests/cpp/textfile_unittest/etalons/out_128.txt +128 -128
- data/tests/cpp/textfile_unittest/main.cpp +89 -89
- data/tests/cpp/textfile_unittest/prj.rb +8 -8
- data/tests/cpp/textfile_unittest/prj.ut.rb +18 -18
- data/tests/cpp/textfile_unittest/tc_textfile_unittest.rb +18 -18
- data/tests/cpp/toolset_name.rb +6 -6
- data/tests/cpp/vc_cleanup/prj_dll_no_implib.rb +10 -10
- data/tests/cpp/vc_cleanup/prj_dll_no_implib_simple_target_root.rb +11 -11
- data/tests/cpp/vc_cleanup/prj_dll_with_implib.rb +11 -11
- data/tests/cpp/vc_cleanup/prj_dll_with_implib_simple_target_root.rb +14 -14
- data/tests/cpp/vc_cleanup/prj_exe_no_implib.rb +10 -10
- data/tests/cpp/vc_cleanup/prj_exe_no_implib_simple_target_root.rb +11 -11
- data/tests/cpp/vc_cleanup/prj_lib.rb +10 -10
- data/tests/cpp/vc_cleanup/prj_lib_with_simple_target_root.rb +11 -11
- data/tests/cpp/vc_cleanup/tc_vc_cleanup.rb +23 -23
- data/tests/mxx_ru/binary_library/tc_binary_library.rb +57 -57
- data/tests/mxx_ru/binary_library/tc_binary_target_lib_methods.rb +114 -114
- data/tests/mxx_ru/change_default_value/ignoring_by_build_root/build.rb +8 -8
- data/tests/mxx_ru/change_default_value/ignoring_by_build_root/child_1.rb +5 -5
- data/tests/mxx_ru/change_default_value/ignoring_by_child_1/build.rb +7 -7
- data/tests/mxx_ru/change_default_value/ignoring_by_child_1/child_1.rb +5 -5
- data/tests/mxx_ru/change_default_value/ignoring_by_child_1/child_2.rb +5 -5
- data/tests/mxx_ru/change_default_value/ok/build.rb +8 -8
- data/tests/mxx_ru/change_default_value/ok/child_1.rb +8 -8
- data/tests/mxx_ru/lib_path/build.rb +8 -8
- data/tests/mxx_ru/lib_path/bye.rb +8 -8
- data/tests/mxx_ru/lib_path/hi.rb +8 -8
- data/tests/mxx_ru/lib_path/main.rb +12 -12
- data/tests/mxx_ru/lib_path/tc_lib_path.rb +18 -18
- data/tests/mxx_ru/obj_placements/tc_custom_subdir.rb +58 -58
- data/tests/mxx_ru/opt_lib_ext/build.rb +7 -7
- data/tests/mxx_ru/opt_lib_ext/hi.rb +7 -7
- data/tests/mxx_ru/opt_lib_ext/tc_opt_lib_ext.rb +18 -18
- data/tests/mxx_ru/opt_lib_ext/test-no-ext.rb +9 -9
- data/tests/mxx_ru/opt_lib_ext/test-with-ext.rb +13 -13
- data/tests/mxx_ru/plural_form_methods/tc.rb +72 -72
- data/tests/mxx_ru/qt_gen/tc_uic_result_subdir.rb +76 -76
- data/tests/mxx_ru/target_ext/prj_dll.rb +8 -8
- data/tests/mxx_ru/target_ext/prj_exe.rb +8 -8
- data/tests/mxx_ru/target_ext/prj_lib.rb +8 -8
- data/tests/mxx_ru/target_ext/tc_target_ext.rb +24 -24
- data/tests/mxx_ru/tc_makestyle_generator.rb +117 -117
- data/tests/mxx_ru/vc8/tc_actual_manifest.rb +230 -230
- data/tests/mxx_ru/vc8/tc_append_mt_commands.rb +104 -104
- data/tests/mxx_ru/vc8/tc_default_manifest.rb +17 -17
- data/tests/mxx_ru/vc8/tc_define_manifest.rb +173 -173
- data/tests/mxx_ru/vc8/tc_drop_default_manifest.rb +16 -16
- data/tests/mxx_ru/vc8/tc_invalid_params.rb +81 -81
- data/tests/mxx_ru/vc8/ts_vc8.rb +10 -10
- data/tests/qt/aclock/aclock.cpp +148 -148
- data/tests/qt/aclock/aclock.h +45 -45
- data/tests/qt/aclock/main.cpp +28 -28
- data/tests/qt/aclock/prj.rb +21 -21
- data/tests/qt/iconview/main.cpp +76 -76
- data/tests/qt/iconview/prj.rb +21 -21
- data/tests/qt/toplevel/main.cpp +9 -9
- data/tests/qt/toplevel/options.ui +587 -587
- data/tests/qt/toplevel/prj.rb +22 -22
- data/tests/test_with_compilation.rb +110 -110
- data/tests/unix/lib_linking_mode/a_shared.rb +7 -7
- data/tests/unix/lib_linking_mode/a_static.rb +7 -7
- data/tests/unix/lib_linking_mode/etalon/shared.txt +2 -2
- data/tests/unix/lib_linking_mode/etalon/static.txt +2 -2
- data/tests/unix/lib_linking_mode/main_conflict.rb +12 -12
- data/tests/unix/lib_linking_mode/main_conflict_2.rb +11 -11
- data/tests/unix/lib_linking_mode/main_shared.rb +9 -9
- data/tests/unix/lib_linking_mode/main_shared.ut.rb +11 -11
- data/tests/unix/lib_linking_mode/main_shared_2.rb +10 -10
- data/tests/unix/lib_linking_mode/main_shared_2.ut.rb +11 -11
- data/tests/unix/lib_linking_mode/main_static.rb +9 -9
- data/tests/unix/lib_linking_mode/main_static.ut.rb +11 -11
- data/tests/unix/lib_linking_mode/main_static_2.rb +10 -10
- data/tests/unix/lib_linking_mode/main_static_2.ut.rb +11 -11
- data/tests/unix/lib_linking_mode/tc_conflicted_build.rb +18 -18
- data/tests/unix/lib_linking_mode/tc_normal_build.rb +18 -18
- data/tests/unix/lib_order/tc_normal_build.rb +16 -16
- metadata +216 -205
@@ -1,106 +1,106 @@
|
|
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/ex'
|
30
|
-
|
31
|
-
module MxxRu
|
32
|
-
|
33
|
-
# Class for description of binary library required to be linked
|
34
|
-
# with binary target.
|
35
|
-
#
|
36
|
-
# Since 1.3.0
|
37
|
-
#
|
38
|
-
# On Unix platform static and shared library can be specified to linker with
|
39
|
-
# same name. For example to link libA.a or libA.so user must specify '-lA'
|
40
|
-
# option. Linker selects appropriate library (static or shared version) by
|
41
|
-
# it own rules (on most Linux platform ld first looks for shared version, than
|
42
|
-
# for static version; this approach can be overriden by '-static' option for
|
43
|
-
# gcc or '-Bstatic' for ld).
|
44
|
-
#
|
45
|
-
# In some cases user may wants to explicitly specify kind of library. For
|
46
|
-
# example, if ld by default searches shared libraries than user can specify
|
47
|
-
# sequence '-Bstatic -lA -Bdynamic' for ld (or '-Wl,-Bstatic,-lA,-Bdynamic'
|
48
|
-
# for gcc). This forces linker for looking only static version of library.
|
49
|
-
#
|
50
|
-
# In version 1.3.0 Mxx_ru support for explicit static/shared library selection
|
51
|
-
# was added. To implement this support required library description was
|
52
|
-
# changed. Instead of storing names of required libraries as String they are
|
53
|
-
# stored as BinaryLibrary objects.
|
54
|
-
class BinaryLibrary
|
55
|
-
# Identifier for static library type.
|
56
|
-
STATIC = :static
|
57
|
-
# Identifier for shared library type.
|
58
|
-
SHARED = :shared
|
59
|
-
# Identifier for library which type if unknown yet (not explicitly specified).
|
60
|
-
ANY = :any
|
61
|
-
|
62
|
-
# Name of library.
|
63
|
-
attr_reader :name
|
64
|
-
# Type of library (STATIC/SHARED/ANY).
|
65
|
-
attr_reader :type
|
66
|
-
|
67
|
-
def initialize( name, type )
|
68
|
-
raise InvalidValueEx.new( "Unknown BinaryLibrary type: #{type}" ) unless
|
69
|
-
[ STATIC, SHARED, ANY ].member?( type )
|
70
|
-
|
71
|
-
@name = name
|
72
|
-
@type = type
|
73
|
-
end
|
74
|
-
|
75
|
-
def to_s
|
76
|
-
@name
|
77
|
-
end
|
78
|
-
|
79
|
-
def eql?( another )
|
80
|
-
@name.eql?( another.name ) and @type.eql?( another.type )
|
81
|
-
end
|
82
|
-
|
83
|
-
def ==( another )
|
84
|
-
self.eql?( another )
|
85
|
-
end
|
86
|
-
|
87
|
-
def <=>( another )
|
88
|
-
r = @name <=> another.name
|
89
|
-
r = @type <=> another.type if 0 == r
|
90
|
-
r
|
91
|
-
end
|
92
|
-
|
93
|
-
end # class BinaryLibrary
|
94
|
-
|
95
|
-
# Exception for the case where conflict of BinaryLibrary usage detected.
|
96
|
-
#
|
97
|
-
# Conflict detected if STATIC and SHARED library with same name specified
|
98
|
-
# for one target.
|
99
|
-
class BinaryLibraryTypeConflictEx < Ex
|
100
|
-
def initialize( target_name, library_name )
|
101
|
-
super( "Binary library conflict with library '#{library_name}' for " +
|
102
|
-
"target '#{target_name}'" )
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
end # module MxxRu
|
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/ex'
|
30
|
+
|
31
|
+
module MxxRu
|
32
|
+
|
33
|
+
# Class for description of binary library required to be linked
|
34
|
+
# with binary target.
|
35
|
+
#
|
36
|
+
# Since 1.3.0
|
37
|
+
#
|
38
|
+
# On Unix platform static and shared library can be specified to linker with
|
39
|
+
# same name. For example to link libA.a or libA.so user must specify '-lA'
|
40
|
+
# option. Linker selects appropriate library (static or shared version) by
|
41
|
+
# it own rules (on most Linux platform ld first looks for shared version, than
|
42
|
+
# for static version; this approach can be overriden by '-static' option for
|
43
|
+
# gcc or '-Bstatic' for ld).
|
44
|
+
#
|
45
|
+
# In some cases user may wants to explicitly specify kind of library. For
|
46
|
+
# example, if ld by default searches shared libraries than user can specify
|
47
|
+
# sequence '-Bstatic -lA -Bdynamic' for ld (or '-Wl,-Bstatic,-lA,-Bdynamic'
|
48
|
+
# for gcc). This forces linker for looking only static version of library.
|
49
|
+
#
|
50
|
+
# In version 1.3.0 Mxx_ru support for explicit static/shared library selection
|
51
|
+
# was added. To implement this support required library description was
|
52
|
+
# changed. Instead of storing names of required libraries as String they are
|
53
|
+
# stored as BinaryLibrary objects.
|
54
|
+
class BinaryLibrary
|
55
|
+
# Identifier for static library type.
|
56
|
+
STATIC = :static
|
57
|
+
# Identifier for shared library type.
|
58
|
+
SHARED = :shared
|
59
|
+
# Identifier for library which type if unknown yet (not explicitly specified).
|
60
|
+
ANY = :any
|
61
|
+
|
62
|
+
# Name of library.
|
63
|
+
attr_reader :name
|
64
|
+
# Type of library (STATIC/SHARED/ANY).
|
65
|
+
attr_reader :type
|
66
|
+
|
67
|
+
def initialize( name, type )
|
68
|
+
raise InvalidValueEx.new( "Unknown BinaryLibrary type: #{type}" ) unless
|
69
|
+
[ STATIC, SHARED, ANY ].member?( type )
|
70
|
+
|
71
|
+
@name = name
|
72
|
+
@type = type
|
73
|
+
end
|
74
|
+
|
75
|
+
def to_s
|
76
|
+
@name
|
77
|
+
end
|
78
|
+
|
79
|
+
def eql?( another )
|
80
|
+
@name.eql?( another.name ) and @type.eql?( another.type )
|
81
|
+
end
|
82
|
+
|
83
|
+
def ==( another )
|
84
|
+
self.eql?( another )
|
85
|
+
end
|
86
|
+
|
87
|
+
def <=>( another )
|
88
|
+
r = @name <=> another.name
|
89
|
+
r = @type <=> another.type if 0 == r
|
90
|
+
r
|
91
|
+
end
|
92
|
+
|
93
|
+
end # class BinaryLibrary
|
94
|
+
|
95
|
+
# Exception for the case where conflict of BinaryLibrary usage detected.
|
96
|
+
#
|
97
|
+
# Conflict detected if STATIC and SHARED library with same name specified
|
98
|
+
# for one target.
|
99
|
+
class BinaryLibraryTypeConflictEx < Ex
|
100
|
+
def initialize( target_name, library_name )
|
101
|
+
super( "Binary library conflict with library '#{library_name}' for " +
|
102
|
+
"target '#{target_name}'" )
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
end # module MxxRu
|
data/lib/mxx_ru/binary_target.rb
CHANGED
@@ -1,173 +1,173 @@
|
|
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/abstract_target'
|
30
|
-
require 'mxx_ru/binary_library'
|
31
|
-
require 'mxx_ru/ex'
|
32
|
-
|
33
|
-
# Base class for all targets, which are binary executables, binary shared
|
34
|
-
# libraries or binary static libraries.
|
35
|
-
#
|
36
|
-
# In version v.1.3 extended by methods lib_path, lib_paths which are
|
37
|
-
# user-frendly synonyms for mxx_add_required_lib_path.
|
38
|
-
module MxxRu
|
39
|
-
|
40
|
-
class BinaryTarget < MxxRu::AbstractTarget
|
41
|
-
def initialize( a_prj_alias )
|
42
|
-
super( a_prj_alias )
|
43
|
-
|
44
|
-
# Libraries list, which would be required to the user of current target.
|
45
|
-
@mxx_required_libs = Array.new
|
46
|
-
# Attribute showing that before return from mxx_required_libs
|
47
|
-
# dublicates should be removed.
|
48
|
-
@mxx_required_libs_changed = true
|
49
|
-
# Folder list, where libraries, encountered in mxx_required_libs,
|
50
|
-
# should be searched for. Also contain paths specified by
|
51
|
-
# lib_path, lib_paths methods.
|
52
|
-
@mxx_required_lib_paths = Array.new
|
53
|
-
# Attribute showing that before return from mxx_required_lib_paths
|
54
|
-
# dublicates should be removed.
|
55
|
-
@mxx_required_lib_paths_changed = true
|
56
|
-
end
|
57
|
-
|
58
|
-
# Add the library required.
|
59
|
-
#
|
60
|
-
# Type of library must be detect implicitly.
|
61
|
-
#
|
62
|
-
# If a_path is other then nil, then it's value is added to the list
|
63
|
-
# of a folders, the libraries should be searched in.
|
64
|
-
def lib( a_library, a_path = nil )
|
65
|
-
mxx_add_required_lib(
|
66
|
-
BinaryLibrary.new( a_library, BinaryLibrary::ANY ) )
|
67
|
-
if a_path
|
68
|
-
mxx_add_required_lib_path( a_path )
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
# Add static library required.
|
73
|
-
#
|
74
|
-
# If a_path is other then nil, then it's value is added to the list
|
75
|
-
# of a folders, the libraries should be searched in.
|
76
|
-
def lib_static( a_library, a_path = nil )
|
77
|
-
mxx_add_required_lib(
|
78
|
-
BinaryLibrary.new( a_library, BinaryLibrary::STATIC ) )
|
79
|
-
if a_path
|
80
|
-
mxx_add_required_lib_path( a_path )
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
# Add shared library required.
|
85
|
-
#
|
86
|
-
# If a_path is other then nil, then it's value is added to the list
|
87
|
-
# of a folders, the libraries should be searched in.
|
88
|
-
def lib_shared( a_library, a_path = nil )
|
89
|
-
mxx_add_required_lib(
|
90
|
-
BinaryLibrary.new( a_library, BinaryLibrary::SHARED ) )
|
91
|
-
if a_path
|
92
|
-
mxx_add_required_lib_path( a_path )
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
# Get all libraries list, which are required to be linked to for
|
97
|
-
# correct usage of given target.
|
98
|
-
# Returns array of strings.
|
99
|
-
def mxx_required_libs
|
100
|
-
if @mxx_required_libs_changed
|
101
|
-
@mxx_required_libs.flatten!
|
102
|
-
BinaryTarget.check_libraries_types( prj_alias, @mxx_required_libs )
|
103
|
-
@mxx_required_libs_changed = false
|
104
|
-
end
|
105
|
-
return @mxx_required_libs
|
106
|
-
end
|
107
|
-
|
108
|
-
# Add library to list of requirements.
|
109
|
-
def mxx_add_required_lib( a_lib )
|
110
|
-
a_lib = BinaryLibrary.new( a_lib, BinaryLibrary::ANY ) if
|
111
|
-
a_lib.kind_of?( String )
|
112
|
-
|
113
|
-
@mxx_required_libs << a_lib
|
114
|
-
@mxx_required_libs_changed = true
|
115
|
-
end
|
116
|
-
|
117
|
-
# Plural form of mxx_add_required_lib.
|
118
|
-
define_plural_form_method :mxx_add_required_lib
|
119
|
-
|
120
|
-
# Get list of all paths to libraries, which should be used to search
|
121
|
-
# libraries, returned by mxx_required_libs method.
|
122
|
-
# Returns array of strings.
|
123
|
-
def mxx_required_lib_paths
|
124
|
-
if @mxx_required_lib_paths_changed
|
125
|
-
@mxx_required_lib_paths.flatten!
|
126
|
-
@mxx_required_lib_paths_changed = false
|
127
|
-
end
|
128
|
-
return @mxx_required_lib_paths
|
129
|
-
end
|
130
|
-
|
131
|
-
# Add folder to search folders list.
|
132
|
-
def mxx_add_required_lib_path( a_path )
|
133
|
-
@mxx_required_lib_paths << a_path
|
134
|
-
@mxx_required_lib_paths_changed = true
|
135
|
-
end
|
136
|
-
|
137
|
-
# Plural form of mxx_add_required_lib_path.
|
138
|
-
define_plural_form_method :mxx_add_required_lib_path
|
139
|
-
|
140
|
-
alias_method :lib_path, :mxx_add_required_lib_path
|
141
|
-
|
142
|
-
# Plural form of lib_path.
|
143
|
-
define_plural_form_method :lib_path
|
144
|
-
|
145
|
-
# Checks types of libraries. Should not exists two instance of
|
146
|
-
# same library with STATIC and SHARED types at one time.
|
147
|
-
#
|
148
|
-
# Raises BinaryLibraryTypeConflictEx if conflict detected.
|
149
|
-
def BinaryTarget.check_libraries_types( prj_alias, libs )
|
150
|
-
if libs.size
|
151
|
-
names_and_types = Hash.new( BinaryLibrary::ANY )
|
152
|
-
libs.each { |l|
|
153
|
-
k = names_and_types[ l.name ]
|
154
|
-
if BinaryLibrary::ANY != l.type
|
155
|
-
|
156
|
-
if BinaryLibrary::ANY != k
|
157
|
-
raise BinaryLibraryTypeConflictEx.new( prj_alias, l.name ) if
|
158
|
-
k != l.type
|
159
|
-
else
|
160
|
-
names_and_types[ l.name ] = l.type
|
161
|
-
end
|
162
|
-
|
163
|
-
end
|
164
|
-
}
|
165
|
-
end
|
166
|
-
end
|
167
|
-
|
168
|
-
end
|
169
|
-
|
170
|
-
# For compatilibily with previous versions.
|
171
|
-
Binary_target = BinaryTarget
|
172
|
-
|
173
|
-
end
|
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/abstract_target'
|
30
|
+
require 'mxx_ru/binary_library'
|
31
|
+
require 'mxx_ru/ex'
|
32
|
+
|
33
|
+
# Base class for all targets, which are binary executables, binary shared
|
34
|
+
# libraries or binary static libraries.
|
35
|
+
#
|
36
|
+
# In version v.1.3 extended by methods lib_path, lib_paths which are
|
37
|
+
# user-frendly synonyms for mxx_add_required_lib_path.
|
38
|
+
module MxxRu
|
39
|
+
|
40
|
+
class BinaryTarget < MxxRu::AbstractTarget
|
41
|
+
def initialize( a_prj_alias )
|
42
|
+
super( a_prj_alias )
|
43
|
+
|
44
|
+
# Libraries list, which would be required to the user of current target.
|
45
|
+
@mxx_required_libs = Array.new
|
46
|
+
# Attribute showing that before return from mxx_required_libs
|
47
|
+
# dublicates should be removed.
|
48
|
+
@mxx_required_libs_changed = true
|
49
|
+
# Folder list, where libraries, encountered in mxx_required_libs,
|
50
|
+
# should be searched for. Also contain paths specified by
|
51
|
+
# lib_path, lib_paths methods.
|
52
|
+
@mxx_required_lib_paths = Array.new
|
53
|
+
# Attribute showing that before return from mxx_required_lib_paths
|
54
|
+
# dublicates should be removed.
|
55
|
+
@mxx_required_lib_paths_changed = true
|
56
|
+
end
|
57
|
+
|
58
|
+
# Add the library required.
|
59
|
+
#
|
60
|
+
# Type of library must be detect implicitly.
|
61
|
+
#
|
62
|
+
# If a_path is other then nil, then it's value is added to the list
|
63
|
+
# of a folders, the libraries should be searched in.
|
64
|
+
def lib( a_library, a_path = nil )
|
65
|
+
mxx_add_required_lib(
|
66
|
+
BinaryLibrary.new( a_library, BinaryLibrary::ANY ) )
|
67
|
+
if a_path
|
68
|
+
mxx_add_required_lib_path( a_path )
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# Add static library required.
|
73
|
+
#
|
74
|
+
# If a_path is other then nil, then it's value is added to the list
|
75
|
+
# of a folders, the libraries should be searched in.
|
76
|
+
def lib_static( a_library, a_path = nil )
|
77
|
+
mxx_add_required_lib(
|
78
|
+
BinaryLibrary.new( a_library, BinaryLibrary::STATIC ) )
|
79
|
+
if a_path
|
80
|
+
mxx_add_required_lib_path( a_path )
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
# Add shared library required.
|
85
|
+
#
|
86
|
+
# If a_path is other then nil, then it's value is added to the list
|
87
|
+
# of a folders, the libraries should be searched in.
|
88
|
+
def lib_shared( a_library, a_path = nil )
|
89
|
+
mxx_add_required_lib(
|
90
|
+
BinaryLibrary.new( a_library, BinaryLibrary::SHARED ) )
|
91
|
+
if a_path
|
92
|
+
mxx_add_required_lib_path( a_path )
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
# Get all libraries list, which are required to be linked to for
|
97
|
+
# correct usage of given target.
|
98
|
+
# Returns array of strings.
|
99
|
+
def mxx_required_libs
|
100
|
+
if @mxx_required_libs_changed
|
101
|
+
@mxx_required_libs.flatten!
|
102
|
+
BinaryTarget.check_libraries_types( prj_alias, @mxx_required_libs )
|
103
|
+
@mxx_required_libs_changed = false
|
104
|
+
end
|
105
|
+
return @mxx_required_libs
|
106
|
+
end
|
107
|
+
|
108
|
+
# Add library to list of requirements.
|
109
|
+
def mxx_add_required_lib( a_lib )
|
110
|
+
a_lib = BinaryLibrary.new( a_lib, BinaryLibrary::ANY ) if
|
111
|
+
a_lib.kind_of?( String )
|
112
|
+
|
113
|
+
@mxx_required_libs << a_lib
|
114
|
+
@mxx_required_libs_changed = true
|
115
|
+
end
|
116
|
+
|
117
|
+
# Plural form of mxx_add_required_lib.
|
118
|
+
define_plural_form_method :mxx_add_required_lib
|
119
|
+
|
120
|
+
# Get list of all paths to libraries, which should be used to search
|
121
|
+
# libraries, returned by mxx_required_libs method.
|
122
|
+
# Returns array of strings.
|
123
|
+
def mxx_required_lib_paths
|
124
|
+
if @mxx_required_lib_paths_changed
|
125
|
+
@mxx_required_lib_paths.flatten!
|
126
|
+
@mxx_required_lib_paths_changed = false
|
127
|
+
end
|
128
|
+
return @mxx_required_lib_paths
|
129
|
+
end
|
130
|
+
|
131
|
+
# Add folder to search folders list.
|
132
|
+
def mxx_add_required_lib_path( a_path )
|
133
|
+
@mxx_required_lib_paths << a_path
|
134
|
+
@mxx_required_lib_paths_changed = true
|
135
|
+
end
|
136
|
+
|
137
|
+
# Plural form of mxx_add_required_lib_path.
|
138
|
+
define_plural_form_method :mxx_add_required_lib_path
|
139
|
+
|
140
|
+
alias_method :lib_path, :mxx_add_required_lib_path
|
141
|
+
|
142
|
+
# Plural form of lib_path.
|
143
|
+
define_plural_form_method :lib_path
|
144
|
+
|
145
|
+
# Checks types of libraries. Should not exists two instance of
|
146
|
+
# same library with STATIC and SHARED types at one time.
|
147
|
+
#
|
148
|
+
# Raises BinaryLibraryTypeConflictEx if conflict detected.
|
149
|
+
def BinaryTarget.check_libraries_types( prj_alias, libs )
|
150
|
+
if libs.size
|
151
|
+
names_and_types = Hash.new( BinaryLibrary::ANY )
|
152
|
+
libs.each { |l|
|
153
|
+
k = names_and_types[ l.name ]
|
154
|
+
if BinaryLibrary::ANY != l.type
|
155
|
+
|
156
|
+
if BinaryLibrary::ANY != k
|
157
|
+
raise BinaryLibraryTypeConflictEx.new( prj_alias, l.name ) if
|
158
|
+
k != l.type
|
159
|
+
else
|
160
|
+
names_and_types[ l.name ] = l.type
|
161
|
+
end
|
162
|
+
|
163
|
+
end
|
164
|
+
}
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
end
|
169
|
+
|
170
|
+
# For compatilibily with previous versions.
|
171
|
+
Binary_target = BinaryTarget
|
172
|
+
|
173
|
+
end
|