mirror of
https://github.com/boostorg/build.git
synced 2026-02-17 01:32:12 +00:00
Add support for toolset specific resource compiler tool. Make gcc toolset configure a resource compiler if available, and optionally can be user configured. This allows the use of RC files with MinGW and CGYWIN. MSVC minor adjustment to changed name of RC rule. (merge from HEAD)
[SVN r33540]
This commit is contained in:
@@ -39,6 +39,7 @@ generators.override gcc.searched-lib-generator : searched-lib-generator ;
|
||||
type.set-generated-target-suffix OBJ : <toolset>gcc : o ;
|
||||
type.set-generated-target-suffix STATIC_LIB : <toolset>gcc : a ;
|
||||
|
||||
import rc ;
|
||||
|
||||
# Initializes the gcc toolset for the given version.
|
||||
# If necessary, command may be used to specify where the compiler
|
||||
@@ -100,6 +101,8 @@ rule init ( version ? : command * : options * )
|
||||
#~ If it's not a system gcc install we should adjust the various
|
||||
#~ programs as needed to prefer using the install specific versions.
|
||||
#~ This is essential for correct use of MinGW and for cross-compiling.
|
||||
|
||||
#~ - The archive builder.
|
||||
local archiver =
|
||||
[ common.get-invocation-command gcc
|
||||
: ar : [ feature.get-values <archiver> : $(options) ] : $(bin) : PATH ] ;
|
||||
@@ -108,6 +111,15 @@ rule init ( version ? : command * : options * )
|
||||
{
|
||||
ECHO notice: using gcc archiver :: $(condition) :: $(archiver[1]) ;
|
||||
}
|
||||
|
||||
#~ - The resource compiler.
|
||||
local rc =
|
||||
[ common.get-invocation-command gcc
|
||||
: windres : [ feature.get-values <rc> : $(options) ] : $(bin) : PATH ] ;
|
||||
local rc-type =
|
||||
[ feature.get-values <rc-type> : $(options) ] ;
|
||||
rc-type ?= windres ;
|
||||
rc.configure $(rc) : $(condition) : <rc-type>$(rc-type) ;
|
||||
}
|
||||
|
||||
if [ os.name ] = NT
|
||||
|
||||
@@ -500,7 +500,7 @@ generators.register-c-compiler msvc.compile.c : C : OBJ : <toolset>msvc ;
|
||||
|
||||
# Using 'register-c-compiler' adds the build directory to INCLUDES
|
||||
generators.register-c-compiler msvc.compile.rc : RC : OBJ(%_res) : <toolset>msvc ;
|
||||
generators.override msvc.compile.rc : rc.resource-compile ;
|
||||
generators.override msvc.compile.rc : rc.compile.resource ;
|
||||
generators.register-standard msvc.compile.asm : ASM : OBJ : <toolset>msvc ;
|
||||
|
||||
generators.register-c-compiler msvc.compile.idl : IDL : MSTYPELIB H C(%_i) C(%_proxy) C(%_dlldata) : <toolset>msvc ;
|
||||
|
||||
@@ -2,12 +2,24 @@
|
||||
# distribute this software is granted provided this copyright notice appears in
|
||||
# all copies. This software is provided "as is" without express or implied
|
||||
# warranty, and with no claim as to its suitability for any purpose.
|
||||
#
|
||||
# Copyright (c) 2006 Rene Rivera.
|
||||
#
|
||||
# Use, modification and distribution is subject to the Boost Software
|
||||
# License Version 1.0. (See accompanying file LICENSE_1_0.txt or
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
import type ;
|
||||
import generators ;
|
||||
import feature ;
|
||||
import errors ;
|
||||
import scanner ;
|
||||
import toolset : flags ;
|
||||
|
||||
if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
|
||||
{
|
||||
.debug-configuration = true ;
|
||||
}
|
||||
|
||||
type.register RC : rc ;
|
||||
|
||||
@@ -15,40 +27,50 @@ rule init ( )
|
||||
{
|
||||
}
|
||||
|
||||
rule resource-compile ( target : sources * : properties * )
|
||||
# Configures a new resource compilation command specific to a condition,
|
||||
# usually a toolset selection condition. The possible options are:
|
||||
#
|
||||
# * <rc-type>(rc|windres) - Indicates the type of options the command
|
||||
# accepts.
|
||||
#
|
||||
# Even though the arguments are all optional, only when a command, condition,
|
||||
# and at minimum the rc-type option are given will the command be configured.
|
||||
# This is so that callers don't have to check auto-configuration values
|
||||
# before calling this. And still get the functionality of build failures when
|
||||
# the resource compiler can't be found.
|
||||
#
|
||||
rule configure ( command ? : condition ? : options * )
|
||||
{
|
||||
local OS = [ feature.get-values <os> : $(properties) ] ;
|
||||
switch $(OS)
|
||||
local rc-type = [ feature.get-values <rc-type> : $(options) ] ;
|
||||
|
||||
if $(command) && $(condition) && $(rc-type)
|
||||
{
|
||||
case "NT" :
|
||||
resource-compile-nt $(target) : $(sources[1]) ;
|
||||
case "CYGWIN" :
|
||||
resource-compile-cygwin $(target) : $(sources[1]) ;
|
||||
case "FREEBSD" :
|
||||
create-empty-object $(target) : $(sources[1]) ;
|
||||
case "SOLARIS" :
|
||||
create-empty-object $(target) : $(sources[1]) ;
|
||||
case "KFREEBSD" :
|
||||
create-empty-object $(target) : $(sources[1]) ;
|
||||
case "LINUX" :
|
||||
create-empty-object $(target) : $(sources[1]) ;
|
||||
case "*" :
|
||||
errors.error "Cannot process RC files for OS=$(OS)" ;
|
||||
flags rc.compile.resource .RC $(condition) : $(command) ;
|
||||
flags rc.compile.resource .RC_TYPE $(condition) : $(rc-type:L) ;
|
||||
if $(.debug-configuration)
|
||||
{
|
||||
ECHO notice: using rc compiler :: $(condition) :: $(command) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
actions quietly resource-compile-nt
|
||||
rule compile.resource ( target : sources * : properties * )
|
||||
{
|
||||
rc /i "$(>:D)" /i "$(<:D)" /fo "$(<)" "$(>)"
|
||||
local rc-type = [ on $(target) return $(.RC_TYPE) ] ;
|
||||
compile.resource.$(rc-type) $(target) : $(sources[1]) ;
|
||||
}
|
||||
|
||||
actions quietly resource-compile-cygwin
|
||||
actions compile.resource.rc
|
||||
{
|
||||
windres --include-dir "$(>:D)" -o "$(<)" -i "$(>)"
|
||||
"$(.RC)" -l 0x409 "-U$(UNDEFS)" "-D$(DEFINES)" -I"$(>:D)" -I"$(<:D)" -I"$(INCLUDES)" -fo "$(<)" "$(>)"
|
||||
}
|
||||
|
||||
actions quietly create-empty-object
|
||||
actions compile.resource.windres
|
||||
{
|
||||
"$(.RC)" "-U$(UNDEFS)" "-D$(DEFINES)" -I"$(>:D)" -I"$(<:D)" -I"$(INCLUDES)" -o "$(<)" -i "$(>)"
|
||||
}
|
||||
|
||||
actions quietly compile.resource.null
|
||||
{
|
||||
as /dev/null -o "$(<)"
|
||||
}
|
||||
@@ -62,7 +84,7 @@ actions quietly create-empty-object
|
||||
# See http://article.gmane.org/gmane.comp.lib.boost.build/5643/
|
||||
#
|
||||
# Using 'register-c-compiler' adds the build directory to INCLUDES
|
||||
generators.register-c-compiler rc.resource-compile : RC : OBJ(%_res) ;
|
||||
generators.register-c-compiler rc.compile.resource : RC : OBJ(%_res) ;
|
||||
|
||||
# Register scanner for resources
|
||||
class res-scanner : scanner
|
||||
@@ -129,7 +151,3 @@ class res-scanner : scanner
|
||||
|
||||
scanner.register res-scanner : include ;
|
||||
type.set-scanner RC : res-scanner ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user