mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
Split C and C++ libraries, so that you can use C++ compiler flags. Build with
C++17.
This commit is contained in:
49
build/c.py
49
build/c.py
@@ -11,6 +11,7 @@ from build.ab import (
|
||||
stripext,
|
||||
)
|
||||
from os.path import *
|
||||
from types import SimpleNamespace
|
||||
|
||||
|
||||
def cfileimpl(self, name, srcs, deps, suffix, commands, label, kind, cflags):
|
||||
@@ -81,17 +82,7 @@ def findsources(name, srcs, deps, cflags, filerule):
|
||||
return objs
|
||||
|
||||
|
||||
@Rule
|
||||
def clibrary(
|
||||
self,
|
||||
name,
|
||||
srcs: Targets = [],
|
||||
deps: Targets = [],
|
||||
hdrs: TargetsMap = {},
|
||||
cflags=[],
|
||||
commands=["$(AR) cqs {outs[0]} {ins}"],
|
||||
label="LIB",
|
||||
):
|
||||
def libraryimpl(self, name, srcs, deps, hdrs, cflags, commands, label, kind):
|
||||
if not srcs and not hdrs:
|
||||
raise ABException(
|
||||
"clibrary contains no sources and no exported headers"
|
||||
@@ -124,6 +115,8 @@ def clibrary(
|
||||
hdrouts += [dest]
|
||||
i = i + 1
|
||||
|
||||
if not hasattr(self, "clibrary"):
|
||||
self.clibrary = SimpleNamespace()
|
||||
if srcs:
|
||||
hr = None
|
||||
if hdrcs:
|
||||
@@ -141,7 +134,7 @@ def clibrary(
|
||||
srcs,
|
||||
deps + ([f"{name}_hdrs"] if hr else []),
|
||||
cflags + ([f"-I{hr.normalrule.objdir}"] if hr else []),
|
||||
cfile,
|
||||
kind,
|
||||
)
|
||||
|
||||
normalrule(
|
||||
@@ -168,6 +161,38 @@ def clibrary(
|
||||
self.clibrary.cflags = ["-I" + r.normalrule.objdir]
|
||||
|
||||
|
||||
@Rule
|
||||
def clibrary(
|
||||
self,
|
||||
name,
|
||||
srcs: Targets = [],
|
||||
deps: Targets = [],
|
||||
hdrs: TargetsMap = {},
|
||||
cflags=[],
|
||||
commands=["$(AR) cqs {outs[0]} {ins}"],
|
||||
label="LIB",
|
||||
):
|
||||
return libraryimpl(
|
||||
self, name, srcs, deps, hdrs, cflags, commands, label, cfile
|
||||
)
|
||||
|
||||
|
||||
@Rule
|
||||
def cxxlibrary(
|
||||
self,
|
||||
name,
|
||||
srcs: Targets = [],
|
||||
deps: Targets = [],
|
||||
hdrs: TargetsMap = {},
|
||||
cflags=[],
|
||||
commands=["$(AR) cqs {outs[0]} {ins}"],
|
||||
label="LIB",
|
||||
):
|
||||
return libraryimpl(
|
||||
self, name, srcs, deps, hdrs, cflags, commands, label, cxxfile
|
||||
)
|
||||
|
||||
|
||||
def programimpl(
|
||||
self, name, srcs, deps, cflags, ldflags, commands, label, filerule, kind
|
||||
):
|
||||
|
||||
Reference in New Issue
Block a user