From 049e228003e3edf37a90a43bf3576d5147460d7f Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Sun, 22 Sep 2019 10:56:02 +0300 Subject: [PATCH] compiler: pass -cflags to thirdparty building stage too --- compiler/cc.v | 28 +++++++++++++++++----------- compiler/main.v | 7 +------ 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/compiler/cc.v b/compiler/cc.v index ab40368d35..e02f162f55 100644 --- a/compiler/cc.v +++ b/compiler/cc.v @@ -369,17 +369,23 @@ fn find_c_compiler_default() string { } fn find_c_compiler_thirdparty_options() string { - if '-m32' in os.args{ - $if windows { - return '-m32' - }$else{ - return '-fPIC -m32' - } - }else{ - $if windows { - return '' - }$else{ - return '-fPIC' + fullargs := env_vflags_and_os_args() + mut cflags := get_cmdline_cflags( fullargs ) + $if !windows { + cflags += ' -fPIC' + } + if '-m32' in fullargs { + cflags += ' -m32' + } + return cflags +} + +fn get_cmdline_cflags(args []string) string { + mut cflags := '' + for ci, cv in args { + if cv == '-cflags' { + cflags += args[ci+1] + ' ' } } + return cflags } diff --git a/compiler/main.v b/compiler/main.v index 19a3c01274..9ed4947721 100644 --- a/compiler/main.v +++ b/compiler/main.v @@ -849,12 +849,7 @@ fn new_v(args[]string) &V { files << f } - mut cflags := '' - for ci, cv in args { - if cv == '-cflags' { - cflags += args[ci+1] + ' ' - } - } + cflags := get_cmdline_cflags(args) rdir := os.realpath( dir ) rdir_name := os.filename( rdir )