# Copyright Vladimir Prus 2004. # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt # or copy at http://www.boost.org/LICENSE_1_0.txt) # Importing common is needed because the rules we inherit here depend on it. # That is nasty. import common ; import errors ; import feature ; import clang ; import msvc ; import os ; import toolset ; import generators ; import type ; import path ; import set ; feature.extend-subfeature toolset clang : platform : win ; toolset.inherit-generators clang-win clang win : msvc ; toolset.inherit-flags clang-win : msvc : on/object off on : YLOPTION ; toolset.inherit-rules clang-win : msvc ; # Override default do-nothing generators. generators.override clang-win.compile.c.pch : pch.default-c-pch-generator ; generators.override clang-win.compile.c++.pch : pch.default-cpp-pch-generator ; generators.override clang-win.compile.rc : rc.compile.resource ; generators.override clang-win.compile.mc : mc.compile ; toolset.flags clang-win.compile PCH_SOURCE on : ; toolset.flags clang-win.compile CFLAGS on/object : "" ; # Initializes the intel toolset for windows rule init ( version ? : # the compiler version command * : # the command to invoke the compiler itself options * # Additional option: # either 'vc6', 'vc7', 'vc7.1' # or 'native'(default). ) { local compatibility = [ feature.get-values : $(options) ] ; local condition = [ common.check-init-parameters clang-win : version $(version) : compatibility $(compatibility) ] ; if ! $(compatibility) { import errors ; errors.error "Please set property for visual studio version!" ; } local vc_version = [ MATCH vc([0-9]+) : $(compatibility) ] ; if ! $(vc_version) { errors.user-error "Invalid value for compatibility option:" $(compatibility) ; } local m = [ MATCH ([0-9]+).* : $(version) ] ; local major = $(m[1]) ; command = [ common.get-invocation-command clang-win : clang-cl.exe : $(command) ] ; common.handle-options clang-win : $(condition) : $(command) : $(options) ; local setup ; setup = [ get-visual-studio-vcvars $(vc_version) ] ; # Get visual studio vcvars bat file path local target_types ; if [ MATCH ^(AMD64) : [ os.environ PROCESSOR_ARCHITECTURE ] ] { target_types = x86 amd64 ; } else { target_types = x86 x86_amd64 ; } for local c in $(target_types) { local cpu-conditions ; local setup-call ; setup-call = "call \""$(setup)"\" $(c) > nul " ; cpu-conditions = $(condition)/$(.cpu-arch-$(c)) ; if [ os.name ] = NT { setup-call = $(setup-call)" " ; } else { setup-call = "cmd /S /C "$(setup-call)" \"&&\" " ; } if $(.debug-configuration) { for local cpu-condition in $(cpu-conditions) { ECHO "notice: [clang-cfg] condition: '$(cpu-condition)', setup: '$(setup-call)'" ; } } local compiler ; compiler = [ path.native $(command) ] ; compiler = "\"$(compiler)\"" ; toolset.flags clang-win.compile .CC $(cpu-conditions) : $(setup-call)$(compiler) ; toolset.flags clang-win.link .LD $(cpu-conditions) : $(setup-call)link /nologo ; toolset.flags clang-win.archive .LD $(cpu-conditions) : $(setup-call)link /lib /nologo ; toolset.flags clang-win.link .MT $(cpu-conditions) : $(setup-call)mt -nologo ; toolset.flags clang-win.compile .MC $(cpu-conditions) : $(setup-call)mc ; toolset.flags clang-win.compile .RC $(cpu-conditions) : $(setup-call)rc ; } local C++FLAGS ; if $(vc_version) = 10 { C++FLAGS += -fmsc-version=1600 ; } else if $(vc_version) = 11 { C++FLAGS += -fmsc-version=1700 ; } else if $(vc_version) = 12 { C++FLAGS += -fmsc-version=1800 ; } toolset.flags clang-win CFLAGS $(condition) : $(C++FLAGS) ; msvc.configure-version-specific clang-win : $(vc_version) : $(condition) ; } local rule get-visual-studio-vcvars ( version ) { local env_variable_name ; env_variable_name = "VS"$(version:U)"0COMNTOOLS" ; local vc-path = [ os.environ $(env_variable_name) ] ; vc-path = [ path.join $(vc-path) "../../VC/vcvarsall.bat" ] ; path.native $(vc-path) ; } if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ] { .debug-configuration = true ; } # Copied from msvc.jam # Supported CPU architectures. .cpu-arch-x86 = / /32 x86/ x86/32 ; .cpu-arch-amd64 = /64 x86/64 ; .cpu-arch-x86_amd64 = /64 x86/64 ; # toolset.flags clang-win.link LIBRARY_OPTION clang : "" ; toolset.flags clang-win YLOPTION ;