Use cc on OpenBSD and link to libm when building result (#14672)
This commit is contained in:
parent
de5cde473a
commit
7b12f13946
1 changed files with 16 additions and 5 deletions
|
|
@ -14,10 +14,18 @@
|
||||||
# compilation.
|
# compilation.
|
||||||
import os, strutils
|
import os, strutils
|
||||||
|
|
||||||
|
when defined(openbsd):
|
||||||
|
const
|
||||||
|
cc = "cc -o $# $#.c"
|
||||||
|
cpp = "cc -E -o $#.i $#.c"
|
||||||
|
ccLinkMath = "cc -lm -o $# $#.c"
|
||||||
|
cppLinkMath = "cc -lm -E -o $#.i $#.c"
|
||||||
|
else:
|
||||||
const
|
const
|
||||||
cc = "gcc -o $# $#.c"
|
cc = "gcc -o $# $#.c"
|
||||||
cpp = "gcc -E -o $#.i $#.c"
|
cpp = "gcc -E -o $#.i $#.c"
|
||||||
|
|
||||||
|
const
|
||||||
cfile = """
|
cfile = """
|
||||||
/* Generated by detect.nim */
|
/* Generated by detect.nim */
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
|
|
@ -89,8 +97,11 @@ proc main =
|
||||||
if open(f, "other_consts.nim", fmWrite):
|
if open(f, "other_consts.nim", fmWrite):
|
||||||
f.write(nimfile % [other])
|
f.write(nimfile % [other])
|
||||||
close(f)
|
close(f)
|
||||||
if not myExec(cc % [gen.addFileExt(ExeExt), gen]): quit(1)
|
|
||||||
if not myExec(cpp % [pre.addFileExt(ExeExt), pre]): quit(1)
|
let cCompile = when defined(openbsd): ccLinkMath else: cc
|
||||||
|
let cppCompile = when defined(openbsd): cppLinkMath else: cpp
|
||||||
|
if not myExec(cCompile % [gen.addFileExt(ExeExt), gen]): quit(1)
|
||||||
|
if not myExec(cppCompile % [pre.addFileExt(ExeExt), pre]): quit(1)
|
||||||
when defined(windows):
|
when defined(windows):
|
||||||
if not myExec(gen.addFileExt(ExeExt)): quit(1)
|
if not myExec(gen.addFileExt(ExeExt)): quit(1)
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue