Configures and installs an engine.json generated from a template. Fixes HEADERONLY targets for install. Fixes locating .ico resource file. Fix infinite loop in CMake configure on new projects.

main
phistere 5 years ago
parent 2625e983b8
commit bedecebdcc

@ -10,6 +10,11 @@
#
set(ICON_FILE ${project_real_path}/Gem/Resources/GameSDK.ico)
if(NOT EXISTS ${ICON_FILE})
# Try another project-relative path
set(ICON_FILE ${project_real_path}/Resources/GameSDK.ico)
endif()
if(NOT EXISTS ${ICON_FILE})
# Try the common LauncherUnified icon instead
set(ICON_FILE Resources/GameSDK.ico)

@ -85,7 +85,7 @@ function(ly_add_target)
if(NOT ly_add_target_NAME)
message(FATAL_ERROR "You must provide a name for the target")
endif()
if(NOT ly_add_target_IMPORTED)
if(NOT ly_add_target_IMPORTED AND NOT ly_add_target_HEADERONLY)
if(NOT ly_add_target_FILES_CMAKE)
message(FATAL_ERROR "You must provide a list of _files.cmake files for the target")
endif()

@ -104,6 +104,13 @@ function(ly_generate_target_find_file)
unset(INCLUDE_DIRECTORIES_PLACEHOLDER)
set(RUNTIME_DEPENDENCIES_PLACEHOLDER ${ly_generate_target_find_file_RUNTIME_DEPENDENCIES})
set(TARGET_TYPE_PLACEHOLDER "IMPORTED")
#set(TARGET_TYPE_PLACEHOLDER)
get_target_property(target_type ${NAME_PLACEHOLDER} TYPE)
if(target_type STREQUAL INTERFACE_LIBRARY)
set(TARGET_TYPE_PLACEHOLDER "HEADERONLY")
endif()
# These targets will be imported. We will expose PUBLIC and INTERFACE properties as INTERFACE properties since
# only INTERFACE properties can be exposed on imported targets
ly_strip_private_properties(COMPILE_DEFINITIONS_PLACEHOLDER ${ly_generate_target_find_file_COMPILE_DEFINITIONS})
@ -225,13 +232,17 @@ function(ly_setup_cmake_install)
install(DIRECTORY "${CMAKE_SOURCE_DIR}/cmake"
DESTINATION .
COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT}
PATTERN "__pycache__" EXCLUDE
REGEX "Findo3de.cmake" EXCLUDE
REGEX "Platform\/.*\/BuiltInPackages_.*\.cmake" EXCLUDE
)
configure_file(${CMAKE_SOURCE_DIR}/cmake/install/engine.json.in ${CMAKE_CURRENT_BINARY_DIR}/cmake/engine.json @ONLY)
install(
FILES
"${CMAKE_SOURCE_DIR}/CMakeLists.txt"
"${CMAKE_SOURCE_DIR}/engine.json"
"${CMAKE_CURRENT_BINARY_DIR}/cmake/engine.json"
DESTINATION .
COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT}
)
@ -369,6 +380,7 @@ function(ly_setup_others)
install(DIRECTORY "${CMAKE_SOURCE_DIR}/${dir}"
DESTINATION ${install_path}
COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT}
PATTERN "__pycache__" EXCLUDE
)
endforeach()
@ -450,7 +462,7 @@ function(ly_setup_others)
get_filename_component(gem_relative_path ${gem_json_path} DIRECTORY)
install(FILES ${gem_json_path}
DESTINATION ${gem_relative_path}
COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT}
COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT}
)
endforeach()

@ -125,9 +125,13 @@ function(ly_delayed_generate_settings_registry)
endif()
get_property(gem_relative_source_dir TARGET ${gem_target} PROPERTY SOURCE_DIR)
if(gem_relative_source_dir)
# Most gems SOURCE dir is nested in the path, we need to find the path to the gem.json file
while(NOT EXISTS ${gem_relative_source_dir}/gem.json)
get_filename_component(gem_relative_source_dir ${gem_relative_source_dir} DIRECTORY)
# Most gems SOURCE dir is nested in the path, we need to find the path to the gem.json or project.json file
while(NOT EXISTS ${gem_relative_source_dir}/gem.json AND NOT EXISTS ${gem_relative_source_dir}/project.json)
get_filename_component(parent_dir ${gem_relative_source_dir} DIRECTORY)
if (${parent_dir} STREQUAL ${gem_relative_source_dir})
message(FATAL_ERROR "Did not find gem.json or project.json while processing target ${gem_target}!")
endif()
set(gem_relative_source_dir ${parent_dir})
endwhile()
file(TO_CMAKE_PATH ${LY_ROOT_FOLDER} ly_root_folder_cmake)
file(RELATIVE_PATH gem_relative_source_dir ${ly_root_folder_cmake} ${gem_relative_source_dir})

@ -12,4 +12,5 @@
string(TIMESTAMP current_year "%Y")
set(LY_VERSION_COPYRIGHT_YEAR ${current_year} CACHE STRING "Open 3D Engine's copyright year")
set(LY_VERSION_STRING "0.0.0.0" CACHE STRING "Open 3D Engine's version")
set(LY_VERSION_BUILD_NUMBER 0 CACHE STRING "Open 3D Engine's build number")
set(LY_VERSION_BUILD_NUMBER 0 CACHE STRING "Open 3D Engine's build number")
set(LY_VERSION_ENGINE_NAME "o3de" CACHE STRING "Open 3D Engine's engine name")

@ -12,7 +12,7 @@
# Generated by O3DE
ly_add_target(
NAME @NAME_PLACEHOLDER@ IMPORTED
NAME @NAME_PLACEHOLDER@ @TARGET_TYPE_PLACEHOLDER@
@NAMESPACE_PLACEHOLDER@
COMPILE_DEFINITIONS
INTERFACE

@ -0,0 +1,7 @@
{
"engine_name": "@LY_VERSION_ENGINE_NAME@",
"FileVersion": 1,
"O3DEVersion": "@LY_VERSION_STRING@",
"O3DECopyrightYear": @LY_VERSION_COPYRIGHT_YEAR@,
"O3DEBuildNumber": @LY_VERSION_BUILD_NUMBER@
}

@ -2,5 +2,6 @@
"engine_name": "o3de",
"FileVersion": 1,
"O3DEVersion": "0.0.0.0",
"O3DECopyrightYear": 2021
"O3DECopyrightYear": 2021,
"O3DEBuildNumber": 0
}

Loading…
Cancel
Save