summaryrefslogtreecommitdiff
path: root/xmake.lua
diff options
context:
space:
mode:
Diffstat (limited to 'xmake.lua')
-rw-r--r--xmake.lua40
1 files changed, 40 insertions, 0 deletions
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