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.
Files changed (177) hide show
  1. data/COPYING +26 -26
  2. data/NEWS +107 -107
  3. data/README +21 -21
  4. data/Rakefile +56 -56
  5. data/examples/exe_and_lib/prj.rb +11 -11
  6. data/examples/exe_and_lib/say.rb +7 -7
  7. data/examples/exe_dll_lib/inout.rb +18 -18
  8. data/examples/exe_dll_lib/prj.rb +11 -11
  9. data/examples/exe_dll_lib/say.rb +9 -9
  10. data/examples/exe_dll_lib_2/build.rb +10 -10
  11. data/examples/exe_dll_lib_2/inout/prj.rb +16 -16
  12. data/examples/exe_dll_lib_2/main/prj.rb +9 -9
  13. data/examples/exe_dll_lib_2/say/prj.rb +8 -8
  14. data/examples/simple_exe/prj.rb +7 -7
  15. data/lib/mxx_ru/abstract_target.rb +335 -335
  16. data/lib/mxx_ru/binary_library.rb +106 -106
  17. data/lib/mxx_ru/binary_target.rb +173 -173
  18. data/lib/mxx_ru/binary_unittest.rb +143 -143
  19. data/lib/mxx_ru/compat.rb +33 -33
  20. data/lib/mxx_ru/cpp.rb +38 -38
  21. data/lib/mxx_ru/cpp/analyzer.rb +237 -237
  22. data/lib/mxx_ru/cpp/composite.rb +118 -118
  23. data/lib/mxx_ru/cpp/detect_toolset.rb +122 -122
  24. data/lib/mxx_ru/cpp/mode.rb +90 -90
  25. data/lib/mxx_ru/cpp/obj_placement.rb +330 -330
  26. data/lib/mxx_ru/cpp/obj_placements/custom_subdir.rb +155 -155
  27. data/lib/mxx_ru/cpp/qt.rb +366 -366
  28. data/lib/mxx_ru/cpp/rucodegen.rb +157 -157
  29. data/lib/mxx_ru/cpp/source_file.rb +79 -79
  30. data/lib/mxx_ru/cpp/target.rb +1523 -1523
  31. data/lib/mxx_ru/cpp/toolset.rb +1087 -1087
  32. data/lib/mxx_ru/cpp/toolsets/bcc_win32_5.rb +53 -53
  33. data/lib/mxx_ru/cpp/toolsets/bcc_win32_family.rb +460 -460
  34. data/lib/mxx_ru/cpp/toolsets/c89_etk_nsk.rb +59 -59
  35. data/lib/mxx_ru/cpp/toolsets/c89_nsk.rb +59 -59
  36. data/lib/mxx_ru/cpp/toolsets/c89_nsk_family.rb +277 -277
  37. data/lib/mxx_ru/cpp/toolsets/gcc_cygwin.rb +58 -58
  38. data/lib/mxx_ru/cpp/toolsets/gcc_family.rb +420 -420
  39. data/lib/mxx_ru/cpp/toolsets/gcc_linux.rb +64 -64
  40. data/lib/mxx_ru/cpp/toolsets/gcc_mingw.rb +149 -150
  41. data/lib/mxx_ru/cpp/toolsets/gcc_sparc_solaris.rb +91 -91
  42. data/lib/mxx_ru/cpp/toolsets/gcc_unix_family.rb +103 -103
  43. data/lib/mxx_ru/cpp/toolsets/vc7.rb +62 -62
  44. data/lib/mxx_ru/cpp/toolsets/vc8.rb +455 -455
  45. data/lib/mxx_ru/cpp/toolsets/vc_family.rb +448 -448
  46. data/lib/mxx_ru/ex.rb +165 -165
  47. data/lib/mxx_ru/makestyle_generator.rb +146 -146
  48. data/lib/mxx_ru/textfile_unittest.rb +303 -303
  49. data/lib/mxx_ru/util.rb +340 -340
  50. data/tests/c/pcre/chartables.c +183 -183
  51. data/tests/c/pcre/config.h +99 -99
  52. data/tests/c/pcre/dftables.c +167 -167
  53. data/tests/c/pcre/get.c +349 -349
  54. data/tests/c/pcre/internal.h +677 -677
  55. data/tests/c/pcre/maketables.c +140 -140
  56. data/tests/c/pcre/pcre.c +8304 -8304
  57. data/tests/c/pcre/pcre.h +193 -193
  58. data/tests/c/pcre/pcre.rb +14 -14
  59. data/tests/c/pcre/pcredemo.c +316 -316
  60. data/tests/c/pcre/pcregrep.c +642 -642
  61. data/tests/c/pcre/pcreposix.c +305 -305
  62. data/tests/c/pcre/pcreposix.h +88 -88
  63. data/tests/c/pcre/pcretest.c +1483 -1483
  64. data/tests/c/pcre/perltest +211 -211
  65. data/tests/c/pcre/printint.c +360 -360
  66. data/tests/c/pcre/study.c +472 -472
  67. data/tests/cpp/cpp_sources_glob/build.rb +7 -7
  68. data/tests/cpp/cpp_sources_glob/some/module/prj.rb +10 -10
  69. data/tests/cpp/cpp_sources_glob/tc_cpp_sources_glob.rb +18 -18
  70. data/tests/cpp/mswin_res_dll/build.rb +14 -14
  71. data/tests/cpp/mswin_res_dll/dll.cpp +17 -17
  72. data/tests/cpp/mswin_res_dll/dll.rb +29 -29
  73. data/tests/cpp/mswin_res_dll/dll.rc +48 -48
  74. data/tests/cpp/mswin_res_dll/h/dll.hpp +8 -8
  75. data/tests/cpp/mswin_res_dll/h/res.h +3 -3
  76. data/tests/cpp/mswin_res_dll/main.cpp +13 -13
  77. data/tests/cpp/mswin_res_dll/main.rb +19 -19
  78. data/tests/cpp/mswin_res_dll/o/dll.o +0 -0
  79. data/tests/cpp/mswin_res_dll/tc_mswin_res_dll.rb +18 -18
  80. data/tests/cpp/mswin_res_exe/build.rb +23 -23
  81. data/tests/cpp/mswin_res_exe/h/res.h +3 -3
  82. data/tests/cpp/mswin_res_exe/main.cpp +17 -17
  83. data/tests/cpp/mswin_res_exe/main.rc +48 -48
  84. data/tests/cpp/mswin_res_exe/o/main.o +0 -0
  85. data/tests/cpp/mswin_res_exe/tc_mswin_res_exe.rb +18 -18
  86. data/tests/cpp/rucodegen.embedded/host_config.cpp +32 -32
  87. data/tests/cpp/rucodegen.embedded/impl/conn_params.cpp +7 -7
  88. data/tests/cpp/rucodegen.embedded/impl/conn_params.rb +14 -14
  89. data/tests/cpp/rucodegen.embedded/impl/h/conn_params.hpp +10 -10
  90. data/tests/cpp/rucodegen.embedded/prj.rb +16 -16
  91. data/tests/cpp/rucodegen.embedded/tc_rucodegen.rb +18 -18
  92. data/tests/cpp/rucodegen/host_config.cpp +20 -20
  93. data/tests/cpp/rucodegen/host_config.rb +14 -14
  94. data/tests/cpp/rucodegen/impl/conn_params.cpp +7 -7
  95. data/tests/cpp/rucodegen/impl/conn_params.rb +14 -14
  96. data/tests/cpp/rucodegen/impl/h/conn_params.hpp +10 -10
  97. data/tests/cpp/rucodegen/prj.rb +16 -16
  98. data/tests/cpp/rucodegen/tc_rucodegen.rb +18 -18
  99. data/tests/cpp/textfile_unittest/build.rb +8 -8
  100. data/tests/cpp/textfile_unittest/etalons/out_1.txt +1 -1
  101. data/tests/cpp/textfile_unittest/etalons/out_128.txt +128 -128
  102. data/tests/cpp/textfile_unittest/main.cpp +89 -89
  103. data/tests/cpp/textfile_unittest/prj.rb +8 -8
  104. data/tests/cpp/textfile_unittest/prj.ut.rb +18 -18
  105. data/tests/cpp/textfile_unittest/tc_textfile_unittest.rb +18 -18
  106. data/tests/cpp/toolset_name.rb +6 -6
  107. data/tests/cpp/vc_cleanup/prj_dll_no_implib.rb +10 -10
  108. data/tests/cpp/vc_cleanup/prj_dll_no_implib_simple_target_root.rb +11 -11
  109. data/tests/cpp/vc_cleanup/prj_dll_with_implib.rb +11 -11
  110. data/tests/cpp/vc_cleanup/prj_dll_with_implib_simple_target_root.rb +14 -14
  111. data/tests/cpp/vc_cleanup/prj_exe_no_implib.rb +10 -10
  112. data/tests/cpp/vc_cleanup/prj_exe_no_implib_simple_target_root.rb +11 -11
  113. data/tests/cpp/vc_cleanup/prj_lib.rb +10 -10
  114. data/tests/cpp/vc_cleanup/prj_lib_with_simple_target_root.rb +11 -11
  115. data/tests/cpp/vc_cleanup/tc_vc_cleanup.rb +23 -23
  116. data/tests/mxx_ru/binary_library/tc_binary_library.rb +57 -57
  117. data/tests/mxx_ru/binary_library/tc_binary_target_lib_methods.rb +114 -114
  118. data/tests/mxx_ru/change_default_value/ignoring_by_build_root/build.rb +8 -8
  119. data/tests/mxx_ru/change_default_value/ignoring_by_build_root/child_1.rb +5 -5
  120. data/tests/mxx_ru/change_default_value/ignoring_by_child_1/build.rb +7 -7
  121. data/tests/mxx_ru/change_default_value/ignoring_by_child_1/child_1.rb +5 -5
  122. data/tests/mxx_ru/change_default_value/ignoring_by_child_1/child_2.rb +5 -5
  123. data/tests/mxx_ru/change_default_value/ok/build.rb +8 -8
  124. data/tests/mxx_ru/change_default_value/ok/child_1.rb +8 -8
  125. data/tests/mxx_ru/lib_path/build.rb +8 -8
  126. data/tests/mxx_ru/lib_path/bye.rb +8 -8
  127. data/tests/mxx_ru/lib_path/hi.rb +8 -8
  128. data/tests/mxx_ru/lib_path/main.rb +12 -12
  129. data/tests/mxx_ru/lib_path/tc_lib_path.rb +18 -18
  130. data/tests/mxx_ru/obj_placements/tc_custom_subdir.rb +58 -58
  131. data/tests/mxx_ru/opt_lib_ext/build.rb +7 -7
  132. data/tests/mxx_ru/opt_lib_ext/hi.rb +7 -7
  133. data/tests/mxx_ru/opt_lib_ext/tc_opt_lib_ext.rb +18 -18
  134. data/tests/mxx_ru/opt_lib_ext/test-no-ext.rb +9 -9
  135. data/tests/mxx_ru/opt_lib_ext/test-with-ext.rb +13 -13
  136. data/tests/mxx_ru/plural_form_methods/tc.rb +72 -72
  137. data/tests/mxx_ru/qt_gen/tc_uic_result_subdir.rb +76 -76
  138. data/tests/mxx_ru/target_ext/prj_dll.rb +8 -8
  139. data/tests/mxx_ru/target_ext/prj_exe.rb +8 -8
  140. data/tests/mxx_ru/target_ext/prj_lib.rb +8 -8
  141. data/tests/mxx_ru/target_ext/tc_target_ext.rb +24 -24
  142. data/tests/mxx_ru/tc_makestyle_generator.rb +117 -117
  143. data/tests/mxx_ru/vc8/tc_actual_manifest.rb +230 -230
  144. data/tests/mxx_ru/vc8/tc_append_mt_commands.rb +104 -104
  145. data/tests/mxx_ru/vc8/tc_default_manifest.rb +17 -17
  146. data/tests/mxx_ru/vc8/tc_define_manifest.rb +173 -173
  147. data/tests/mxx_ru/vc8/tc_drop_default_manifest.rb +16 -16
  148. data/tests/mxx_ru/vc8/tc_invalid_params.rb +81 -81
  149. data/tests/mxx_ru/vc8/ts_vc8.rb +10 -10
  150. data/tests/qt/aclock/aclock.cpp +148 -148
  151. data/tests/qt/aclock/aclock.h +45 -45
  152. data/tests/qt/aclock/main.cpp +28 -28
  153. data/tests/qt/aclock/prj.rb +21 -21
  154. data/tests/qt/iconview/main.cpp +76 -76
  155. data/tests/qt/iconview/prj.rb +21 -21
  156. data/tests/qt/toplevel/main.cpp +9 -9
  157. data/tests/qt/toplevel/options.ui +587 -587
  158. data/tests/qt/toplevel/prj.rb +22 -22
  159. data/tests/test_with_compilation.rb +110 -110
  160. data/tests/unix/lib_linking_mode/a_shared.rb +7 -7
  161. data/tests/unix/lib_linking_mode/a_static.rb +7 -7
  162. data/tests/unix/lib_linking_mode/etalon/shared.txt +2 -2
  163. data/tests/unix/lib_linking_mode/etalon/static.txt +2 -2
  164. data/tests/unix/lib_linking_mode/main_conflict.rb +12 -12
  165. data/tests/unix/lib_linking_mode/main_conflict_2.rb +11 -11
  166. data/tests/unix/lib_linking_mode/main_shared.rb +9 -9
  167. data/tests/unix/lib_linking_mode/main_shared.ut.rb +11 -11
  168. data/tests/unix/lib_linking_mode/main_shared_2.rb +10 -10
  169. data/tests/unix/lib_linking_mode/main_shared_2.ut.rb +11 -11
  170. data/tests/unix/lib_linking_mode/main_static.rb +9 -9
  171. data/tests/unix/lib_linking_mode/main_static.ut.rb +11 -11
  172. data/tests/unix/lib_linking_mode/main_static_2.rb +10 -10
  173. data/tests/unix/lib_linking_mode/main_static_2.ut.rb +11 -11
  174. data/tests/unix/lib_linking_mode/tc_conflicted_build.rb +18 -18
  175. data/tests/unix/lib_linking_mode/tc_normal_build.rb +18 -18
  176. data/tests/unix/lib_order/tc_normal_build.rb +16 -16
  177. metadata +216 -205
@@ -1,90 +1,90 @@
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 'singleton'
30
-
31
- module MxxRu
32
- module Cpp
33
-
34
- # Arguments passed into Ruby interpreter, intended to control MxxRu::Cpp.
35
- MXXCPPARG_RELEASE = "--mxx-cpp-release"
36
- MXXCPPARG_DEBUG = "--mxx-cpp-debug"
37
- MXXCPPARG_ONLY_ONE = "--mxx-cpp-1"
38
- MXXCPPARG_NO_DEPENDS_ANALYZER = "--mxx-cpp-no-depends-analyzer"
39
- MXXCPPARG_EXTRACT_OPTIONS = "--mxx-cpp-extract-options"
40
-
41
- # Class, detecting a mode of MxxRu::Cpp is running
42
- class Mode
43
- include Singleton
44
-
45
- attr_reader :is_release
46
- attr_reader :is_debug
47
- attr_reader :is_only_one
48
- attr_reader :is_no_depends_analyzer
49
- attr_reader :is_option_extraction
50
-
51
- # Constructor checks for a special arguments in a command line
52
- def initialize
53
- @is_release = ARGV.include?( MXXCPPARG_RELEASE )
54
- @is_debug = ARGV.include?( MXXCPPARG_DEBUG )
55
- @is_only_one = ARGV.include?( MXXCPPARG_ONLY_ONE )
56
- @is_no_depends_analyzer = ARGV.include?( MXXCPPARG_NO_DEPENDS_ANALYZER )
57
- @is_option_extraction = ARGV.include?( MXXCPPARG_EXTRACT_OPTIONS )
58
- @manual_dry_run_counter = 0
59
- end
60
-
61
- # It should be executed before build/clean of subprojects.
62
- # If is_only_one option is set and manual_dry_run_counter is equal to 0,
63
- # manual dry_run mode is activated.
64
- def before_subprj_processing
65
- if is_only_one
66
- if 0 == @manual_dry_run_counter
67
- MxxRu::Util::Mode.instance.manual_dry_run( true )
68
- end
69
- @manual_dry_run_counter += 1
70
- end
71
- end
72
-
73
- # It should be executed after build/clean of subprojects.
74
- # If is_only_one option is set and manual_dry_run_counter is equal to 0,
75
- # manual dry_run mode is activated.
76
- def after_subprj_processing
77
- if is_only_one
78
- @manual_dry_run_counter -= 1
79
- if 0 == @manual_dry_run_counter
80
- MxxRu::Util::Mode.instance.manual_dry_run( false )
81
- end
82
- end
83
- end
84
-
85
- end
86
-
87
- end # module Cpp
88
- end # module MxxRu
89
-
90
- load File.dirname( __FILE__ ) + '/../compat.rb'
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 'singleton'
30
+
31
+ module MxxRu
32
+ module Cpp
33
+
34
+ # Arguments passed into Ruby interpreter, intended to control MxxRu::Cpp.
35
+ MXXCPPARG_RELEASE = "--mxx-cpp-release"
36
+ MXXCPPARG_DEBUG = "--mxx-cpp-debug"
37
+ MXXCPPARG_ONLY_ONE = "--mxx-cpp-1"
38
+ MXXCPPARG_NO_DEPENDS_ANALYZER = "--mxx-cpp-no-depends-analyzer"
39
+ MXXCPPARG_EXTRACT_OPTIONS = "--mxx-cpp-extract-options"
40
+
41
+ # Class, detecting a mode of MxxRu::Cpp is running
42
+ class Mode
43
+ include Singleton
44
+
45
+ attr_reader :is_release
46
+ attr_reader :is_debug
47
+ attr_reader :is_only_one
48
+ attr_reader :is_no_depends_analyzer
49
+ attr_reader :is_option_extraction
50
+
51
+ # Constructor checks for a special arguments in a command line
52
+ def initialize
53
+ @is_release = ARGV.include?( MXXCPPARG_RELEASE )
54
+ @is_debug = ARGV.include?( MXXCPPARG_DEBUG )
55
+ @is_only_one = ARGV.include?( MXXCPPARG_ONLY_ONE )
56
+ @is_no_depends_analyzer = ARGV.include?( MXXCPPARG_NO_DEPENDS_ANALYZER )
57
+ @is_option_extraction = ARGV.include?( MXXCPPARG_EXTRACT_OPTIONS )
58
+ @manual_dry_run_counter = 0
59
+ end
60
+
61
+ # It should be executed before build/clean of subprojects.
62
+ # If is_only_one option is set and manual_dry_run_counter is equal to 0,
63
+ # manual dry_run mode is activated.
64
+ def before_subprj_processing
65
+ if is_only_one
66
+ if 0 == @manual_dry_run_counter
67
+ MxxRu::Util::Mode.instance.manual_dry_run( true )
68
+ end
69
+ @manual_dry_run_counter += 1
70
+ end
71
+ end
72
+
73
+ # It should be executed after build/clean of subprojects.
74
+ # If is_only_one option is set and manual_dry_run_counter is equal to 0,
75
+ # manual dry_run mode is activated.
76
+ def after_subprj_processing
77
+ if is_only_one
78
+ @manual_dry_run_counter -= 1
79
+ if 0 == @manual_dry_run_counter
80
+ MxxRu::Util::Mode.instance.manual_dry_run( false )
81
+ end
82
+ end
83
+ end
84
+
85
+ end
86
+
87
+ end # module Cpp
88
+ end # module MxxRu
89
+
90
+ load File.dirname( __FILE__ ) + '/../compat.rb'
@@ -1,330 +1,330 @@
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
- module Cpp
34
-
35
- # Base class for a folder name generator.
36
- # Results of compilation and linking would be located in that folder.
37
- class ObjPlacement
38
- # Method, that returns the name of a folder, object file would be located in.
39
- #
40
- # [_source_path_name_] Folder name, where source file located is.
41
- # [_toolset_] Current toolset.
42
- # [_target_] Current target.
43
- def get_obj(
44
- source_path_name,
45
- toolset,
46
- target )
47
-
48
- raise AbstractMethodEx.new(
49
- "MxxRu::Cpp::ObjPlacement::get_obj" )
50
- end
51
-
52
- # Method, that returns the name of a folder,
53
- # compiled mswin-resource file would be located in.
54
- #
55
- # [_source_path_name_] Folder name, where source file located is.
56
- # [_toolset_] Current toolset.
57
- # [_target_] Current target.
58
- def get_mswin_res(
59
- source_path_name,
60
- toolset,
61
- target )
62
-
63
- raise AbstractMethodEx.new(
64
- "MxxRu::Cpp::ObjPlacement::get_mswin_res" )
65
- end
66
-
67
- # Method, that returns the name of a folder,
68
- # static library file would be located in.
69
- #
70
- # [_source_path_name_] Folder name, where source file located is.
71
- # [_toolset_] Current toolset.
72
- # [_target_] Current target.
73
- def get_lib(
74
- source_path_name,
75
- toolset,
76
- target )
77
-
78
- raise AbstractMethodEx.new(
79
- "MxxRu::Cpp::ObjPlacement::get_lib" )
80
- end
81
-
82
- # Method, that returns the name of a folder,
83
- # shared library file would be located in.
84
- #
85
- # [_source_path_name_] Folder name, where source file located is.
86
- # [_toolset_] Current toolset.
87
- # [_target_] Current target.
88
- def get_dll(
89
- source_path_name,
90
- toolset,
91
- target )
92
-
93
- raise AbstractMethodEx.new(
94
- "MxxRu::Cpp::ObjPlacement::get_dll" )
95
- end
96
-
97
- # Method, that returns the name of a folder,
98
- # executable file would be located in.
99
- #
100
- # [_source_path_name_] Folder name, where source file located is.
101
- # [_toolset_] Current toolset.
102
- # [_target_] Current target.
103
- def get_exe(
104
- source_path_name,
105
- toolset,
106
- target )
107
-
108
- raise AbstractMethodEx.new(
109
- "MxxRu::Cpp::ObjPlacement::get_exe" )
110
- end
111
- end # class ObjPlacement
112
-
113
- # For compatibility with previous versions.
114
- Obj_placement = ObjPlacement
115
-
116
- # The generator of folder name for an object file,
117
- # using a subfolder with a fixed name in a folder with source file.
118
- # Folder for lib, dll and exe files are not modified.
119
- # get_obj and get_mswin_res methods are checking if result folder exists.
120
- # If it's not, they are trying to create it.
121
- class SourceSubdirObjPlacement < ObjPlacement
122
- attr :subdir
123
-
124
- def initialize( a_subdir = "o" )
125
- # The name of subfolder, object files should be located in.
126
- @subdir = a_subdir.clone
127
- end
128
-
129
- def get_obj(
130
- source_path_name,
131
- toolset,
132
- target )
133
-
134
- result = File.join( source_path_name, subdir )
135
- MxxRu::Util.ensure_path_exists( result )
136
-
137
- return result
138
- end
139
-
140
- def get_mswin_res(
141
- source_path_name,
142
- toolset,
143
- target )
144
-
145
- result = File.join( source_path_name, subdir )
146
- MxxRu::Util.ensure_path_exists( result )
147
-
148
- return result
149
- end
150
-
151
- def get_lib(
152
- source_path_name,
153
- toolset,
154
- target )
155
-
156
- return String.new( source_path_name )
157
- end
158
-
159
- def get_dll(
160
- source_path_name,
161
- toolset,
162
- target )
163
-
164
- return String.new( source_path_name )
165
- end
166
-
167
- def get_exe(
168
- source_path_name,
169
- toolset,
170
- target )
171
-
172
- return String.new( source_path_name )
173
- end
174
-
175
- end # class SourceSubdirObjPlacement
176
-
177
- # For compatibility with previous versions.
178
- Source_subdir_obj_placement = SourceSubdirObjPlacement
179
-
180
- # The generator of folder name for compilation results,
181
- # building a hierarchy of subfolders in a special folder,
182
- # which name is choosen based on runtime mode.
183
- #
184
- # For example, let src/lib/l.cpp and src/main/m.cpp files would be
185
- # the sources of lib/l.lib library and m.exe application.
186
- # If project is compiled in RELEASE mode, then following files
187
- # would be created: release/src/lib/l.obj, release/src/main/m.obj,
188
- # release/lib/l.lib and release/m.exe.
189
- # Thus the presence of subfolders required will be supervised
190
- # (for example, release/src/lib, release/src/main,...).
191
- # If some subfolder doesn't exist, it will be created.
192
- #
193
- # An example of usage:
194
- #
195
- # class Build < MxxRu::Cpp::Composite_target
196
- # def initialize( a_alias = MxxRu::BUILD_ROOT )
197
- # global_obj_placement(
198
- # MxxRu::Cpp::RuntimeSubdirObjPlacement.new(
199
- # "output" ) )
200
- #
201
- # required_prj( "src/lib/prj.rb" )
202
- # required_prj( "src/main/prj.rb" )
203
- # end
204
- # end
205
- #
206
- class RuntimeSubdirObjPlacement < ObjPlacement
207
- # Folder name, where subfolders for exact runtime-modes
208
- # will be created.
209
- attr_reader :root_dir
210
- # A name of subfolder, which will ve created in a root_dir
211
- # for MxxRu::Cpp::RUNTIME_DEBUG mode.
212
- attr_reader :debug_subdir
213
- # A name of subfolder, which will ve created in a root_dir
214
- # for MxxRu::Cpp::RUNTIME_DEFAULT mode.
215
- attr_reader :default_subdir
216
- # A name of subfolder, which will ve created in a root_dir
217
- # for MxxRu::Cpp::RUNTIME_RELEASE mode.
218
- attr_reader :release_subdir
219
-
220
- # a_root_dir A folder, where subfolders for exact runtime-modes
221
- # will be created. If contains nil, subfolders are created in
222
- # current folder.
223
- #
224
- # [_a_debug_subdir_] Subfolder name for MxxRu::Cpp::RUNTIME_DEBUG mode.
225
- # [_a_default_subdir_] Subfolder name for MxxRu::Cpp::RUNTIME_DEFAULT mode.
226
- # [_a_release_subdir_] Subfolder name for MxxRu::Cpp::RUNTIME_RELEASE mode.
227
- def initialize(
228
- a_root_dir = nil,
229
- a_debug_subdir = "debug",
230
- a_default_subdir = "default",
231
- a_release_subdir = "release" )
232
-
233
- if a_root_dir
234
- @root_dir = a_root_dir
235
- else
236
- @root_dir = "./"
237
- end
238
-
239
- @debug_subdir = a_debug_subdir
240
- @default_subdir = a_default_subdir
241
- @release_subdir = a_release_subdir
242
- end
243
-
244
- # It's the only method running something.
245
- def get_obj(
246
- source_path_name,
247
- toolset,
248
- target )
249
-
250
- if source_path_name &&
251
- "" != source_path_name &&
252
- "." != source_path_name
253
- result = File.join( @root_dir, runtime_mode_path( target ),
254
- source_path_name )
255
- else
256
- result = File.join( @root_dir, runtime_mode_path( target ) )
257
- end
258
-
259
- MxxRu::Util.ensure_path_exists( result )
260
-
261
- return result
262
- end
263
-
264
- # Returns result of get_obj method.
265
- def get_mswin_res(
266
- source_path_name,
267
- toolset,
268
- target )
269
-
270
- return get_obj( source_path_name, toolset, target )
271
- end
272
-
273
- # Returns result of get_obj method.
274
- def get_lib(
275
- source_path_name,
276
- toolset,
277
- target )
278
-
279
- return get_obj( source_path_name, toolset, target )
280
- end
281
-
282
- # Returns result of get_obj method.
283
- def get_dll(
284
- source_path_name,
285
- toolset,
286
- target )
287
-
288
- return get_obj( source_path_name, toolset, target )
289
- end
290
-
291
- # Returns result of get_obj method.
292
- def get_exe(
293
- source_path_name,
294
- toolset,
295
- target )
296
-
297
- return get_obj( source_path_name, toolset, target )
298
- end
299
-
300
- protected
301
- # Returns folder name, which is used for target's runtime mode.
302
- #
303
- # [_a_target_] Target, actions are performed for.
304
- def runtime_mode_path( a_target )
305
- case a_target.mxx_runtime_mode
306
- when MxxRu::Cpp::RUNTIME_DEBUG
307
- return @debug_subdir
308
-
309
- when MxxRu::Cpp::RUNTIME_RELEASE
310
- return @release_subdir
311
-
312
- else
313
- return @default_subdir
314
- end
315
- end
316
-
317
- end # class RuntimeSubdirObjPlacement
318
-
319
- # For compatibility with older versions.
320
- Runtime_subdir_obj_placement = RuntimeSubdirObjPlacement
321
-
322
- # Creation of obj_placement object, which should be used by default.
323
- def Cpp.default_obj_placement
324
- return SourceSubdirObjPlacement.new
325
- end
326
-
327
- end # module Cpp
328
-
329
- end # module MxxRu
330
-
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
+ module Cpp
34
+
35
+ # Base class for a folder name generator.
36
+ # Results of compilation and linking would be located in that folder.
37
+ class ObjPlacement
38
+ # Method, that returns the name of a folder, object file would be located in.
39
+ #
40
+ # [_source_path_name_] Folder name, where source file located is.
41
+ # [_toolset_] Current toolset.
42
+ # [_target_] Current target.
43
+ def get_obj(
44
+ source_path_name,
45
+ toolset,
46
+ target )
47
+
48
+ raise AbstractMethodEx.new(
49
+ "MxxRu::Cpp::ObjPlacement::get_obj" )
50
+ end
51
+
52
+ # Method, that returns the name of a folder,
53
+ # compiled mswin-resource file would be located in.
54
+ #
55
+ # [_source_path_name_] Folder name, where source file located is.
56
+ # [_toolset_] Current toolset.
57
+ # [_target_] Current target.
58
+ def get_mswin_res(
59
+ source_path_name,
60
+ toolset,
61
+ target )
62
+
63
+ raise AbstractMethodEx.new(
64
+ "MxxRu::Cpp::ObjPlacement::get_mswin_res" )
65
+ end
66
+
67
+ # Method, that returns the name of a folder,
68
+ # static library file would be located in.
69
+ #
70
+ # [_source_path_name_] Folder name, where source file located is.
71
+ # [_toolset_] Current toolset.
72
+ # [_target_] Current target.
73
+ def get_lib(
74
+ source_path_name,
75
+ toolset,
76
+ target )
77
+
78
+ raise AbstractMethodEx.new(
79
+ "MxxRu::Cpp::ObjPlacement::get_lib" )
80
+ end
81
+
82
+ # Method, that returns the name of a folder,
83
+ # shared library file would be located in.
84
+ #
85
+ # [_source_path_name_] Folder name, where source file located is.
86
+ # [_toolset_] Current toolset.
87
+ # [_target_] Current target.
88
+ def get_dll(
89
+ source_path_name,
90
+ toolset,
91
+ target )
92
+
93
+ raise AbstractMethodEx.new(
94
+ "MxxRu::Cpp::ObjPlacement::get_dll" )
95
+ end
96
+
97
+ # Method, that returns the name of a folder,
98
+ # executable file would be located in.
99
+ #
100
+ # [_source_path_name_] Folder name, where source file located is.
101
+ # [_toolset_] Current toolset.
102
+ # [_target_] Current target.
103
+ def get_exe(
104
+ source_path_name,
105
+ toolset,
106
+ target )
107
+
108
+ raise AbstractMethodEx.new(
109
+ "MxxRu::Cpp::ObjPlacement::get_exe" )
110
+ end
111
+ end # class ObjPlacement
112
+
113
+ # For compatibility with previous versions.
114
+ Obj_placement = ObjPlacement
115
+
116
+ # The generator of folder name for an object file,
117
+ # using a subfolder with a fixed name in a folder with source file.
118
+ # Folder for lib, dll and exe files are not modified.
119
+ # get_obj and get_mswin_res methods are checking if result folder exists.
120
+ # If it's not, they are trying to create it.
121
+ class SourceSubdirObjPlacement < ObjPlacement
122
+ attr :subdir
123
+
124
+ def initialize( a_subdir = "o" )
125
+ # The name of subfolder, object files should be located in.
126
+ @subdir = a_subdir.clone
127
+ end
128
+
129
+ def get_obj(
130
+ source_path_name,
131
+ toolset,
132
+ target )
133
+
134
+ result = File.join( source_path_name, subdir )
135
+ MxxRu::Util.ensure_path_exists( result )
136
+
137
+ return result
138
+ end
139
+
140
+ def get_mswin_res(
141
+ source_path_name,
142
+ toolset,
143
+ target )
144
+
145
+ result = File.join( source_path_name, subdir )
146
+ MxxRu::Util.ensure_path_exists( result )
147
+
148
+ return result
149
+ end
150
+
151
+ def get_lib(
152
+ source_path_name,
153
+ toolset,
154
+ target )
155
+
156
+ return String.new( source_path_name )
157
+ end
158
+
159
+ def get_dll(
160
+ source_path_name,
161
+ toolset,
162
+ target )
163
+
164
+ return String.new( source_path_name )
165
+ end
166
+
167
+ def get_exe(
168
+ source_path_name,
169
+ toolset,
170
+ target )
171
+
172
+ return String.new( source_path_name )
173
+ end
174
+
175
+ end # class SourceSubdirObjPlacement
176
+
177
+ # For compatibility with previous versions.
178
+ Source_subdir_obj_placement = SourceSubdirObjPlacement
179
+
180
+ # The generator of folder name for compilation results,
181
+ # building a hierarchy of subfolders in a special folder,
182
+ # which name is choosen based on runtime mode.
183
+ #
184
+ # For example, let src/lib/l.cpp and src/main/m.cpp files would be
185
+ # the sources of lib/l.lib library and m.exe application.
186
+ # If project is compiled in RELEASE mode, then following files
187
+ # would be created: release/src/lib/l.obj, release/src/main/m.obj,
188
+ # release/lib/l.lib and release/m.exe.
189
+ # Thus the presence of subfolders required will be supervised
190
+ # (for example, release/src/lib, release/src/main,...).
191
+ # If some subfolder doesn't exist, it will be created.
192
+ #
193
+ # An example of usage:
194
+ #
195
+ # class Build < MxxRu::Cpp::Composite_target
196
+ # def initialize( a_alias = MxxRu::BUILD_ROOT )
197
+ # global_obj_placement(
198
+ # MxxRu::Cpp::RuntimeSubdirObjPlacement.new(
199
+ # "output" ) )
200
+ #
201
+ # required_prj( "src/lib/prj.rb" )
202
+ # required_prj( "src/main/prj.rb" )
203
+ # end
204
+ # end
205
+ #
206
+ class RuntimeSubdirObjPlacement < ObjPlacement
207
+ # Folder name, where subfolders for exact runtime-modes
208
+ # will be created.
209
+ attr_reader :root_dir
210
+ # A name of subfolder, which will ve created in a root_dir
211
+ # for MxxRu::Cpp::RUNTIME_DEBUG mode.
212
+ attr_reader :debug_subdir
213
+ # A name of subfolder, which will ve created in a root_dir
214
+ # for MxxRu::Cpp::RUNTIME_DEFAULT mode.
215
+ attr_reader :default_subdir
216
+ # A name of subfolder, which will ve created in a root_dir
217
+ # for MxxRu::Cpp::RUNTIME_RELEASE mode.
218
+ attr_reader :release_subdir
219
+
220
+ # a_root_dir A folder, where subfolders for exact runtime-modes
221
+ # will be created. If contains nil, subfolders are created in
222
+ # current folder.
223
+ #
224
+ # [_a_debug_subdir_] Subfolder name for MxxRu::Cpp::RUNTIME_DEBUG mode.
225
+ # [_a_default_subdir_] Subfolder name for MxxRu::Cpp::RUNTIME_DEFAULT mode.
226
+ # [_a_release_subdir_] Subfolder name for MxxRu::Cpp::RUNTIME_RELEASE mode.
227
+ def initialize(
228
+ a_root_dir = nil,
229
+ a_debug_subdir = "debug",
230
+ a_default_subdir = "default",
231
+ a_release_subdir = "release" )
232
+
233
+ if a_root_dir
234
+ @root_dir = a_root_dir
235
+ else
236
+ @root_dir = "./"
237
+ end
238
+
239
+ @debug_subdir = a_debug_subdir
240
+ @default_subdir = a_default_subdir
241
+ @release_subdir = a_release_subdir
242
+ end
243
+
244
+ # It's the only method running something.
245
+ def get_obj(
246
+ source_path_name,
247
+ toolset,
248
+ target )
249
+
250
+ if source_path_name &&
251
+ "" != source_path_name &&
252
+ "." != source_path_name
253
+ result = File.join( @root_dir, runtime_mode_path( target ),
254
+ source_path_name )
255
+ else
256
+ result = File.join( @root_dir, runtime_mode_path( target ) )
257
+ end
258
+
259
+ MxxRu::Util.ensure_path_exists( result )
260
+
261
+ return result
262
+ end
263
+
264
+ # Returns result of get_obj method.
265
+ def get_mswin_res(
266
+ source_path_name,
267
+ toolset,
268
+ target )
269
+
270
+ return get_obj( source_path_name, toolset, target )
271
+ end
272
+
273
+ # Returns result of get_obj method.
274
+ def get_lib(
275
+ source_path_name,
276
+ toolset,
277
+ target )
278
+
279
+ return get_obj( source_path_name, toolset, target )
280
+ end
281
+
282
+ # Returns result of get_obj method.
283
+ def get_dll(
284
+ source_path_name,
285
+ toolset,
286
+ target )
287
+
288
+ return get_obj( source_path_name, toolset, target )
289
+ end
290
+
291
+ # Returns result of get_obj method.
292
+ def get_exe(
293
+ source_path_name,
294
+ toolset,
295
+ target )
296
+
297
+ return get_obj( source_path_name, toolset, target )
298
+ end
299
+
300
+ protected
301
+ # Returns folder name, which is used for target's runtime mode.
302
+ #
303
+ # [_a_target_] Target, actions are performed for.
304
+ def runtime_mode_path( a_target )
305
+ case a_target.mxx_runtime_mode
306
+ when MxxRu::Cpp::RUNTIME_DEBUG
307
+ return @debug_subdir
308
+
309
+ when MxxRu::Cpp::RUNTIME_RELEASE
310
+ return @release_subdir
311
+
312
+ else
313
+ return @default_subdir
314
+ end
315
+ end
316
+
317
+ end # class RuntimeSubdirObjPlacement
318
+
319
+ # For compatibility with older versions.
320
+ Runtime_subdir_obj_placement = RuntimeSubdirObjPlacement
321
+
322
+ # Creation of obj_placement object, which should be used by default.
323
+ def Cpp.default_obj_placement
324
+ return SourceSubdirObjPlacement.new
325
+ end
326
+
327
+ end # module Cpp
328
+
329
+ end # module MxxRu
330
+