18bf80f4bSopenharmony_ci# 28bf80f4bSopenharmony_ci# Copyright (C) 2024 Huawei Technologies Co, Ltd. 38bf80f4bSopenharmony_ci# 48bf80f4bSopenharmony_ci 58bf80f4bSopenharmony_cicmake_minimum_required(VERSION 3.18) 68bf80f4bSopenharmony_ciproject(EcsSerializer LANGUAGES CXX) 78bf80f4bSopenharmony_ci 88bf80f4bSopenharmony_ciset(target_name EcsSerializer) 98bf80f4bSopenharmony_ci 108bf80f4bSopenharmony_cifind_package(AGPBaseAPI REQUIRED) 118bf80f4bSopenharmony_cifind_package(AGPEngineAPI REQUIRED) 128bf80f4bSopenharmony_cifind_package(AGPRenderAPI REQUIRED) 138bf80f4bSopenharmony_cifind_package(AGP3DAPI REQUIRED) 148bf80f4bSopenharmony_cifind_package(ComponentHelperSDK REQUIRED) 158bf80f4bSopenharmony_ci 168bf80f4bSopenharmony_ciinclude(${BASE_ROOT_DIRECTORY}/cmake/cmake_tools.cmake) 178bf80f4bSopenharmony_ci 188bf80f4bSopenharmony_ci# 198bf80f4bSopenharmony_ci# Library target. 208bf80f4bSopenharmony_ci# 218bf80f4bSopenharmony_ciadd_library(${target_name} STATIC) 228bf80f4bSopenharmony_ci 238bf80f4bSopenharmony_ciset(sources 248bf80f4bSopenharmony_ci include/ecs_serializer/api.h 258bf80f4bSopenharmony_ci include/ecs_serializer/ecs_animation_util.h 268bf80f4bSopenharmony_ci include/ecs_serializer/ecs_clone_util.h 278bf80f4bSopenharmony_ci include/ecs_serializer/ecs_property_util.h 288bf80f4bSopenharmony_ci include/ecs_serializer/intf_ecs_asset_loader.h 298bf80f4bSopenharmony_ci include/ecs_serializer/intf_ecs_asset_manager.h 308bf80f4bSopenharmony_ci include/ecs_serializer/intf_ecs_serializer.h 318bf80f4bSopenharmony_ci include/ecs_serializer/intf_entity_collection.h 328bf80f4bSopenharmony_ci include/ecs_serializer/namespace.h 338bf80f4bSopenharmony_ci 348bf80f4bSopenharmony_ci src/ecs_serializer/asset_migration.cpp 358bf80f4bSopenharmony_ci src/ecs_serializer/asset_migration.h 368bf80f4bSopenharmony_ci src/ecs_serializer/ecs_asset_loader.cpp 378bf80f4bSopenharmony_ci src/ecs_serializer/ecs_asset_manager.cpp 388bf80f4bSopenharmony_ci src/ecs_serializer/ecs_serializer.cpp 398bf80f4bSopenharmony_ci src/ecs_serializer/entity_collection.cpp 408bf80f4bSopenharmony_ci) 418bf80f4bSopenharmony_cisource_group(TREE ${CMAKE_CURRENT_LIST_DIR} FILES ${sources}) 428bf80f4bSopenharmony_ci 438bf80f4bSopenharmony_citarget_sources(${target_name} PRIVATE 448bf80f4bSopenharmony_ci ${sources} 458bf80f4bSopenharmony_ci) 468bf80f4bSopenharmony_ci 478bf80f4bSopenharmony_citarget_include_directories(${target_name} PUBLIC include PRIVATE src) 488bf80f4bSopenharmony_ci 498bf80f4bSopenharmony_citarget_link_libraries(${target_name} PRIVATE 508bf80f4bSopenharmony_ci AGPBase::AGPBaseAPI 518bf80f4bSopenharmony_ci AGPEngine::AGPEngineAPI 528bf80f4bSopenharmony_ci AGPRender::AGPRenderAPI 538bf80f4bSopenharmony_ci AGP3D::AGP3DAPI 548bf80f4bSopenharmony_ci RuntimeUtil 558bf80f4bSopenharmony_ci AGPEngine::ComponentHelperSDK 568bf80f4bSopenharmony_ci) 578bf80f4bSopenharmony_ci 588bf80f4bSopenharmony_ciset_property(TARGET ${target_name} PROPERTY CXX_STANDARD 17) 598bf80f4bSopenharmony_ciset_property(TARGET ${target_name} PROPERTY CXX_EXTENSIONS OFF) 608bf80f4bSopenharmony_ci 618bf80f4bSopenharmony_cisetup_warnings(${target_name}) 628bf80f4bSopenharmony_ci 638bf80f4bSopenharmony_ci# Fix for min/max macro conflicts on windows. 648bf80f4bSopenharmony_ciif(WIN32) 658bf80f4bSopenharmony_ci target_compile_definitions(${target_name} PRIVATE NOMINMAX) 668bf80f4bSopenharmony_ciendif() 678bf80f4bSopenharmony_ci 688bf80f4bSopenharmony_ci# Disable RTTI 698bf80f4bSopenharmony_ciif(MSVC) 708bf80f4bSopenharmony_ci target_compile_options(${target_name} PRIVATE /GR-) 718bf80f4bSopenharmony_cielseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") 728bf80f4bSopenharmony_ci target_compile_options(${target_name} PRIVATE -fno-rtti) 738bf80f4bSopenharmony_ciendif() 748bf80f4bSopenharmony_ci 758bf80f4bSopenharmony_ci# 768bf80f4bSopenharmony_ci# Clang format target 778bf80f4bSopenharmony_ci# 788bf80f4bSopenharmony_ciset(formatTarget "Format${target_name}") 798bf80f4bSopenharmony_ciadd_custom_target(${formatTarget} 808bf80f4bSopenharmony_ci COMMAND clang-format -verbose -i ${src} 818bf80f4bSopenharmony_ci WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} 828bf80f4bSopenharmony_ci) 838bf80f4bSopenharmony_ciset_target_properties(${formatTarget} PROPERTIES FOLDER Formatting) 84