summaryrefslogtreecommitdiff
path: root/xmake.lua
diff options
context:
space:
mode:
authorOmniscient <17525998+omnisci3nce@users.noreply.github.com>2024-02-24 11:43:13 +1100
committerOmniscient <17525998+omnisci3nce@users.noreply.github.com>2024-02-24 11:43:13 +1100
commitb047be5252aeb981faea077409c1768fda0301d9 (patch)
tree43925d4f4ef3aed59a147746d918c34e66fe91a6 /xmake.lua
parenta67df4d18655e58d8544e91cde546122f41cb492 (diff)
xmake init with shared/static lib
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