603 lines
20 KiB
CMake
603 lines
20 KiB
CMake
cmake_minimum_required(VERSION 3.26)
|
||
|
||
project(MetaCore
|
||
VERSION 1.0.0
|
||
DESCRIPTION "MetaCore Filament-based Unity-like editor prototype"
|
||
LANGUAGES CXX
|
||
)
|
||
|
||
set(CMAKE_CXX_STANDARD 20)
|
||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||
|
||
if(MSVC)
|
||
# Debug 使用调试运行库,Release 使用可分发运行库,避免不同配置之间的 CRT 冲突。
|
||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
|
||
endif()
|
||
|
||
option(METACORE_BUILD_TESTS "Build MetaCore tests" ON)
|
||
option(METACORE_BUILD_CORE_ONLY "Build only MetaCore core libraries" OFF)
|
||
option(METACORE_BUILD_PLATFORM "Build MetaCore platform module when core-only is enabled" OFF)
|
||
option(METACORE_BUILD_RUNTIME_DATA "Build MetaCore runtime data module when core-only is enabled" OFF)
|
||
|
||
set(METACORE_ENABLE_PLATFORM FALSE)
|
||
if(NOT METACORE_BUILD_CORE_ONLY OR METACORE_BUILD_PLATFORM)
|
||
set(METACORE_ENABLE_PLATFORM TRUE)
|
||
endif()
|
||
|
||
set(METACORE_ENABLE_RUNTIME_DATA FALSE)
|
||
if(NOT METACORE_BUILD_CORE_ONLY OR METACORE_BUILD_RUNTIME_DATA)
|
||
set(METACORE_ENABLE_RUNTIME_DATA TRUE)
|
||
endif()
|
||
|
||
|
||
list(PREPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
||
|
||
set(METACORE_VCPKG_TRIPLET "")
|
||
set(METACORE_VCPKG_PREFIX "")
|
||
if(WIN32)
|
||
set(METACORE_VCPKG_TRIPLET "x64-windows")
|
||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|amd64|AMD64)$")
|
||
set(METACORE_VCPKG_TRIPLET "x64-linux")
|
||
endif()
|
||
|
||
if(METACORE_VCPKG_TRIPLET)
|
||
foreach(METACORE_VCPKG_PREFIX_CANDIDATE IN ITEMS
|
||
"${CMAKE_SOURCE_DIR}/vcpkg_installed/${METACORE_VCPKG_TRIPLET}"
|
||
"$ENV{VCPKG_ROOT}/installed/${METACORE_VCPKG_TRIPLET}"
|
||
"$ENV{HOME}/vcpkg/installed/${METACORE_VCPKG_TRIPLET}"
|
||
)
|
||
if(EXISTS "${METACORE_VCPKG_PREFIX_CANDIDATE}/share/imgui/imgui-config.cmake")
|
||
set(METACORE_VCPKG_PREFIX "${METACORE_VCPKG_PREFIX_CANDIDATE}")
|
||
list(PREPEND CMAKE_PREFIX_PATH "${METACORE_VCPKG_PREFIX_CANDIDATE}")
|
||
break()
|
||
endif()
|
||
endforeach()
|
||
endif()
|
||
|
||
if(METACORE_VCPKG_PREFIX)
|
||
foreach(METACORE_CACHED_PACKAGE_DIR IN ITEMS imgui_DIR glfw3_DIR)
|
||
if(DEFINED ${METACORE_CACHED_PACKAGE_DIR} AND
|
||
NOT "${${METACORE_CACHED_PACKAGE_DIR}}" MATCHES "^${METACORE_VCPKG_PREFIX}(/|$)")
|
||
unset(${METACORE_CACHED_PACKAGE_DIR} CACHE)
|
||
endif()
|
||
endforeach()
|
||
endif()
|
||
|
||
|
||
|
||
find_package(glm CONFIG REQUIRED)
|
||
set(METACORE_IMGUI_USES_PKG_CONFIG FALSE)
|
||
if(NOT METACORE_BUILD_CORE_ONLY)
|
||
include(MetaCoreFilament)
|
||
find_package(imgui CONFIG QUIET)
|
||
if(NOT imgui_FOUND)
|
||
set(METACORE_IMGUI_USES_PKG_CONFIG TRUE)
|
||
find_package(PkgConfig REQUIRED)
|
||
pkg_check_modules(IMGUI REQUIRED IMPORTED_TARGET imgui)
|
||
add_library(imgui::imgui INTERFACE IMPORTED)
|
||
target_link_libraries(imgui::imgui INTERFACE PkgConfig::IMGUI)
|
||
target_include_directories(imgui::imgui INTERFACE /usr/include/imgui/backends)
|
||
endif()
|
||
endif()
|
||
|
||
if(METACORE_ENABLE_PLATFORM AND NOT WIN32)
|
||
find_package(glfw3 CONFIG REQUIRED)
|
||
endif()
|
||
|
||
set(METACORE_COMMON_WARNINGS)
|
||
if(MSVC)
|
||
set(METACORE_COMMON_WARNINGS /W4 /permissive- /EHsc /utf-8)
|
||
else()
|
||
set(METACORE_COMMON_WARNINGS -Wall -Wextra -Wpedantic)
|
||
endif()
|
||
|
||
if(NOT METACORE_BUILD_CORE_ONLY)
|
||
set(METACORE_UI_BLIT_MATERIAL_SOURCE "${CMAKE_SOURCE_DIR}/third_party/filament/libs/filagui/src/materials/uiBlit.mat")
|
||
set(METACORE_UI_BLIT_MATERIAL_OUTPUT "${CMAKE_BINARY_DIR}/uiBlit.filamat")
|
||
if(WIN32)
|
||
set(METACORE_FILAMENT_MATC "${METACORE_FILAMENT_ROOT}/bin/matc.exe")
|
||
else()
|
||
set(METACORE_FILAMENT_MATC "${METACORE_FILAMENT_ROOT}/bin/matc")
|
||
endif()
|
||
|
||
set(METACORE_UI_BLIT_MATERIAL_PREBUILT "")
|
||
foreach(candidate IN ITEMS
|
||
"${CMAKE_SOURCE_DIR}/build_filament/libs/filagui/generated/material/uiBlit.filamat"
|
||
"${METACORE_FILAMENT_ROOT}/bin/uiBlit.filamat"
|
||
)
|
||
if(EXISTS "${candidate}")
|
||
set(METACORE_UI_BLIT_MATERIAL_PREBUILT "${candidate}")
|
||
break()
|
||
endif()
|
||
endforeach()
|
||
|
||
if(EXISTS "${METACORE_UI_BLIT_MATERIAL_SOURCE}")
|
||
add_custom_command(
|
||
OUTPUT "${METACORE_UI_BLIT_MATERIAL_OUTPUT}"
|
||
COMMAND "${METACORE_FILAMENT_MATC}"
|
||
--platform desktop
|
||
--api opengl
|
||
--output "${METACORE_UI_BLIT_MATERIAL_OUTPUT}"
|
||
"${METACORE_UI_BLIT_MATERIAL_SOURCE}"
|
||
DEPENDS
|
||
"${METACORE_UI_BLIT_MATERIAL_SOURCE}"
|
||
"${METACORE_FILAMENT_MATC}"
|
||
VERBATIM
|
||
)
|
||
elseif(METACORE_UI_BLIT_MATERIAL_PREBUILT)
|
||
add_custom_command(
|
||
OUTPUT "${METACORE_UI_BLIT_MATERIAL_OUTPUT}"
|
||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||
"${METACORE_UI_BLIT_MATERIAL_PREBUILT}"
|
||
"${METACORE_UI_BLIT_MATERIAL_OUTPUT}"
|
||
DEPENDS "${METACORE_UI_BLIT_MATERIAL_PREBUILT}"
|
||
VERBATIM
|
||
)
|
||
else()
|
||
message(FATAL_ERROR "Missing uiBlit material source or prebuilt uiBlit.filamat.")
|
||
endif()
|
||
|
||
add_custom_target(MetaCoreUiBlitMaterial
|
||
DEPENDS "${METACORE_UI_BLIT_MATERIAL_OUTPUT}"
|
||
)
|
||
|
||
function(metacore_stage_ui_blit_material target_name)
|
||
add_dependencies(${target_name} MetaCoreUiBlitMaterial)
|
||
add_custom_command(TARGET ${target_name} POST_BUILD
|
||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||
"${METACORE_UI_BLIT_MATERIAL_OUTPUT}"
|
||
"$<TARGET_FILE_DIR:${target_name}>/uiBlit.filamat"
|
||
VERBATIM
|
||
)
|
||
endfunction()
|
||
endif()
|
||
|
||
add_executable(MetaCoreHeaderTool
|
||
tools/MetaCoreHeaderTool/main.cpp
|
||
)
|
||
|
||
target_compile_options(MetaCoreHeaderTool PRIVATE ${METACORE_COMMON_WARNINGS})
|
||
|
||
if(METACORE_ENABLE_RUNTIME_DATA)
|
||
add_executable(MetaCoreRuntimeConfigTool
|
||
tools/MetaCoreRuntimeConfigTool/main.cpp
|
||
)
|
||
|
||
target_compile_options(MetaCoreRuntimeConfigTool PRIVATE ${METACORE_COMMON_WARNINGS})
|
||
|
||
add_executable(MetaCoreTcpSenderTool
|
||
tools/MetaCoreTcpSenderTool/main.cpp
|
||
)
|
||
|
||
target_compile_options(MetaCoreTcpSenderTool PRIVATE ${METACORE_COMMON_WARNINGS})
|
||
if(WIN32)
|
||
target_link_libraries(MetaCoreTcpSenderTool PRIVATE ws2_32)
|
||
endif()
|
||
endif()
|
||
|
||
function(metacore_generate_reflection module_name function_name output_var)
|
||
set(generated_headers ${ARGN})
|
||
set(absolute_headers)
|
||
foreach(header IN LISTS generated_headers)
|
||
list(APPEND absolute_headers "${CMAKE_SOURCE_DIR}/${header}")
|
||
endforeach()
|
||
|
||
set(generated_cpp "${CMAKE_BINARY_DIR}/Generated/${module_name}/${module_name}GeneratedReflection.cpp")
|
||
add_custom_command(
|
||
OUTPUT "${generated_cpp}"
|
||
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/Generated/${module_name}"
|
||
COMMAND $<TARGET_FILE:MetaCoreHeaderTool>
|
||
--output "${generated_cpp}"
|
||
--function "${function_name}"
|
||
--module "${module_name}"
|
||
${absolute_headers}
|
||
DEPENDS
|
||
MetaCoreHeaderTool
|
||
${absolute_headers}
|
||
VERBATIM
|
||
)
|
||
|
||
set(${output_var} "${generated_cpp}" PARENT_SCOPE)
|
||
endfunction()
|
||
|
||
set(METACORE_FOUNDATION_HEADERS
|
||
Source/MetaCoreFoundation/Public/MetaCoreFoundation/MetaCoreArchive.h
|
||
Source/MetaCoreFoundation/Public/MetaCoreFoundation/MetaCoreAssetGuid.h
|
||
Source/MetaCoreFoundation/Public/MetaCoreFoundation/MetaCoreAssetChange.h
|
||
Source/MetaCoreFoundation/Public/MetaCoreFoundation/MetaCoreAssetDependencyGraph.h
|
||
Source/MetaCoreFoundation/Public/MetaCoreFoundation/MetaCoreAssetRegistry.h
|
||
Source/MetaCoreFoundation/Public/MetaCoreFoundation/MetaCoreGeneratedReflection.h
|
||
Source/MetaCoreFoundation/Public/MetaCoreFoundation/MetaCoreHash.h
|
||
Source/MetaCoreFoundation/Public/MetaCoreFoundation/MetaCoreId.h
|
||
Source/MetaCoreFoundation/Public/MetaCoreFoundation/MetaCoreLogService.h
|
||
Source/MetaCoreFoundation/Public/MetaCoreFoundation/MetaCorePackage.h
|
||
Source/MetaCoreFoundation/Public/MetaCoreFoundation/MetaCoreProject.h
|
||
Source/MetaCoreFoundation/Public/MetaCoreFoundation/MetaCoreReflection.h
|
||
Source/MetaCoreFoundation/Public/MetaCoreFoundation/MetaCoreRuntimeAssetRegistry.h
|
||
)
|
||
|
||
set(METACORE_FOUNDATION_SOURCES
|
||
Source/MetaCoreFoundation/Private/MetaCoreArchive.cpp
|
||
Source/MetaCoreFoundation/Private/MetaCoreAssetGuid.cpp
|
||
Source/MetaCoreFoundation/Private/MetaCoreAssetDependencyGraph.cpp
|
||
Source/MetaCoreFoundation/Private/MetaCoreAssetRegistry.cpp
|
||
Source/MetaCoreFoundation/Private/MetaCoreHash.cpp
|
||
Source/MetaCoreFoundation/Private/MetaCoreId.cpp
|
||
Source/MetaCoreFoundation/Private/MetaCoreLogService.cpp
|
||
Source/MetaCoreFoundation/Private/MetaCorePackage.cpp
|
||
Source/MetaCoreFoundation/Private/MetaCoreProject.cpp
|
||
Source/MetaCoreFoundation/Private/MetaCoreReflection.cpp
|
||
Source/MetaCoreFoundation/Private/MetaCoreRuntimeAssetRegistry.cpp
|
||
)
|
||
|
||
metacore_generate_reflection(
|
||
Foundation
|
||
MetaCoreRegisterFoundationGeneratedTypes
|
||
METACORE_FOUNDATION_GENERATED_SOURCE
|
||
Source/MetaCoreFoundation/Public/MetaCoreFoundation/MetaCoreAssetGuid.h
|
||
Source/MetaCoreFoundation/Public/MetaCoreFoundation/MetaCorePackage.h
|
||
Source/MetaCoreFoundation/Public/MetaCoreFoundation/MetaCoreAssetTypes.h
|
||
)
|
||
|
||
add_library(MetaCoreFoundation STATIC
|
||
${METACORE_FOUNDATION_HEADERS}
|
||
${METACORE_FOUNDATION_SOURCES}
|
||
${METACORE_FOUNDATION_GENERATED_SOURCE}
|
||
)
|
||
|
||
target_include_directories(MetaCoreFoundation
|
||
PUBLIC
|
||
Source/MetaCoreFoundation/Public
|
||
third_party
|
||
)
|
||
|
||
target_link_libraries(MetaCoreFoundation
|
||
PUBLIC
|
||
glm::glm
|
||
)
|
||
|
||
target_compile_options(MetaCoreFoundation PRIVATE ${METACORE_COMMON_WARNINGS})
|
||
|
||
if(METACORE_ENABLE_PLATFORM)
|
||
set(METACORE_PLATFORM_HEADERS
|
||
Source/MetaCorePlatform/Public/MetaCorePlatform/MetaCoreInput.h
|
||
Source/MetaCorePlatform/Public/MetaCorePlatform/MetaCoreWindow.h
|
||
)
|
||
|
||
set(METACORE_PLATFORM_SOURCES
|
||
Source/MetaCorePlatform/Private/MetaCoreInput.cpp
|
||
)
|
||
|
||
if(WIN32)
|
||
list(APPEND METACORE_PLATFORM_SOURCES
|
||
Source/MetaCorePlatform/Private/MetaCoreWindow.cpp
|
||
)
|
||
else()
|
||
list(APPEND METACORE_PLATFORM_SOURCES
|
||
Source/MetaCorePlatform/Private/MetaCoreWindowGlfw.cpp
|
||
)
|
||
endif()
|
||
|
||
add_library(MetaCorePlatform STATIC
|
||
${METACORE_PLATFORM_HEADERS}
|
||
${METACORE_PLATFORM_SOURCES}
|
||
)
|
||
|
||
target_include_directories(MetaCorePlatform
|
||
PUBLIC
|
||
Source/MetaCorePlatform/Public
|
||
)
|
||
|
||
target_link_libraries(MetaCorePlatform
|
||
PUBLIC
|
||
MetaCoreFoundation
|
||
glm::glm
|
||
)
|
||
|
||
if(NOT WIN32)
|
||
target_link_libraries(MetaCorePlatform PUBLIC glfw)
|
||
endif()
|
||
|
||
target_compile_options(MetaCorePlatform PRIVATE ${METACORE_COMMON_WARNINGS})
|
||
if(WIN32)
|
||
target_compile_definitions(MetaCorePlatform PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX)
|
||
endif()
|
||
endif()
|
||
|
||
set(METACORE_SCENE_HEADERS
|
||
Source/MetaCoreScene/Public/MetaCoreScene/MetaCoreComponents.h
|
||
Source/MetaCoreScene/Public/MetaCoreScene/MetaCoreGameObject.h
|
||
Source/MetaCoreScene/Public/MetaCoreScene/MetaCoreSceneDocument.h
|
||
Source/MetaCoreScene/Public/MetaCoreScene/MetaCoreScenePackage.h
|
||
Source/MetaCoreScene/Public/MetaCoreScene/MetaCoreScene.h
|
||
Source/MetaCoreScene/Public/MetaCoreScene/MetaCoreSceneSerializer.h
|
||
)
|
||
|
||
set(METACORE_SCENE_SOURCES
|
||
Source/MetaCoreScene/Private/MetaCoreScenePackage.cpp
|
||
Source/MetaCoreScene/Private/MetaCoreScene.cpp
|
||
Source/MetaCoreScene/Private/MetaCoreSceneSerializer.cpp
|
||
)
|
||
|
||
metacore_generate_reflection(
|
||
Scene
|
||
MetaCoreRegisterSceneGeneratedTypes
|
||
METACORE_SCENE_GENERATED_SOURCE
|
||
Source/MetaCoreScene/Public/MetaCoreScene/MetaCoreComponents.h
|
||
Source/MetaCoreScene/Public/MetaCoreScene/MetaCoreGameObject.h
|
||
Source/MetaCoreScene/Public/MetaCoreScene/MetaCoreSceneDocument.h
|
||
Source/MetaCoreScene/Public/MetaCoreScene/MetaCoreScene.h
|
||
)
|
||
|
||
add_library(MetaCoreScene STATIC
|
||
${METACORE_SCENE_HEADERS}
|
||
${METACORE_SCENE_SOURCES}
|
||
${METACORE_SCENE_GENERATED_SOURCE}
|
||
)
|
||
|
||
target_include_directories(MetaCoreScene
|
||
PUBLIC
|
||
Source/MetaCoreScene/Public
|
||
third_party
|
||
)
|
||
|
||
target_link_libraries(MetaCoreScene
|
||
PUBLIC
|
||
MetaCoreFoundation
|
||
glm::glm
|
||
)
|
||
|
||
target_compile_options(MetaCoreScene PRIVATE ${METACORE_COMMON_WARNINGS})
|
||
|
||
if(NOT METACORE_BUILD_CORE_ONLY)
|
||
set(METACORE_RENDER_HEADERS
|
||
Source/MetaCoreRender/Public/MetaCoreRender/MetaCoreEditorViewportRenderer.h
|
||
Source/MetaCoreRender/Public/MetaCoreRender/MetaCoreFilamentSceneBridge.h
|
||
Source/MetaCoreRender/Public/MetaCoreRender/MetaCoreImGuiHelper.h
|
||
Source/MetaCoreRender/Public/MetaCoreRender/MetaCoreRenderDevice.h
|
||
Source/MetaCoreRender/Public/MetaCoreRender/MetaCoreSceneRenderSync.h
|
||
Source/MetaCoreRender/Public/MetaCoreRender/MetaCoreRenderTypes.h
|
||
)
|
||
|
||
set(METACORE_RENDER_SOURCES
|
||
Source/MetaCoreRender/Private/MetaCoreEditorViewportRenderer.cpp
|
||
Source/MetaCoreRender/Private/MetaCoreFilamentSceneBridge.cpp
|
||
Source/MetaCoreRender/Private/MetaCoreGlibcCompat.cpp
|
||
Source/MetaCoreRender/Private/MetaCoreImGuiHelper.cpp
|
||
Source/MetaCoreRender/Private/MetaCoreRenderDevice.cpp
|
||
Source/MetaCoreRender/Private/MetaCoreSceneRenderSync.cpp
|
||
)
|
||
|
||
|
||
add_library(MetaCoreRender STATIC
|
||
${METACORE_RENDER_HEADERS}
|
||
${METACORE_RENDER_SOURCES}
|
||
)
|
||
|
||
target_include_directories(MetaCoreRender
|
||
PUBLIC
|
||
Source/MetaCoreRender/Public
|
||
)
|
||
|
||
target_link_libraries(MetaCoreRender
|
||
PUBLIC
|
||
MetaCoreFoundation
|
||
MetaCorePlatform
|
||
MetaCoreScene
|
||
glm::glm
|
||
imgui::imgui
|
||
)
|
||
|
||
metacore_use_filament(MetaCoreRender)
|
||
|
||
|
||
target_compile_options(MetaCoreRender PRIVATE ${METACORE_COMMON_WARNINGS})
|
||
endif()
|
||
|
||
if(METACORE_ENABLE_RUNTIME_DATA)
|
||
set(METACORE_RUNTIME_DATA_HEADERS
|
||
Source/MetaCoreRuntimeData/Public/MetaCoreRuntimeData/MetaCoreRuntimeDataDispatcher.h
|
||
Source/MetaCoreRuntimeData/Public/MetaCoreRuntimeData/MetaCoreRuntimeDataProject.h
|
||
Source/MetaCoreRuntimeData/Public/MetaCoreRuntimeData/MetaCoreRuntimeDataSource.h
|
||
Source/MetaCoreRuntimeData/Public/MetaCoreRuntimeData/MetaCoreRuntimeDataTypes.h
|
||
)
|
||
|
||
set(METACORE_RUNTIME_DATA_SOURCES
|
||
Source/MetaCoreRuntimeData/Private/MetaCoreRuntimeDataDispatcher.cpp
|
||
Source/MetaCoreRuntimeData/Private/MetaCoreRuntimeDataProject.cpp
|
||
Source/MetaCoreRuntimeData/Private/MetaCoreRuntimeDataSource.cpp
|
||
)
|
||
|
||
metacore_generate_reflection(
|
||
RuntimeData
|
||
MetaCoreRegisterRuntimeDataGeneratedTypes
|
||
METACORE_RUNTIME_DATA_GENERATED_SOURCE
|
||
Source/MetaCoreRuntimeData/Public/MetaCoreRuntimeData/MetaCoreRuntimeDataProject.h
|
||
Source/MetaCoreRuntimeData/Public/MetaCoreRuntimeData/MetaCoreRuntimeDataTypes.h
|
||
)
|
||
|
||
add_library(MetaCoreRuntimeData STATIC
|
||
${METACORE_RUNTIME_DATA_HEADERS}
|
||
${METACORE_RUNTIME_DATA_SOURCES}
|
||
${METACORE_RUNTIME_DATA_GENERATED_SOURCE}
|
||
)
|
||
|
||
target_include_directories(MetaCoreRuntimeData
|
||
PUBLIC
|
||
Source/MetaCoreRuntimeData/Public
|
||
)
|
||
|
||
target_link_libraries(MetaCoreRuntimeData
|
||
PUBLIC
|
||
MetaCoreFoundation
|
||
MetaCoreScene
|
||
glm::glm
|
||
)
|
||
|
||
if(WIN32)
|
||
target_link_libraries(MetaCoreRuntimeData PRIVATE ws2_32)
|
||
endif()
|
||
|
||
target_compile_options(MetaCoreRuntimeData PRIVATE ${METACORE_COMMON_WARNINGS})
|
||
|
||
target_link_libraries(MetaCoreRuntimeConfigTool
|
||
PRIVATE
|
||
MetaCoreFoundation
|
||
MetaCoreRuntimeData
|
||
MetaCoreScene
|
||
)
|
||
endif()
|
||
|
||
if(NOT METACORE_BUILD_CORE_ONLY)
|
||
set(METACORE_EDITOR_HEADERS
|
||
Source/MetaCoreEditor/Public/MetaCoreEditor/MetaCoreBuiltinModules.h
|
||
Source/MetaCoreEditor/Public/MetaCoreEditor/MetaCoreEditorApp.h
|
||
Source/MetaCoreEditor/Public/MetaCoreEditor/MetaCoreEditorAssetTypes.h
|
||
Source/MetaCoreEditor/Public/MetaCoreEditor/MetaCoreEditorCommandService.h
|
||
Source/MetaCoreEditor/Public/MetaCoreEditor/MetaCoreEditorContext.h
|
||
Source/MetaCoreEditor/Public/MetaCoreEditor/MetaCoreEditorModule.h
|
||
Source/MetaCoreEditor/Public/MetaCoreEditor/MetaCoreEditorServices.h
|
||
Source/MetaCoreEditor/Public/MetaCoreEditor/MetaCoreSceneInteractionService.h
|
||
)
|
||
|
||
set(METACORE_EDITOR_PRIVATE_HEADERS
|
||
Source/MetaCoreEditor/Private/MetaCoreBuiltinEditorModule.h
|
||
Source/MetaCoreEditor/Private/MetaCoreEditorCameraController.h
|
||
Source/MetaCoreEditor/Private/MetaCoreGltfImporter.h
|
||
Source/MetaCoreEditor/Private/MetaCoreLocalCgltf.h
|
||
third_party/ImGuizmo/ImGuizmo.h
|
||
third_party/cgltf/cgltf.h
|
||
third_party/stb/stb_image.h
|
||
)
|
||
|
||
set(METACORE_EDITOR_SOURCES
|
||
Source/MetaCoreEditor/Private/MetaCoreBuiltinCoreServicesModule.cpp
|
||
Source/MetaCoreEditor/Private/MetaCoreGltfImporter.cpp
|
||
Source/MetaCoreEditor/Private/MetaCoreBuiltinEditorModule.cpp
|
||
Source/MetaCoreEditor/Private/MetaCoreEditorApp.cpp
|
||
Source/MetaCoreEditor/Private/MetaCoreEditorCameraController.cpp
|
||
Source/MetaCoreEditor/Private/MetaCoreEditorCommandService.cpp
|
||
Source/MetaCoreEditor/Private/MetaCoreEditorContext.cpp
|
||
Source/MetaCoreEditor/Private/MetaCoreEditorServices.cpp
|
||
Source/MetaCoreEditor/Private/MetaCoreEditorModule.cpp
|
||
Source/MetaCoreEditor/Private/MetaCoreSceneInteractionService.cpp
|
||
Source/MetaCoreEditor/Private/MetaCoreLocalCgltf.cpp
|
||
third_party/ImGuizmo/ImGuizmo.cpp
|
||
third_party/stb/stb_image_impl.cpp
|
||
)
|
||
|
||
if(NOT WIN32 AND METACORE_IMGUI_USES_PKG_CONFIG)
|
||
set(METACORE_IMGUI_GLFW_BACKEND_SOURCE "/usr/share/doc/libimgui-dev/examples/backends/imgui_impl_glfw.cpp")
|
||
if(EXISTS "${METACORE_IMGUI_GLFW_BACKEND_SOURCE}")
|
||
list(APPEND METACORE_EDITOR_SOURCES "${METACORE_IMGUI_GLFW_BACKEND_SOURCE}")
|
||
endif()
|
||
endif()
|
||
|
||
metacore_generate_reflection(
|
||
Editor
|
||
MetaCoreRegisterEditorGeneratedTypes
|
||
METACORE_EDITOR_GENERATED_SOURCE
|
||
Source/MetaCoreEditor/Public/MetaCoreEditor/MetaCoreEditorAssetTypes.h
|
||
Source/MetaCoreEditor/Public/MetaCoreEditor/MetaCoreEditorContext.h
|
||
)
|
||
|
||
add_library(MetaCoreEditor STATIC
|
||
${METACORE_EDITOR_HEADERS}
|
||
${METACORE_EDITOR_PRIVATE_HEADERS}
|
||
${METACORE_EDITOR_SOURCES}
|
||
${METACORE_EDITOR_GENERATED_SOURCE}
|
||
)
|
||
|
||
target_include_directories(MetaCoreEditor
|
||
PUBLIC
|
||
Source/MetaCoreEditor/Public
|
||
PRIVATE
|
||
Source/MetaCoreEditor/Private
|
||
third_party
|
||
third_party/ImGuizmo
|
||
third_party/cgltf
|
||
third_party/stb
|
||
)
|
||
|
||
target_link_libraries(MetaCoreEditor
|
||
PUBLIC
|
||
MetaCoreFoundation
|
||
MetaCorePlatform
|
||
MetaCoreRender
|
||
MetaCoreRuntimeData
|
||
MetaCoreScene
|
||
glm::glm
|
||
imgui::imgui
|
||
)
|
||
|
||
target_compile_options(MetaCoreEditor PRIVATE ${METACORE_COMMON_WARNINGS})
|
||
if(WIN32)
|
||
target_compile_definitions(MetaCoreEditor PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX)
|
||
endif()
|
||
|
||
add_executable(MetaCoreEditorApp
|
||
Apps/MetaCoreEditor/main.cpp
|
||
Source/MetaCoreRender/Private/MetaCoreGlibcCompat.cpp
|
||
)
|
||
|
||
target_link_libraries(MetaCoreEditorApp
|
||
PRIVATE
|
||
MetaCoreEditor
|
||
)
|
||
metacore_stage_ui_blit_material(MetaCoreEditorApp)
|
||
|
||
|
||
|
||
add_executable(MetaCorePlayer
|
||
Apps/MetaCorePlayer/main.cpp
|
||
Source/MetaCoreRender/Private/MetaCoreGlibcCompat.cpp
|
||
)
|
||
|
||
target_link_libraries(MetaCorePlayer
|
||
PRIVATE
|
||
MetaCoreFoundation
|
||
MetaCorePlatform
|
||
MetaCoreRender
|
||
MetaCoreRuntimeData
|
||
MetaCoreScene
|
||
)
|
||
metacore_stage_ui_blit_material(MetaCorePlayer)
|
||
|
||
|
||
|
||
if(METACORE_BUILD_TESTS)
|
||
enable_testing()
|
||
|
||
add_executable(MetaCoreSmokeTests
|
||
tests/MetaCoreSmokeTests.cpp
|
||
Source/MetaCoreRender/Private/MetaCoreGlibcCompat.cpp
|
||
)
|
||
|
||
target_link_libraries(MetaCoreSmokeTests
|
||
PRIVATE
|
||
MetaCoreEditor
|
||
MetaCoreRuntimeData
|
||
)
|
||
target_compile_options(MetaCoreSmokeTests PRIVATE ${METACORE_COMMON_WARNINGS})
|
||
|
||
|
||
add_test(NAME MetaCoreSmokeTests COMMAND MetaCoreSmokeTests)
|
||
|
||
# Filament + ImGui 离屏渲染 Demo
|
||
add_executable(FilamentImGuiDemo
|
||
tests/FilamentImGuiDemo.cpp
|
||
Source/MetaCoreRender/Private/MetaCoreGlibcCompat.cpp
|
||
)
|
||
target_link_libraries(FilamentImGuiDemo
|
||
PRIVATE
|
||
MetaCoreRender
|
||
imgui::imgui
|
||
)
|
||
target_compile_options(FilamentImGuiDemo PRIVATE ${METACORE_COMMON_WARNINGS})
|
||
target_compile_definitions(FilamentImGuiDemo PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX)
|
||
metacore_use_filament(FilamentImGuiDemo)
|
||
metacore_stage_ui_blit_material(FilamentImGuiDemo)
|
||
endif()
|
||
endif()
|