summaryrefslogtreecommitdiff
path: root/xmake.lua
blob: 5a873f010d4417d9d7e063b3b497d3df88c12877 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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)")