Mxx_ru 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/COPYING +26 -0
- data/NEWS +52 -0
- data/README +21 -0
- data/Rakefile +32 -0
- data/examples/exe_and_lib/main.cpp +15 -0
- data/examples/exe_and_lib/prj.rb +11 -0
- data/examples/exe_and_lib/say.cpp +13 -0
- data/examples/exe_and_lib/say.hpp +11 -0
- data/examples/exe_and_lib/say.rb +7 -0
- data/examples/exe_dll_lib/inout.cpp +15 -0
- data/examples/exe_dll_lib/inout.hpp +26 -0
- data/examples/exe_dll_lib/inout.rb +18 -0
- data/examples/exe_dll_lib/main.cpp +23 -0
- data/examples/exe_dll_lib/prj.rb +11 -0
- data/examples/exe_dll_lib/say.cpp +13 -0
- data/examples/exe_dll_lib/say.hpp +12 -0
- data/examples/exe_dll_lib/say.rb +9 -0
- data/examples/exe_dll_lib_2/build.rb +7 -0
- data/examples/exe_dll_lib_2/inout/inout.cpp +15 -0
- data/examples/exe_dll_lib_2/inout/inout.hpp +26 -0
- data/examples/exe_dll_lib_2/inout/prj.rb +16 -0
- data/examples/exe_dll_lib_2/main/main.cpp +23 -0
- data/examples/exe_dll_lib_2/main/prj.rb +9 -0
- data/examples/exe_dll_lib_2/say/prj.rb +8 -0
- data/examples/exe_dll_lib_2/say/say.cpp +13 -0
- data/examples/exe_dll_lib_2/say/say.hpp +12 -0
- data/examples/simple_exe/main.cpp +26 -0
- data/examples/simple_exe/prj.rb +7 -0
- data/lib/mxx_ru/abstract_target.rb +283 -0
- data/lib/mxx_ru/binary_target.rb +89 -0
- data/lib/mxx_ru/binary_unittest.rb +130 -0
- data/lib/mxx_ru/cpp/analyzer.rb +230 -0
- data/lib/mxx_ru/cpp/composite.rb +106 -0
- data/lib/mxx_ru/cpp/detect_toolset.rb +122 -0
- data/lib/mxx_ru/cpp/mode.rb +85 -0
- data/lib/mxx_ru/cpp/obj_placement.rb +321 -0
- data/lib/mxx_ru/cpp/qt.rb +333 -0
- data/lib/mxx_ru/cpp/rucodegen.rb +114 -0
- data/lib/mxx_ru/cpp/source_file.rb +71 -0
- data/lib/mxx_ru/cpp/target.rb +1371 -0
- data/lib/mxx_ru/cpp/toolset.rb +1029 -0
- data/lib/mxx_ru/cpp/toolsets/bcc_win32_5.rb +52 -0
- data/lib/mxx_ru/cpp/toolsets/bcc_win32_family.rb +451 -0
- data/lib/mxx_ru/cpp/toolsets/c89_etk_nsk.rb +56 -0
- data/lib/mxx_ru/cpp/toolsets/c89_nsk.rb +56 -0
- data/lib/mxx_ru/cpp/toolsets/c89_nsk_family.rb +273 -0
- data/lib/mxx_ru/cpp/toolsets/gcc_cygwin.rb +54 -0
- data/lib/mxx_ru/cpp/toolsets/gcc_family.rb +382 -0
- data/lib/mxx_ru/cpp/toolsets/gcc_linux.rb +60 -0
- data/lib/mxx_ru/cpp/toolsets/gcc_mingw.rb +144 -0
- data/lib/mxx_ru/cpp/toolsets/gcc_sparc_solaris.rb +87 -0
- data/lib/mxx_ru/cpp/toolsets/vc7.rb +62 -0
- data/lib/mxx_ru/cpp/toolsets/vc8.rb +452 -0
- data/lib/mxx_ru/cpp/toolsets/vc_family.rb +428 -0
- data/lib/mxx_ru/cpp.rb +36 -0
- data/lib/mxx_ru/ex.rb +134 -0
- data/lib/mxx_ru/makestyle_generator.rb +138 -0
- data/lib/mxx_ru/textfile_unittest.rb +284 -0
- data/lib/mxx_ru/util.rb +258 -0
- data/tests/c/pcre/chartables.c +183 -0
- data/tests/c/pcre/config.h +99 -0
- data/tests/c/pcre/dftables.c +167 -0
- data/tests/c/pcre/get.c +349 -0
- data/tests/c/pcre/internal.h +677 -0
- data/tests/c/pcre/maketables.c +140 -0
- data/tests/c/pcre/pcre.c +8304 -0
- data/tests/c/pcre/pcre.h +193 -0
- data/tests/c/pcre/pcre.rb +14 -0
- data/tests/c/pcre/pcredemo.c +316 -0
- data/tests/c/pcre/pcregrep.c +642 -0
- data/tests/c/pcre/pcreposix.c +305 -0
- data/tests/c/pcre/pcreposix.h +88 -0
- data/tests/c/pcre/pcretest.c +1483 -0
- data/tests/c/pcre/perltest +211 -0
- data/tests/c/pcre/printint.c +360 -0
- data/tests/c/pcre/study.c +472 -0
- data/tests/cpp/mswin_res_dll/build.rb +14 -0
- data/tests/cpp/mswin_res_dll/dll.cpp +17 -0
- data/tests/cpp/mswin_res_dll/dll.rb +30 -0
- data/tests/cpp/mswin_res_dll/dll.rc +48 -0
- data/tests/cpp/mswin_res_dll/h/dll.hpp +8 -0
- data/tests/cpp/mswin_res_dll/h/res.h +3 -0
- data/tests/cpp/mswin_res_dll/main.cpp +13 -0
- data/tests/cpp/mswin_res_dll/main.rb +20 -0
- data/tests/cpp/mswin_res_dll/res/tree_fol.bmp +0 -0
- data/tests/cpp/mswin_res_dll/res/tree_state_1.bmp +0 -0
- data/tests/cpp/mswin_res_dll/res/tree_state_2.bmp +0 -0
- data/tests/cpp/mswin_res_exe/build.rb +23 -0
- data/tests/cpp/mswin_res_exe/h/res.h +3 -0
- data/tests/cpp/mswin_res_exe/main.cpp +17 -0
- data/tests/cpp/mswin_res_exe/main.rc +48 -0
- data/tests/cpp/mswin_res_exe/res/tree_fol.bmp +0 -0
- data/tests/cpp/mswin_res_exe/res/tree_state_1.bmp +0 -0
- data/tests/cpp/mswin_res_exe/res/tree_state_2.bmp +0 -0
- data/tests/cpp/rucodegen/host_config.cpp +20 -0
- data/tests/cpp/rucodegen/host_config.rb +14 -0
- data/tests/cpp/rucodegen/impl/conn_params.cpp +7 -0
- data/tests/cpp/rucodegen/impl/conn_params.rb +14 -0
- data/tests/cpp/rucodegen/impl/h/conn_params.hpp +10 -0
- data/tests/cpp/rucodegen/prj.rb +17 -0
- data/tests/cpp/textfile_unittest/build.rb +8 -0
- data/tests/cpp/textfile_unittest/etalons/out_0.txt +0 -0
- data/tests/cpp/textfile_unittest/etalons/out_1.txt +1 -0
- data/tests/cpp/textfile_unittest/etalons/out_128.txt +128 -0
- data/tests/cpp/textfile_unittest/main.cpp +89 -0
- data/tests/cpp/textfile_unittest/prj.rb +8 -0
- data/tests/cpp/textfile_unittest/prj.ut.rb +18 -0
- data/tests/cpp/toolset_name.rb +6 -0
- data/tests/cpp/vc_cleanup/cout.log +72 -0
- data/tests/cpp/vc_cleanup/dll_hi.cpp +5 -0
- data/tests/cpp/vc_cleanup/exe_hi.cpp +10 -0
- data/tests/cpp/vc_cleanup/lib_hi.cpp +5 -0
- data/tests/cpp/vc_cleanup/prj_dll_no_implib.rb +10 -0
- data/tests/cpp/vc_cleanup/prj_dll_no_implib_simple_target_root.rb +11 -0
- data/tests/cpp/vc_cleanup/prj_dll_with_implib.rb +11 -0
- data/tests/cpp/vc_cleanup/prj_dll_with_implib_simple_target_root.rb +14 -0
- data/tests/cpp/vc_cleanup/prj_exe_no_implib.rb +10 -0
- data/tests/cpp/vc_cleanup/prj_exe_no_implib_simple_target_root.rb +11 -0
- data/tests/cpp/vc_cleanup/prj_lib.rb +10 -0
- data/tests/cpp/vc_cleanup/prj_lib_with_simple_target_root.rb +11 -0
- data/tests/cpp/vc_cleanup/tc_vc_cleanup.rb +60 -0
- data/tests/mxx_ru/change_default_value/ignoring_by_build_root/build.rb +8 -0
- data/tests/mxx_ru/change_default_value/ignoring_by_build_root/child_1.rb +5 -0
- data/tests/mxx_ru/change_default_value/ignoring_by_child_1/build.rb +7 -0
- data/tests/mxx_ru/change_default_value/ignoring_by_child_1/child_1.rb +5 -0
- data/tests/mxx_ru/change_default_value/ignoring_by_child_1/child_2.rb +5 -0
- data/tests/mxx_ru/change_default_value/ok/build.rb +8 -0
- data/tests/mxx_ru/change_default_value/ok/child_1.rb +8 -0
- data/tests/mxx_ru/tc_makestyle_generator.rb +117 -0
- data/tests/mxx_ru/vc8/tc_actual_manifest.rb +230 -0
- data/tests/mxx_ru/vc8/tc_append_mt_commands.rb +104 -0
- data/tests/mxx_ru/vc8/tc_default_manifest.rb +17 -0
- data/tests/mxx_ru/vc8/tc_define_manifest.rb +173 -0
- data/tests/mxx_ru/vc8/tc_drop_default_manifest.rb +16 -0
- data/tests/mxx_ru/vc8/tc_invalid_params.rb +81 -0
- data/tests/mxx_ru/vc8/ts_vc8.rb +10 -0
- data/tests/qt/aclock/aclock.cpp +148 -0
- data/tests/qt/aclock/aclock.h +45 -0
- data/tests/qt/aclock/main.cpp +28 -0
- data/tests/qt/aclock/prj.rb +21 -0
- data/tests/qt/iconview/main.cpp +76 -0
- data/tests/qt/iconview/prj.rb +21 -0
- data/tests/qt/toplevel/main.cpp +9 -0
- data/tests/qt/toplevel/options.ui +587 -0
- data/tests/qt/toplevel/options.ui.h +98 -0
- data/tests/qt/toplevel/prj.rb +21 -0
- metadata +241 -0
|
@@ -0,0 +1,428 @@
|
|
|
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 Visual C++
|
|
36
|
+
class Vc_family < Mxx_ru::Cpp::Toolset
|
|
37
|
+
public
|
|
38
|
+
def initialize( a_name )
|
|
39
|
+
super( a_name )
|
|
40
|
+
|
|
41
|
+
setup_tag( "host_os", "mswin" )
|
|
42
|
+
setup_tag( "target_os", "mswin" )
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Returns compiler name.
|
|
46
|
+
def compiler_name
|
|
47
|
+
return "cl"
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Returns linker name.
|
|
51
|
+
def linker_name
|
|
52
|
+
return "link"
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Returns librarian name.
|
|
56
|
+
def librarian_name
|
|
57
|
+
return "lib"
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Returns resource compiler name.
|
|
61
|
+
def rc_name
|
|
62
|
+
return "rc"
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# See description at Mxx_ru::Cpp::Toolset#setup_mandatory_options.
|
|
66
|
+
def setup_mandatory_options( target )
|
|
67
|
+
|
|
68
|
+
target.compiler_option( "-nologo" )
|
|
69
|
+
target.linker_option( "/NOLOGO" )
|
|
70
|
+
target.librarian_option( "/NOLOGO" )
|
|
71
|
+
target.cpp_compiler_option( "-EHsc" )
|
|
72
|
+
|
|
73
|
+
if RUNTIME_DEBUG == target.mxx_runtime_mode
|
|
74
|
+
target.compiler_option( "-Zi" )
|
|
75
|
+
target.linker_option( "/DEBUG" )
|
|
76
|
+
setup_vc_specific_debug_options( target )
|
|
77
|
+
elsif RUNTIME_RELEASE == target.mxx_runtime_mode
|
|
78
|
+
target.define( "NDEBUG" )
|
|
79
|
+
if OPTIM_SIZE == target.mxx_optimization
|
|
80
|
+
target.compiler_option( "-O1" )
|
|
81
|
+
else
|
|
82
|
+
target.compiler_option( "-O2" )
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
if RTTI_ENABLED == target.mxx_rtti_mode
|
|
87
|
+
target.cpp_compiler_option( "-GR" )
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
if RTL_SHARED == target.mxx_rtl_mode
|
|
91
|
+
if THREADING_SINGLE == target.mxx_threading_mode
|
|
92
|
+
raise Mxx_ru::Unsupported_mode_ex.new(
|
|
93
|
+
"Visual C++ not support single-threaded shared RTL" )
|
|
94
|
+
else
|
|
95
|
+
if RUNTIME_DEBUG == target.mxx_runtime_mode
|
|
96
|
+
target.compiler_option( "-MDd" )
|
|
97
|
+
else
|
|
98
|
+
target.compiler_option( "-MD" )
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
else
|
|
102
|
+
if THREADING_MULTI == target.mxx_threading_mode
|
|
103
|
+
if RUNTIME_DEBUG == target.mxx_runtime_mode
|
|
104
|
+
target.compiler_option( "-MTd" )
|
|
105
|
+
else
|
|
106
|
+
target.compiler_option( "-MT" )
|
|
107
|
+
end
|
|
108
|
+
else
|
|
109
|
+
if RUNTIME_DEBUG == target.mxx_runtime_mode
|
|
110
|
+
target.compiler_option( "-MLd" )
|
|
111
|
+
else
|
|
112
|
+
target.compiler_option( "-ML" )
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
if target.target_type.name == Dll_target_type::TYPE
|
|
118
|
+
target.compiler_option( "-LD" )
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
if SCREEN_WINDOW == target.mxx_screen_mode
|
|
122
|
+
target.linker_option( "/SUBSYSTEM:WINDOWS" )
|
|
123
|
+
else
|
|
124
|
+
target.linker_option( "/SUBSYSTEM:CONSOLE" )
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
# All defines and all include_path should be applied
|
|
128
|
+
# to resource compiler too.
|
|
129
|
+
target.mxx_all_defines.each { |d|
|
|
130
|
+
target.compiler_option( "-D" + d )
|
|
131
|
+
target.mswin_rc_option( "/d" + d )
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
target.mxx_all_include_paths.each { |p|
|
|
135
|
+
target.compiler_option( "-I" + p )
|
|
136
|
+
target.mswin_rc_option( "/i" + p )
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
# Resource compiler specific options.
|
|
140
|
+
target.mxx_all_mswin_rc_defines.each { |d|
|
|
141
|
+
target.mswin_rc_option( "/d" + d )
|
|
142
|
+
}
|
|
143
|
+
target.mxx_all_mswin_rc_include_paths.each { |p|
|
|
144
|
+
target.mswin_rc_option( "/i" + p )
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
# Common description see Mxx_ru::Cpp::Toolset#clean_lib_specific_files.
|
|
150
|
+
#
|
|
151
|
+
# Removes VC specific garbage files.
|
|
152
|
+
def clean_lib_specific_files(
|
|
153
|
+
a_lib_file,
|
|
154
|
+
a_lib_info,
|
|
155
|
+
a_target )
|
|
156
|
+
|
|
157
|
+
clean_vc_specific_garbage( a_lib_file )
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
# See description at Mxx_ru::Cpp::Toolset#clean_dll_specific_files.
|
|
161
|
+
#
|
|
162
|
+
# Removes import library if exists.
|
|
163
|
+
#
|
|
164
|
+
# Removes *.ilk, *.pdb files.
|
|
165
|
+
def clean_dll_specific_files(
|
|
166
|
+
a_dll_file,
|
|
167
|
+
a_dll_info,
|
|
168
|
+
a_target )
|
|
169
|
+
|
|
170
|
+
# Remove import library if exists.
|
|
171
|
+
if nil != a_dll_info.link_name
|
|
172
|
+
implib_name = File.join( [ a_dll_info.link_path, a_dll_info.link_name ] )
|
|
173
|
+
Mxx_ru::Util::delete_file( implib_name )
|
|
174
|
+
|
|
175
|
+
# *.exp files are also created by Visual C++.
|
|
176
|
+
explib_name =
|
|
177
|
+
Mxx_ru::Util::change_file_ext( implib_name, ".exp" )
|
|
178
|
+
Mxx_ru::Util::delete_file( explib_name )
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
clean_vc_specific_garbage( a_dll_file )
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
# See description at Mxx_ru::Cpp::Toolset#clean_exe_specific_files.
|
|
185
|
+
#
|
|
186
|
+
# Removing *.ilk, *.pdb files.
|
|
187
|
+
def clean_exe_specific_files(
|
|
188
|
+
a_exe_file,
|
|
189
|
+
a_exe_info,
|
|
190
|
+
a_target )
|
|
191
|
+
|
|
192
|
+
clean_vc_specific_garbage( a_exe_file )
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
# See description at Mxx_ru::Cpp::Toolset#obj_file_ext.
|
|
196
|
+
def obj_file_ext
|
|
197
|
+
return ".obj"
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
# See description at Mxx_ru::Cpp::Toolset#make_c_obj_command_lines.
|
|
201
|
+
def make_c_obj_command_lines(
|
|
202
|
+
obj_name,
|
|
203
|
+
source_name,
|
|
204
|
+
compiler_options,
|
|
205
|
+
target )
|
|
206
|
+
|
|
207
|
+
tmpfile = Mxx_ru::Util::Tmp_files.instance.create(
|
|
208
|
+
"-c -TC -Fo#{obj_name} " +
|
|
209
|
+
"#{compiler_options.join(' ')} #{source_name}" )
|
|
210
|
+
|
|
211
|
+
return [ "#{compiler_name} @#{tmpfile}" ]
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
# See description at Mxx_ru::Cpp::Toolset#make_c_obj_command_lines.
|
|
215
|
+
def make_cpp_obj_command_lines(
|
|
216
|
+
obj_name,
|
|
217
|
+
source_name,
|
|
218
|
+
compiler_options,
|
|
219
|
+
target )
|
|
220
|
+
|
|
221
|
+
tmpfile = Mxx_ru::Util::Tmp_files.instance.create(
|
|
222
|
+
"-c -TP -Fo#{obj_name} " +
|
|
223
|
+
"#{compiler_options.join(' ')} #{source_name}" )
|
|
224
|
+
|
|
225
|
+
return [ "#{compiler_name} @#{tmpfile}" ]
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
# See description at Mxx_ru::Cpp::Toolset#mswin_res_file_name.
|
|
229
|
+
def mswin_res_file_name( source_name )
|
|
230
|
+
return source_name + ".res"
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
# See description at Mxx_ru::Cpp::Toolset#make_mswin_res_command_lines.
|
|
234
|
+
def make_mswin_res_command_lines(
|
|
235
|
+
res_name,
|
|
236
|
+
rc_file,
|
|
237
|
+
rc_options,
|
|
238
|
+
target )
|
|
239
|
+
|
|
240
|
+
return [ "#{rc_name} " +
|
|
241
|
+
"#{rc_options.join(' ')} /r " +
|
|
242
|
+
"/fo#{res_name} #{rc_file}" ]
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
# See description at Mxx_ru::Cpp::Toolset#lib_file_name.
|
|
246
|
+
def lib_file_name( source_name )
|
|
247
|
+
return source_name + ".lib"
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
# See description at Mxx_ru::Cpp::Toolset#lib_link_name.
|
|
251
|
+
def lib_link_name( source_name )
|
|
252
|
+
return lib_file_name( source_name )
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
# See description at Mxx_ru::Cpp::Toolset#make_lib_command_lines.
|
|
256
|
+
def make_lib_command_lines(
|
|
257
|
+
lib_name,
|
|
258
|
+
obj_files,
|
|
259
|
+
librarian_options,
|
|
260
|
+
target )
|
|
261
|
+
|
|
262
|
+
tmpfile = Mxx_ru::Util::Tmp_files.instance.create(
|
|
263
|
+
"#{librarian_options.join(' ')} " +
|
|
264
|
+
"/OUT:#{lib_name} #{obj_files.join(' ')}" )
|
|
265
|
+
|
|
266
|
+
return [ "#{librarian_name} @#{tmpfile}" ]
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
# See description at Mxx_ru::Cpp::Toolset#dll_file_name.
|
|
270
|
+
def dll_file_name( source_name )
|
|
271
|
+
return source_name + ".dll"
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
# See description at Mxx_ru::Cpp::Toolset#implib_link_name.
|
|
275
|
+
def implib_link_name(
|
|
276
|
+
dll_real_name,
|
|
277
|
+
target )
|
|
278
|
+
|
|
279
|
+
# Import library should be defined explicitly for Visual C++.
|
|
280
|
+
if nil != target.mxx_implib_path
|
|
281
|
+
return lib_file_name( target.mxx_target_name )
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
return nil
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
# See description at Mxx_ru::Cpp::Toolset#implib_link_path.
|
|
288
|
+
#
|
|
289
|
+
# Returns a value, based on
|
|
290
|
+
# Mxx_ru::Cpp::Target#mxx_implib_path.
|
|
291
|
+
def implib_link_path(
|
|
292
|
+
dll_real_name,
|
|
293
|
+
dll_real_path,
|
|
294
|
+
target )
|
|
295
|
+
return target.mxx_obj_placement.get_lib(
|
|
296
|
+
target.mxx_implib_path, self, target )
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
# See description at Mxx_ru::Cpp::Toolset#make_dll_command_lines.
|
|
300
|
+
def make_dll_command_lines(
|
|
301
|
+
a_dll_name,
|
|
302
|
+
a_dll_info,
|
|
303
|
+
a_linker_lists,
|
|
304
|
+
a_target )
|
|
305
|
+
|
|
306
|
+
result = "/DLL " +
|
|
307
|
+
"#{a_linker_lists.linker_options.join(' ')} " +
|
|
308
|
+
"/OUT:#{a_dll_name} "
|
|
309
|
+
|
|
310
|
+
if a_linker_lists.resources.size
|
|
311
|
+
result << "#{a_target.mxx_all_mswin_rlink_options.join(' ')} "
|
|
312
|
+
end
|
|
313
|
+
|
|
314
|
+
if nil != a_dll_info.link_name
|
|
315
|
+
implib_name = File.join( [ a_dll_info.link_path,
|
|
316
|
+
a_dll_info.link_name ] )
|
|
317
|
+
result << "/IMPLIB:#{implib_name} "
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
a_linker_lists.lib_paths.each { |p| result << "/LIBPATH:#{p} " }
|
|
321
|
+
|
|
322
|
+
result << "#{a_linker_lists.objs.join(' ')} "
|
|
323
|
+
result << "#{a_linker_lists.libs.join(' ')} "
|
|
324
|
+
result << "#{a_linker_lists.resources.join(' ')} "
|
|
325
|
+
|
|
326
|
+
tmpfile = Mxx_ru::Util::Tmp_files.instance.create( result )
|
|
327
|
+
|
|
328
|
+
return [ "#{linker_name} @#{tmpfile}" ]
|
|
329
|
+
end
|
|
330
|
+
|
|
331
|
+
# See description at Mxx_ru::Cpp::Toolset#make_dll_requirements.
|
|
332
|
+
def make_dll_requirements(
|
|
333
|
+
a_dll_name,
|
|
334
|
+
a_dll_info,
|
|
335
|
+
a_linker_lists,
|
|
336
|
+
a_target )
|
|
337
|
+
|
|
338
|
+
result = Dll_requirements.new
|
|
339
|
+
|
|
340
|
+
# Dependencies are exists only if import library is present.
|
|
341
|
+
if nil != a_dll_info.link_name
|
|
342
|
+
result.add_libs( [ a_dll_info.link_name ] )
|
|
343
|
+
result.add_lib_paths( [ a_dll_info.link_path ] )
|
|
344
|
+
end
|
|
345
|
+
|
|
346
|
+
return result
|
|
347
|
+
end
|
|
348
|
+
|
|
349
|
+
# See description at Mxx_ru::Cpp::Toolset#exe_file_name.
|
|
350
|
+
def exe_file_name( source_name )
|
|
351
|
+
return source_name + ".exe"
|
|
352
|
+
end
|
|
353
|
+
|
|
354
|
+
# See description at Mxx_ru::Cpp::Toolset#make_exe_command_lines.
|
|
355
|
+
def make_exe_command_lines(
|
|
356
|
+
a_exe_name,
|
|
357
|
+
a_exe_info,
|
|
358
|
+
a_linker_lists,
|
|
359
|
+
a_target )
|
|
360
|
+
|
|
361
|
+
result = "#{a_linker_lists.linker_options.join(' ')} " +
|
|
362
|
+
"/OUT:#{a_exe_name} "
|
|
363
|
+
|
|
364
|
+
if a_linker_lists.resources.size
|
|
365
|
+
result << "#{a_target.mxx_all_mswin_rlink_options.join(' ')} "
|
|
366
|
+
end
|
|
367
|
+
|
|
368
|
+
a_linker_lists.lib_paths.each { |p| result << "/LIBPATH:#{p} " }
|
|
369
|
+
|
|
370
|
+
result << "#{a_linker_lists.objs.join(' ')} "
|
|
371
|
+
result << "#{a_linker_lists.libs.join(' ')} "
|
|
372
|
+
result << "#{a_linker_lists.resources.join(' ')} "
|
|
373
|
+
|
|
374
|
+
tmpfile = Mxx_ru::Util::Tmp_files.instance.create( result )
|
|
375
|
+
|
|
376
|
+
return [ "#{linker_name} @#{tmpfile}" ]
|
|
377
|
+
end
|
|
378
|
+
|
|
379
|
+
# Setting up VC specific options for managing PDB files.
|
|
380
|
+
#
|
|
381
|
+
# Adding '/Fd<full-target-name>.pdb' option for compiler.
|
|
382
|
+
# Adding '/PDB:<full-target-name>.pdb' option for linker (in case
|
|
383
|
+
# of EXE or DLL).
|
|
384
|
+
def setup_vc_specific_debug_options( target )
|
|
385
|
+
full_name =
|
|
386
|
+
case target.target_type.name
|
|
387
|
+
when Exe_target_type::TYPE:
|
|
388
|
+
make_exe_name( target.mxx_target_name, target ).full_name
|
|
389
|
+
when Dll_target_type::TYPE:
|
|
390
|
+
make_dll_name( target.mxx_target_name, target ).full_name
|
|
391
|
+
when Lib_target_type::TYPE:
|
|
392
|
+
make_lib_name( target.mxx_target_name, target ).full_name
|
|
393
|
+
else nil
|
|
394
|
+
end
|
|
395
|
+
if full_name
|
|
396
|
+
pdb_file = Mxx_ru::Util::change_file_ext( full_name, ".pdb" )
|
|
397
|
+
target.compiler_option( "/Fd#{pdb_file}" )
|
|
398
|
+
target.linker_option( "/PDB:#{pdb_file}" )
|
|
399
|
+
end
|
|
400
|
+
end
|
|
401
|
+
|
|
402
|
+
# Remove VC specific garbage.
|
|
403
|
+
#
|
|
404
|
+
# In DEBUG mode: *.ilk, *.pdb files.
|
|
405
|
+
# If something exported from executable: *.exp, *.lib (only if
|
|
406
|
+
# *.exp file exists).
|
|
407
|
+
def clean_vc_specific_garbage( full_name )
|
|
408
|
+
Mxx_ru::Util::delete_file(
|
|
409
|
+
Mxx_ru::Util::change_file_ext( full_name, ".ilk" ) )
|
|
410
|
+
Mxx_ru::Util::delete_file(
|
|
411
|
+
Mxx_ru::Util::change_file_ext( full_name, ".pdb" ) )
|
|
412
|
+
|
|
413
|
+
exp_file_name = Mxx_ru::Util::change_file_ext( full_name, ".exp" )
|
|
414
|
+
if File.exists?( exp_file_name )
|
|
415
|
+
Mxx_ru::Util::delete_file( exp_file_name )
|
|
416
|
+
# Import library for this export-file must be removed too.
|
|
417
|
+
Mxx_ru::Util::delete_file(
|
|
418
|
+
Mxx_ru::Util::change_file_ext( full_name, ".lib" ) )
|
|
419
|
+
end
|
|
420
|
+
end
|
|
421
|
+
|
|
422
|
+
end # class Vc_family
|
|
423
|
+
|
|
424
|
+
end # module Toolsets
|
|
425
|
+
|
|
426
|
+
end # module Cpp
|
|
427
|
+
|
|
428
|
+
end # module Mxx_ru
|
data/lib/mxx_ru/cpp.rb
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
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_target'
|
|
31
|
+
require 'mxx_ru/cpp/detect_toolset'
|
|
32
|
+
require 'mxx_ru/cpp/target'
|
|
33
|
+
require 'mxx_ru/cpp/composite'
|
|
34
|
+
|
|
35
|
+
# Determining which toolset should be used.
|
|
36
|
+
Mxx_ru::Cpp::detect_toolset
|
data/lib/mxx_ru/ex.rb
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
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
|
+
module Mxx_ru
|
|
30
|
+
|
|
31
|
+
# Base class for all exceptions.
|
|
32
|
+
class Ex < Exception
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Exception, thrown on execution of 'pure abstract method'.
|
|
36
|
+
class Abstract_method_ex < Ex
|
|
37
|
+
def initialize( method_name )
|
|
38
|
+
super( "Pure virtual method call: " + method_name )
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Exception, thrown if returned object type is not expected.
|
|
43
|
+
class Invalid_cast_ex < Ex
|
|
44
|
+
def initialize( msg )
|
|
45
|
+
super( msg )
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Exception, thrown if build commands fail.
|
|
50
|
+
class Build_ex < Ex
|
|
51
|
+
def initialize( cmd_line, desc )
|
|
52
|
+
super( "Build error: '#{cmd_line}' returns '#{desc}'" )
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Exception, thrown if unknown target type is detected.
|
|
57
|
+
class Unsupported_target_type_ex < Ex
|
|
58
|
+
def initialize( target_class, target_type )
|
|
59
|
+
super( "Unsupported target type '#{target_type}'" +
|
|
60
|
+
" in '#{target_class}'" )
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# Exception, thrown if no target object is found for given alias.
|
|
65
|
+
class Target_unknown_ex < Ex
|
|
66
|
+
def initialize( target_name )
|
|
67
|
+
super( "Target unknown for: " + target_name )
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# Exception, thrown if value conflict for global options such as
|
|
72
|
+
# runtime_mode, rtl_mode, etc is detected
|
|
73
|
+
class Global_option_conflict_ex < Ex
|
|
74
|
+
# [_a_name_] Option name.
|
|
75
|
+
# [_a_current_] Current option value.
|
|
76
|
+
# [_a_current_owner_] Who was set current value.
|
|
77
|
+
# [_a_new_] New option value.
|
|
78
|
+
# [_a_new_owner_] Who tries to set current value.
|
|
79
|
+
def initialize(
|
|
80
|
+
a_name,
|
|
81
|
+
a_current,
|
|
82
|
+
a_current_owner,
|
|
83
|
+
a_new,
|
|
84
|
+
a_new_owner )
|
|
85
|
+
|
|
86
|
+
super( "Global option '#{a_name}' conflict detected! " +
|
|
87
|
+
"Current value '#{a_current}' set by '#{a_current_owner}'. " +
|
|
88
|
+
"New value '#{a_new}' required by '#{a_new_owner}'" )
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# Exception, thrown if anyone tries to set invalid value to global options such as
|
|
93
|
+
# runtime_mode, rtl_mode, etc.
|
|
94
|
+
class Global_option_disallowed_value_ex < Ex
|
|
95
|
+
# [_a_name_] Option name.
|
|
96
|
+
# [_a_available_values_] Available values list. Should be Array of String.
|
|
97
|
+
# [_a_new_] New option value.
|
|
98
|
+
# [_a_new_owner_] Who tries to set new value.
|
|
99
|
+
def initialize(
|
|
100
|
+
a_name,
|
|
101
|
+
a_available_values,
|
|
102
|
+
a_new,
|
|
103
|
+
a_new_owner )
|
|
104
|
+
|
|
105
|
+
super( "Value '#{new}' required by '#{a_new_owner}' " +
|
|
106
|
+
"disallowed for global option '#{a_name}'! " +
|
|
107
|
+
"Allowed values are: #{a_available_values.join(' ')}" )
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# Exception, thrown if some mode is not supported by the toolset.
|
|
112
|
+
class Unsupported_mode_ex < Ex
|
|
113
|
+
def initialize( msg )
|
|
114
|
+
super( msg )
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
# Exception, thrown if some dependency file is missing.
|
|
119
|
+
class Missing_depend_file_ex < Ex
|
|
120
|
+
def initialize( missing_file, depend_for )
|
|
121
|
+
super( "File '#{missing_file}' required by '#{depend_for}' " +
|
|
122
|
+
"missing" )
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# Exception, thrown if some value is invalid in current context.
|
|
127
|
+
class Invalid_value_ex < Ex
|
|
128
|
+
def initialize( msg )
|
|
129
|
+
super( msg )
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
end
|
|
134
|
+
|