Class: MxxRu::Cpp::Toolsets::Vc8Family

Inherits:
VcFamily
  • Object
show all
Defined in:
lib/mxx_ru/cpp/toolsets/vc8_family.rb

Overview

Toolset implementation for Visual C++ 2005 (8.0) and above.

Direct Known Subclasses

IccWin, Vc10, Vc11, Vc12, Vc8, Vc9

Defined Under Namespace

Classes: ActualManifest

Constant Summary collapse

MT_NAME_TAG =

Tag name for a custom manifest tool name.

Since v.1.4.0

'mt_name'
Actual_manifest =

For compatibility with previous versions.

ActualManifest
@@default_manifest =
OpenStruct.new(
:autogen => true,
:mt => true,
:manifest_file => :default,
:resource_id => :default,
:keep_manifest_file => false )
@@resource_id_names =

Set of avaliable values for :resource_id key-value pair in manifest description.

Set.new( [
:default,
:process_manifest,
:isolationaware_manifest,
:isolationaware_nostaticimport_manifest ] )

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from VcFamily

#clean_lib_specific_files, #clean_vc_specific_garbage, #compiler_name, #dll_file_name, #exe_file_name, #implib_link_name, #implib_link_path, #lib_file_name, #lib_link_name, #librarian_name, #linker_name, #make_c_obj_command_lines, #make_cpp_obj_command_lines, #make_dll_requirements, #make_lib_command_lines, #make_mswin_res_command_lines, #mswin_res_file_name, #obj_file_ext, #rc_name, #setup_vc_specific_debug_options

Constructor Details

#initialize(a_name = "vc") ⇒ Vc8Family

Returns a new instance of Vc8Family.



121
122
123
# File 'lib/mxx_ru/cpp/toolsets/vc8_family.rb', line 121

def initialize( a_name = "vc" )
  super( a_name )
end

Class Method Details

.default_manifestObject

Get default manifest.



295
296
297
# File 'lib/mxx_ru/cpp/toolsets/vc8_family.rb', line 295

def self.default_manifest
  @@default_manifest
end

.manifest(params) ⇒ Object

Make manifest description.

Examples:

# Autogenerate manifest for target. Do not embed into executable.
# Manifest stored in <target>.manifest file.
MxxRu::Cpp::Toolsets::Vc8::manifest(
  :target => self,
  :autogen => :to_default_file )

# Autogenerate manifest for target. Embed into executable.
# Autogenerated manifest will be deleted after embeding.
MxxRu::Cpp::Toolsets::Vc8::manifest(
  :target => self,
  :autogen => :to_default_file,
  :mt => {} )

# Autogenerate manifest for target. Embed into executable.
# Autogenerated manifest will be kept after embeding.
MxxRu::Cpp::Toolsets::Vc8::manifest(
  :target => self,
  :autogen => :to_default_file,
  :mt => { :keep_manifest_file => true } )

# Autogenerate manifest for target. Embed into executable as
# resource with id CREATEPROCESS_MANIFEST_RESOURCE_ID id.
MxxRu::Cpp::Toolsets::Vc8::manifest(
  :target => self,
  :autogen => :to_default_file,
  :mt => { :resource_id => :process_manifest } )

# Autogenerate manifest for target. Store manifest into
# file 'hello_world.exe.manifest'. Embed info executable.
MxxRu::Cpp::Toolsets::Vc8::manifest(
  :target => self,
  :autogen => 'hello_world.exe.manifest',
  :mt => {} )

# Embed manifest from file 'hello_world.exe.manifest' into 
# target executable.
MxxRu::Cpp::Toolsets::Vc8::manifest(
  :target => self,
  :mt => { :manifest => 'hello_world.exe.manifest' } )
# Embed manifest from file 'hello_world.dll.manifest' into 
# target executable as resource with
# ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID id.
MxxRu::Cpp::Toolsets::Vc8::manifest(
  :target => self,
  :mt => { :manifest => 'hello_world.exe.manifest',
    :resource_id => :isolationaware_nonstaticimport } )

# Autogenerate manifest for all targets in build. Store manifest
# in default files. Do not embed manifest into executable.
MxxRu::Cpp::Toolsets::Vc8::manifest(
  :autogen => :to_default_file )

# Autogenerate manifest for all targets in build. Store manifest
# in default files. Embed manifest into executable.
MxxRu::Cpp::Toolsets::Vc8::manifest(
  :autogen => :to_default_file,
  :mt => {} )

# Drop default manifest for build. Only explicitly specified
# manifest will be generated.
MxxRu::Cpp::Toolsets::Vc8::manifest( nil )


250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
# File 'lib/mxx_ru/cpp/toolsets/vc8_family.rb', line 250

def self.manifest( params )
  if nil == params
    # No default manifest.
    @@default_manifest = nil
  else
    check_manifest_params( params )

    d = OpenStruct.new( :keep_manifest_file => true )
    
    if params.key?( :autogen )
      d.autogen = true
      d.manifest_file = ( params[ :autogen ] == :to_default_file ?
        :default : params[ :autogen ] )
      d.keep_manifest_file = false
    else
      d.autogen = false
    end

    if params.key?( :mt ) && nil != params[ :mt ]
      d.mt = true
      mt_params = params[ :mt ]
      d.manifest_file = mt_params[ :manifest ] if
        mt_params.key?( :manifest )
      d.resource_id = ( mt_params.key?( :resource_id ) ?
        mt_params[ :resource_id ] : :default )

      if mt_params.key?( :keep_manifest_file ) and
        params.key?( :autogen )
        d.keep_manifest_file = mt_params[ :keep_manifest_file ]
      end
    else
      d.mt = false
    end

    if params.key?( :target )
      # Source manifest must be set for specified target.
      params[ :target ].vc8_source_manifest = d
    else
      # This is new default manifest.
      @@default_manifest = d
    end
  end
end

Instance Method Details

#clean_dll_specific_files(dll_file, dll_info, target) ⇒ Object

Remove autogenerated manifest file if any.



147
148
149
150
# File 'lib/mxx_ru/cpp/toolsets/vc8_family.rb', line 147

def clean_dll_specific_files( dll_file, dll_info, target )
  super( dll_file, dll_info, target )
  clean_autogenerated_manifest( target )
end

#clean_exe_specific_files(exe_file, exe_info, target) ⇒ Object

Remove autogenerated manifest file if any.



153
154
155
156
# File 'lib/mxx_ru/cpp/toolsets/vc8_family.rb', line 153

def clean_exe_specific_files( exe_file, exe_info, target )
  super( exe_file, exe_info, target )
  clean_autogenerated_manifest( target )
end

#make_dll_command_lines(dll_name, dll_info, linker_lists, target) ⇒ Object

Append command line for embeding manifest file to result of super class implementation.



160
161
162
163
164
165
166
167
168
169
170
# File 'lib/mxx_ru/cpp/toolsets/vc8_family.rb', line 160

def make_dll_command_lines(
    dll_name,
    dll_info,
    linker_lists,
    target )

  append_mt_command_lines(
    super( dll_name, dll_info, linker_lists, target ),
    dll_name,
    target )
end

#make_exe_command_lines(exe_name, exe_info, linker_lists, target) ⇒ Object

Append command line for embeding manifest file to result of super class implementation.



174
175
176
177
178
179
180
181
182
183
# File 'lib/mxx_ru/cpp/toolsets/vc8_family.rb', line 174

def make_exe_command_lines(
    exe_name,
    exe_info,
    linker_lists,
    target )
  append_mt_command_lines(
    super( exe_name, exe_info, linker_lists, target ),
    exe_name,
    target )
end

#setup_mandatory_options(target) ⇒ Object

Check some VC8.0 constraints before calling superclass implementation

VC8.0 does not support Single-Thread Run-Time.



129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/mxx_ru/cpp/toolsets/vc8_family.rb', line 129

def setup_mandatory_options( target )
  if THREADING_SINGLE == target.mxx_threading_mode
    raise MxxRu::UnsupportedModeEx.new(
      "Visual C++ 2005 and above doesn't support " +
      "single-threaded static RTL" )
  elsif THREADING_DEFAULT == target.mxx_threading_mode
    # Because VC8.0 doesn't support Single Thread Run-Time then
    # by default we must use Mutli-Threading Run-Time. 
    target.threading_mode( THREADING_MULTI )
  end

  super( target )

  setup_manifest( target )
  setup_manifest_params( target )
end