diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2019-07-23 15:50:45 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2019-08-14 13:13:23 -0700 |
commit | 499c44dc77c2d4a2c649830555cd9257d285bba6 (patch) | |
tree | 3cbb65e1311b799e54db60de4e88d300fe523978 /mesonbuild/compilers/cuda.py | |
parent | 9b3a1fabc5555739ff6c5046c7bf1ee2266cd53c (diff) | |
download | meson-499c44dc77c2d4a2c649830555cd9257d285bba6.zip meson-499c44dc77c2d4a2c649830555cd9257d285bba6.tar.gz meson-499c44dc77c2d4a2c649830555cd9257d285bba6.tar.bz2 |
compilers/cuda: don't use re for replacement
Even with the check (for extra safety) string.replace is more than twice
as fast.
Diffstat (limited to 'mesonbuild/compilers/cuda.py')
-rw-r--r-- | mesonbuild/compilers/cuda.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/mesonbuild/compilers/cuda.py b/mesonbuild/compilers/cuda.py index 152c8ba..ffd60f3 100644 --- a/mesonbuild/compilers/cuda.py +++ b/mesonbuild/compilers/cuda.py @@ -12,13 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -import re, os.path +import os.path from .. import mlog from ..mesonlib import EnvironmentException, MachineChoice, Popen_safe from .compilers import (Compiler, cuda_buildtype_args, cuda_optimization_args, cuda_debug_args, CompilerType) -from .mixins.gnu import get_gcc_soname_args class CudaCompiler(Compiler): def __init__(self, exelist, version, for_machine: MachineChoice, is_cross, exe_wrapper=None): @@ -165,7 +164,7 @@ class CudaCompiler(Compiler): Converts GNU-style arguments -Wl,-arg,-arg to NVCC-style arguments -Xlinker=-arg,-arg """ - return [re.sub('^-Wl,', '-Xlinker=', arg) for arg in args] + return [arg.replace('-Wl', '-Xlinker=', 1) if arg.startswith('-Wl') else arg for arg in args] def get_output_args(self, target): return ['-o', target] |