Skip to content

Commit

Permalink
[compiler]: Use clang and libc++ by default
Browse files Browse the repository at this point in the history
  • Loading branch information
muqiuhan committed Mar 10, 2024
1 parent 905ff8e commit 7fa9ae5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions compiler/diagnostics/diagnostics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "utils.h"
#include <iomanip>
#include <iostream>
#include <map>
#include <regex>
#include <utility>

Expand Down
9 changes: 8 additions & 1 deletion compiler/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,25 @@ set_xmakever("2.8.1")
add_rules("mode.debug", "mode.release")
add_rules("plugin.compile_commands.autoupdate", {outputdir = "."})

includes("../stdlib")

target("swc")
set_kind("binary")
set_languages("c++20")

add_cxxflags("clang::-stdlib=libc++")
add_files("*.cpp", "**/*.cpp")
add_includedirs(".", "ast", "type", "lexer", "parser", "diagnostics", "utils")

add_links("c++")

before_build(function (target)
os.run("flex -o $(scriptdir)/lexer/flex_lexer.cpp $(scriptdir)/lexer/lexer.l")
os.run("bison -o $(scriptdir)/parser/bison_parser.cpp -d $(scriptdir)/parser/parser.y")
end)

after_build(function (_)
os.run("make fmt")
end)
end)

add_deps("stdlib")
1 change: 0 additions & 1 deletion stdlib/stdlib.cpp
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
auto main(int argc, char *argv[]) -> int { return 0; }
2 changes: 0 additions & 2 deletions stdlib/xmake.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
includes("../compiler")

target("stdlib")
set_kind("shared")
set_languages("c++20")
Expand Down

0 comments on commit 7fa9ae5

Please sign in to comment.