From b047be5252aeb981faea077409c1768fda0301d9 Mon Sep 17 00:00:00 2001 From: Omniscient <17525998+omnisci3nce@users.noreply.github.com> Date: Sat, 24 Feb 2024 11:43:13 +1100 Subject: xmake init with shared/static lib --- xmake.lua | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 xmake.lua (limited to 'xmake.lua') diff --git a/xmake.lua b/xmake.lua new file mode 100644 index 0000000..5a873f0 --- /dev/null +++ b/xmake.lua @@ -0,0 +1,40 @@ +set_project("celeritas") +set_version("0.1.0") +set_config("cc", "gcc") + +add_rules("mode.debug", "mode.release") -- we have two modes: debug & release + +-- -Wall : base set of warnings +-- -Wextra : additional warnings not covered by -Wall +-- -Wundef : undefined macros +-- -Wdouble-promotion : catch implicit converion of float to double +add_cflags("-Wall", "-Wextra", "-Wundef", "-Wdouble-promotion") + +if is_mode("debug") then + add_cflags("-g") -- Add debug symbols in debug mode +end + +-- common configuration for both static and shared libraries +target("core_config") + set_kind("static") -- kind is required but you can ignore it since it's just for common settings + add_includedirs("src/", {public = true}) + add_includedirs("src/platform/", {public = true}) + add_files("src/platform/*.c") + set_default(false) -- prevents standalone building of this target + +-- Define a static library +target("core_static") + set_kind("static") + add_deps("core_config") -- inherit common configurations + +-- Define a shared library +target("core_shared") + set_kind("shared") + add_deps("core_config") -- inherit common configurations + + +target("first") + set_kind("binary") + add_deps("core_shared") + add_files("examples/first.c") + set_rundir("$(projectdir)") \ No newline at end of file -- cgit v1.2.3-70-g09d2