Files

153 lines
5.9 KiB
Lua

includes("third_party/luajit")
add_rules("mode.debug", "mode.release")
add_requires("capstone", "fmt", "freetype", "libcurl", "libsdl3", "libuv", "zlib")
-- Only four of ffmpeg's libraries are used, and asking for "ffmpeg" wholesale
-- never resolves to the system copy: that package requires all eight pkg-config
-- modules, and libpostproc is GPL-only and so isn't packaged on Ubuntu at all.
-- The result is ffmpeg getting built from source on every clean checkout. These
-- are the same four names the Makefile's PACKAGES already asks for.
add_requires("pkgconfig::libavcodec", "pkgconfig::libavformat",
"pkgconfig::libavutil", "pkgconfig::libswresample")
set_languages("c++26")
target("thorvg", function()
set_kind("static")
local dir = "third_party/thorvg/src/"
add_files(
dir .. "common/*.cpp",
dir .. "renderer/*.cpp",
dir .. "renderer/cpu_engine/*.cpp",
dir .. "renderer/gpu_engine/*.cpp",
dir .. "renderer/gpu_engine/gl/*.cpp",
dir .. "loaders/svg/*.cpp",
dir .. "loaders/png/*.cpp",
dir .. "loaders/jpg/*.cpp",
dir .. "loaders/lottie/*.cpp",
dir .. "loaders/sfnt/*.cpp",
dir .. "loaders/raw/*.cpp",
dir .. "bindings/capi/tvgCapi.cpp",
"third_party/thorvg-config/tvgGlLoader.cpp",
nil
)
-- Replaced by third_party/thorvg-config/tvgGlLoader.cpp, which includes it.
remove_files(dir .. "renderer/gpu_engine/gl/tvgGl.cpp")
add_includedirs("third_party/thorvg-config", "third_party/thorvg/inc")
for _, sub in ipairs({ "common", "renderer", "renderer/cpu_engine", "renderer/gpu_engine",
"renderer/gpu_engine/gl", "loaders/svg", "loaders/png", "loaders/jpg",
"loaders/lottie", "loaders/sfnt", "loaders/raw", "bindings/capi" }) do
add_includedirs(dir .. sub)
end
add_defines("THORVG_GL_TARGET_GL=1")
add_defines("TVG_STATIC=1", { public = true })
end)
-- FTXUI: compiled from its sources, no CMake. The *_test.cpp / *_fuzzer.cpp
-- files need gtest / libFuzzer and are not part of the library. component/loop.cpp
-- is a leftover upstream no longer builds: Loop now lives in component/app.cpp.
target("ftxui", function()
set_kind("static")
add_files("third_party/ftxui/src/**.cpp")
remove_files("third_party/ftxui/src/**_test.cpp", "third_party/ftxui/src/**_fuzzer.cpp",
"third_party/ftxui/src/ftxui/component/loop.cpp")
add_includedirs("third_party/ftxui/src")
add_includedirs("third_party/ftxui/include", { public = true })
if is_plat("windows") then
add_defines("UNICODE", "_UNICODE")
end
end)
target("pcsx-redux", function()
add_includedirs(
".",
"src",
"third_party",
"third_party/ELFIO",
"third_party/gl3w",
"third_party/imgui",
"third_party/imgui/backends",
"third_party/imgui/misc/cpp",
"third_party/llhttp",
"third_party/luajit/src",
"third_party/luv/src",
"third_party/luv/deps/lua-compat-5.3/c-api",
"third_party/magic_enum/include",
"third_party/md4c/src",
"third_party/multipart-parser-c",
"third_party/PEGTL/include",
"third_party/tracy/public",
"third_party/ucl",
"third_party/ucl/include",
"third_party/uriparser/include",
"third_party/xbyak/xbyak",
"third_party/zep/extensions",
"third_party/zep/include",
nil
)
add_files("third_party/imgui/*.cpp", { cxxflags = "-include src/forced-includes/imgui.h" })
add_files("third_party/implot/*.cpp", { cxxflags = "-include src/forced-includes/implot.h" })
add_deps("luajit", "thorvg", "ftxui")
add_packages("capstone", "fmt", "freetype", "libcurl", "libsdl3", "libuv", "zlib",
"pkgconfig::libavcodec", "pkgconfig::libavformat",
"pkgconfig::libavutil", "pkgconfig::libswresample")
add_files(
"src/**/*.cc",
"third_party/cq/reclaimer.cc",
"third_party/clip/clip.cpp",
"third_party/clip/image.cpp",
"third_party/cueparser/*.c",
"third_party/gl3w/GL/gl3w.c",
"third_party/gl3w/GL/gl3w-throwers.cc",
"third_party/iec-60908b/*.c",
"third_party/ImFileDialog/ImFileDialog.cpp",
"third_party/imgui/backends/imgui_impl_opengl3.cpp",
"third_party/imgui/backends/imgui_impl_sdl3.cpp",
"third_party/imgui/misc/cpp/imgui_stdlib.cpp",
"third_party/imgui/misc/freetype/imgui_freetype.cpp",
"third_party/imgui_lua_bindings/imgui_lua_bindings.cpp",
"third_party/imgui_md/imgui_md.cpp",
"third_party/imgui_memory_editor/imgui_memory_editor.cpp",
"third_party/llhttp/*.c",
"third_party/lpeg/*.c",
"third_party/lua-protobuf/pb.c",
"third_party/luafilesystem/src/lfs.c",
"third_party/luv/src/luv.c",
"third_party/md4c/src/md4c.c",
"third_party/multipart-parser-c/multipart_parser.c",
"third_party/ucl/src/n2e_99.c",
"third_party/ucl/src/n2e_ds.c",
"third_party/ucl/src/alloc.c",
"third_party/uriparser/src/*.c",
"third_party/zep/extensions/repl/mode_repl.cpp",
"third_party/zep/src/*.cpp",
"third_party/zep/src/mcommon/animation/timer.cpp",
"third_party/zep/src/mcommon/file/path.cpp",
"third_party/zep/src/mcommon/string/stringutils.cpp",
nil
)
-- src/mips is the nugget submodule, built by its own toolchain.
remove_files("src/mips/**")
add_defines(
"IMGUI_IMPL_OPENGL_LOADER_GL3W",
"IMGUI_ENABLE_FREETYPE",
"PB_STATIC_API",
"ZEP_FEATURE_CPP_FILE_SYSTEM",
nil
)
if is_plat("macosx") then
add_files("src/main/complain.mm", "third_party/clip/clip_osx.mm")
add_frameworks("GLUT", "OpenGL", "CoreFoundation", "Cocoa")
else
add_files("third_party/clip/clip_x11.cpp")
add_ldflags("-lstdc++fs", "-lGL", "-lX11", "-lxcb")
end
end)