Skip to content

Commit

Permalink
Add standard C++ library.
Browse files Browse the repository at this point in the history
  • Loading branch information
CuppoJava committed Dec 10, 2022
1 parent 28ec4eb commit 3da1a94
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
10 changes: 0 additions & 10 deletions compiler/main.stanza
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,6 @@ defn build-system (verbose?:True|False) :
;User flags
emit-args(ccflags)

;If a C++ library hasn't already been included, then
;include it.
if not contains?(ccflags, "-lc++") and
not contains?(ccflags, "-lstdc++") :
val libcpp = switch(platform) :
`os-x : "-lc++"
`linux : "-lstdc++"
`windows : "-lstdc++"
emit-arg(libcpp)

;Output file.
emit-args(["-o" output])

Expand Down
10 changes: 8 additions & 2 deletions compiler/system-dependencies.stanza
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ public defn system-dependencies (platform:Symbol) -> ProjDependencies :
val ccfiles = Vector<String>()
val ccflags = Vector<String>()

;C++ Standard
add(ccflags, "-std=gnu++11")
;C Standard
add(ccflags, "-std=gnu11")

;Use static linking on windows
if platform == `windows :
Expand Down Expand Up @@ -40,6 +40,12 @@ public defn system-dependencies (platform:Symbol) -> ProjDependencies :
if platform == `linux :
add(ccflags, "-D_GNU_SOURCE")

;Include standard C++ library.
switch(platform) :
`os-x : add(ccflags, "-lc++")
`linux : add(ccflags, "-lstdc++")
`windows : add(ccflags, "-lstdc++")

;Stanza include dir
add(ccflags, to-string("-I%_" % [system-filepath(StanzaIncludeDir)]))

Expand Down

0 comments on commit 3da1a94

Please sign in to comment.