-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Integrate Filament source into Game Engine. #7961
Replies: 1 comment · 5 replies
-
Hi, what are you having problems with? I use C++ and in my case I include FIlament source as part of my CMake project. Here's roughly how a CMakLists.txt that adds Filament could look like: cmake_minimum_required(VERSION 3.19)
project(MyEngine)
add_subdirectory(ThirdParty/Filament) # Path to Filament source directory.
set(CMAKE_CXX_STANDARD 17)
add_library(MyEngine SHARED YOUR_SOURCE_FILES)
target_link_libraries(MyEngine filagui gltfio gltfio_core) |
Beta Was this translation helpful? Give feedback.
All reactions
-
I can barely recall all the steps I took before I reset my project, but I'll give it a try.
Unfortunately, I could not succeed. No matter how many libraries I linked, I always encountered some unresolved externals or mismatch errors. I regret not keeping the logs. This is my first attempt at setting up a project using Premake while integrating another project that uses CMake. I would greatly appreciate any assistance. |
Beta Was this translation helpful? Give feedback.
All reactions
-
Here's a Premake script that successfully compiled HelloTriangle sample for me. Trying it out using sample code is difficult, because Filament releases do not contain all necessary headers and libraries - samples use an internal helper FilamentApp class to avoid copy-pasting a lot of initialization code. In my case I have a I use macOS so I also had to include Apple frameworks, I guess there's probably some (For my projects I would still use CMake, though, since everyone already uses it so integrating other projects and libraries is just easier.) -- premake5.lua
workspace "HelloWorld"
configurations { "Debug", "Release" }
project "HelloWorld"
kind "ConsoleApp"
language "C++"
targetdir "bin/%{cfg.buildcfg}"
cppdialect "C++17"
-- Project sources.
files { "src/**.h", "src/**.cpp" }
-- Filament.
libdirs { "filament/lib/arm64" }
links { "backend", "basis_transcoder", "bluegl", "bluevk", "camutils", "civetweb", "dracodec", "filabridge", "filaflat", "filamat", "filament-iblprefilter", "filament", "filameshio", "geometry", "gltfio_core", "gltfio", "ibl", "image", "ktxreader", "matdbg", "meshoptimizer", "mikktspace", "shaders", "smol-v", "stb", "uberarchive", "uberzlib", "utils", "viewer", "vkshaders", "zstd" }
externalincludedirs { "filament/include" }
externalincludedirs { "filamentsrc/third_party/getopt/include" }
-- ImGui support for Filament.
libdirs { "filamentsrc/out/libs/filagui", "filamentsrc/out/third_party/imgui/tnt" }
links { "filagui", "imgui" }
-- Filament sample app + resources.
libdirs {
"filamentsrc/out/libs/filamentapp",
"filamentsrc/out/samples",
"filamentsrc/out/third_party/libsdl2/tnt"
}
links {
"filamentapp",
"filamentapp-resources",
"sample-resources",
"sdl2"
}
externalincludedirs {
"filamentsrc/libs/filamentapp/include",
"filamentsrc/out/samples",
"filamentsrc/third_party/libsdl2/include"
}
-- macOS frameworks.
links {
"Cocoa.framework",
"QuartzCore.framework",
"Metal.framework",
"ForceFeedback.framework",
"IOKit.framework",
"CoreAudio.framework",
"AudioUnit.framework",
"CoreVideo.framework",
"Carbon.framework"
}
filter "configurations:Debug"
defines { "DEBUG" }
symbols "On"
filter "configurations:Release"
defines { "NDEBUG" }
optimize "On" |
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
Build Log
@adamwych - Thank you so much! |
Beta Was this translation helpful? Give feedback.
All reactions
-
Is this Windows? If you just want to test if Filament works right, then I think you can remove the entire Otherwise, you would have to re-implement |
Beta Was this translation helpful? Give feedback.
All reactions
-
Thank you. I figured it out soon after. After I fixed that I was greeted with a pleasant surprise of 1486 new errors . Build Log - 1486 Errors
Here's my premake script if you're curious. Premake Script-- premake5.lua
project "XGE-Editor"
configurations { "Debug", "Release" }
kind "ConsoleApp"
language "C++"
targetdir "bin/%{cfg.buildcfg}"
cppdialect "C++20"
staticruntime "on"
-- Project sources.
files { "Source/**.h", "Source/**.cpp" }
-- Filament.
libdirs
{
"../3rdParty/filament/out/**",
"../3rdParty/filament/out/third_party/getopt/Debug"
}
links { "backend", "basis_transcoder", "bluegl", "camutils", "civetweb", "dracodec", "filabridge", "filaflat", "filamat", "filament-iblprefilter", "filament", "filameshio", "geometry", "gltfio_core", "gltfio", "ibl", "image", "ktxreader", "matdbg", "meshoptimizer", "mikktspace", "shaders", "smol-v", "stb", "uberarchive", "uberzlib", "utils", "viewer", "vkshaders", "zstd" }
links { "getopt" }
externalincludedirs
{
"../3rdParty/filament/filament/include",
"../3rdParty/filament/filament/backend/include",
"../3rdParty/filament/libs/utils/include",
"../3rdParty/filament/libs/math/include",
"../3rdParty/filament/libs/filabridge/include",
"../3rdParty/filament/libs/camutils/include"
}
externalincludedirs { "../3rdParty/filament/third_party/getopt/include" }
-- ImGui support for Filament.
libdirs { "../3rdParty/filament/out/libs/filagui", "../3rdParty/filament/out/third_party/imgui/tnt" }
links { "filagui", "imgui" }
-- Filament sample app + resources.
libdirs {
"../3rdParty/filament/out/libs/filamentapp",
"../3rdParty/filament/out/samples",
"../3rdParty/filament/out/third_party/libsdl2/tnt"
}
links {
"filamentapp",
"filamentapp-resources",
"sample-resources",
"sdl2"
}
externalincludedirs {
"../3rdParty/filament/libs/filamentapp/include",
"../3rdParty/filament/out/samples",
"../3rdParty/filament/third_party/libsdl2/include"
}
links
{
"shlwapi",
"winmm",
"version",
"libcmtd",
"opengl32"
}
targetdir("../Binaries/" .. OutputDir .. "/%{prj.name}")
objdir("../Binaries/Intermediates/" .. OutputDir .. "/%{prj.name}")
filter "action:vs*"
defines "_CRT_SECURE_NO_WARNINGS"
filter "system:windows"
systemversion "latest"
filter "configurations:Debug"
defines { "DEBUG" }
prebuildcommands{"cmake --build ../3rdParty/filament/out --config Debug"}
runtime "Debug"
symbols "On"
filter "configurations:Release"
defines { "RELEASE" }
prebuildcommands{"cmake --build ../3rdParty/filament/out --config Release"}
runtime "Release"
optimize "On"
symbols "Off"
Nevermind. |
Beta Was this translation helpful? Give feedback.
-
Hello.
I am developing a Game Engine, and trying to integrate filament by building it from source.
I have been trying for a couple of days and I haven't seen any success.
Is there a repository or step-by-step manual I could follow ?
Can I simply use the prebuilt libraries, and be able to peek through its source ?
Beta Was this translation helpful? Give feedback.
All reactions