Mxx_ru 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (147) hide show
  1. data/COPYING +26 -0
  2. data/NEWS +52 -0
  3. data/README +21 -0
  4. data/Rakefile +32 -0
  5. data/examples/exe_and_lib/main.cpp +15 -0
  6. data/examples/exe_and_lib/prj.rb +11 -0
  7. data/examples/exe_and_lib/say.cpp +13 -0
  8. data/examples/exe_and_lib/say.hpp +11 -0
  9. data/examples/exe_and_lib/say.rb +7 -0
  10. data/examples/exe_dll_lib/inout.cpp +15 -0
  11. data/examples/exe_dll_lib/inout.hpp +26 -0
  12. data/examples/exe_dll_lib/inout.rb +18 -0
  13. data/examples/exe_dll_lib/main.cpp +23 -0
  14. data/examples/exe_dll_lib/prj.rb +11 -0
  15. data/examples/exe_dll_lib/say.cpp +13 -0
  16. data/examples/exe_dll_lib/say.hpp +12 -0
  17. data/examples/exe_dll_lib/say.rb +9 -0
  18. data/examples/exe_dll_lib_2/build.rb +7 -0
  19. data/examples/exe_dll_lib_2/inout/inout.cpp +15 -0
  20. data/examples/exe_dll_lib_2/inout/inout.hpp +26 -0
  21. data/examples/exe_dll_lib_2/inout/prj.rb +16 -0
  22. data/examples/exe_dll_lib_2/main/main.cpp +23 -0
  23. data/examples/exe_dll_lib_2/main/prj.rb +9 -0
  24. data/examples/exe_dll_lib_2/say/prj.rb +8 -0
  25. data/examples/exe_dll_lib_2/say/say.cpp +13 -0
  26. data/examples/exe_dll_lib_2/say/say.hpp +12 -0
  27. data/examples/simple_exe/main.cpp +26 -0
  28. data/examples/simple_exe/prj.rb +7 -0
  29. data/lib/mxx_ru/abstract_target.rb +283 -0
  30. data/lib/mxx_ru/binary_target.rb +89 -0
  31. data/lib/mxx_ru/binary_unittest.rb +130 -0
  32. data/lib/mxx_ru/cpp/analyzer.rb +230 -0
  33. data/lib/mxx_ru/cpp/composite.rb +106 -0
  34. data/lib/mxx_ru/cpp/detect_toolset.rb +122 -0
  35. data/lib/mxx_ru/cpp/mode.rb +85 -0
  36. data/lib/mxx_ru/cpp/obj_placement.rb +321 -0
  37. data/lib/mxx_ru/cpp/qt.rb +333 -0
  38. data/lib/mxx_ru/cpp/rucodegen.rb +114 -0
  39. data/lib/mxx_ru/cpp/source_file.rb +71 -0
  40. data/lib/mxx_ru/cpp/target.rb +1371 -0
  41. data/lib/mxx_ru/cpp/toolset.rb +1029 -0
  42. data/lib/mxx_ru/cpp/toolsets/bcc_win32_5.rb +52 -0
  43. data/lib/mxx_ru/cpp/toolsets/bcc_win32_family.rb +451 -0
  44. data/lib/mxx_ru/cpp/toolsets/c89_etk_nsk.rb +56 -0
  45. data/lib/mxx_ru/cpp/toolsets/c89_nsk.rb +56 -0
  46. data/lib/mxx_ru/cpp/toolsets/c89_nsk_family.rb +273 -0
  47. data/lib/mxx_ru/cpp/toolsets/gcc_cygwin.rb +54 -0
  48. data/lib/mxx_ru/cpp/toolsets/gcc_family.rb +382 -0
  49. data/lib/mxx_ru/cpp/toolsets/gcc_linux.rb +60 -0
  50. data/lib/mxx_ru/cpp/toolsets/gcc_mingw.rb +144 -0
  51. data/lib/mxx_ru/cpp/toolsets/gcc_sparc_solaris.rb +87 -0
  52. data/lib/mxx_ru/cpp/toolsets/vc7.rb +62 -0
  53. data/lib/mxx_ru/cpp/toolsets/vc8.rb +452 -0
  54. data/lib/mxx_ru/cpp/toolsets/vc_family.rb +428 -0
  55. data/lib/mxx_ru/cpp.rb +36 -0
  56. data/lib/mxx_ru/ex.rb +134 -0
  57. data/lib/mxx_ru/makestyle_generator.rb +138 -0
  58. data/lib/mxx_ru/textfile_unittest.rb +284 -0
  59. data/lib/mxx_ru/util.rb +258 -0
  60. data/tests/c/pcre/chartables.c +183 -0
  61. data/tests/c/pcre/config.h +99 -0
  62. data/tests/c/pcre/dftables.c +167 -0
  63. data/tests/c/pcre/get.c +349 -0
  64. data/tests/c/pcre/internal.h +677 -0
  65. data/tests/c/pcre/maketables.c +140 -0
  66. data/tests/c/pcre/pcre.c +8304 -0
  67. data/tests/c/pcre/pcre.h +193 -0
  68. data/tests/c/pcre/pcre.rb +14 -0
  69. data/tests/c/pcre/pcredemo.c +316 -0
  70. data/tests/c/pcre/pcregrep.c +642 -0
  71. data/tests/c/pcre/pcreposix.c +305 -0
  72. data/tests/c/pcre/pcreposix.h +88 -0
  73. data/tests/c/pcre/pcretest.c +1483 -0
  74. data/tests/c/pcre/perltest +211 -0
  75. data/tests/c/pcre/printint.c +360 -0
  76. data/tests/c/pcre/study.c +472 -0
  77. data/tests/cpp/mswin_res_dll/build.rb +14 -0
  78. data/tests/cpp/mswin_res_dll/dll.cpp +17 -0
  79. data/tests/cpp/mswin_res_dll/dll.rb +30 -0
  80. data/tests/cpp/mswin_res_dll/dll.rc +48 -0
  81. data/tests/cpp/mswin_res_dll/h/dll.hpp +8 -0
  82. data/tests/cpp/mswin_res_dll/h/res.h +3 -0
  83. data/tests/cpp/mswin_res_dll/main.cpp +13 -0
  84. data/tests/cpp/mswin_res_dll/main.rb +20 -0
  85. data/tests/cpp/mswin_res_dll/res/tree_fol.bmp +0 -0
  86. data/tests/cpp/mswin_res_dll/res/tree_state_1.bmp +0 -0
  87. data/tests/cpp/mswin_res_dll/res/tree_state_2.bmp +0 -0
  88. data/tests/cpp/mswin_res_exe/build.rb +23 -0
  89. data/tests/cpp/mswin_res_exe/h/res.h +3 -0
  90. data/tests/cpp/mswin_res_exe/main.cpp +17 -0
  91. data/tests/cpp/mswin_res_exe/main.rc +48 -0
  92. data/tests/cpp/mswin_res_exe/res/tree_fol.bmp +0 -0
  93. data/tests/cpp/mswin_res_exe/res/tree_state_1.bmp +0 -0
  94. data/tests/cpp/mswin_res_exe/res/tree_state_2.bmp +0 -0
  95. data/tests/cpp/rucodegen/host_config.cpp +20 -0
  96. data/tests/cpp/rucodegen/host_config.rb +14 -0
  97. data/tests/cpp/rucodegen/impl/conn_params.cpp +7 -0
  98. data/tests/cpp/rucodegen/impl/conn_params.rb +14 -0
  99. data/tests/cpp/rucodegen/impl/h/conn_params.hpp +10 -0
  100. data/tests/cpp/rucodegen/prj.rb +17 -0
  101. data/tests/cpp/textfile_unittest/build.rb +8 -0
  102. data/tests/cpp/textfile_unittest/etalons/out_0.txt +0 -0
  103. data/tests/cpp/textfile_unittest/etalons/out_1.txt +1 -0
  104. data/tests/cpp/textfile_unittest/etalons/out_128.txt +128 -0
  105. data/tests/cpp/textfile_unittest/main.cpp +89 -0
  106. data/tests/cpp/textfile_unittest/prj.rb +8 -0
  107. data/tests/cpp/textfile_unittest/prj.ut.rb +18 -0
  108. data/tests/cpp/toolset_name.rb +6 -0
  109. data/tests/cpp/vc_cleanup/cout.log +72 -0
  110. data/tests/cpp/vc_cleanup/dll_hi.cpp +5 -0
  111. data/tests/cpp/vc_cleanup/exe_hi.cpp +10 -0
  112. data/tests/cpp/vc_cleanup/lib_hi.cpp +5 -0
  113. data/tests/cpp/vc_cleanup/prj_dll_no_implib.rb +10 -0
  114. data/tests/cpp/vc_cleanup/prj_dll_no_implib_simple_target_root.rb +11 -0
  115. data/tests/cpp/vc_cleanup/prj_dll_with_implib.rb +11 -0
  116. data/tests/cpp/vc_cleanup/prj_dll_with_implib_simple_target_root.rb +14 -0
  117. data/tests/cpp/vc_cleanup/prj_exe_no_implib.rb +10 -0
  118. data/tests/cpp/vc_cleanup/prj_exe_no_implib_simple_target_root.rb +11 -0
  119. data/tests/cpp/vc_cleanup/prj_lib.rb +10 -0
  120. data/tests/cpp/vc_cleanup/prj_lib_with_simple_target_root.rb +11 -0
  121. data/tests/cpp/vc_cleanup/tc_vc_cleanup.rb +60 -0
  122. data/tests/mxx_ru/change_default_value/ignoring_by_build_root/build.rb +8 -0
  123. data/tests/mxx_ru/change_default_value/ignoring_by_build_root/child_1.rb +5 -0
  124. data/tests/mxx_ru/change_default_value/ignoring_by_child_1/build.rb +7 -0
  125. data/tests/mxx_ru/change_default_value/ignoring_by_child_1/child_1.rb +5 -0
  126. data/tests/mxx_ru/change_default_value/ignoring_by_child_1/child_2.rb +5 -0
  127. data/tests/mxx_ru/change_default_value/ok/build.rb +8 -0
  128. data/tests/mxx_ru/change_default_value/ok/child_1.rb +8 -0
  129. data/tests/mxx_ru/tc_makestyle_generator.rb +117 -0
  130. data/tests/mxx_ru/vc8/tc_actual_manifest.rb +230 -0
  131. data/tests/mxx_ru/vc8/tc_append_mt_commands.rb +104 -0
  132. data/tests/mxx_ru/vc8/tc_default_manifest.rb +17 -0
  133. data/tests/mxx_ru/vc8/tc_define_manifest.rb +173 -0
  134. data/tests/mxx_ru/vc8/tc_drop_default_manifest.rb +16 -0
  135. data/tests/mxx_ru/vc8/tc_invalid_params.rb +81 -0
  136. data/tests/mxx_ru/vc8/ts_vc8.rb +10 -0
  137. data/tests/qt/aclock/aclock.cpp +148 -0
  138. data/tests/qt/aclock/aclock.h +45 -0
  139. data/tests/qt/aclock/main.cpp +28 -0
  140. data/tests/qt/aclock/prj.rb +21 -0
  141. data/tests/qt/iconview/main.cpp +76 -0
  142. data/tests/qt/iconview/prj.rb +21 -0
  143. data/tests/qt/toplevel/main.cpp +9 -0
  144. data/tests/qt/toplevel/options.ui +587 -0
  145. data/tests/qt/toplevel/options.ui.h +98 -0
  146. data/tests/qt/toplevel/prj.rb +21 -0
  147. metadata +241 -0
@@ -0,0 +1,273 @@
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/toolset'
30
+
31
+ module Mxx_ru
32
+ module Cpp
33
+ module Toolsets
34
+
35
+ # Toolset implemetation for c89 NonStopKernel.
36
+ class C89_nsk_family < Mxx_ru::Cpp::Toolset
37
+ public
38
+ # Tag name, points to target platform is
39
+ # Open System Services on NonStopKernel.
40
+ TANDEM_OSS = "tandem_oss"
41
+
42
+ def initialize( a_name )
43
+ super( a_name )
44
+ end
45
+
46
+ # Returns C compiler name
47
+ def c_compiler_name
48
+ return "c89"
49
+ end
50
+
51
+ # Returns C++ compiler name.
52
+ def cpp_compiler_name
53
+ return "c89"
54
+ end
55
+
56
+ # Returns linker name.
57
+ def linker_name
58
+ return "c89"
59
+ end
60
+
61
+ # Returns librarian name.
62
+ def librarian_name
63
+ return "ar"
64
+ end
65
+
66
+ # See description at Mxx_ru::Cpp::Toolset#setup_mandatory_options.
67
+ def setup_mandatory_options( target )
68
+
69
+ if TANDEM_OSS == tag( "target_os" )
70
+ target.compiler_option( "-Wsystype=oss" )
71
+ target.linker_option( "-Wsystype=oss" )
72
+ end
73
+
74
+ target.compiler_option( "-Wcall_shared" )
75
+
76
+ if RUNTIME_DEBUG == target.mxx_runtime_mode
77
+ target.compiler_option( "-g" )
78
+ target.linker_option( "-g" )
79
+ elsif RUNTIME_RELEASE == target.mxx_runtime_mode
80
+ target.define( "NDEBUG" )
81
+ target.linker_option( "-s" )
82
+ if OPTIM_SIZE == target.mxx_optimization
83
+ target.compiler_option( "-Woptimize=1" )
84
+ else
85
+ target.compiler_option( "-Woptimize=2" )
86
+ end
87
+ end
88
+
89
+ target.compiler_option( "-WIEEE_float" )
90
+ target.compiler_option( "-Wnowarn=1255" )
91
+
92
+ target.cpp_compiler_option( "-Wcplusplus" )
93
+ target.linker_option( "-Wcplusplus" )
94
+ target.cpp_compiler_option( "-Wversion3" )
95
+ target.linker_option( "-Wversion3" )
96
+
97
+ # No warnings:
98
+ # 1506 - implicit conversion form "unsigned int" to long.
99
+ # 770 - variable set but never used.
100
+ # 734 - function not inlined.
101
+ # 495 - delete of pointer to incomplete class.
102
+ # 270 - pointless comparision of unsigned integer with zero.
103
+ # 262 - variable declared but never referenced.
104
+ # 101 - last line of file ends without a newline.
105
+ target.compiler_option( "-Wnowarn=1506,770,734,495,270,262,101" )
106
+
107
+ target.mxx_all_defines.each { |d|
108
+ target.compiler_option( "-D " + d )
109
+ }
110
+
111
+ target.mxx_all_include_paths.each { |p|
112
+ target.compiler_option( "-I " + p )
113
+ }
114
+ end
115
+
116
+ # See description at Mxx_ru::Cpp::Toolset#obj_file_ext.
117
+ def obj_file_ext
118
+ return ".o"
119
+ end
120
+
121
+ # See description at Mxx_ru::Cpp::Toolset#make_c_obj_command_lines.
122
+ def make_c_obj_command_lines(
123
+ obj_name,
124
+ source_name,
125
+ compiler_options,
126
+ target )
127
+
128
+ cmd_line = "-c -o #{obj_name} " +
129
+ "#{compiler_options.join(' ')} #{source_name}"
130
+
131
+ return [ "#{c_compiler_name} #{cmd_line}" ]
132
+ end
133
+
134
+ # See description at Mxx_ru::Cpp::Toolset#make_c_obj_command_lines.
135
+ def make_cpp_obj_command_lines(
136
+ obj_name,
137
+ source_name,
138
+ compiler_options,
139
+ target )
140
+
141
+ cmd_line = "-c -o #{obj_name} " +
142
+ "#{compiler_options.join(' ')} #{source_name}"
143
+
144
+ return [ "#{cpp_compiler_name} #{cmd_line}" ]
145
+ end
146
+
147
+ # See description at Mxx_ru::Cpp::Toolset#lib_file_name.
148
+ def lib_file_name( source_name )
149
+ return "lib" + source_name + ".a"
150
+ end
151
+
152
+ # See description at Mxx_ru::Cpp::Toolset#lib_link_name.
153
+ def lib_link_name( source_name )
154
+ return source_name
155
+ end
156
+
157
+ # See description at Mxx_ru::Cpp::Toolset#make_lib_command_lines.
158
+ def make_lib_command_lines(
159
+ lib_name,
160
+ obj_files,
161
+ librarian_options,
162
+ target )
163
+
164
+ result = "-r #{librarian_options.join(' ')} " +
165
+ "#{lib_name} #{obj_files.join(' ')}"
166
+
167
+ return [ "#{librarian_name} #{result}" ]
168
+ end
169
+
170
+ # See description at Mxx_ru::Cpp::Toolset#dll_file_name.
171
+ def dll_file_name( source_name )
172
+ return "lib" + source_name + ".so"
173
+ end
174
+
175
+ # See description at Mxx_ru::Cpp::Toolset#implib_link_name.
176
+ def implib_link_name(
177
+ dll_real_name,
178
+ target )
179
+
180
+ # Target name should be passed to linker on UNIX platform
181
+ return lib_link_name(
182
+ File.basename( target.mxx_target_name ) )
183
+ end
184
+
185
+ # See description at Mxx_ru::Cpp::Toolset#implib_link_path.
186
+ def implib_link_path(
187
+ dll_real_name,
188
+ dll_real_path,
189
+ target )
190
+
191
+ # DLL name is the import library name on UNIX platform.
192
+ return dll_real_path
193
+ end
194
+
195
+ # See description at Mxx_ru::Cpp::Toolset#make_dll_command_lines.
196
+ def make_dll_command_lines(
197
+ a_dll_name,
198
+ a_dll_info,
199
+ a_linker_lists,
200
+ a_target )
201
+
202
+ result = "-Wshared " +
203
+ "#{a_linker_lists.linker_options.join(' ')} " +
204
+ "-Wld=-export_all " +
205
+ "-o #{a_dll_name} "
206
+
207
+ a_linker_lists.lib_paths.each { |p| result << "-L #{p} " }
208
+
209
+ result << "#{a_linker_lists.objs.join(' ')} "
210
+ a_linker_lists.libs.each { |l| result << "-l#{l} " }
211
+
212
+ return [ "#{linker_name} #{result}" ]
213
+ end
214
+
215
+ # See description at Mxx_ru::Cpp::Toolset#make_dll_requirements.
216
+ def make_dll_requirements(
217
+ a_dll_name,
218
+ a_dll_info,
219
+ a_linker_lists,
220
+ a_target )
221
+
222
+ result = Dll_requirements.new
223
+
224
+ #FIX ME: This should be checked on a real translator.
225
+ # On UNIX all requirements are dependencies.
226
+
227
+ # This library, as a first one.
228
+ result.add_libs( [ a_dll_info.link_name ] )
229
+ result.add_lib_paths( [ a_dll_info.link_path ] )
230
+
231
+ # And all required libraries.
232
+ a_target.mxx_required_prjs.each { |d|
233
+ if d.kind_of?( Mxx_ru::Binary_target )
234
+ result.add_libs( d.mxx_required_libs )
235
+ result.add_lib_paths( d.mxx_required_lib_paths )
236
+ end
237
+ }
238
+
239
+ return result
240
+ end
241
+
242
+ # See description at Mxx_ru::Cpp::Toolset#exe_file_name.
243
+ def exe_file_name( source_name )
244
+ return source_name
245
+ end
246
+
247
+ # See description at Mxx_ru::Cpp::Toolset#make_exe_command_lines.
248
+ def make_exe_command_lines(
249
+ a_exe_name,
250
+ a_exe_info,
251
+ a_linker_lists,
252
+ a_target )
253
+
254
+ result = "-Wcall_shared " +
255
+ "#{a_linker_lists.linker_options.join(' ')} " +
256
+ "-o #{a_exe_name} "
257
+
258
+ a_linker_lists.lib_paths.each { |p| result << "-L #{p} " }
259
+
260
+ result << "#{a_linker_lists.objs.join(' ')} "
261
+ a_linker_lists.libs.each { |l| result << "-l#{l} " }
262
+
263
+ return [ "#{linker_name} #{result}" ]
264
+ end
265
+
266
+ end # class C89_nsk_family
267
+
268
+ end # module Toolsets
269
+
270
+ end # module Cpp
271
+
272
+ end # module Mxx_ru
273
+
@@ -0,0 +1,54 @@
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/toolsets/gcc_family'
30
+
31
+ module Mxx_ru
32
+ module Cpp
33
+ module Toolsets
34
+
35
+ # Toolset implemetation for GCC compiler for Cygwin.
36
+ class Gcc_cygwin < Mxx_ru::Cpp::Toolsets::Gcc_mswin_family
37
+ public
38
+ def initialize( a_name = "gcc" )
39
+ super( a_name )
40
+
41
+ setup_tag( GCC_PORT_TAG, GCC_PORT_CYGWIN )
42
+ setup_tag( "host_os", "unix" )
43
+ setup_tag( "target_os", "unix" )
44
+ setup_tag( "unix_port", "cygwin" )
45
+ end
46
+ end # class Gcc_cygwin
47
+
48
+ end # module Toolsets
49
+
50
+ end # module Cpp
51
+
52
+ end # module Mxx_ru
53
+
54
+ Mxx_ru::Cpp::setup_toolset( Mxx_ru::Cpp::Toolsets::Gcc_cygwin.new )
@@ -0,0 +1,382 @@
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/toolset'
30
+
31
+ module Mxx_ru
32
+ module Cpp
33
+ module Toolsets
34
+
35
+ # Toolset implemetation for GCC compiler.
36
+ class Gcc_family < Mxx_ru::Cpp::Toolset
37
+ public
38
+ # Tag name, indicates gcc port beeing used.
39
+ GCC_PORT_TAG = "gcc_port"
40
+ # GCC_PORT: GCC on Unix/Linux.
41
+ GCC_PORT_UNIX = "unix"
42
+ # GCC_PORT: MinGW on Win32.
43
+ GCC_PORT_MINGW = "mingw"
44
+ # GCC_PORT: Cygwin on Win32.
45
+ GCC_PORT_CYGWIN = "cygwin"
46
+
47
+ def initialize( a_name )
48
+ super( a_name )
49
+ end
50
+
51
+ # Returns C compiler name.
52
+ def c_compiler_name
53
+ return "gcc"
54
+ end
55
+
56
+ # Returns C++ compiler name.
57
+ def cpp_compiler_name
58
+ return "g++"
59
+ end
60
+
61
+ # Returns linker name.
62
+ def linker_name
63
+ return "g++"
64
+ end
65
+
66
+ # Returns librarian name.
67
+ def librarian_name
68
+ return "ar"
69
+ end
70
+
71
+ # See description at Mxx_ru::Cpp::Toolset#setup_mandatory_options.
72
+ def setup_mandatory_options( target )
73
+
74
+ if RUNTIME_DEBUG == target.mxx_runtime_mode
75
+ target.compiler_option( "-g" )
76
+ target.linker_option( "-g" )
77
+ elsif RUNTIME_RELEASE == target.mxx_runtime_mode
78
+ target.define( "NDEBUG" )
79
+ target.linker_option( "-s" )
80
+ if OPTIM_SIZE == target.mxx_optimization
81
+ target.compiler_option( "-Os" )
82
+ else
83
+ target.compiler_option( "-O2" )
84
+ end
85
+ end
86
+
87
+ if RTTI_DISABLED == target.mxx_rtti_mode
88
+ target.cpp_compiler_option( "-fno-rtti" )
89
+ end
90
+
91
+ if RTL_STATIC == target.mxx_rtl_mode
92
+ target.linker_option( "--static-libgcc" )
93
+ else
94
+ target.linker_option( "--shared-libgcc" )
95
+ end
96
+
97
+ # This is not required on mswin platform.
98
+ if target.target_type.name == Dll_target_type::TYPE
99
+ target.compiler_option( "-fPIC" )
100
+ end
101
+
102
+ # If C++ files are exist, linker should use stdc++ library.
103
+ if target.mxx_cpp_files.size
104
+ # target.lib( "stdc++" )
105
+ end
106
+
107
+ target.mxx_all_defines.each { |d|
108
+ target.compiler_option( "-D" + d )
109
+ }
110
+
111
+ target.mxx_all_include_paths.each { |p|
112
+ target.compiler_option( "-I" + p )
113
+ }
114
+ end
115
+
116
+ # See description at Mxx_ru::Cpp::Toolset#obj_file_ext.
117
+ def obj_file_ext
118
+ return ".o"
119
+ end
120
+
121
+ # See description at Mxx_ru::Cpp::Toolset#make_c_obj_command_lines.
122
+ def make_c_obj_command_lines(
123
+ obj_name,
124
+ source_name,
125
+ compiler_options,
126
+ target )
127
+
128
+ cmd_line = "-c -o #{obj_name} " +
129
+ "#{compiler_options.join(' ')} #{source_name}"
130
+
131
+ return [ "#{c_compiler_name} #{cmd_line}" ]
132
+ end
133
+
134
+ # See description at Mxx_ru::Cpp::Toolset#make_c_obj_command_lines.
135
+ def make_cpp_obj_command_lines(
136
+ obj_name,
137
+ source_name,
138
+ compiler_options,
139
+ target )
140
+
141
+ cmd_line = "-c -o #{obj_name} " +
142
+ "#{compiler_options.join(' ')} #{source_name}"
143
+
144
+ return [ "#{cpp_compiler_name} #{cmd_line}" ]
145
+ end
146
+
147
+ # See description at Mxx_ru::Cpp::Toolset#lib_file_name.
148
+ def lib_file_name( source_name )
149
+ return "lib" + source_name + ".a"
150
+ end
151
+
152
+ # See description at Mxx_ru::Cpp::Toolset#lib_link_name.
153
+ def lib_link_name( source_name )
154
+ return source_name
155
+ end
156
+
157
+ # See description at Mxx_ru::Cpp::Toolset#make_lib_command_lines.
158
+ def make_lib_command_lines(
159
+ lib_name,
160
+ obj_files,
161
+ librarian_options,
162
+ target )
163
+
164
+ result = "-r #{librarian_options.join(' ')} " +
165
+ "#{lib_name} #{obj_files.join(' ')}"
166
+
167
+ return [ "#{librarian_name} #{result}" ]
168
+ end
169
+
170
+ # See description at Mxx_ru::Cpp::Toolset#dll_file_name.
171
+ def dll_file_name( source_name )
172
+ return "lib" + source_name + ".so"
173
+ end
174
+
175
+ # See description at Mxx_ru::Cpp::Toolset#implib_link_name.
176
+ def implib_link_name(
177
+ dll_real_name,
178
+ target )
179
+
180
+ # Target name should be passed to linker on UNIX platform
181
+ return lib_link_name(
182
+ File.basename( target.mxx_target_name ) )
183
+ end
184
+
185
+ # See description at Mxx_ru::Cpp::Toolset#implib_link_path.
186
+ def implib_link_path(
187
+ dll_real_name,
188
+ dll_real_path,
189
+ target )
190
+
191
+ # DLL name is the import library name on UNIX platform.
192
+ return dll_real_path
193
+ end
194
+
195
+ # See description at Mxx_ru::Cpp::Toolset#make_dll_command_lines.
196
+ def make_dll_command_lines(
197
+ a_dll_name,
198
+ a_dll_info,
199
+ a_linker_lists,
200
+ a_target )
201
+
202
+ result = "-shared " +
203
+ "#{a_linker_lists.linker_options.join(' ')} " +
204
+ "-o #{a_dll_name} "
205
+
206
+ a_linker_lists.lib_paths.each { |p| result << "-L#{p} " }
207
+
208
+ result << "#{a_linker_lists.objs.join(' ')} "
209
+ a_linker_lists.libs.each { |l| result << "-l#{l} " }
210
+
211
+ result << port_specific_dll_link_options(
212
+ a_dll_name, a_dll_info, a_linker_lists, a_target )
213
+
214
+ return [ "#{linker_name} #{result}" ]
215
+ end
216
+
217
+ # See description at Mxx_ru::Cpp::Toolset#make_dll_requirements.
218
+ def make_dll_requirements(
219
+ a_dll_name,
220
+ a_dll_info,
221
+ a_linker_lists,
222
+ a_target )
223
+
224
+ result = Dll_requirements.new
225
+
226
+ # On UNIX all requirements are dependencies.
227
+
228
+ # This library, as a first one.
229
+ result.add_libs( [ a_dll_info.link_name ] )
230
+ result.add_lib_paths( [ a_dll_info.link_path ] )
231
+
232
+ # And all required libraries.
233
+ a_target.mxx_required_prjs.each { |d|
234
+ if d.kind_of?( Mxx_ru::Binary_target )
235
+ result.add_libs( d.mxx_required_libs )
236
+ result.add_lib_paths( d.mxx_required_lib_paths )
237
+ end
238
+ }
239
+
240
+ return result
241
+ end
242
+
243
+ # See description at Mxx_ru::Cpp::Toolset#exe_file_name.
244
+ def exe_file_name( source_name )
245
+ return source_name
246
+ end
247
+
248
+ # See description at Mxx_ru::Cpp::Toolset#make_exe_command_lines.
249
+ def make_exe_command_lines(
250
+ a_exe_name,
251
+ a_exe_info,
252
+ a_linker_lists,
253
+ a_target )
254
+
255
+ result = "#{a_linker_lists.linker_options.join(' ')} " +
256
+ "-o #{a_exe_name} "
257
+
258
+ a_linker_lists.lib_paths.each { |p| result << "-L#{p} " }
259
+
260
+ result << "#{a_linker_lists.objs.join(' ')} "
261
+ a_linker_lists.libs.each { |l| result << "-l#{l} " }
262
+
263
+ result << port_specific_exe_link_options(
264
+ a_exe_name, a_exe_info, a_linker_lists, a_target )
265
+
266
+ return [ "#{linker_name} #{result}" ]
267
+ end
268
+
269
+ # Return string containing port-specific linker option for DLL linking.
270
+ #
271
+ # All parameters are similar to make_dll_command_lines parameters.
272
+ #
273
+ # Return empty string in a base class.
274
+ def port_specific_dll_link_options(
275
+ a_dll_name, a_dll_info, a_linker_lists, a_target )
276
+ return ""
277
+ end
278
+
279
+ # Return string containing port-specific linker option for EXE linking.
280
+ #
281
+ # All parameters are similar to make_exe_command_lines parameters.
282
+ #
283
+ # Return empty string in a base class.
284
+ def port_specific_exe_link_options(
285
+ a_exe_name, a_exe_info, a_linker_lists, a_target )
286
+ return ""
287
+ end
288
+
289
+ end # class Gcc_family
290
+
291
+ # Toolset implemetation for GCC compiler for Win32.
292
+ # This class is a base class for both MinGW and Cygwin
293
+ class Gcc_mswin_family < Gcc_family
294
+ public
295
+
296
+ # See description at Mxx_ru::Cpp::Toolset#exe_file_name.
297
+ def exe_file_name( source_name )
298
+ return source_name + ".exe"
299
+ end
300
+
301
+ # See description at Mxx_ru::Cpp::Toolset#clean_dll_specific_files.
302
+ #
303
+ # Delete import library if exists.
304
+ def clean_dll_specific_files(
305
+ a_dll_file,
306
+ a_dll_info,
307
+ a_target )
308
+
309
+ # Delete import library if exists.
310
+ if nil != a_dll_info.link_name
311
+ implib_name = File.join( [ a_dll_info.link_path,
312
+ lib_file_name( a_dll_info.link_name ) ] )
313
+ Mxx_ru::Util::delete_file( implib_name )
314
+ end
315
+ end
316
+
317
+ # See description at Mxx_ru::Cpp::Toolset#implib_link_name.
318
+ def implib_link_name(
319
+ dll_real_name,
320
+ target )
321
+
322
+ # It's required to pass import library name to linker on mswin platform
323
+ if nil != target.mxx_implib_path
324
+ return lib_link_name( target.mxx_target_name )
325
+ end
326
+
327
+ return nil
328
+ end
329
+
330
+ # See description at Mxx_ru::Cpp::Toolset#implib_link_path.
331
+ def implib_link_path(
332
+ dll_real_name,
333
+ dll_real_path,
334
+ target )
335
+ return target.mxx_obj_placement.get_lib(
336
+ target.mxx_implib_path, self, target )
337
+ end
338
+
339
+ # See description at Mxx_ru::Cpp::Toolset#make_dll_requirements.
340
+ def make_dll_requirements(
341
+ a_dll_name,
342
+ a_dll_info,
343
+ a_linker_lists,
344
+ a_target )
345
+
346
+ result = Dll_requirements.new
347
+
348
+ # Dependencies are exists only if import library is present.
349
+ if nil != a_dll_info.link_name
350
+ result.add_libs( [ a_dll_info.link_name ] )
351
+ result.add_lib_paths( [ a_dll_info.link_path ] )
352
+ end
353
+
354
+ return result
355
+ end
356
+
357
+ # Return string containing port-specific linker option for DLL linking.
358
+ #
359
+ # All parameters are similar to make_dll_command_lines parameters.
360
+ #
361
+ # Return empty string in a base class.
362
+ def port_specific_dll_link_options(
363
+ a_dll_name, a_dll_info, a_linker_lists, a_target )
364
+ # Build import library if it's required.
365
+ if nil != a_dll_info.link_name
366
+ full_lib_name = File.join( [ a_dll_info.link_path,
367
+ lib_file_name( a_dll_info.link_name ) ] )
368
+
369
+ return "-Wl,--out-implib=#{full_lib_name}" +
370
+ ",--export-all-symbols"
371
+ end
372
+
373
+ return ""
374
+ end
375
+
376
+ end # class Gcc_mswin_family
377
+
378
+ end # module Toolsets
379
+
380
+ end # module Cpp
381
+
382
+ end # module Mxx_ru