]>
Commit | Line | Data |
---|---|---|
7c673cae | 1 | # Copyright Noel Belcourt 2007. |
b32b8144 | 2 | # Copyright 2017, NVIDIA CORPORATION. |
7c673cae FG |
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) | |
6 | ||
7 | import property ; | |
8 | import generators ; | |
9 | import os ; | |
10 | import toolset : flags ; | |
11 | import feature ; | |
12 | import fortran ; | |
13 | import type ; | |
14 | import common ; | |
15 | import gcc ; | |
16 | ||
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 ; | |
21 | ||
22 | # Documentation and toolchain description located | |
23 | # http://www.pgroup.com/resources/docs.htm | |
24 | ||
25 | rule init ( version ? : command * : options * ) | |
26 | { | |
27 | local condition = [ common.check-init-parameters pgi : version $(version) ] ; | |
28 | ||
b32b8144 | 29 | local l_command = [ common.get-invocation-command pgi : pgc++ : $(command) ] ; |
7c673cae FG |
30 | |
31 | common.handle-options pgi : $(condition) : $(l_command) : $(options) ; | |
32 | ||
33 | command_c = $(command_c[1--2]) $(l_command[-1]:B=pgcc) ; | |
34 | ||
35 | toolset.flags pgi CONFIG_C_COMMAND $(condition) : $(command_c) ; | |
36 | ||
37 | flags pgi.compile DEFINES $(condition) : | |
38 | [ feature.get-values <define> : $(options) ] : unchecked ; | |
39 | ||
7c673cae FG |
40 | # set link flags |
41 | flags pgi.link FINDLIBS-ST : [ | |
42 | feature.get-values <find-static-library> : $(options) ] : unchecked ; | |
7c673cae FG |
43 | } |
44 | ||
45 | # Declare generators | |
46 | generators.register-c-compiler pgi.compile.c : C : OBJ : <toolset>pgi ; | |
47 | generators.register-c-compiler pgi.compile.c++ : CPP : OBJ : <toolset>pgi ; | |
48 | generators.register-fortran-compiler pgi.compile.fortran : FORTRAN : OBJ : <toolset>pgi ; | |
49 | ||
50 | # Declare flags and actions for compilation | |
b32b8144 | 51 | flags pgi.compile OPTIONS <link>shared : -fpic ; |
7c673cae | 52 | flags pgi.compile OPTIONS <debug-symbols>on : -gopt ; |
b32b8144 FG |
53 | flags pgi.compile OPTIONS <optimization>off : -O0 ; |
54 | flags pgi.compile OPTIONS <optimization>speed : -fast ; | |
55 | flags pgi.compile OPTIONS <optimization>space : -fast ; | |
7c673cae FG |
56 | |
57 | flags pgi.compile OPTIONS <warnings>off : -Minform=severe ; | |
58 | flags pgi.compile OPTIONS <warnings>on : -Minform=warn ; | |
b32b8144 | 59 | flags pgi.compile OPTIONS <warnings-as-errors>on : -Werror ; |
7c673cae | 60 | |
b32b8144 FG |
61 | flags pgi.compile.c++ OPTIONS <rtti>off : --no_rtti ; |
62 | flags pgi.compile.c++ OPTIONS <exception-handling>off : --no_exceptions ; | |
7c673cae FG |
63 | |
64 | flags pgi.compile OPTIONS <cflags> ; | |
65 | flags pgi.compile.c++ OPTIONS <cxxflags> ; | |
66 | flags pgi.compile DEFINES <define> ; | |
67 | flags pgi.compile INCLUDES <include> ; | |
68 | ||
69 | flags pgi.compile.fortran OPTIONS <fflags> ; | |
70 | ||
71 | actions compile.c | |
72 | { | |
73 | "$(CONFIG_C_COMMAND)" $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" | |
74 | } | |
75 | ||
76 | actions compile.c++ | |
77 | { | |
78 | "$(CONFIG_COMMAND)" $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" | |
79 | } | |
80 | ||
81 | actions compile.fortran | |
82 | { | |
83 | "$(CONFIG_F_COMMAND)" $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" | |
84 | } | |
85 | ||
86 | # Declare flags and actions for linking | |
87 | flags pgi.link OPTIONS <debug-symbols>on : -gopt ; | |
88 | # Strip the binary when no debugging is needed | |
89 | flags pgi.link OPTIONS <debug-symbols>off : -s ; | |
7c673cae | 90 | flags pgi.link OPTIONS <linkflags> ; |
b32b8144 | 91 | flags pgi.link OPTIONS <link>shared : -fpic ; |
7c673cae FG |
92 | flags pgi.link LINKPATH <library-path> ; |
93 | flags pgi.link FINDLIBS-ST <find-static-library> ; | |
94 | flags pgi.link FINDLIBS-SA <find-shared-library> ; | |
95 | flags pgi.link FINDLIBS-SA <threading>multi : pthread rt ; | |
96 | flags pgi.link LIBRARIES <library-file> ; | |
97 | flags pgi.link LINK-RUNTIME <runtime-link>static : static ; | |
98 | flags pgi.link LINK-RUNTIME <runtime-link>shared : dynamic ; | |
99 | flags pgi.link RPATH <dll-path> ; | |
100 | ||
7c673cae FG |
101 | rule link ( targets * : sources * : properties * ) |
102 | { | |
103 | SPACE on $(targets) = " " ; | |
104 | } | |
105 | ||
7c673cae FG |
106 | actions link bind LIBRARIES |
107 | { | |
b32b8144 | 108 | "$(CONFIG_COMMAND)" $(OPTIONS) -L"$(LINKPATH)" -R"$(RPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-ST) -l$(FINDLIBS-SA) |
7c673cae FG |
109 | } |
110 | ||
111 | # Slight mods for dlls | |
112 | rule link.dll ( targets * : sources * : properties * ) | |
113 | { | |
114 | SPACE on $(targets) = " " ; | |
115 | } | |
116 | ||
7c673cae FG |
117 | actions link.dll bind LIBRARIES |
118 | { | |
b32b8144 | 119 | "$(CONFIG_COMMAND)" $(OPTIONS) -shared -L"$(LINKPATH)" -R"$(RPATH)" -soname $(<[-1]:D=) -o "$(<)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) |
7c673cae FG |
120 | } |
121 | ||
122 | actions updated together piecemeal pgi.archive | |
123 | { | |
124 | ar -rc$(ARFLAGS:E=) "$(<)" "$(>)" | |
125 | } | |
126 |