1 # Copyright Noel Belcourt 2007.
2 # Copyright 2017, NVIDIA CORPORATION.
3 # Distributed under the Boost Software License, Version 1.0.
4 # (See accompanying file LICENSE_1_0.txt or copy at
5 # http://www.boost.org/LICENSE_1_0.txt)
10 import toolset : flags ;
17 feature.extend toolset : pgi ;
18 toolset.inherit pgi : unix ;
19 generators.override pgi.prebuilt : builtin.lib-generator ;
20 generators.override pgi.searched-lib-generator : searched-lib-generator ;
22 # Documentation and toolchain description located
23 # http://www.pgroup.com/resources/docs.htm
25 rule init ( version ? : command * : options * )
27 local condition = [ common.check-init-parameters pgi : version $(version) ] ;
29 local l_command = [ common.get-invocation-command pgi : pgc++ : $(command) ] ;
31 common.handle-options pgi : $(condition) : $(l_command) : $(options) ;
33 command_c = $(command_c[1--2]) $(l_command[-1]:B=pgcc) ;
35 toolset.flags pgi CONFIG_C_COMMAND $(condition) : $(command_c) ;
37 flags pgi.compile DEFINES $(condition) :
38 [ feature.get-values <define> : $(options) ] : unchecked ;
41 flags pgi.link FINDLIBS-ST : [
42 feature.get-values <find-static-library> : $(options) ] : unchecked ;
44 gcc.init-link-flags pgi gnu $(condition) ;
48 generators.register-c-compiler pgi.compile.c : C : OBJ : <toolset>pgi ;
49 generators.register-c-compiler pgi.compile.c++ : CPP : OBJ : <toolset>pgi ;
50 generators.register-fortran-compiler pgi.compile.fortran : FORTRAN : OBJ : <toolset>pgi ;
52 # Declare flags and actions for compilation
53 flags pgi.compile OPTIONS <link>shared : -fpic ;
54 flags pgi.compile OPTIONS <debug-symbols>on : -gopt ;
55 flags pgi.compile OPTIONS <optimization>off : -O0 ;
56 flags pgi.compile OPTIONS <optimization>speed : -fast ;
57 flags pgi.compile OPTIONS <optimization>space : -fast ;
59 flags pgi.compile OPTIONS <warnings>off : -Minform=severe ;
60 flags pgi.compile OPTIONS <warnings>on : -Minform=warn ;
61 flags pgi.compile OPTIONS <warnings-as-errors>on : -Werror ;
63 flags pgi.compile.c++ OPTIONS <rtti>off : --no_rtti ;
64 flags pgi.compile.c++ OPTIONS <exception-handling>off : --no_exceptions ;
66 flags pgi.compile OPTIONS <cflags> ;
67 flags pgi.compile.c++ OPTIONS <cxxflags> ;
68 flags pgi.compile DEFINES <define> ;
69 flags pgi.compile INCLUDES <include> ;
71 flags pgi.compile.fortran OPTIONS <fflags> ;
75 "$(CONFIG_C_COMMAND)" $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
80 "$(CONFIG_COMMAND)" $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
83 actions compile.fortran
85 "$(CONFIG_F_COMMAND)" $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
88 # Declare flags and actions for linking
89 flags pgi.link OPTIONS <debug-symbols>on : -gopt ;
90 # Strip the binary when no debugging is needed
91 flags pgi.link OPTIONS <debug-symbols>off : -s ;
92 flags pgi.link OPTIONS <linkflags> ;
93 flags pgi.link OPTIONS <link>shared : -fpic ;
94 flags pgi.link LINKPATH <library-path> ;
95 flags pgi.link FINDLIBS-ST <find-static-library> ;
96 flags pgi.link FINDLIBS-SA <find-shared-library> ;
97 flags pgi.link FINDLIBS-SA <threading>multi : pthread rt ;
98 flags pgi.link LIBRARIES <library-file> ;
99 flags pgi.link LINK-RUNTIME <runtime-link>static : static ;
100 flags pgi.link LINK-RUNTIME <runtime-link>shared : dynamic ;
101 flags pgi.link RPATH <dll-path> ;
103 rule link ( targets * : sources * : properties * )
105 SPACE on $(targets) = " " ;
108 actions link bind LIBRARIES
110 "$(CONFIG_COMMAND)" $(OPTIONS) -L"$(LINKPATH)" -R"$(RPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-ST) -l$(FINDLIBS-SA)
113 # Slight mods for dlls
114 rule link.dll ( targets * : sources * : properties * )
116 SPACE on $(targets) = " " ;
119 actions link.dll bind LIBRARIES
121 "$(CONFIG_COMMAND)" $(OPTIONS) -shared -L"$(LINKPATH)" -R"$(RPATH)" -soname $(<[-1]:D=) -o "$(<)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST)
124 actions updated together piecemeal pgi.archive
126 ar -rc$(ARFLAGS:E=) "$(<)" "$(>)"