Files
eepp/premake5.lua
T
Martín Lucas Golini 74dc6e9fdd feat(window): receive X11 drags without files + feat(eefm): drops from Ark and XDS, run programs
Some applications drag things that only become files when they are dropped: an archive manager
drags entries it has not extracted, a browser an image it has not saved. These drags carry no file
list, so SDL's XDND support refuses them.

eepp (X11 with SDL3, getCapabilities().dataTarget):
- DragAndDrop::setFileSaveDropHandler(): drags using the XDS direct save protocol
  (XdndDirectSave0), such as Engrampa and Xarchiver. The callback picks a local folder for the
  drop position; the source then saves into it. XDS takes priority over a file list offered with it,
  which such sources only fill with temporary copies.
- DragAndDrop::setDataDropHandler(): drags offering application-defined MIME types and no file
  list. The callback receives each registered type's contents and the drop position.
- X11DropTarget takes over only the drags it accepts through the existing SDL3 X11 event hook,
  which stays installed while a window has a handler. Callbacks run from DragManager::poll(),
  outside native hooks, and may replace or remove handlers.
- Each drop receives its data in its own property, and replies must match its timestamp: a late
  reply to an abandoned drop never completes a newer one. Queued drops belong to their data
  handler registration (a never-reused generation), so a removed or replaced handler never
  receives them. INCR, oversized or unreadable replies fail the drop instead of delivering empty
  data.
- XErrorScope moves to x11errorscope.hpp, shared by the X11 drag source and drop target.
- Fix a use-after-free in the X11 drag source: destroying the drag preview pumps X events, which
  could re-enter the source and destroy the same preview window again (the intermittent
  "free(): invalid pointer" of eepp-native-dnd-tests). The preview is detached before it is reset,
  in the X11 source and in both SDL preview backends.
- Wayland is unchanged: SDL owns its data device and refuses these offers.

eefm:
- Entries dragged out of Ark are extracted where they are dropped. Ark's drag only names a D-Bus
  object; ArkDrop asks it to extract into the folder (org.kde.ark.DndExtract, as Dolphin does).
  libdbus is loaded at runtime, and the drag's name, path and the destination are validated before
  the call, since libdbus aborts on invalid ones.
- XDS drops save into the pane, or the folder row, under the pointer. Both kinds of drop refuse
  remote folders, which the source cannot write to.
- Opening a local executable runs it in its folder: native programs (ELF / Mach-O) directly,
  scripts ("#!") after a confirmation. The execute permission alone is not enough (FAT and NTFS
  mounts set it on every file), and remote files are only opened.

Tests: eepp-native-dnd-tests --automated adds the drop target checks on X11 (data drop, INCR
reply, late reply, XDS save and refusal, removed and replaced handlers) from a scripted source.
The "skipped" exit code 77 is now named TestSkipped.

Docs: native_drag_and_drop.md describes receiving drags without files.
2026-10-16 13:36:22 -03:00

2361 lines
77 KiB
Lua

require "premake.export-compile-commands.export-compile-commands"
require "premake.premake-cmake.cmake"
local function premake_is_previous_to_beta8()
if _PREMAKE_VERSION:match("^5%.0%.0[%.%-]alpha%d+$") then
return true
end
local beta = _PREMAKE_VERSION:match("^5%.0%.0[%.%-]beta(%d+)$")
if beta then
return tonumber(beta) < 8
end
return false
end
-- We will disable this later, since config names are different (local ninja use old naming convention with config=debug or config=release while the new one uses the premake5 convention config=debug_x86_64 and config=release_x86_64)
if true or premake_is_previous_to_beta8() then
require "premake.premake-ninja.ninja"
end
newoption { trigger = "with-openssl", description = "Enables OpenSSL support ( and disables mbedtls backend )." }
newoption { trigger = "with-dynamic-freetype", description = "Dynamic link against freetype." }
newoption { trigger = "with-static-eepp", description = "Force to build the demos and tests with eepp compiled statically" }
newoption { trigger = "with-static-backend", description = "It will try to compile the library with a static backend (only for gcc and mingw).\n\t\t\t\tThe backend should be placed in libs/your_platform/libYourBackend.a" }
newoption { trigger = "with-gles2", description = "Compile with GLES2 support" }
newoption { trigger = "with-gles1", description = "Compile with GLES1 support" }
newoption { trigger = "with-glew", description = "Compile with GLEW support (disabled by default)." }
newoption { trigger = "without-mojoal", description = "Compile without mojoAL as OpenAL implementation (that requires SDL2 backend). Instead it will use openal-soft." }
newoption { trigger = "use-frameworks", description = "In macOS it will try to link the external libraries from its frameworks. For example, instead of linking against SDL2 it will link against SDL2.framework." }
newoption { trigger = "windows-vc-build", description = "This is used to build the framework in Visual Studio downloading its external dependencies and making them available to the VS project without having to install them manually." }
newoption { trigger = "windows-mingw-build", description = "This is used to build the framework with mingw downloading its external dependencies." }
newoption { trigger = "with-mold-linker", description = "Tries to use the mold linker instead of the default linker of the toolchain" }
newoption { trigger = "with-debug-symbols", description = "Release builds are built with debug symbols." }
newoption { trigger = "thread-sanitizer", description = "Compile with ThreadSanitizer." }
newoption { trigger = "address-sanitizer", description = "Compile with AddressSanitizer." }
newoption { trigger = "time-trace", description = "Compile with time tracing." }
newoption { trigger = "disable-static-build", description = "Disables eepp static build project, this is just a helper to avoid rebuilding twice eepp while developing the library." }
newoption { trigger = "without-text-shaper", description = "Disables text-shaping capabilities." }
newoption {
trigger = "with-backend",
description = "Select the backend to use for window and input handling.\n\t\t\tIf no backend is selected or if the selected is not installed the script will search for a backend present in the system, and will use it.",
allowed = {
{ "SDL2", "SDL2" },
{ "SDL3", "SDL3" },
}
}
newoption {
trigger = "sharedir",
value = "PATH",
description = "Set the shared data directory",
}
newoption { trigger = "with-static-cpp", description = "Builds statically libstdc++" }
newoption { trigger = "without-vfs-sftp", description = "Disables sftp:// support in the eepp-vfs module (otherwise the vendored libssh2 is built)." }
newoption { trigger = "with-lto", description = "Enables Link-Time Optimization for release builds." }
function is_arm64_arch()
local arch = _OPTIONS["arch"]
return arch and (arch:lower() == "arm64" or arch:lower() == "aarch64")
end
function get_dll_extension()
if os.target() == "macosx" then
return "dylib"
elseif os.target() == "windows" then
return "dll"
else
return "so"
end
end
function get_host()
if os.getenv("MSYSTEM") ~= "" and not is_vs() then
return "msys"
end
return os.host()
end
function os_ishost(host)
return get_host() == host
end
function postsymlinklib(src_path, dst_path, lib, arch)
filter { "configurations:release*", "system:windows", arch }
if os_ishost("windows") then
postbuildcommands { "mklink \"" .. dst_path .. lib .. ".dll\"" .. " \"" .. src_path .. lib .. ".dll\" || ver>nul" }
else
postbuildcommands { "ln -sf \"" .. src_path .. lib .. "." .. get_dll_extension() .. "\" \"" .. dst_path .. "\"" }
end
filter { "configurations:debug*", "system:windows", arch }
if os_ishost("windows") then
postbuildcommands { "mklink \"" .. dst_path .. lib .. "-debug.dll\"" .. " \"" .. src_path .. lib .. "-debug.dll\" || ver>nul" }
else
postbuildcommands { "ln -sf \"" .. src_path .. lib .. "-debug." .. get_dll_extension() .. "\" \"" .. dst_path .. "\"" }
end
filter { "configurations:release*", "not system:windows", arch }
postbuildcommands { "ln -sf \"" .. src_path .. "lib" .. lib .. "." .. get_dll_extension() .. "\" \"" .. dst_path .. "\"" }
filter { "configurations:debug*", "not system:windows", arch }
postbuildcommands { "ln -sf \"" .. src_path .. "lib" .. lib .. "-debug." .. get_dll_extension() .. "\" \"" .. dst_path .. "\"" }
filter {}
end
function print_table( table_ref )
for _, value in pairs( table_ref ) do
print(value)
end
end
function table_length(T)
local count = 0
for _ in pairs(T) do count = count + 1 end
return count
end
function multiple_insert( parent_table, insert_table )
for _, value in pairs( insert_table ) do
table.insert( parent_table, value )
end
end
function os_findlib( name )
if os.istarget("macosx") and ( is_xcode() or _OPTIONS["use-frameworks"] ) then
local path = _MAIN_SCRIPT_DIR .. "src/thirdparty/" .. name .. ".framework"
if os.isdir( path ) then
return path
end
path = "/Library/Frameworks/" .. name .. ".framework"
if os.isdir( path ) then
return path
end
end
return os.findlib( name )
end
function get_backend_link_name( name )
if os.istarget("macosx") and ( is_xcode() or _OPTIONS["use-frameworks"] ) then
local fname = name .. ".framework"
if os_findlib( name ) then -- Search for the framework
return fname
end
end
return name
end
function string.starts(String,Start)
if ( _ACTION ) then
return string.sub(String,1,string.len(Start))==Start
end
return false
end
function is_vs()
return ( string.starts(_ACTION,"vs") )
end
function is_xcode()
return ( string.starts(_ACTION,"xcode") )
end
-- True when the configuration is built with clang. FreeBSD targets are forced
-- to clang ( see the workspace "eepp" toolset filter ), macOS and iOS default
-- to it.
function is_clang()
if _OPTIONS["cc"] then
return _OPTIONS["cc"] == "clang"
end
return os.istarget("bsd") or os.istarget("macosx") or os.istarget("ios")
end
function set_kind()
if os.istarget("macosx") then
kind("ConsoleApp")
else
kind("WindowedApp")
end
cppdialect "C++20"
end
link_list = { }
os_links = { }
backends = { }
static_backends = { }
backend_selected = false
remote_sdl2_version_number = "2.32.10"
remote_sdl2_version = "SDL2-" .. remote_sdl2_version_number
remote_sdl2_devel_src_url = "https://libsdl.org/release/" .. remote_sdl2_version .. ".zip"
remote_sdl2_devel_vc_url = "https://www.libsdl.org/release/SDL2-devel-" .. remote_sdl2_version_number .. "-VC.zip"
remote_sdl2_devel_vc_arm64_url = "https://github.com/mmozeiko/build-sdl2/releases/download/2025-12-14/SDL2-arm64-2025-12-14.zip"
remote_sdl2_devel_mingw_url = "https://www.libsdl.org/release/SDL2-devel-" .. remote_sdl2_version_number .. "-mingw.zip"
remote_sdl2_arm64_cross_tools_path = "/usr/local/cross-tools/aarch64-w64-mingw32"
remote_sdl3_version_number = "3.4.10"
remote_sdl3_version = "SDL3-" .. remote_sdl3_version_number
remote_sdl3_devel_src_url = "https://libsdl.org/release/" .. remote_sdl3_version .. ".zip"
remote_sdl3_devel_vc_url = "https://www.libsdl.org/release/SDL3-devel-" .. remote_sdl3_version_number .. "-VC.zip"
remote_sdl3_devel_vc_arm64_url = "https://github.com/mmozeiko/build-sdl3/releases/download/2026-06-07/SDL3-arm64-2026-06-07.zip"
remote_sdl3_devel_mingw_url = "https://www.libsdl.org/release/SDL3-devel-" .. remote_sdl3_version_number .. "-mingw.zip"
remote_sdl3_arm64_cross_tools_path = "/usr/local/cross-tools/aarch64-w64-mingw32"
sdl_version_dir_override = nil
function is_sdl3_backend()
if _OPTIONS["with-backend"] then
return _OPTIONS["with-backend"] == "SDL3"
end
return false
end
function glew_supported()
return not os.istarget("haiku") and not os.istarget("ios") and not os.istarget("android") and not os.istarget("emscripten")
end
function glew_enabled()
return _OPTIONS["with-glew"] and glew_supported()
end
function get_sdl_version_dir()
if sdl_version_dir_override then
return sdl_version_dir_override
end
if is_sdl3_backend() then
return remote_sdl3_version
end
return remote_sdl2_version
end
function get_sdl_dll_name()
if is_sdl3_backend() then
return "SDL3.dll"
end
return "SDL2.dll"
end
function get_sdl_include_sub()
if is_sdl3_backend() then
return "SDL3"
end
return "SDL2"
end
function get_sdl_arm64_cross_tools_path()
if is_sdl3_backend() then
return remote_sdl3_arm64_cross_tools_path
end
return remote_sdl2_arm64_cross_tools_path
end
function get_sdl_arm64_version_name()
if is_sdl3_backend() then
return "SDL3-arm64"
end
return "SDL2-arm64"
end
function get_sdl_devel_url(url_type)
if is_sdl3_backend() then
if url_type == "vc" then return remote_sdl3_devel_vc_url
elseif url_type == "vc_arm64" then return remote_sdl3_devel_vc_arm64_url
elseif url_type == "mingw" then return remote_sdl3_devel_mingw_url
elseif url_type == "src" then return remote_sdl3_devel_src_url
end
else
if url_type == "vc" then return remote_sdl2_devel_vc_url
elseif url_type == "vc_arm64" then return remote_sdl2_devel_vc_arm64_url
elseif url_type == "mingw" then return remote_sdl2_devel_mingw_url
elseif url_type == "src" then return remote_sdl2_devel_src_url
end
end
end
function incdirs( dirs )
if is_xcode() then
externalincludedirs { dirs }
end
includedirs { dirs }
end
function popen( executable_path )
local handle = io.popen(executable_path)
local result = handle:read("*a")
handle:close()
return result
end
function download_and_extract_sdl(sdl_url, sdl_version_dir)
print("Downloading: " .. sdl_url)
local dest_dir = "src/thirdparty/"
local local_file = dest_dir .. sdl_version_dir .. ".zip"
local res, response_code = http.download(sdl_url, local_file)
if response_code == 200 then
print("Downloaded successfully to: " .. local_file)
zip.extract(local_file, dest_dir)
print("Extracted " .. local_file .. " into " .. dest_dir)
else
print("Failed to download: " .. sdl_url .. " res: " .. res)
exit(1)
end
end
function copy_sdl()
local dll_name = get_sdl_dll_name()
local version_dir = get_sdl_version_dir()
if _OPTIONS["windows-vc-build"] and is_arm64_arch() then
os.copyfile( _MAIN_SCRIPT_DIR .. "/src/thirdparty/" .. version_dir .."/bin/" .. dll_name, _MAIN_SCRIPT_DIR .. "/bin/" .. dll_name )
os.copyfile( _MAIN_SCRIPT_DIR .. "/src/thirdparty/" .. version_dir .."/bin/" .. dll_name, _MAIN_SCRIPT_DIR .. "/bin/unit_tests/" .. dll_name )
elseif _OPTIONS["windows-vc-build"] then
os.copyfile( _MAIN_SCRIPT_DIR .. "/src/thirdparty/" .. version_dir .."/lib/x64/" .. dll_name, _MAIN_SCRIPT_DIR .. "/bin/" .. dll_name )
os.copyfile( _MAIN_SCRIPT_DIR .. "/src/thirdparty/" .. version_dir .."/lib/x64/" .. dll_name, _MAIN_SCRIPT_DIR .. "/bin/unit_tests/" .. dll_name )
elseif _OPTIONS["windows-mingw-build"] and not is_arm64_arch() then
os.copyfile( _MAIN_SCRIPT_DIR .. "/src/thirdparty/" .. version_dir .."/x86_64-w64-mingw32/bin/" .. dll_name, _MAIN_SCRIPT_DIR .. "/bin/" .. dll_name )
os.copyfile( _MAIN_SCRIPT_DIR .. "/src/thirdparty/" .. version_dir .."/x86_64-w64-mingw32/bin/" .. dll_name, _MAIN_SCRIPT_DIR .. "/bin/unit_tests/" .. dll_name )
end
end
function version_to_number( version )
versionpart = 0
versionnum = 0
versionmod = 1000
for str in string.gmatch(version, "[^%.]+") do
versionnum = versionnum + tonumber(str) * versionmod
versionpart = versionpart + 1
if versionpart == 1 then
versionmod = 100
elseif versionpart == 2 then
versionmod = 10
end
end
return versionnum
end
function download_and_extract_dependencies()
sdl_version_dir_override = nil
if _OPTIONS["windows-vc-build"] and is_arm64_arch() then
sdl_version_dir_override = get_sdl_arm64_version_name()
end
local sdl_version_dir = get_sdl_version_dir()
if not os.isdir("src/thirdparty/" .. sdl_version_dir) then
if _OPTIONS["windows-vc-build"] and is_arm64_arch() then
download_and_extract_sdl(get_sdl_devel_url("vc_arm64"), sdl_version_dir)
copy_sdl()
elseif _OPTIONS["windows-vc-build"] then
download_and_extract_sdl(get_sdl_devel_url("vc"), sdl_version_dir)
copy_sdl()
elseif _OPTIONS["windows-mingw-build"] and not is_arm64_arch() then
download_and_extract_sdl(get_sdl_devel_url("mingw"), sdl_version_dir)
copy_sdl()
elseif _OPTIONS["windows-mingw-build"] and is_arm64_arch() then
download_and_extract_sdl(get_sdl_devel_url("src"), sdl_version_dir)
elseif os.istarget("ios") then
download_and_extract_sdl(get_sdl_devel_url("src"), sdl_version_dir)
end
end
end
function build_arch_configuration()
filter {"architecture:x86", "options:cc=mingw"}
buildoptions { "-D__USE_MINGW_ANSI_STDIO=1 -B /usr/bin/i686-w64-mingw32-" }
filter {"architecture:x86_64", "options:cc=mingw"}
if not is_arm64_arch() then
buildoptions { "-D__USE_MINGW_ANSI_STDIO=1 -B /usr/bin/x86_64-w64-mingw32-" }
end
filter {}
end
function build_base_configuration( package_name )
incdirs { "src/thirdparty/zlib" }
set_ios_config()
set_apple_config()
build_arch_configuration()
filter "not system:windows"
buildoptions{ "-fPIC" }
filter "configurations:debug*"
targetname ( package_name .. "-debug" )
filter "configurations:release*"
targetname ( package_name )
filter "action:not vs*"
cdialect "gnu99"
buildoptions { "-Wall" }
filter "action:vs*"
incdirs { "src/thirdparty/libzip/vs" }
buildoptions { "/utf-8" }
filter "system:emscripten"
buildoptions { "-O3 -s USE_SDL=2" }
buildoptions { "-s USE_PTHREADS=1" }
filter {}
end
function build_base_cpp_configuration( package_name )
if not os.istarget("windows") then
buildoptions{ "-fPIC" }
end
set_ios_config()
set_apple_config()
build_arch_configuration()
if _OPTIONS["with-static-eepp"] then
defines { "EE_STATIC" }
end
filter "action:vs*"
buildoptions{ "/std:c++20", "/utf-8", "/Zc:preprocessor" }
filter "action:not vs*"
cppdialect "C++20"
buildoptions { "-Wall" }
filter "configurations:debug*"
defines { "DEBUG", "EE_DEBUG", "EE_MEMORY_MANAGER" }
symbols "On"
targetname ( package_name .. "-debug" )
filter "configurations:release*"
defines { "NDEBUG" }
optimize "Speed"
targetname ( package_name )
filter { "configurations:release*", "options:with-debug-symbols" }
symbols "On"
filter "system:emscripten"
buildoptions { "-O3 -s USE_SDL=2" }
buildoptions { "-s USE_PTHREADS=1" }
filter {}
end
function get_architecture()
if jit then
return jit.arch
end
local handle = io.popen("uname -m 2>/dev/null")
if handle then
local arch = handle:read("*l")
handle:close()
if arch then return arch end
end
local arch = os.getenv("PROCESSOR_ARCHITECTURE")
if arch then
if arch == "AMD64" or arch == "IA64" then
return "x86_64"
end
return string.lower(arch)
end
return "x86_64"
end
function build_link_configuration( package_name, use_ee_icon, use_sdl_main )
filter {}
incdirs { "include" }
local extension = "";
if package_name ~= "eepp" and package_name ~= "eepp-static" then
files { "src/eepp/core/memorymanagerglobal.cpp" }
end
if os.istarget("emscripten") and package_name ~= "eepp" and package_name ~= "eepp-static" then
local without_assets = {
["eepp-empty-window"] = true,
["eepp-sound"] = true,
["eepp-vbo-fbo-batch"] = true,
["eepp-physics-demo"] = true,
["eepp-http-request"] = true,
}
if not without_assets[package_name] then
if package_name == "ecode" then
linkoptions { "--preload-file " .. package_name .. "/assets/" }
else
linkoptions { "--preload-file assets/" }
end
end
end
if package_name == "eepp" then
defines { "EE_EXPORTS" }
elseif package_name == "eepp-static" then
defines { "EE_STATIC" }
end
if package_name ~= "eepp" and package_name ~= "eepp-static" then
if not _OPTIONS["with-static-eepp"] then
links { "eepp-shared" }
else
links { "eepp-static" }
defines { "EE_STATIC" }
add_static_links()
links { link_list }
end
end
if _OPTIONS["with-mold-linker"] then
if is_clang() then
linkoptions { "-fuse-ld=mold" }
else
gccversion = os.outputof( "gcc -dumpfullversion" )
gccversionnumber = version_to_number( gccversion )
if gccversionnumber >= 12110 then
linkoptions { "-fuse-ld=mold" }
else
linkoptions { "-B/usr/bin/mold" }
end
end
end
if not _OPTIONS["without-text-shaper"] then
defines { "EE_TEXT_SHAPER_ENABLED" }
end
if _OPTIONS["with-static-cpp"] then
linkoptions { "-static-libgcc -static-libstdc++" }
end
if _OPTIONS["sharedir"] then
defines { 'ECODE_SHAREDIR="' .. _OPTIONS["sharedir"] .. '"' }
end
cppdialect "C++20"
set_ios_config()
set_apple_config()
build_arch_configuration()
filter { "system:linux or system:macosx or system:haiku or system:bsd", "action:not vs*" }
if package_name ~= "eepp" and package_name ~= "eepp-static" then
linkoptions { "-Wl,-rpath,'$$ORIGIN'" }
end
filter { "system:linux", "action:not vs*" }
if package_name == "eepp" then
-- Shared eepp must resolve its own indirect dependencies beside the library.
linkoptions { "-Wl,-rpath,'$$ORIGIN'" }
end
filter "system:macosx"
linkoptions { "-weak_framework UniformTypeIdentifiers" }
filter { "system:bsd" }
if package_name ~= "eepp" and package_name ~= "eepp-static" then
if type(userelativelinks) == "function" then
userelativelinks "On"
else
flags { "RelativeLinks" }
end
end
filter { "system:windows", "action:not vs*", "architecture:x86" }
if true == use_ee_icon then
linkoptions { _MAIN_SCRIPT_DIR .. "/bin/assets/icon/ee.res" }
end
filter { "system:windows", "action:not vs*", "architecture:x86_64" }
if true == use_ee_icon then
linkoptions { _MAIN_SCRIPT_DIR .. "/bin/assets/icon/ee.x64.res" }
end
filter { "system:windows", "action:vs*" }
if true == use_ee_icon then
files { "bin/assets/icon/ee.rc", "bin/assets/icon/ee.ico" }
vpaths { ['Resources/*'] = { "ee.rc", "ee.ico" } }
end
filter "action:vs*"
buildoptions{ "/std:c++20", "/utf-8", "/bigobj", "/Zc:preprocessor" }
filter "action:not vs*"
buildoptions { "-Wall" }
filter { "configurations:debug*", "action:not vs*" }
buildoptions{ "-Wno-long-long" }
filter { "configurations:release*", "action:not vs*" }
buildoptions { "-fno-strict-aliasing" }
filter "configurations:debug*"
defines { "DEBUG", "EE_DEBUG", "EE_MEMORY_MANAGER" }
targetname ( package_name .. "-debug" .. extension )
filter "configurations:release*"
defines { "NDEBUG" }
targetname ( package_name .. extension )
filter { "system:windows", "action:not vs*" }
linkoptions { "-static-libgcc", "-static-libstdc++" }
linkoptions { "-Wl,-Bstatic", "-lstdc++", "-Wl,--whole-archive", "-lwinpthread", "-Wl,--no-whole-archive", "-Wl,-Bdynamic" }
filter { "system:windows", "action:vs*" }
if table.contains( backends, "SDL2" ) then
links { "SDL2", "SDL2main" }
end
if table.contains( backends, "SDL3" ) then
links { "SDL3" }
if package_name ~= "eepp" and package_name ~= "eepp-static" and use_sdl_main ~= false then
-- SDL3 provides main/WinMain through a header instead of SDL2main.lib.
files { "src/eepp/main/sdl3_main.cpp" }
incdirs { "src/thirdparty/" .. get_sdl_version_dir() .. "/include" }
end
end
filter { "options:windows-vc-build", "options:arch=arm64" }
syslibdirs { "src/thirdparty/" .. get_sdl_version_dir() .."/lib" }
filter { "options:windows-vc-build", "options:arch=aarch64" }
syslibdirs { "src/thirdparty/" .. get_sdl_version_dir() .."/lib" }
filter { "options:windows-vc-build", "system:windows", "platforms:x86" }
syslibdirs { "src/thirdparty/" .. get_sdl_version_dir() .."/lib/x86" }
filter { "options:windows-vc-build", "system:windows", "platforms:x86_64", "not options:arch=arm64", "not options:arch=aarch64" }
syslibdirs { "src/thirdparty/" .. get_sdl_version_dir() .."/lib/x64" }
filter { "options:windows-mingw-build", "architecture:x86" }
syslibdirs { "src/thirdparty/" .. get_sdl_version_dir() .."/i686-w64-mingw32/lib/", "/usr/i686-w64-mingw32/sys-root/mingw/lib/" }
syslibdirs { "libs/windows/x86/thirdparty" }
filter { "options:windows-mingw-build", "architecture:x86_64" }
if not is_arm64_arch() then
syslibdirs { "src/thirdparty/" .. get_sdl_version_dir() .."/x86_64-w64-mingw32/lib/", "/usr/x86_64-w64-mingw32/sys-root/mingw/lib/" }
syslibdirs { "libs/windows/x86_64/thirdparty" }
end
filter { "options:windows-mingw-build", "options:arch=arm64" }
syslibdirs { get_sdl_arm64_cross_tools_path().. "/lib/" }
filter { "options:windows-mingw-build", "options:arch=aarch64" }
syslibdirs { get_sdl_arm64_cross_tools_path().. "/lib/" }
filter "system:emscripten"
targetname ( package_name .. extension )
if package_name ~= "eepp" and package_name ~= "eepp-static" then
targetextension ".html"
end
linkoptions { "-O3 -s TOTAL_MEMORY=536870912 -s ALLOW_MEMORY_GROWTH=1 -s USE_SDL=2 -s ENVIRONMENT=worker,web -s EXPORTED_RUNTIME_METHODS=ccall" }
buildoptions { "-O3 -s USE_SDL=2" }
buildoptions { "-s USE_PTHREADS=1" }
linkoptions { "-s USE_PTHREADS=1 -sPTHREAD_POOL_SIZE=8" }
if _OPTIONS["with-gles1"] and ( not _OPTIONS["with-gles2"] or _OPTIONS["force-gles1"] ) then
linkoptions{ "-s LEGACY_GL_EMULATION=1" }
end
if _OPTIONS["with-gles2"] and not _OPTIONS["force-gles1"] then
linkoptions{ "-s FULL_ES2=1" }
end
filter { "action:export-compile-commands", "system:macosx" }
buildoptions { "-std=c++20" }
filter {}
end
function generate_os_links()
if os.istarget("linux") then
multiple_insert( os_links, { "rt", "pthread", "GL" } )
if _OPTIONS["with-static-eepp"] then
table.insert( os_links, "dl" )
end
elseif os.istarget("windows") then
multiple_insert( os_links, { "opengl32", "glu32", "gdi32", "ws2_32", "winmm", "ole32", "oleaut32", "uuid", "shell32", "dwrite", "uiautomationcore", "comctl32" } )
elseif os.istarget("mingw32") then
multiple_insert( os_links, { "opengl32", "glu32", "gdi32", "ws2_32", "winmm", "ole32", "oleaut32", "uuid", "shell32", "dwrite", "uiautomationcore", "comctl32" } )
elseif os.istarget("macosx") then
multiple_insert( os_links, { "eepp-macos-helper-static", "Cocoa.framework", "OpenGL.framework", "CoreFoundation.framework", "CoreServices.framework", "CoreText.framework" } )
elseif os.istarget("bsd") then
multiple_insert( os_links, { "rt", "pthread", "GL" } )
elseif os.istarget("haiku") then
multiple_insert( os_links, { "GL", "network" } )
elseif os.istarget("ios") then
multiple_insert( os_links, { "OpenGLES.framework", "AudioToolbox.framework", "CoreAudio.framework", "Foundation.framework", "CoreFoundation.framework", "CoreText.framework", "UIKit.framework", "QuartzCore.framework", "CoreGraphics.framework", "CoreMotion.framework", "AVFoundation.framework", "GameController.framework" } )
elseif os.istarget("android") then
multiple_insert( os_links, { "GLESv1_CM", "GLESv2", "log" } )
end
if _OPTIONS["without-mojoal"] then
if os.istarget("linux") or os.istarget("bsd") or os.istarget("haiku") or os.istarget("emscripten") then
multiple_insert( os_links, { "openal" } )
elseif os.istarget("windows") or os.istarget("mingw32") then
if os_ishost("msys") then
multiple_insert( os_links, { "openal" } )
else
multiple_insert( os_links, { "OpenAL32" } )
end
elseif os.istarget("macosx") or os.istarget("ios") then
multiple_insert( os_links, { "OpenAL.framework" } )
end
end
end
function parse_args()
if _OPTIONS["with-gles2"] then
defines { "EE_GLES2", "SOIL_GLES2" }
end
if _OPTIONS["with-gles1"] then
defines { "EE_GLES1", "SOIL_GLES1" }
end
if glew_enabled() then
defines { "EE_ENABLE_GLEW" }
end
if _OPTIONS["thread-sanitizer"] then
buildoptions { "-fsanitize=thread" }
linkoptions { "-fsanitize=thread" }
-- clang links its own sanitizer runtimes, -ltsan is gcc only.
if not is_clang() then
links { "tsan" }
end
end
if _OPTIONS["address-sanitizer"] then
buildoptions { "-fsanitize=address" }
linkoptions { "-fsanitize=address" }
-- clang links its own sanitizer runtimes, -lasan is gcc only.
if not is_clang() then
links { "asan" }
end
end
if _OPTIONS["time-trace"] then
buildoptions { "-ftime-trace" }
end
if _OPTIONS["with-lto"] then
filter { "configurations:release*", "toolset:gcc", "not system:emscripten" }
buildoptions { "-flto=auto" }
linkoptions { "-flto=auto" }
filter { "configurations:release*", "toolset:clang", "not system:emscripten" }
buildoptions { "-flto=thin" }
linkoptions { "-flto=thin" }
filter { "configurations:release*", "toolset:msc" }
linktimeoptimization "On"
filter {}
end
end
function add_static_links()
-- The linking order DOES matter
-- Expose the symbols that need one static library AFTER adding that static lib
-- Add static backends
if next(static_backends) ~= nil then
for _, value in pairs( static_backends ) do
linkoptions { value }
end
end
if not _OPTIONS["with-dynamic-freetype"] then
links { "freetype-static" }
end
if not _OPTIONS["without-text-shaper"] then
links { "harfbuzz-static", "SheenBidi-static" }
includedirs { "src/thirdparty/SheenBidi/Headers" }
defines { "EE_TEXT_SHAPER_ENABLED" }
end
links { "SOIL2-static",
"simdutf-static",
"chipmunk-static",
"libzip-static",
"jpeg-compressor-static",
"zlib-static",
"imageresampler-static",
"pugixml-static",
"vorbis-static",
"pcre2-8-static",
"oniguruma-static",
"libwebp-static",
"libpng-static",
"md4c-static",
"gumbo-parser-static",
"brotli-static",
}
if not _OPTIONS["without-mojoal"] then
links { "mojoal-static"}
end
if not _OPTIONS["with-openssl"] then
links { "mbedtls-static" }
end
if glew_enabled() then
links{ "glew-static" }
end
end
function can_add_static_backend()
if _OPTIONS["with-static-backend"] then
return true
end
return false
end
function insert_static_backend( name )
table.insert( static_backends, _MAIN_SCRIPT_DIR .. "/libs/" .. os.target() .. "/lib" .. name .. ".a" )
end
function add_sdl2()
print("Using SDL2 backend");
if not can_add_static_backend("SDL2") then
if not os.istarget("emscripten") then
table.insert( link_list, get_backend_link_name( "SDL2" ) )
end
else
print("Using static backend")
insert_static_backend( "SDL2" )
end
table.insert( backends, "SDL2" )
end
function add_sdl3()
print("Using SDL3 backend");
if not can_add_static_backend("SDL3") then
table.insert( link_list, get_backend_link_name( "SDL3" ) )
else
print("Using static backend")
insert_static_backend( "SDL3" )
end
table.insert( backends, "SDL3" )
end
function set_apple_config()
if is_xcode() or _OPTIONS["use-frameworks"] then
linkoptions { "-F /Library/Frameworks" }
buildoptions { "-F /Library/Frameworks" }
if table.contains(backends, "SDL2") then
incdirs { "/Library/Frameworks/SDL2.framework/Headers" }
end
if table.contains(backends, "SDL3") then
incdirs { "/Library/Frameworks/SDL3.framework/Headers" }
end
end
if os.istarget("macosx") then
if table.contains(backends, "SDL2") then
defines { "EE_SDL2_FROM_ROOTPATH" }
end
if table.contains(backends, "SDL3") and ( is_xcode() or _OPTIONS["use-frameworks"] ) then
-- Framework headers are flat; pkg-config exposes the SDL3/ include prefix.
defines { "EE_SDL3_FROM_ROOTPATH" }
end
if not is_xcode() and not _OPTIONS["use-frameworks"] then
if table.contains(backends, "SDL2") then
local sdl2flags = popen("sdl2-config --cflags"):gsub("\n", "")
buildoptions { sdl2flags }
end
if table.contains(backends, "SDL3") then
local sdl3flags = popen("pkg-config --cflags sdl3"):gsub("\n", "")
buildoptions { sdl3flags }
end
end
end
end
function set_ios_config()
if os.istarget("ios") then
-- local toolchainpath = os.getenv("TOOLCHAINPATH")
local iosversion = os.getenv("IOSVERSION")
local sysroot_path = os.getenv("SYSROOTPATH")
if nil == os.getenv("TOOLCHAINPATH") then
toolchainpath = os.outputof("xcrun -find -sdk iphonesimulator clang")
end
if nil == os.getenv("IOSVERSION") then
iosversion = os.outputof("xcrun --sdk iphonesimulator --show-sdk-version")
end
if nil == os.getenv("SYSROOTPATH") then
local platform_path = os.outputof("xcrun --sdk iphonesimulator --show-sdk-platform-path")
sysroot_path = platform_path .. "/Developer/SDKs/iPhoneSimulator" .. iosversion .. ".sdk/"
end
local framework_path = sysroot_path .. "/System/Library/Frameworks"
local framework_libs_path = framework_path .. "/usr/lib"
local sysroot_ver = " -miphoneos-version-min=16.3 -isysroot " .. sysroot_path
buildoptions { sysroot_ver .. " -I" .. sysroot_path .. "/usr/include" }
linkoptions { sysroot_ver }
libdirs { framework_libs_path }
linkoptions { " -F" .. framework_path .. " -L" .. framework_libs_path .. " -isysroot " .. sysroot_path }
incdirs { "src/thirdparty/" .. get_sdl_version_dir() .. "/include" }
end
end
function backend_is( name, libname )
if not _OPTIONS["with-backend"] then
_OPTIONS["with-backend"] = "SDL2"
end
if next(backends) == nil then
backends = string.explode(_OPTIONS["with-backend"],",")
end
local backend_sel = table.contains( backends, name )
local ret_val = os_findlib( libname ) and backend_sel
if os.istarget("mingw32") or os.istarget("emscripten") then
ret_val = backend_sel
end
if ret_val then
backend_selected = true
end
return ret_val
end
function select_backend()
if backend_is("SDL2", "SDL2") then
print("Selected SDL2")
add_sdl2()
end
if backend_is("SDL3", "SDL3") then
print("Selected SDL3")
add_sdl3()
end
-- If the selected backend is not present, try to find one present
if not backend_selected then
if os_findlib("SDL3", "SDL3") then
add_sdl3()
elseif os_findlib("SDL2", "SDL2") then
add_sdl2()
else
if table.contains( backends, "SDL3" ) then
add_sdl3()
print("ERROR: Couldnt find any backend. Forced SDL3.")
else
add_sdl2()
print("ERROR: Couldnt find any backend. Forced SDL2.")
end
end
end
end
function check_ssl_support()
if _OPTIONS["with-openssl"] then
if os.istarget("windows") then
table.insert( link_list, get_backend_link_name( "libssl" ) )
table.insert( link_list, get_backend_link_name( "libcrypto" ) )
else
table.insert( link_list, get_backend_link_name( "ssl" ) )
table.insert( link_list, get_backend_link_name( "crypto" ) )
end
files { "src/eepp/network/ssl/backend/openssl/*.cpp" }
defines { "EE_OPENSSL" }
else
files { "src/eepp/network/ssl/backend/mbedtls/*.cpp" }
defines { "EE_MBEDTLS" }
end
defines { "EE_SSL_SUPPORT" }
end
function eepp_module_maps_add()
links { "eepp-maps-static" }
defines { "EE_MAPS_STATIC" }
incdirs { "src/modules/maps/include/", "src/modules/maps/src/" }
end
function eepp_module_physics_add()
links { "eepp-physics-static", "chipmunk-static" }
defines { "EE_PHYSICS_STATIC" }
incdirs { "src/modules/physics/include/", "src/modules/physics/src/" }
end
function vfs_sftp_enabled()
-- Enabled by default; emscripten has no raw sockets or processes for SSH.
return _OPTIONS["without-vfs-sftp"] == nil and not os.istarget("emscripten")
end
function eepp_module_vfs_add()
links { "eepp-vfs-static", "efsw-static" }
incdirs { "src/modules/vfs/include/", "src/thirdparty/efsw/include" }
-- The ssh_config evaluator (always built) resolves host names through Winsock.
filter "system:windows"
links { "ws2_32" }
-- efsw watches directories through FSEvents.
filter "system:macosx"
links { "CoreFoundation.framework", "CoreServices.framework" }
filter {}
if vfs_sftp_enabled() then
defines { "EE_VFS_SFTP" }
links { "libssh2-static" }
filter "system:windows"
-- Like mbedtls below: eepp.dll does not export the zlib that libssh2 uses.
links { "zlib-static", "ws2_32", "crypt32", "bcrypt" }
filter {}
if not _OPTIONS["with-openssl"] then
-- libssh2 calls mbedtls directly. ELF and Mach-O builds of eepp export it, so linking a
-- second copy would duplicate (and interpose) its globals; eepp.dll does not export it.
filter "system:windows"
links { "mbedtls-static" }
filter {}
end
end
end
function eepp_module_backward_add( ecode_mode )
files { "src/modules/backward/src/backward.cpp" }
incdirs { "src/thirdparty" }
if ecode_mode then
defines { "EE_BACKWARD_ECODE_MODE" }
end
filter "system:windows"
links { "dbghelp", "psapi" }
filter "system:linux or system:bsd"
linkoptions { "-rdynamic" }
filter "system:linux"
if os_findlib("dw") then
links { "dw" }
defines { "EE_BACKWARD_HAS_DW" }
end
filter {}
end
function build_eepp( build_name )
files { "src/eepp/core/*.cpp",
"src/eepp/math/*.cpp",
"src/eepp/system/*.cpp",
"src/eepp/audio/*.cpp",
"src/eepp/graphics/*.cpp",
"src/eepp/graphics/renderer/*.cpp",
"src/eepp/window/*.cpp",
"src/eepp/window/draganddrop/*.cpp",
"src/eepp/window/backend/*.cpp",
"src/eepp/network/*.cpp",
"src/eepp/network/ssl/*.cpp",
"src/eepp/network/http/*.cpp",
"src/eepp/scene/*.cpp",
"src/eepp/scene/actions/*.cpp",
"src/eepp/ui/*.cpp",
"src/eepp/ui/icons/*.cpp",
"src/eepp/ui/accessibility/*.cpp",
"src/eepp/ui/abstract/*.cpp",
"src/eepp/ui/models/*.cpp",
"src/eepp/ui/css/*.cpp",
"src/eepp/ui/doc/*.cpp",
"src/eepp/ui/doc/languages/*.cpp",
"src/eepp/ui/tools/*.cpp",
"src/eepp/physics/*.cpp",
"src/eepp/physics/constraints/*.cpp"
}
incdirs {
"include",
"src",
"src/thirdparty",
"include/eepp/thirdparty",
"src/thirdparty/freetype2/include",
"src/thirdparty/zlib",
"src/thirdparty/libogg/include",
"src/thirdparty/libvorbis/include",
"src/thirdparty/mbedtls/include",
"src/thirdparty/pcre2/src",
"src/thirdparty/oniguruma",
"src/thirdparty/libwebp/src",
"src/thirdparty/SheenBidi/Headers",
"src/thirdparty/SheenBidi/Headers/SheenBidi",
"src/thirdparty/brotli/include",
}
add_static_links()
check_ssl_support()
defines { "PCRE2_STATIC", "PCRE2_CODE_UNIT_WIDTH=8", "ONIG_STATIC" }
if table.contains( backends, "SDL2" ) then
files { "src/eepp/window/backend/SDL2/*.cpp" }
defines { "EE_BACKEND_SDL_ACTIVE", "EE_SDL_VERSION_2" }
end
if table.contains( backends, "SDL3" ) then
files { "src/eepp/window/backend/SDL3/*.cpp" }
defines { "EE_BACKEND_SDL_ACTIVE", "EE_SDL_VERSION_3" }
end
multiple_insert( link_list, os_links )
links { link_list }
build_link_configuration( build_name )
if _OPTIONS["with-dynamic-freetype"] and not os.istarget("ios") and os_findlib("freetype") then
table.insert( link_list, get_backend_link_name( "freetype" ) )
end
cppdialect "C++20"
filter "options:use-frameworks"
defines { "EE_USE_FRAMEWORKS" }
filter { "system:macosx", "action:xcode* or options:use-frameworks" }
libdirs { "/System/Library/Frameworks", "/Library/Frameworks", "src/thirdparty" }
filter { "system:macosx", "not action:xcode*", "not options:use-frameworks" }
libdirs { "/opt/homebrew/lib" }
filter "system:windows"
files { "src/eepp/system/platform/win/*.cpp" }
files { "src/eepp/network/platform/win/*.cpp" }
links { "bcrypt" }
filter "system:not windows"
files { "src/eepp/system/platform/posix/*.cpp" }
files { "src/eepp/network/platform/unix/*.cpp" }
filter "options:not without-mojoal"
defines { "AL_LIBTYPE_STATIC", "EE_MOJOAL" }
incdirs { "src/thirdparty/mojoAL" }
filter "options:windows-vc-build"
incdirs { "src/thirdparty/" .. get_sdl_version_dir() .. "/include" }
incdirs { "src/thirdparty/" .. get_sdl_version_dir() .. "/include/" .. get_sdl_include_sub() }
filter { "options:windows-mingw-build", "architecture:x86" }
incdirs { "src/thirdparty/" .. get_sdl_version_dir() .."/i686-w64-mingw32/include/" }
filter { "options:windows-mingw-build", "architecture:x86_64" }
if not is_arm64_arch() then
incdirs { "src/thirdparty/" .. get_sdl_version_dir() .."/x86_64-w64-mingw32/include/" }
end
filter { "options:windows-mingw-build", "options:arch=arm64" }
incdirs { get_sdl_arm64_cross_tools_path() .. "/include/" }
filter { "options:windows-mingw-build", "options:arch=aarch64" }
incdirs { get_sdl_arm64_cross_tools_path() .. "/include/" }
filter "action:vs*"
incdirs { "src/thirdparty/libzip/vs" }
buildoptions{ "/std:c++20", "/utf-8", "/bigobj", "/Zc:preprocessor" }
filter { "action:export-compile-commands", "system:macosx" }
buildoptions { "-std=c++20" }
filter {}
end
function target_dir_lib(path)
filter "architecture:wasm32"
targetdir("libs/" .. os.target() .. "/wasm32/" .. path .. "/")
filter "architecture:x86"
targetdir("libs/" .. os.target() .. "/x86/" .. path .. "/")
filter "architecture:x86_64"
targetdir("libs/" .. os.target() .. "/x86_64/" .. path .. "/")
filter "architecture:ARM"
targetdir("libs/" .. os.target() .. "/arm/" .. path .. "/")
filter "architecture:ARM64 or AARCH64"
targetdir("libs/" .. os.target() .. "/arm64/" .. path .. "/")
filter "architecture:universal"
targetdir("libs/" .. os.target() .. "/universal/" .. path .. "/")
filter {}
end
function target_dir_thirdparty()
target_dir_lib("thirdparty")
end
function postsymlinklib_arch(name)
postsymlinklib( _MAIN_SCRIPT_DIR .. "/libs/" .. os.target() .. "/x86/", _MAIN_SCRIPT_DIR .. "/bin/", name, "architecture:x86" )
postsymlinklib( _MAIN_SCRIPT_DIR .. "/libs/" .. os.target() .. "/x86_64/", _MAIN_SCRIPT_DIR .. "/bin/", name, "architecture:x86_64" )
postsymlinklib( _MAIN_SCRIPT_DIR .. "/libs/" .. os.target() .. "/arm/", _MAIN_SCRIPT_DIR .. "/bin/", name, "architecture:ARM" )
postsymlinklib( _MAIN_SCRIPT_DIR .. "/libs/" .. os.target() .. "/arm64/", _MAIN_SCRIPT_DIR .. "/bin/", name, "architecture:AARCH64" )
postsymlinklib( _MAIN_SCRIPT_DIR .. "/libs/" .. os.target() .. "/arm64/", _MAIN_SCRIPT_DIR .. "/bin/", name, "options:arch=arm64" )
postsymlinklib( _MAIN_SCRIPT_DIR .. "/libs/" .. os.target() .. "/arm64/", _MAIN_SCRIPT_DIR .. "/bin/", name, "options:arch=aarch64" )
postsymlinklib( _MAIN_SCRIPT_DIR .. "/libs/" .. os.target() .. "/universal/", _MAIN_SCRIPT_DIR .. "/bin/", name, "architecture:universal" )
if name == "eepp" then
postsymlinklib( _MAIN_SCRIPT_DIR .. "/libs/" .. os.target() .. "/x86/", _MAIN_SCRIPT_DIR .. "/bin/unit_tests/", name, "architecture:x86" )
postsymlinklib( _MAIN_SCRIPT_DIR .. "/libs/" .. os.target() .. "/x86_64/", _MAIN_SCRIPT_DIR .. "/bin/unit_tests/", name, "architecture:x86_64" )
postsymlinklib( _MAIN_SCRIPT_DIR .. "/libs/" .. os.target() .. "/arm/", _MAIN_SCRIPT_DIR .. "/bin/unit_tests/", name, "architecture:ARM" )
postsymlinklib( _MAIN_SCRIPT_DIR .. "/libs/" .. os.target() .. "/arm64/", _MAIN_SCRIPT_DIR .. "/bin/unit_tests/", name, "architecture:AARCH64" )
postsymlinklib( _MAIN_SCRIPT_DIR .. "/libs/" .. os.target() .. "/arm64/", _MAIN_SCRIPT_DIR .. "/bin/unit_tests/", name, "options:arch=arm64" )
postsymlinklib( _MAIN_SCRIPT_DIR .. "/libs/" .. os.target() .. "/arm64/", _MAIN_SCRIPT_DIR .. "/bin/unit_tests/", name, "options:arch=aarch64" )
postsymlinklib( _MAIN_SCRIPT_DIR .. "/libs/" .. os.target() .. "/universal/", _MAIN_SCRIPT_DIR .. "/bin/unit_tests/", name, "architecture:universal" )
end
end
workspace "eepp"
targetdir(_MAIN_SCRIPT_DIR .. "/bin/")
if _ACTION == "ninja" then
configurations { "debug", "release" }
platforms { get_architecture() }
elseif os.istarget("emscripten") then
configurations { "debug", "release" }
platforms { "wasm32" }
else
configurations { "debug", "release" }
platforms { "x86_64", "x86", "arm64" }
end
-- FreeBSD builds use clang: force the clang toolset so the generated project
-- files never fall back to the default gcc toolchain of the bsd system.
-- An explicitly requested compiler (--cc) still takes precedence.
filter { "system:bsd", "not options:cc" }
toolset "clang"
filter {}
rtti "On"
download_and_extract_dependencies()
select_backend()
generate_os_links()
parse_args()
location("./make/" .. os.target() .. "/")
objdir("obj/" .. os.target() .. "/")
filter "platforms:x86"
architecture "x86"
filter "platforms:arm64"
architecture "ARM64"
filter { "platforms:arm64", "system:macosx" }
architecture "ARM64"
buildoptions { "-arch arm64" }
linkoptions { "-arch arm64" }
filter "platforms:x86_64"
architecture "x86_64"
filter "platforms:wasm32"
architecture "wasm32"
filter { "platforms:x86_64", "system:macosx" }
architecture "x86_64"
buildoptions { "-arch x86_64" }
linkoptions { "-arch x86_64" }
filter "system:macosx"
defines { "GL_SILENCE_DEPRECATION" }
filter "system:ios"
defines { "GLES_SILENCE_DEPRECATION" }
filter "configurations:debug*"
defines { "DEBUG" }
symbols "On"
filter "configurations:release*"
optimize "Speed"
filter { "configurations:release*", "options:with-debug-symbols" }
symbols "On"
filter { "system:windows", "action:vs*" }
if type(multiprocessorcompile) == "function" then
multiprocessorcompile "On"
else
flags { "MultiProcessorCompile" }
end
disablewarnings{ "4305", "4146", "4996", "4244", "4267" }
filter "system:bsd"
syslibdirs { "/usr/local/lib" }
externalincludedirs { "/usr/local/include" }
filter {}
project "SOIL2-static"
kind "StaticLib"
language "C"
files { "src/thirdparty/SOIL2/src/SOIL2/*.c" }
incdirs { "src/thirdparty/SOIL2" }
build_base_configuration( "SOIL2" )
target_dir_thirdparty()
if glew_enabled() then
project "glew-static"
kind "StaticLib"
language "C"
defines { "GLEW_NO_GLU", "GLEW_STATIC" }
files { "src/thirdparty/glew/*.c" }
incdirs { "include/thirdparty/glew" }
build_base_configuration( "glew" )
target_dir_thirdparty()
filter { "action:vs*", "options:arch=arm64" }
buildoptions{ "/bigobj", "/O1", "/Zm200" }
filter { "action:vs*", "options:arch=aarch64" }
buildoptions{ "/bigobj", "/O1", "/Zm200" }
filter {}
end
project "mbedtls-static"
kind "StaticLib"
language "C"
incdirs { "src/thirdparty/mbedtls/include/" }
files { "src/thirdparty/mbedtls/library/*.c" }
build_base_configuration( "mbedtls" )
target_dir_thirdparty()
project "vorbis-static"
kind "StaticLib"
language "C"
incdirs { "src/thirdparty/libvorbis/lib/", "src/thirdparty/libogg/include", "src/thirdparty/libvorbis/include" }
files { "src/thirdparty/libogg/**.c", "src/thirdparty/libvorbis/**.c" }
build_base_cpp_configuration( "vorbis" )
target_dir_thirdparty()
project "pugixml-static"
kind "StaticLib"
language "C++"
files { "src/thirdparty/pugixml/*.cpp" }
build_base_cpp_configuration( "pugixml" )
target_dir_thirdparty()
project "simdutf-static"
kind "StaticLib"
language "C++"
files { "src/thirdparty/simdutf/simdutf.cpp" }
includedirs { "src/thirdparty/simdutf" }
build_base_cpp_configuration( "simdutf" )
target_dir_thirdparty()
project "zlib-static"
kind "StaticLib"
language "C"
defines { "_LARGEFILE64_SOURCE" }
files { "src/thirdparty/zlib/*.c" }
build_base_configuration( "zlib" )
target_dir_thirdparty()
project "libzip-static"
kind "StaticLib"
language "C"
files { "src/thirdparty/libzip/*.c" }
incdirs { "src/thirdparty/zlib" }
build_base_configuration( "libzip" )
target_dir_thirdparty()
project "libpng-static"
kind "StaticLib"
language "C"
files { "src/thirdparty/libpng/**.c" }
incdirs { "src/thirdparty/libpng/include" }
build_base_configuration( "libpng" )
target_dir_thirdparty()
project "libwebp-static"
kind "StaticLib"
language "C"
files { "src/thirdparty/libwebp/**.c" }
incdirs { "src/thirdparty/libwebp" }
build_base_configuration( "libwebp" )
target_dir_thirdparty()
project "freetype-static"
kind "StaticLib"
language "C"
defines { "FT2_BUILD_LIBRARY" }
files { "src/thirdparty/freetype2/src/**.c" }
incdirs { "src/thirdparty/freetype2/include", "src/thirdparty/libpng", "src/thirdparty/brotli/include" }
build_base_configuration( "freetype" )
target_dir_thirdparty()
project "pcre2-8-static"
kind "StaticLib"
language "C"
defines { "HAVE_CONFIG_H", "PCRE2_STATIC", "PCRE2_CODE_UNIT_WIDTH=8" }
files {
'src/thirdparty/pcre2/src/pcre2_auto_possess.c',
'src/thirdparty/pcre2/src/pcre2_chartables.c',
'src/thirdparty/pcre2/src/pcre2_chkdint.c',
'src/thirdparty/pcre2/src/pcre2_compile.c',
'src/thirdparty/pcre2/src/pcre2_config.c',
'src/thirdparty/pcre2/src/pcre2_context.c',
'src/thirdparty/pcre2/src/pcre2_convert.c',
'src/thirdparty/pcre2/src/pcre2_dfa_match.c',
'src/thirdparty/pcre2/src/pcre2_error.c',
'src/thirdparty/pcre2/src/pcre2_extuni.c',
'src/thirdparty/pcre2/src/pcre2_find_bracket.c',
'src/thirdparty/pcre2/src/pcre2_maketables.c',
'src/thirdparty/pcre2/src/pcre2_match.c',
'src/thirdparty/pcre2/src/pcre2_match_data.c',
'src/thirdparty/pcre2/src/pcre2_newline.c',
'src/thirdparty/pcre2/src/pcre2_ord2utf.c',
'src/thirdparty/pcre2/src/pcre2_pattern_info.c',
'src/thirdparty/pcre2/src/pcre2_script_run.c',
'src/thirdparty/pcre2/src/pcre2_serialize.c',
'src/thirdparty/pcre2/src/pcre2_string_utils.c',
'src/thirdparty/pcre2/src/pcre2_study.c',
'src/thirdparty/pcre2/src/pcre2_substitute.c',
'src/thirdparty/pcre2/src/pcre2_substring.c',
'src/thirdparty/pcre2/src/pcre2_tables.c',
'src/thirdparty/pcre2/src/pcre2_ucd.c',
'src/thirdparty/pcre2/src/pcre2_valid_utf.c',
'src/thirdparty/pcre2/src/pcre2_xclass.c',
}
if not os.istarget("emscripten") and not os.istarget("ios") then
files { 'src/thirdparty/pcre2/src/pcre2_jit_compile.c' }
end
incdirs { "src/thirdparty/pcre2/src" }
build_base_configuration( "pcre2-8" )
target_dir_thirdparty()
project "oniguruma-static"
kind "StaticLib"
language "C"
target_dir_thirdparty()
files {
'src/thirdparty/oniguruma/regcomp.c',
'src/thirdparty/oniguruma/regenc.c',
'src/thirdparty/oniguruma/regerror.c',
'src/thirdparty/oniguruma/regext.c',
'src/thirdparty/oniguruma/regexec.c',
'src/thirdparty/oniguruma/regparse.c',
'src/thirdparty/oniguruma/regsyntax.c',
'src/thirdparty/oniguruma/regtrav.c',
'src/thirdparty/oniguruma/regversion.c',
'src/thirdparty/oniguruma/st.c',
'src/thirdparty/oniguruma/reggnu.c',
'src/thirdparty/oniguruma/regposerr.c',
'src/thirdparty/oniguruma/regposix.c',
'src/thirdparty/oniguruma/mktable.c',
'src/thirdparty/oniguruma/ascii.c',
'src/thirdparty/oniguruma/euc_jp.c',
'src/thirdparty/oniguruma/euc_tw.c',
'src/thirdparty/oniguruma/euc_kr.c',
'src/thirdparty/oniguruma/sjis.c',
'src/thirdparty/oniguruma/big5.c',
'src/thirdparty/oniguruma/gb18030.c',
'src/thirdparty/oniguruma/koi8.c',
'src/thirdparty/oniguruma/koi8_r.c',
'src/thirdparty/oniguruma/cp1251.c',
'src/thirdparty/oniguruma/iso8859_1.c',
'src/thirdparty/oniguruma/iso8859_2.c',
'src/thirdparty/oniguruma/iso8859_3.c',
'src/thirdparty/oniguruma/iso8859_4.c',
'src/thirdparty/oniguruma/iso8859_5.c',
'src/thirdparty/oniguruma/iso8859_6.c',
'src/thirdparty/oniguruma/iso8859_7.c',
'src/thirdparty/oniguruma/iso8859_8.c',
'src/thirdparty/oniguruma/iso8859_9.c',
'src/thirdparty/oniguruma/iso8859_10.c',
'src/thirdparty/oniguruma/iso8859_11.c',
'src/thirdparty/oniguruma/iso8859_13.c',
'src/thirdparty/oniguruma/iso8859_14.c',
'src/thirdparty/oniguruma/iso8859_15.c',
'src/thirdparty/oniguruma/iso8859_16.c',
'src/thirdparty/oniguruma/utf8.c',
'src/thirdparty/oniguruma/utf16_be.c',
'src/thirdparty/oniguruma/utf16_le.c',
'src/thirdparty/oniguruma/utf32_be.c',
'src/thirdparty/oniguruma/utf32_le.c',
'src/thirdparty/oniguruma/unicode.c',
'src/thirdparty/oniguruma/unicode_fold_data.c',
'src/thirdparty/oniguruma/unicode_fold1_key.c',
'src/thirdparty/oniguruma/unicode_fold2_key.c',
'src/thirdparty/oniguruma/unicode_fold3_key.c',
'src/thirdparty/oniguruma/onig_init.c',
'src/thirdparty/oniguruma/unicode_unfold_key.c',
}
defines { "ONIG_STATIC" }
incdirs { "src/thirdparty/oniguruma" }
build_base_configuration( "oniguruma" )
if not _OPTIONS["without-text-shaper"] then
project "harfbuzz-static"
kind "StaticLib"
language "C++"
defines { "HAVE_CONFIG_H" }
files { "src/thirdparty/harfbuzz/**.cc" }
incdirs { "src/thirdparty/freetype2/include", "src/thirdparty/harfbuzz" }
build_base_cpp_configuration( "harfbuzz" )
target_dir_thirdparty()
filter "action:vs*"
buildoptions{ "/bigobj" }
filter { "system:windows", "action:not vs*" }
buildoptions{ "-Wa,-mbig-obj" }
linkoptions { "-Wl,--export-all-symbols" }
project "SheenBidi-static"
kind "StaticLib"
language "C"
files { "src/thirdparty/SheenBidi/Source/**.c" }
incdirs { "src/thirdparty/SheenBidi/Headers" }
target_dir_thirdparty()
build_base_configuration( "sheenbidi" )
end
project "chipmunk-static"
kind "StaticLib"
files { "src/thirdparty/chipmunk/*.c", "src/thirdparty/chipmunk/constraints/*.c" }
incdirs { "src/modules/physics/include/eepp/thirdparty/chipmunk" }
build_base_configuration( "chipmunk" )
target_dir_thirdparty()
filter "action:vs*"
language "C++"
buildoptions { "/TP" }
filter "action:not vs*"
language "C"
project "jpeg-compressor-static"
kind "StaticLib"
language "C++"
files { "src/thirdparty/jpeg-compressor/*.cpp" }
build_base_cpp_configuration( "jpeg-compressor" )
target_dir_thirdparty()
project "imageresampler-static"
kind "StaticLib"
language "C++"
files { "src/thirdparty/imageresampler/*.cpp" }
build_base_cpp_configuration( "imageresampler" )
target_dir_thirdparty()
project "mojoal-static"
kind "StaticLib"
language "C"
defines { "AL_LIBTYPE_STATIC", "EE_MOJOAL" }
if _OPTIONS["with-backend"] == "SDL3" then
incdirs { "src/thirdparty/mojoAL-SDL3", "src/thirdparty/mojoAL-SDL3/AL" }
files { "src/thirdparty/mojoAL-SDL3/*.c" }
else
incdirs { "src/thirdparty/mojoAL" }
files { "src/thirdparty/mojoAL/*.c" }
end
build_base_cpp_configuration( "mojoal" )
target_dir_thirdparty()
filter "options:windows-vc-build"
incdirs { "src/thirdparty/" .. get_sdl_version_dir() .. "/include" }
incdirs { "src/thirdparty/" .. get_sdl_version_dir() .. "/include/" .. get_sdl_include_sub() }
filter { "options:windows-mingw-build", "architecture:x86" }
incdirs { "src/thirdparty/" .. get_sdl_version_dir() .."/i686-w64-mingw32/include/" }
filter { "options:windows-mingw-build", "architecture:x86_64" }
if not is_arm64_arch() then
incdirs { "src/thirdparty/" .. get_sdl_version_dir() .."/x86_64-w64-mingw32/include/" }
end
filter { "options:windows-mingw-build", "options:arch=arm64" }
incdirs { get_sdl_arm64_cross_tools_path() .."/include/" }
filter { "options:windows-mingw-build", "options:arch=aarch64" }
incdirs { get_sdl_arm64_cross_tools_path() .."/include/" }
project "brotli-static"
kind "StaticLib"
language "C"
incdirs { "src/thirdparty/brotli/include", "src/thirdparty/brotli/include/brotli" }
files { "src/thirdparty/brotli/**.c" }
build_base_configuration( "brotli" )
target_dir_thirdparty()
project "md4c-static"
kind "StaticLib"
language "C"
files { "src/thirdparty/md4c/**.c" }
build_base_configuration( "md4c" )
target_dir_thirdparty()
project "libyaml-static"
kind "StaticLib"
language "C"
defines { "HAVE_CONFIG_H", "YAML_DECLARE_STATIC" }
files { "src/thirdparty/libyaml/**.c" }
incdirs { "src/thirdparty/libyaml/include" }
build_base_configuration( "libyaml" )
target_dir_thirdparty()
project "tinyexpr-static"
kind "StaticLib"
language "C"
files { "src/thirdparty/tinyexpr/tinyexpr.c" }
build_base_configuration( "tinyexpr" )
target_dir_thirdparty()
project "gumbo-parser-static"
kind "StaticLib"
language "C"
files { "src/thirdparty/gumbo-parser/**.c" }
build_base_configuration( "gumbo-parser" )
target_dir_thirdparty()
filter "action:vs*"
incdirs { "src/thirdparty/gumbo-parser/visualc/include/" }
project "efsw-static"
kind "StaticLib"
language "C++"
cppdialect "C++20"
incdirs { "src/thirdparty/efsw/include", "src/thirdparty/efsw/src" }
files { "src/thirdparty/efsw/src/efsw/*.cpp" }
build_base_cpp_configuration( "efsw" )
target_dir_thirdparty()
filter "system:windows"
files { "src/thirdparty/efsw/src/efsw/platform/win/*.cpp" }
excludes {
"src/thirdparty/efsw/src/efsw/WatcherKqueue.cpp",
"src/thirdparty/efsw/src/efsw/WatcherFSEvents.cpp",
"src/thirdparty/efsw/src/efsw/WatcherInotify.cpp",
"src/thirdparty/efsw/src/efsw/FileWatcherKqueue.cpp",
"src/thirdparty/efsw/src/efsw/FileWatcherInotify.cpp",
"src/thirdparty/efsw/src/efsw/FileWatcherFSEvents.cpp"
}
filter "system:linux"
excludes {
"src/thirdparty/efsw/src/efsw/WatcherKqueue.cpp",
"src/thirdparty/efsw/src/efsw/WatcherFSEvents.cpp",
"src/thirdparty/efsw/src/efsw/WatcherWin32.cpp",
"src/thirdparty/efsw/src/efsw/FileWatcherKqueue.cpp",
"src/thirdparty/efsw/src/efsw/FileWatcherWin32.cpp",
"src/thirdparty/efsw/src/efsw/FileWatcherFSEvents.cpp"
}
filter "system:macosx or system:ios"
excludes {
"src/thirdparty/efsw/src/efsw/WatcherInotify.cpp",
"src/thirdparty/efsw/src/efsw/WatcherWin32.cpp",
"src/thirdparty/efsw/src/efsw/FileWatcherInotify.cpp",
"src/thirdparty/efsw/src/efsw/FileWatcherWin32.cpp"
}
filter "system:bsd"
excludes {
"src/thirdparty/efsw/src/efsw/WatcherInotify.cpp",
"src/thirdparty/efsw/src/efsw/WatcherWin32.cpp",
"src/thirdparty/efsw/src/efsw/WatcherFSEvents.cpp",
"src/thirdparty/efsw/src/efsw/FileWatcherInotify.cpp",
"src/thirdparty/efsw/src/efsw/FileWatcherWin32.cpp",
"src/thirdparty/efsw/src/efsw/FileWatcherFSEvents.cpp"
}
filter "system:not windows"
files { "src/thirdparty/efsw/src/efsw/platform/posix/*.cpp" }
project "eepp-maps-static"
kind "StaticLib"
language "C++"
cppdialect "C++20"
incdirs { "include", "src/modules/maps/include/","src/modules/maps/src/" }
files { "src/modules/maps/src/**.cpp" }
defines { "EE_MAPS_STATIC" }
if _OPTIONS["with-static-eepp"] then
defines { "EE_STATIC" }
end
build_base_cpp_configuration( "eepp-maps-static" )
target_dir_lib("")
filter "action:not vs*"
buildoptions { "-Wall" }
if not os.istarget("emscripten") then
project "eepp-maps"
kind "SharedLib"
language "C++"
cppdialect "C++20"
incdirs { "include", "src/modules/maps/include/","src/modules/maps/src/" }
files { "src/modules/maps/src/**.cpp" }
links { "eepp-shared" }
defines { "EE_MAPS_EXPORTS" }
build_base_cpp_configuration( "eepp-maps" )
postsymlinklib_arch( "eepp-maps" )
target_dir_lib("")
filter { "system:windows", "action:not vs*" }
links { "winpthread" }
filter "action:not vs*"
buildoptions { "-Wall" }
end
project "eepp-physics-static"
kind "StaticLib"
language "C++"
cppdialect "C++20"
incdirs { "include", "src/modules/physics/include/","src/modules/physics/src/" }
files { "src/modules/physics/src/**.cpp", "src/eepp/physics/constraints/*.cpp" }
defines { "EE_PHYSICS_STATIC" }
if _OPTIONS["with-static-eepp"] then
defines { "EE_STATIC" }
end
build_base_cpp_configuration( "eepp-physics-static" )
target_dir_lib("")
filter "action:not vs*"
buildoptions { "-Wall" }
if not os.istarget("emscripten") then
project "eepp-physics"
kind "SharedLib"
language "C++"
cppdialect "C++20"
incdirs { "include", "src/modules/physics/include/","src/modules/physics/src/" }
files { "src/modules/physics/src/**.cpp", "src/eepp/physics/constraints/*.cpp" }
links { "chipmunk-static", "eepp-shared" }
defines { "EE_PHYSICS_EXPORTS" }
build_base_cpp_configuration( "eepp-physics" )
postsymlinklib_arch( "eepp-physics" )
target_dir_lib("")
filter "action:not vs*"
buildoptions { "-Wall" }
end
project "eterm-static"
kind "StaticLib"
language "C++"
cppdialect "C++20"
incdirs { "include", "src/modules/eterm/include/","src/modules/eterm/src/" }
files { "src/modules/eterm/src/**.cpp" }
if _OPTIONS["with-static-eepp"] then
defines { "EE_STATIC" }
end
if os_ishost("msys") then
defines { "WINVER=0x0602" }
end
build_base_cpp_configuration( "eterm" )
target_dir_lib("")
filter "action:not vs*"
buildoptions { "-Wall" }
filter { "action:export-compile-commands", "system:macosx" }
buildoptions { "-std=c++20" }
if vfs_sftp_enabled() then
project "libssh2-static"
kind "StaticLib"
language "C"
incdirs { "src/thirdparty/libssh2/include", "src/thirdparty/libssh2/src" }
files { "src/thirdparty/libssh2/src/*.c" }
defines { "HAVE_CONFIG_H", "LIBSSH2_HAVE_ZLIB" }
if _OPTIONS["with-openssl"] then
defines { "LIBSSH2_OPENSSL" }
else
defines { "LIBSSH2_MBEDTLS" }
-- mbedTLS has no Ed25519/X25519: Monocypher provides them (mbedtls_ed25519.c).
incdirs { "src/thirdparty/mbedtls/include", "src/thirdparty/monocypher" }
files { "src/thirdparty/monocypher/*.c" }
end
build_base_configuration( "libssh2" )
target_dir_thirdparty()
end
-- Remote file watching helper consumed by the eepp-vfs sftp:// watch backend. It only depends on
-- efsw and is normally deployed on the remote host.
project "efsw-agent"
kind "ConsoleApp"
language "C++"
cppdialect "C++20"
targetdir(_MAIN_SCRIPT_DIR .. "/bin")
incdirs { "src/thirdparty/efsw/include", "src/thirdparty/efsw/src" }
files { "src/thirdparty/efsw/src/agent/*.cpp" }
links { "efsw-static" }
build_base_cpp_configuration( "efsw-agent" )
filter { "system:windows", "action:not vs*" }
links { "winpthread" }
filter { "system:not windows", "system:not haiku" }
links { "pthread" }
filter "system:macosx"
links { "CoreFoundation.framework", "CoreServices.framework" }
filter {}
project "eepp-vfs-static"
kind "StaticLib"
language "C++"
cppdialect "C++20"
incdirs { "include", "src/modules/vfs/include/", "src/modules/vfs/src/", "src/thirdparty/efsw/include" }
files { "src/modules/vfs/src/**.cpp" }
if vfs_sftp_enabled() then
defines { "EE_VFS_SFTP" }
incdirs { "src/thirdparty/libssh2/include" }
else
excludes { "src/modules/vfs/src/eepp/vfs/sftp/**.cpp" }
end
if _OPTIONS["with-static-eepp"] then
defines { "EE_STATIC" }
end
build_base_cpp_configuration( "eepp-vfs" )
target_dir_lib("")
filter "action:not vs*"
buildoptions { "-Wall" }
filter { "action:export-compile-commands", "system:macosx" }
buildoptions { "-std=c++20" }
project "languages-syntax-highlighting-static"
kind "StaticLib"
language "C++"
cppdialect "C++20"
incdirs { "include", "src/modules/languages-syntax-highlighting/src" }
files { "src/modules/languages-syntax-highlighting/src/**.cpp" }
if _OPTIONS["with-static-eepp"] then
defines { "EE_STATIC" }
end
build_base_cpp_configuration( "languages-syntax-highlighting" )
target_dir_lib("")
filter "action:not vs*"
buildoptions { "-Wall" }
filter { "action:export-compile-commands", "system:macosx" }
buildoptions { "-std=c++20" }
if os.istarget("macosx") then
project "eepp-macos-helper-static"
kind "StaticLib"
language "C++"
cppdialect "C++20"
incdirs { "include", "src" }
files { "src/eepp/ui/platform/macos/macosmenubar.mm",
"src/eepp/window/platform/macos/platformhelper.mm",
"src/eepp/ui/accessibility/accessibilitybackendmacos.mm",
"src/eepp/system/fileassociation_macos.mm",
"src/eepp/ui/icons/macosiconimage.mm",
"src/eepp/window/draganddrop/cocoadraganddrop.mm" }
buildoptions { "-x objective-c++" }
build_base_cpp_configuration( "eepp-macos-helper" )
target_dir_lib( "" )
filter "action:not vs*"
buildoptions { "-Wall" }
filter { "action:export-compile-commands", "system:macosx" }
buildoptions { "-std=c++20" }
end
-- Library
if not _OPTIONS["disable-static-build"] then
project "eepp-static"
kind "StaticLib"
language "C++"
build_eepp( "eepp-static" )
target_dir_lib("")
end
if not os.istarget("emscripten") then
project "eepp-shared"
kind "SharedLib"
language "C++"
build_eepp( "eepp" )
postsymlinklib_arch( "eepp" )
target_dir_lib("")
-- Bind calls between libeepp's own functions directly instead of through the PLT. ELF
-- only: Mach-O and PE already bind them directly.
if os.istarget("linux") or os.istarget("bsd") or os.istarget("haiku") then
linkoptions { "-Wl,-Bsymbolic-functions" }
end
end
-- Examples
project "eepp-external-shader"
set_kind()
language "C++"
files { "src/examples/external_shader/*.cpp" }
build_link_configuration( "eepp-external-shader", true )
if os.istarget("linux") or os.istarget("windows") or os.istarget("macosx") then
project "eepp-native-dnd-tests"
kind "ConsoleApp"
language "C++"
files { "src/tests/native_drag_and_drop/main.cpp",
"src/examples/native_drag_and_drop/native_drag_and_drop.cpp" }
if os.istarget("linux") then
files { "src/tests/native_drag_and_drop/x11.cpp",
"src/tests/native_drag_and_drop/x11droptarget.cpp",
"src/tests/native_drag_and_drop/wayland.cpp" }
links { "dl" }
elseif os.istarget("macosx") then
files { "src/tests/native_drag_and_drop/macos.cpp" }
else
files { "src/tests/native_drag_and_drop/win32.cpp" }
links { "shell32", "ole32", "uuid", "gdi32" }
end
build_link_configuration( "eepp-native-dnd-tests", true )
end
project "eepp-native-drag-and-drop"
set_kind()
language "C++"
files { "src/examples/native_drag_and_drop/*.cpp" }
build_link_configuration( "eepp-native-drag-and-drop", true )
project "eepp-empty-window"
set_kind()
language "C++"
files { "src/examples/empty_window/*.cpp" }
build_link_configuration( "eepp-empty-window", true )
project "eepp-sound"
kind "ConsoleApp"
language "C++"
files { "src/examples/sound/*.cpp" }
build_link_configuration( "eepp-sound", true )
project "eepp-sprites"
set_kind()
language "C++"
files { "src/examples/sprites/*.cpp" }
build_link_configuration( "eepp-sprites", true )
project "eepp-fonts"
set_kind()
language "C++"
files { "src/examples/fonts/*.cpp" }
build_link_configuration( "eepp-fonts", true )
project "eepp-vbo-fbo-batch"
set_kind()
language "C++"
files { "src/examples/vbo_fbo_batch/*.cpp" }
build_link_configuration( "eepp-vbo-fbo-batch", true )
project "eepp-physics-demo"
set_kind()
language "C++"
files { "src/examples/physics/*.cpp" }
eepp_module_physics_add()
build_link_configuration( "eepp-physics-demo", true )
project "eepp-http-request"
kind "ConsoleApp"
language "C++"
files { "src/examples/http_request/*.cpp" }
incdirs { "src/thirdparty" }
build_link_configuration( "eepp-http-request", true )
project "eepp-ui-custom-widget"
set_kind()
language "C++"
files { "src/examples/ui_custom_widget/*.cpp" }
build_link_configuration( "eepp-ui-custom-widget", true )
project "eepp-ui-charts"
set_kind()
language "C++"
files { "src/examples/ui_charts/*.cpp" }
build_link_configuration( "eepp-ui-charts", true )
project "eepp-ui-hello-world"
set_kind()
language "C++"
files { "src/examples/ui_hello_world/*.cpp" }
build_link_configuration( "eepp-ui-hello-world", true )
project "eepp-ui-rtl"
set_kind()
language "C++"
files { "src/examples/ui_rtl/*.cpp" }
build_link_configuration( "eepp-ui-rtl", true )
project "eepp-ui-application-hello-world"
set_kind()
language "C++"
files { "src/examples/ui_application_hello_world/*.cpp" }
build_link_configuration( "eepp-ui-application-hello-world", true )
project "eepp-ui-application-multi-window"
set_kind()
language "C++"
files { "src/examples/ui_application_multi_window/*.cpp" }
build_link_configuration( "eepp-ui-application-multi-window", true )
project "eepp-ui-accessibility"
set_kind()
language "C++"
files { "src/examples/ui_accessibility/*.cpp" }
build_link_configuration( "eepp-ui-accessibility", true )
project "eepp-ui-date-time-picker"
set_kind()
language "C++"
files { "src/examples/ui_date_time_picker/*.cpp" }
build_link_configuration( "eepp-ui-date-time-picker", true )
project "eepp-ui-font-picker"
set_kind()
language "C++"
files { "src/examples/ui_font_picker/*.cpp" }
build_link_configuration( "eepp-ui-font-picker", true )
project "eepp-ui-dropdownmodellist"
set_kind()
language "C++"
files { "src/examples/ui_dropdownmodellist/*.cpp" }
build_link_configuration( "eepp-ui-dropdownmodellist", true )
project "eepp-ui-data-handling"
set_kind()
language "C++"
files { "src/examples/ui_data_handling/*.cpp" }
build_link_configuration( "eepp-ui-data-handling", true )
project "eepp-ui-data-collections"
set_kind()
language "C++"
files { "src/examples/ui_data_collections/*.cpp" }
build_link_configuration( "eepp-ui-data-collections", true )
project "eepp-ui-richtext"
set_kind()
language "C++"
files { "src/examples/ui_richtext/*.cpp" }
build_link_configuration( "eepp-ui-richtext", true )
project "eepp-ui-html"
set_kind()
language "C++"
incdirs { "src/thirdparty" }
files { "src/examples/ui_html/*.cpp" }
build_link_configuration( "eepp-ui-html", true )
project "eepp-ui-markdownview"
set_kind()
language "C++"
incdirs { "src/thirdparty" }
files { "src/examples/ui_markdownview/*.cpp" }
build_link_configuration( "eepp-ui-markdownview", true )
project "eepp-richtext"
set_kind()
language "C++"
files { "src/examples/richtext/*.cpp" }
build_link_configuration( "eepp-richtext", true )
project "eepp-7guis-counter"
set_kind()
language "C++"
files { "src/examples/7guis/counter/*.cpp" }
build_link_configuration( "eepp-7guis-counter", true )
project "eepp-7guis-temperature-converter"
set_kind()
language "C++"
files { "src/examples/7guis/temperature_converter/*.cpp" }
build_link_configuration( "eepp-7guis-temperature-converter", true )
project "eepp-7guis-flight-booker"
set_kind()
language "C++"
files { "src/examples/7guis/flight_booker/*.cpp" }
build_link_configuration( "eepp-7guis-flight-booker", true )
project "eepp-7guis-timer"
set_kind()
language "C++"
files { "src/examples/7guis/timer/*.cpp" }
build_link_configuration( "eepp-7guis-timer", true )
project "eepp-7guis-crud"
set_kind()
language "C++"
files { "src/examples/7guis/crud/*.cpp" }
build_link_configuration( "eepp-7guis-crud", true )
project "eepp-7guis-circle-drawer"
set_kind()
language "C++"
files { "src/examples/7guis/circle_drawer/*.cpp" }
build_link_configuration( "eepp-7guis-circle-drawer", true )
project "eepp-7guis-cells"
set_kind()
language "C++"
files { "src/examples/7guis/cells/*.cpp" }
build_link_configuration( "eepp-7guis-cells", true )
project "eepp-treeviewmodel"
set_kind()
language "C++"
files { "src/examples/ui_treeview_model/*.cpp" }
build_link_configuration( "eepp-treeviewmodel", true )
-- Tools
project "eepp-textureatlaseditor"
set_kind()
language "C++"
eepp_module_backward_add( false )
files { "src/tools/textureatlaseditor/*.cpp" }
build_link_configuration( "eepp-TextureAtlasEditor", true )
project "eepp-mapeditor"
set_kind()
language "C++"
eepp_module_backward_add( false )
files { "src/tools/mapeditor/*.cpp" }
eepp_module_maps_add()
build_link_configuration( "eepp-MapEditor", true )
project "eepp-uieditor"
set_kind()
language "C++"
eepp_module_backward_add( false )
incdirs { "src/thirdparty/efsw/include", "src/thirdparty" }
links { "efsw-static", "pugixml-static" }
files { "src/tools/uieditor/*.cpp" }
build_link_configuration( "eepp-UIEditor", true )
filter "system:macosx"
links { "CoreFoundation.framework", "CoreServices.framework" }
filter { "system:not windows", "system:not haiku" }
links { "pthread" }
project "ecode"
set_kind()
language "C++"
files { "src/tools/ecode/**.cpp" }
eepp_module_backward_add( true )
incdirs { "src/thirdparty/efsw/include", "src/thirdparty", "src/modules/eterm/include/", "src/modules/languages-syntax-highlighting/src" }
links { "efsw-static", "eterm-static", "languages-syntax-highlighting-static", "libyaml-static", "tinyexpr-static" }
build_link_configuration( "ecode", false )
filter { "system:windows" }
links { "gumbo-parser-static" }
filter { "system:windows", "action:not vs*" }
buildoptions{ "-Wa,-mbig-obj" }
linkoptions { "-Wl,--export-all-symbols" }
filter { "system:windows", "action:vs*" }
files { "bin/assets/icon/ecode.rc", "bin/assets/icon/ecode.ico" }
vpaths { ['Resources/*'] = { "ecode.rc", "ecode.ico" } }
filter { "system:windows", "action:not vs*", "architecture:x86" }
linkoptions { _MAIN_SCRIPT_DIR .. "/bin/assets/icon/ecode.res" }
filter { "system:windows", "action:not vs*", "architecture:x86_64" }
linkoptions { _MAIN_SCRIPT_DIR .. "/bin/assets/icon/ecode.x64.res" }
filter "system:macosx"
links { "CoreFoundation.framework", "CoreServices.framework", "Cocoa.framework" }
filter { "system:not windows", "system:not haiku" }
links { "pthread" }
filter "system:linux"
links { "util" }
filter { "system:linux or system:macosx or system:haiku or system:bsd", "configurations:release*" }
buildoptions { "-g1", "-fvisibility=default" }
filter "system:haiku"
links { "bsd", "network" }
filter "system:bsd"
links { "util" }
filter { "system:windows", "action:not vs*", "configurations:release*" }
buildoptions { "-g1" }
project "eterm"
set_kind()
language "C++"
eepp_module_backward_add( false )
incdirs { "src/thirdparty/efsw/include", "src/modules/eterm/include/", "src/thirdparty" }
files { "src/tools/eterm/**.cpp" }
links { "efsw-static", "eterm-static" }
build_link_configuration( "eterm", false )
filter { "system:windows", "action:vs*" }
files { "bin/assets/icon/eterm.rc", "bin/assets/icon/eterm.ico" }
vpaths { ['Resources/*'] = { "eterm.rc", "eterm.ico" } }
filter { "system:windows", "action:not vs*", "architecture:x86" }
linkoptions { _MAIN_SCRIPT_DIR .. "/bin/assets/icon/eterm.res" }
filter { "system:windows", "action:not vs*", "architecture:x86_64" }
linkoptions { _MAIN_SCRIPT_DIR .. "/bin/assets/icon/eterm.x64.res" }
filter "system:linux or system:bsd"
links { "util" }
filter { "system:not windows", "system:not haiku" }
links { "pthread" }
filter "system:macosx"
links { "CoreFoundation.framework", "CoreServices.framework" }
filter "system:haiku"
links { "bsd" }
project "eepp-texturepacker"
kind "ConsoleApp"
language "C++"
eepp_module_backward_add( false )
incdirs { "src/thirdparty" }
files { "src/tools/texturepacker/*.cpp" }
build_link_configuration( "eepp-TexturePacker", true )
project "eeiv"
set_kind()
language "C++"
eepp_module_backward_add( false )
filter { "system:windows", "action:vs*" }
files { "bin/assets/icon/eeiv.rc", "bin/assets/icon/eeiv.ico" }
vpaths { ['Resources/*'] = { "eeiv.rc", "eeiv.ico" } }
filter { "system:windows", "action:not vs*", "architecture:x86" }
linkoptions { _MAIN_SCRIPT_DIR .. "/bin/assets/icon/eeiv.res" }
filter { "system:windows", "action:not vs*", "architecture:x86_64" }
linkoptions { _MAIN_SCRIPT_DIR .. "/bin/assets/icon/eeiv.x64.res" }
filter {}
files { "src/tools/eeiv/*.cpp" }
build_link_configuration( "eeiv", false )
project "eefm"
set_kind()
language "C++"
eepp_module_backward_add( false )
incdirs { "src/thirdparty", "src/modules/eterm/include/" }
files { "src/tools/eefm/*.cpp" }
links { "eterm-static" }
eepp_module_vfs_add()
filter "system:windows"
links { "shell32" } -- Recycle Bin (SHFileOperationW)
filter {}
build_link_configuration( "eefm", true )
project "eproc"
set_kind()
language "C++"
eepp_module_backward_add( false )
incdirs { "src/thirdparty/efsw/include", "src/thirdparty" }
filter { "system:windows", "action:vs*" }
files { "bin/assets/icon/eproc.rc", "bin/assets/icon/eproc.ico" }
vpaths { ['Resources/*'] = { "eproc.rc", "eproc.ico" } }
filter { "system:windows", "action:not vs*", "architecture:x86" }
linkoptions { _MAIN_SCRIPT_DIR .. "/bin/assets/icon/eproc.res" }
filter { "system:windows", "action:not vs*", "architecture:x86_64" }
linkoptions { _MAIN_SCRIPT_DIR .. "/bin/assets/icon/eproc.x64.res" }
filter {}
files {
"src/tools/eproc/appconfig.cpp",
"src/tools/eproc/eproc.cpp",
"src/tools/eproc/gui_window_tracker.cpp",
"src/tools/eproc/process_collector.cpp",
"src/tools/eproc/process_info.cpp",
"src/tools/eproc/process_model.cpp",
"src/tools/eproc/process_table_state.cpp",
"src/tools/eproc/settingspanel.cpp",
"src/tools/eproc/window_icon.cpp",
}
filter "system:linux"
files {
"src/tools/eproc/platform/linux/gpu_reader_nvidia.cpp",
"src/tools/eproc/platform/linux/gpu_reader_drm.cpp",
"src/tools/eproc/platform/linux/process_collector_linux.cpp",
"src/tools/eproc/platform/posix/process_icon_resolver.cpp",
"src/tools/eproc/platform/linux/process_network_monitor.cpp",
}
filter "system:windows"
files { "src/tools/eproc/platform/windows/process_collector_windows.cpp" }
links { "psapi", "advapi32" }
filter "system:macosx"
files { "src/tools/eproc/platform/macos/process_collector_macos.cpp",
"src/tools/eproc/platform/macos/process_icon_resolver_macos.cpp" }
links { "CoreFoundation.framework", "CoreGraphics.framework", "ImageIO.framework" }
filter "system:bsd"
files { "src/tools/eproc/platform/freebsd/process_collector_freebsd.cpp",
"src/tools/eproc/platform/posix/process_icon_resolver.cpp" }
filter {}
build_link_configuration( "eproc", false )
-- Tests
project "eepp-test"
set_kind()
language "C++"
files { "src/tests/test_all/*.cpp" }
eepp_module_maps_add()
eepp_module_physics_add()
build_link_configuration( "eepp-test", true )
project "eepp-ui-perf-test"
set_kind()
language "C++"
files { "src/tests/ui_perf_test/*.cpp" }
incdirs { "src/thirdparty" }
build_link_configuration( "eepp-ui-perf-test", true )
project "eepp-benchmarks"
kind "ConsoleApp"
targetdir(_MAIN_SCRIPT_DIR .. "/bin/benchmarks")
language "C++"
files { "src/benchmarks/*.cpp" }
incdirs { "src/thirdparty" }
eepp_module_vfs_add()
-- UTEST_MAIN supplies a native main instead of eepp's SDL_main.
build_link_configuration( "eepp-benchmarks", true, false )
project "eepp-unit_tests"
kind "ConsoleApp"
targetdir(_MAIN_SCRIPT_DIR .. "/bin/unit_tests")
defines { "EE_UNIT_TESTS" }
links { "eterm-static", "languages-syntax-highlighting-static" }
incdirs { "src/modules/eterm/include/", "src/thirdparty", "src/modules/vfs/src/" }
language "C++"
files { "src/tests/unit_tests/*.cpp",
"src/tools/eproc/process_info.cpp",
"src/tools/eproc/process_model.cpp",
"src/tools/eproc/process_table_state.cpp",
"src/tools/eproc/window_icon.cpp",
"src/tools/ecode/ignorematcher.cpp",
"src/tools/ecode/jsonhelper.cpp",
"src/tools/ecode/projectdirectorytree.cpp",
"src/tools/ecode/plugins/git/git.cpp",
"src/tools/ecode/plugins/git/gitdiff.cpp",
"src/tools/ecode/plugins/autocomplete/snippetparser.cpp",
"src/tools/ecode/plugins/autocomplete/usersnippetstore.cpp" }
if os.istarget("macosx") then
files { "src/tests/unit_tests/accessibility_macos_tests.mm" }
links { "Cocoa.framework" }
end
filter { "system:not windows", "system:not haiku" }
links { "pthread" }
filter "system:macosx"
links { "CoreFoundation.framework", "CoreGraphics.framework", "ImageIO.framework" }
files { "src/tools/eproc/process_collector.cpp",
"src/tools/eproc/platform/macos/process_collector_macos.cpp",
"src/tools/eproc/platform/macos/process_icon_resolver_macos.cpp" }
filter "system:haiku"
links { "bsd", "network" }
filter "system:bsd"
links { "util" }
filter {}
eepp_module_vfs_add()
eepp_module_backward_add( false )
filter { "system:linux" }
files { "src/tools/eproc/process_collector.cpp",
"src/tools/eproc/platform/linux/process_collector_linux.cpp",
"src/tools/eproc/platform/linux/gpu_reader_nvidia.cpp",
"src/tools/eproc/platform/linux/gpu_reader_drm.cpp",
"src/tools/eproc/platform/linux/process_network_monitor.cpp",
"src/tools/eproc/platform/posix/process_icon_resolver.cpp" }
filter {}
build_link_configuration( "eepp-unit_tests", true )
if os.istarget("windows") then
project "eepp-windows-accessibility-tests"
kind "ConsoleApp"
targetdir(_MAIN_SCRIPT_DIR .. "/bin/unit_tests")
language "C++"
-- Compile the private providers into the harness for deterministic teardown and
-- cross-window identity tests without requiring the system's UIA client APIs.
files { "src/tests/windows_accessibility/*.cpp",
"src/eepp/ui/accessibility/accessibilitybackenduia.cpp",
"src/eepp/ui/accessibility/accessibilitybackenduiaprovider.cpp",
"src/eepp/ui/accessibility/accessibilitybackenduiatext.cpp" }
links { "uiautomationcore", "ole32", "oleaut32", "comctl32" }
-- This harness supplies its own native wmain instead of eepp's SDL_main.
build_link_configuration( "eepp-windows-accessibility-tests", true, false )
-- MinGW: the harness uses wmain, and CLSID_CUIAutomation lives in libuuid.
filter "action:gmake*"
links { "uuid" }
linkoptions { "-municode" }
filter {}
end
if os.isfile("external_projects.lua") then
dofile("external_projects.lua")
end
if os.isfile("external_projects_premake5.lua") then
dofile("external_projects_premake5.lua")
end