rev: 21c5e6d2f665d0e8b4ff917a51b664c895dab2ed tukan/genie.lua -rw-r--r-- 5.3 KiB View raw Log this file
21c5e6d2f665 — Leonard Ritter * renamed project from Liminal to Tukan 2 years ago
                                                                                
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
local THISDIR = os.getcwd()

local function flatten(t)
    local result = {}
    local function iterate(t)
        for _,k in pairs(t) do
            if type(k) == "table" then
                iterate(k)
            elseif k ~= nil then
                table.insert(result, k)
            end
        end
    end
    iterate(t)
    return result
end

local function commandline(array)
    return table.concat(flatten(array), " ")
end

-- to install the Oculus VR SDK, place the appropriate archive downloaded from
-- the oculus developer lounge in externals/archives, then execute
-- build_ovrsdk.py
-- TODO: osx needs to have this set to false or something, it always seems to think this dir exists...
local HAS_OVRSDK = os.isdir(path.join(THISDIR, 'build', 'src', 'ovrsdk'))

solution "Tukan"
    location ( "build" )
    configurations { "Debug", "Release" }
    platforms {"native", "x64", "x32"}

    configuration { "vs*" }
        buildoptions {
            "/D_CRT_SECURE_NO_WARNINGS",
            "/wd4100",  -- unreferenced formal parameter
            "/wd4201",  -- nonstandard extension used : nameless struct/union
            "/wd4244",  --conversion from 'double' to 'float'
            "/wd4305",  -- 'initializing' : truncation from 'double' to 'float'
        }

    configuration { "gmake" }
        linkoptions {
            "-Wl,-rpath,'$$ORIGIN'",
        -- "-Wl,-rpath-link,'$$ORIGIN'",

        -- the ones below will fail when linking
        -- to GLEW, which then delay-loads GL
        -- "-Wl,--no-undefined",
        -- "-Wl,--allow-shlib-undefined"
        }
        buildoptions {
            -- "-Wextra",
            "-Wno-unused-parameter",
            "-fno-strict-aliasing"
        }

    project "tukan_core"
        kind "SharedLib"
        language "C++"
        files {
            "src/glad.c",
            "src/tukan/*.cpp",
            "src/tukan/*.c",
            "src/tukan/*.h",
            -- "src/tukan/editor/*.cpp",
            -- "src/tukan/editor/*.h",
            "include/tukan/*.h",

            "src/stb/*.c",

            --"src/coro/*.c",

            "build/src/imgui/imgui.cpp",
            "build/src/imgui/imgui_draw.cpp",
            "build/src/imgui/imgui_demo.cpp",

            "build/src/cimgui/cimgui/*.cpp",
        }
        includedirs {
            "include",
            "include/glad",
            "build/include",
            "build/include/SDL2",
            "src",
            "build/src/imgui",
        }
        libdirs {
            "bin",
            "build/src/nanovg/build",
            "build/src/tess2/Build",
            "build/src/stk/src",
        }
        targetdir("bin")


        if HAS_OVRSDK then
            libdirs "build/src/ovrsdk"
            links {
                "ovr",
            }
            defines "TUKAN_OVRSDK"
        end

        configuration { "linux" }
            libdirs {
                "build/src/nativefiledialog/src",
            }

            if HAS_OVRSDK then
                links {
                    --"udev",
                    --"GL",
                    --"X11",
                    "Xrandr",
                    "rt"
                }
                defines { 'OVR_OS_LINUX' }
            end
            links {
                "pthread",
                "nanovg",
                "stk",
                "tess2",
                "gtk-3", -- for nativefiledialog
            }
            linkoptions {
                "-l:libSDL2-2.0.so.0",
                "-Wl,--whole-archive",
                "-lnfd",
                "-Wl,--no-whole-archive",
                --"`pkg-config --libs gtk+-3.0`",
            }

        configuration { "windows" }
            files {
                "build/src/nativefiledialog/src/nfd_win.cpp",
                "build/src/nativefiledialog/src/nfd_common.c"
            }
            --links { "nanovg", "stk", "tess2", "glew", "opengl32", "comctl32" }
            links { "nanovg", "SDL2", "comctl32", "imm32", "uuid", "ole32", "stdc++" }
            defines { "TUKAN_DLL" }
            buildoptions_cpp {
                "-fmax-errors=1",
            }
            linkoptions {
                "-Wl,--export-all-symbols",
            }
            buildoptions {
                "-fmax-errors=1",
            }
            libdirs {
                -- "build/src/soil/bin"
            }
            if HAS_OVRSDK then
                defines { 'OVR_OS_WIN32' }
            end

        configuration { "macosx" }
            links { "glew", "nanovg", "stk", "tess2", "pthread", "sdl2"  }
            buildoptions { "-stdlib=libstdc++" }
            libdirs {
                "build/lib"
            }
            linkoptions {
                "-v",
                "-undefined dynamic_lookup",
                "-stdlib=libstdc++",
                "-framework IOKit -framework AppKit -framework CoreAudio -framework CoreFoundation -framework CoreMidi" }
            if HAS_OVRSDK then
                defines { 'OVR_OS_MAC' }
            end
            postbuildcommands {
                commandline{
                    mcpp_macosx_args,
                    CORE_CDEF
                }
            }

        configuration "Debug"
            defines { "DEBUG" }
            flags { "Symbols", "ExtraWarnings"}

        configuration "Release"
            defines { "NDEBUG" }
            flags { "Optimize", "ExtraWarnings"}