From fa31d21ba92669a521a7768467246918e3947e02 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Thu, 1 Apr 2021 13:39:11 -0400 Subject: Added compiler-core project (#1775) * #include an absolute path didn't work - because paths were taken to always be relative. * Split out compiler-core initially with just slang-source-loc.cpp * More lexer, name, token to compiler-core. * Split Lexer and Core diagnostics. * Move slang-file-system to core. * Add slang-file-system to core. * More DownstreamCompiler into compiler-core * Fix typo. * Add compiler-core to bootstrap proj. * Small fixes to premake * For linux try with compiler-core * Remove compiler-core from examples. * Added NameConventionUtil to compiler-core * Add global function to CharUtil to *hopefully* avoid linking issue. * Hack to make linkage of CharUtil work on linux. --- premake5.lua | 47 +++++++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 20 deletions(-) (limited to 'premake5.lua') diff --git a/premake5.lua b/premake5.lua index c53c4f48a..0b2fc65c7 100644 --- a/premake5.lua +++ b/premake5.lua @@ -681,6 +681,28 @@ standardProject("core", "source/core") addSourceDir "source/core/unix" end +standardProject("compiler-core", "source/compiler-core") + uuid "12C1E89D-F5D0-41D3-8E8D-FB3F358F8126" + kind "StaticLib" + -- We need the compiler-core library to be relocatable to be able to link with slang.so + pic "On" + + links { "core" } + + -- For our core implementation, we want to use the most + -- aggressive warning level supported by the target, and + -- to treat every warning as an error to make sure we + -- keep our code free of warnings. + -- + warnings "Extra" + flags { "FatalWarnings" } + + if isTargetWindows then + addSourceDir "source/compiler-core/windows" + else + addSourceDir "source/compiler-core/unix" + end + -- -- The cpp extractor is a tool that scans C++ header files to extract -- reflection like information, and generate files to handle @@ -691,22 +713,7 @@ tool "slang-cpp-extractor" uuid "CA8A30D1-8FA9-4330-B7F7-84709246D8DC" includedirs { "." } - files { - "source/slang/slang-lexer.cpp", - "source/slang/slang-lexer.h", - "source/slang/slang-source-loc.cpp", - "source/slang/slang-source-loc.h", - "source/slang/slang-file-system.cpp", - "source/slang/slang-file-system.h", - "source/slang/slang-diagnostics.cpp", - "source/slang/slang-diagnostics.h", - "source/slang/slang-name.cpp", - "source/slang/slang-name.h", - "source/slang/slang-token.cpp", - "source/slang/slang-token.h", - } - - links { "core" } + links { "core", "compiler-core" } -- -- `slang-generate` is a tool we use for source code generation on @@ -730,7 +737,7 @@ tool "slang-embed" tool "slang-test" uuid "0C768A18-1D25-4000-9F37-DA5FE99E3B64" includedirs { "." } - links { "core", "slang", "miniz", "lz4" } + links { "core", "compiler-core", "slang", "miniz", "lz4" } -- We want to set to the root of the project, but that doesn't seem to work with '.'. -- So set a path that resolves to the same place. @@ -1059,7 +1066,7 @@ if enableEmbedStdLib then standardProject("slangc-bootstrap", "source/slangc") uuid "6339BF31-AC99-4819-B719-679B63451EF0" kind "ConsoleApp" - links { "core", "miniz", "lz4" } + links { "core", "compiler-core", "miniz", "lz4" } -- We need to run all the generators to be able to build the main -- slang source in source/slang @@ -1159,7 +1166,7 @@ end standardProject("slang", "source/slang") uuid "DB00DA62-0533-4AFD-B59F-A67D5B3A0808" kind "SharedLib" - links { "core", "miniz", "lz4"} + links { "core", "compiler-core", "miniz", "lz4"} warnings "Extra" flags { "FatalWarnings" } pic "On" @@ -1260,7 +1267,7 @@ if enableProfile then addSourceDir "source/slang" includedirs { "." } - links { "core", "miniz", "lz4"} + links { "core", "compiler-core", "miniz", "lz4"} filter { "system:linux" } linkoptions{ "-pg" } -- cgit v1.2.3