]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/tools/build/src/tools/clang-darwin.jam
bump version to 18.2.2-pve1
[ceph.git] / ceph / src / boost / tools / build / src / tools / clang-darwin.jam
CommitLineData
7c673cae
FG
1# Copyright Vladimir Prus 2004.
2# Copyright Noel Belcourt 2007.
1e59de90 3# Copyright Nikita Kniazev 2020-2021.
7c673cae 4# Distributed under the Boost Software License, Version 1.0.
1e59de90
TL
5# (See accompanying file LICENSE.txt
6# or copy at https://www.bfgroup.xyz/b2/LICENSE.txt)
7c673cae
FG
7
8import clang ;
9import feature : feature ;
10import os ;
11import toolset ;
12import toolset : flags ;
13import gcc ;
14import common ;
15import errors ;
16import generators ;
17
18feature.extend-subfeature toolset clang : platform : darwin ;
19
f67539c2
TL
20toolset.inherit-generators clang-darwin
21 <toolset>clang <toolset-clang:platform>darwin
22 : gcc
1e59de90 23 : gcc.mingw.link gcc.mingw.link.dll
7c673cae
FG
24 ;
25
26generators.override clang-darwin.prebuilt : builtin.lib-generator ;
27generators.override clang-darwin.prebuilt : builtin.prebuilt ;
28generators.override clang-darwin.searched-lib-generator : searched-lib-generator ;
29
1e59de90
TL
30# Override default do-nothing generators.
31generators.override clang-darwin.compile.c.pch : pch.default-c-pch-generator ;
32generators.override clang-darwin.compile.c++.pch : pch.default-cpp-pch-generator ;
7c673cae
FG
33
34toolset.inherit-rules clang-darwin : gcc ;
f67539c2 35toolset.inherit-flags clang-darwin : gcc
11fdf7f2 36 : <inlining>full
7c673cae
FG
37 <architecture>x86/<address-model>32
38 <architecture>x86/<address-model>64
f67539c2
TL
39 <lto>on/<lto-mode>full
40 <lto>on/<lto-mode>fat
7c673cae 41 ;
f67539c2 42
7c673cae
FG
43if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
44{
45 .debug-configuration = true ;
46}
f67539c2 47
7c673cae
FG
48# Initializes the clang-darwin toolset
49# version in optional
92f5a8d4 50# name (default clang++) is used to invoke the specified clang compiler
7c673cae
FG
51# compile and link options allow you to specify addition command line options for each version
52rule init ( version ? : command * : options * )
53{
1e59de90
TL
54 command = [ common.find-compiler clang-darwin : clang++ : $(version) : $(command)
55 : /usr/bin /usr/local/bin ] ;
56 local command-string = [ common.make-command-string $(command) ] ;
57 if ! $(version) { # ?= operator does not short-circuit
58 version ?= [ get-short-version $(command-string) ] ;
7c673cae
FG
59 }
60
b32b8144
FG
61 local condition = [ common.check-init-parameters clang
62 : version $(version) ] ;
7c673cae
FG
63
64 common.handle-options clang-darwin : $(condition) : $(command) : $(options) ;
11fdf7f2 65 clang.init-cxxstd-flags clang-darwin : $(condition) : $(version) ;
b32b8144 66
b32b8144
FG
67 # - Archive builder.
68 local archiver = [ feature.get-values <archiver> : $(options) ] ;
69 toolset.flags clang-darwin.archive .AR $(condition) : $(archiver[1]) ;
7c673cae
FG
70}
71
1e59de90
TL
72rule get-full-version ( command-string )
73{
74 import clang-linux ;
75 return [ clang-linux.get-full-version $(command-string) ] ;
76}
7c673cae 77
1e59de90
TL
78rule get-short-version ( command-string )
79{
80 import clang-linux ;
81 return [ clang-linux.get-short-version $(command-string) ] ;
82}
83
84SPACE = " " ;
7c673cae
FG
85
86# Declare flags and action for compilation.
7c673cae
FG
87
88# For clang, 'on' and 'full' are identical
7c673cae
FG
89toolset.flags clang-darwin.compile OPTIONS <inlining>full : -Wno-inline ;
90
f67539c2
TL
91# LTO
92toolset.flags clang-darwin.compile OPTIONS <lto>on/<lto-mode>thin : -flto=thin ;
93toolset.flags clang-darwin.link OPTIONS <lto>on/<lto-mode>thin : -flto=thin ;
94
95toolset.flags clang-darwin.compile OPTIONS <lto>on/<lto-mode>full : -flto=full ;
96toolset.flags clang-darwin.link OPTIONS <lto>on/<lto-mode>full : -flto=full ;
97
98# stdlib selection
99toolset.flags clang-darwin.compile OPTIONS <stdlib>gnu <stdlib>gnu11 : -stdlib=libstdc++ ;
100toolset.flags clang-darwin.link OPTIONS <stdlib>gnu <stdlib>gnu11 : -stdlib=libstdc++ ;
101
102toolset.flags clang-darwin.compile OPTIONS <stdlib>libc++ : -stdlib=libc++ ;
103toolset.flags clang-darwin.link OPTIONS <stdlib>libc++ : -stdlib=libc++ ;
104
1e59de90 105rule compile.c ( targets * : sources * : properties * )
7c673cae 106{
1e59de90 107 DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ;
7c673cae
FG
108}
109
1e59de90 110rule compile.c++ ( targets * : sources * : properties * )
7c673cae 111{
1e59de90 112 DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ;
7c673cae
FG
113}
114
1e59de90 115.include-pch = "-include-pch " ;
7c673cae 116
1e59de90 117actions compile.c bind PCH_FILE
7c673cae 118{
1e59de90 119 "$(CONFIG_COMMAND)" -x c $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" $(.include-pch)"$(PCH_FILE)" -c -o "$(<)" "$(>)"
7c673cae
FG
120}
121
1e59de90 122actions compile.c++ bind PCH_FILE
7c673cae 123{
1e59de90 124 "$(CONFIG_COMMAND)" -x c++ $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" $(.include-pch)"$(PCH_FILE)" -c -o "$(<)" "$(>)"
7c673cae
FG
125}
126
7c673cae
FG
127# Declare actions for linking
128rule link ( targets * : sources * : properties * )
129{
130 SPACE on $(targets) = " " ;
7c673cae
FG
131}
132
133actions link bind LIBRARIES
134{
135 "$(CONFIG_COMMAND)" $(USER_OPTIONS) -L"$(LINKPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" $(START-GROUP) $(FINDLIBS-ST-PFX) -l$(FINDLIBS-ST) $(FINDLIBS-SA-PFX) -l$(FINDLIBS-SA) $(END-GROUP) $(OPTIONS)
136}
137
138actions link.dll bind LIBRARIES
139{
140 "$(CONFIG_COMMAND)" $(USER_OPTIONS) -L"$(LINKPATH)" -o "$(<)" -single_module -dynamiclib -install_name "@rpath/$(<[1]:D=)" "$(>)" "$(LIBRARIES)" $(START-GROUP) $(FINDLIBS-ST-PFX) -l$(FINDLIBS-ST) $(FINDLIBS-SA-PFX) -l$(FINDLIBS-SA) $(END-GROUP) $(OPTIONS)
141}