@ -9,6 +9,7 @@
# W I T H O U T W A R R A N T I E S O R C O N D I T I O N S O F A N Y K I N D , e i t h e r e x p r e s s o r i m p l i e d .
#
set ( CMAKE_INSTALL_MESSAGE NEVER ) # S i m p l i f y m e s s a g e s t o r e d u c e o u t p u t n o i s e
# ! l y _ i n s t a l l _ t a r g e t : r e g i s t e r s t h e t a r g e t t o b e i n s t a l l e d b y c m a k e i n s t a l l .
#
@ -35,27 +36,16 @@ function(ly_install_target ly_install_target_NAME)
install (
T A R G E T S $ { l y _ i n s t a l l _ t a r g e t _ N A M E }
E X P O R T $ { l y _ i n s t a l l _ t a r g e t _ N A M E } T a r g e t s
L I B R A R Y D E S T I N A T I O N l i b / $ < C O N F I G >
A R C H I V E D E S T I N A T I O N l i b / $ < C O N F I G >
R U N T I M E D E S T I N A T I O N b i n / $ < C O N F I G >
P U B L I C _ H E A D E R D E S T I N A T I O N $ { i n c l u d e _ l o c a t i o n }
)
install ( EXPORT ${ ly_install_target_NAME } Targets
ly_generate_target_config_file ( ${ ly_install_target_NAME } )
install ( FILES "${CMAKE_CURRENT_BINARY_DIR}/${ly_install_target_NAME}_$<CONFIG>.cmake"
D E S T I N A T I O N c m a k e _ a u t o g e n / $ { l y _ i n s t a l l _ t a r g e t _ N A M E }
)
# H e a d e r o n l y targets ( i.e., INTERFACE ) d o n ' t h a v e o u t p u t s
get_target_property ( target_type ${ ly_install_target_NAME } TYPE )
if ( NOT ${ target_type } STREQUAL "INTERFACE_LIBRARY" )
ly_generate_target_config_file ( ${ ly_install_target_NAME } )
install ( FILES "${CMAKE_CURRENT_BINARY_DIR}/${ly_install_target_NAME}_$<CONFIG>.cmake"
D E S T I N A T I O N c m a k e _ a u t o g e n / $ { l y _ i n s t a l l _ t a r g e t _ N A M E }
)
endif ( )
install ( FILES "${CMAKE_CURRENT_BINARY_DIR}/Find${ly_install_target_NAME}.cmake"
D E S T I N A T I O N c m a k e
)
@ -66,8 +56,8 @@ endfunction()
# ! l y _ g e n e r a t e _ t a r g e t _ f i n d _ f i l e : g e n e r a t e s t h e F i n d $ { t a r g e t } . c m a k e f i l e w h i c h i s u s e d w h e n i m p o r t i n g i n s t a l l e d p a c k a g e s .
#
# \ a r g : N A M E n a m e o f t h e t a r g e t
# \ a r g : I N C L U D E _ D I R E C T O R I E S p a t h s t o t h e i n c l u d e d i r e c t o r i e s
# \ a r g : N A M E S P A C E n a m e s p a c e d e c l a r a t i o n f o r t h i s t a r g e t . I t w i l l b e u s e d f o r I D E a n d d e p e n d e n c i e s
# \ a r g : I N C L U D E _ D I R E C T O R I E S p a t h s t o t h e i n c l u d e d i r e c t o r i e s
# \ a r g : B U I L D _ D E P E N D E N C I E S l i s t o f i n t e r f a c e s t h i s t a r g e t d e p e n d s on ( could be a compilation dependency
# i f t h e d e p e n d e n c y i s o n l y e x p o s i n g a n i n c l u d e p a t h , o r c o u l d b e a l i n k i n g
# d e p e n d e n c y i s e x p o s i n g a l i b )
@ -77,64 +67,38 @@ function(ly_generate_target_find_file)
set ( options )
set ( oneValueArgs NAME NAMESPACE )
set ( multiValueArgs COMPILE_DEFINITIONS BUILD_DEPENDENCIES RUNTIME_DEPENDENC IES INCLUDE_DIRECTOR IES)
set ( multiValueArgs INCLUDE_DIRECTORIES COMPILE_DEFINITIONS BUILD_DEPENDENCIES RUNTIME_DEPENDENC IES)
cmake_parse_arguments ( ly_generate_target_find_file "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ ARGN } )
# T h e s e t a r g e t s w i l l b e i m p o r t e d . S o w e s t r i p P R I V A T E p r o p e r t i e s .
# W e c a n o n l y s e t I N T E R F A C E p r o p e r t i e s o n i m p o r t e d t a r g e t s
unset ( build_dependencies_interface_props )
unset ( compile_definitions_interface_props )
unset ( include_directories_interface_props )
unset ( installed_include_directories_interface_props )
ly_strip_non_interface_properties ( build_dependencies_interface_props ${ ly_generate_target_find_file_BUILD_DEPENDENCIES } )
ly_strip_non_interface_properties ( compile_definitions_interface_props ${ ly_generate_target_find_file_COMPILE_DEFINITIONS } )
ly_strip_non_interface_properties ( include_directories_interface_props ${ ly_generate_target_find_file_INCLUDE_DIRECTORIES } )
set ( NAME_PLACEHOLDER ${ ly_generate_target_find_file_NAME } )
unset ( NAMESPACE_PLACEHOLDER )
unset ( COMPILE_DEFINITIONS_PLACEHOLDER )
unset ( include_directories_interface_props )
unset ( INCLUDE_DIRECTORIES_PLACEHOLDER )
set ( RUNTIME_DEPENDENCIES_PLACEHOLDER ${ ly_generate_target_find_file_RUNTIME_DEPENDENCIES } )
# I n c l u d e s n e e d a d d i t i o n a l p r o c e s s i n g t o a d d t h e i n s t a l l r o o t
foreach ( include ${ include_directories_interface_props } )
set ( installed_include_prefix "\${LY_ROOT_FOLDER}/include/" )
file ( RELATIVE_PATH relative_path ${ CMAKE_SOURCE_DIR } ${ CMAKE_CURRENT_SOURCE_DIR } / ${ include } )
string ( APPEND installed_include_prefix ${ relative_path } )
list ( APPEND installed_include_directories_interface_props ${ installed_include_prefix } )
endforeach ( )
# T h e s e t a r g e t s w i l l b e i m p o r t e d . W e w i l l e x p o s e P U B L I C a n d I N T E R F A C E p r o p e r t i e s a s I N T E R F A C E p r o p e r t i e s s i n c e
# o n l y I N T E R F A C E p r o p e r t i e s c a n b e e x p o s e d o n i m p o r t e d t a r g e t s
ly_strip_private_properties ( COMPILE_DEFINITIONS_PLACEHOLDER ${ ly_generate_target_find_file_COMPILE_DEFINITIONS } )
ly_strip_private_properties ( include_directories_interface_props ${ ly_generate_target_find_file_INCLUDE_DIRECTORIES } )
ly_strip_private_properties ( BUILD_DEPENDENCIES_PLACEHOLDER ${ ly_generate_target_find_file_BUILD_DEPENDENCIES } )
if ( ly_generate_target_find_file_NAMESPACE )
set ( NAMESPACE_PLACEHOLDER "NAMESPACE ${ly_generate_target_find_file_NAMESPACE}" )
endif ( )
if ( installed_include_directories_interface_props )
string ( REPLACE ";" "\n" include_dirs "${installed_include_directories_interface_props}" )
set ( INCLUDE_DIRECTORIES_PLACEHOLDER "INCLUDE_DIRECTORIES\nINTERFACE\n${include_dirs}" )
endif ( )
if ( build_dependencies_interface_props )
string ( REPLACE ";" "\n" build_deps "${build_dependencies_interface_props}" )
set ( BUILD_DEPENDENCIES_PLACEHOLDER "BUILD_DEPENDENCIES\nINTERFACE\n${build_deps}" )
endif ( )
if ( ly_generate_target_find_file_RUNTIME_DEPENDENCIES )
string ( REPLACE ";" "\n" runtime_deps "${ly_generate_target_find_file_RUNTIME_DEPENDENCIES}" )
set ( RUNTIME_DEPENDENCIES_PLACEHOLDER "RUNTIME_DEPENDENCIES\n${runtime_deps}" )
endif ( )
if ( compile_definitions_interface_props )
string ( REPLACE ";" "\n" compile_defs "${compile_definitions_interface_props}" )
set ( COMPILE_DEFINITIONS_PLACEHOLDER "COMPILE_DEFINITIONS\nINTERFACE\n${compile_defs}" )
endif ( )
string ( REPLACE ";" " " ALL_CONFIGS "${CMAKE_CONFIGURATION_TYPES }")
string ( REPLACE ";" "\n" COMPILE_DEFINITIONS_PLACEHOLDER "${COMPILE_DEFINITIONS_PLACEHOLDER}" )
set ( target_config_found_vars "" )
foreach ( config ${ CMAKE_CONFIGURATION_TYPES } )
string ( APPEND target_config_found_vars "\n${ly_generate_target_find_file_NAME}_${config}_FOUND" )
# I n c l u d e s n e e d a d d i t i o n a l p r o c e s s i n g t o a d d t h e i n s t a l l r o o t
foreach ( include ${ include_directories_interface_props } )
set ( installed_include_prefix "\${LY_ROOT_FOLDER}/include/" )
file ( RELATIVE_PATH relative_path ${ CMAKE_SOURCE_DIR } ${ CMAKE_CURRENT_SOURCE_DIR } / ${ include } )
list ( APPEND INCLUDE_DIRECTORIES_PLACEHOLDER "include/${relative_path}" )
endforeach ( )
set ( TARGET_CONFIG_FOUND_VARS_PLACEHOLDER "${target_config_found_vars}" )
# I n t e r f a c e l i b s a r e n ' t b u i l t s o t h e y d o n ' t g e n e r a t e a l i b r a r y . T h e s e a r e o u r H E A D E R _ O N L Y t a r g e t s .
get_target_property ( target_type ${ ly_generate_target_find_file_NAME } TYPE )
if ( NOT ${ target_type } STREQUAL "INTERFACE_LIBRARY" )
set ( HEADER_ONLY_PLACEHOLDER FALSE )
else ( )
set ( HEADER_ONLY_PLACEHOLDER TRUE )
endif ( )
string ( REPLACE ";" "\n" INCLUDE_DIRECTORIES_PLACEHOLDER "${INCLUDE_DIRECTORIES_PLACEHOLDER}" )
string ( REPLACE ";" "\n" BUILD_DEPENDENCIES_PLACEHOLDER "${BUILD_DEPENDENCIES_PLACEHOLDER}" )
string ( REPLACE ";" "\n" RUNTIME_DEPENDENCIES_PLACEHOLDER "${RUNTIME_DEPENDENCIES_PLACEHOLDER}" )
configure_file ( ${ LY_ROOT_FOLDER } /cmake/FindTarget.cmake.in ${ CMAKE_CURRENT_BINARY_DIR } /Find ${ ly_generate_target_find_file_NAME } .cmake @ONLY )
@ -148,37 +112,47 @@ endfunction()
# \ a r g : N A M E n a m e o f t h e t a r g e t
function ( ly_generate_target_config_file NAME )
# S H A R E D _ L I B R A R Y i s o m i t t e d f r o m t h i s l i s t b e c a u s e w e l i n k t o t h e i m p l i b o n W i n d o w s
set ( BINARY_DIR_OUTPUTS EXECUTABLE APPLICATION )
set ( target_file_contents "" )
if ( ${ target_type } IN_LIST BINARY_DIR_OUTPUTS )
set ( out_file_generator TARGET_FILE_NAME )
set ( out_dir bin )
else ( )
set ( out_file_generator TARGET_LINKER_FILE_NAME )
set ( out_dir lib )
endif ( )
get_target_property ( target_type ${ NAME } TYPE )
string ( APPEND target_file_contents "
# G e n e r a t e d b y O 3 D E
unset ( target_file_contents )
if ( NOT target_type STREQUAL INTERFACE_LIBRARY )
set ( BINARY_DIR_OUTPUTS EXECUTABLE APPLICATION )
set ( target_file_contents "" )
if ( ${ target_type } IN_LIST BINARY_DIR_OUTPUTS )
set ( out_file_generator TARGET_FILE_NAME )
set ( out_dir bin )
else ( )
set ( out_file_generator TARGET_LINKER_FILE_NAME )
set ( out_dir lib )
endif ( )
set_target_properties ( ${ NAME } PROPERTIES IMPORTED_LOCATION \"\${LY_ROOT_FOLDER}/${out_dir}/$<CONFIG>/$<${out_file_generator}:${NAME}>\")
string ( APPEND target_file_contents
" # G e n e r a t e d b y O 3 D E i n s t a l l
if ( EXISTS \"\${LY_ROOT_FOLDER}/${out_dir}/$<CONFIG>/$<${out_file_generator}:${NAME}>\")
set ( target_location \"\${LY_ROOT_FOLDER}/${out_dir}/$<CONFIG>/$<${out_file_generator}:${NAME}>\")
set_target_properties ( ${ NAME }
P R O P E R T I E S
$ < $ < C O N F I G : p r o f i l e > : I M P O R T E D _ L O C A T I O N \ " \ $ { t a r g e t _ l o c a t i o n } > \ "
I M P O R T E D _ L O C A T I O N _ $ < U P P E R _ C A S E : $ < C O N F I G > > \ " \ $ { t a r g e t _ l o c a t i o n } \ "
)
if ( EXISTS \"\${target_location}\")
set ( ${ NAME } _ $< CONFIG > _FOUND TRUE )
else ( )
set ( ${ NAME } _ $< CONFIG > _FOUND FALSE )
endif ( ) " )
endif ( )
" )
endif ( )
file ( GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${NAME}_$<CONFIG>.cmake" CONTENT ${ target_file_contents } )
file ( GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${NAME}_$<CONFIG>.cmake" CONTENT "${target_file_contents}" )
endfunction ( )
# ! l y _ s t r i p _ no n _ i n t e r f a c e _ p r o p e r t i e s : s t r i p s p r i v a t e p r o p e r t i e s s i n c e w e ' r e e x p o r t i n g a n i n t e r f a c e t a r g e t
# ! l y _ s t r i p _ pr i v a t e _ p r o p e r t i e s : s t r i p s p r i v a t e p r o p e r t i e s s i n c e w e ' r e e x p o r t i n g a n i n t e r f a c e t a r g e t
#
# \ a r g : I N T E R F A C E _ P R O P E R T I E S l i s t o f i n t e r f a c e p r o p e r t i e s t o b e r e t u r n e d
function ( ly_strip_ non_interfac e_properties INTERFACE_PROPERTIES )
function ( ly_strip_ privat e_properties INTERFACE_PROPERTIES )
set ( reserved_keywords PRIVATE PUBLIC INTERFACE )
unset ( last_keyword )
unset ( stripped_props )
@ -196,36 +170,79 @@ function(ly_strip_non_interface_properties INTERFACE_PROPERTIES)
endfunction ( )
# ! l y _ s e t u p _ o 3 d e _ i n s t a l l : ge n e r a t e s t h e F i n d o 3 d e . c m a k e f i l e a n d s e t u p i n s t a l l l o c a t i o n s f o r s c r i p t s , t o o l s , a s s e t s e t c . ,
# ! l y _ s e t u p _ o 3 d e _ i n s t a l l : or c h e s t r a t e s t h e i n s t a l l a t i o n o f t h e d i f f e r e n t p a r t s . T h i s i s t h e e n t r y p o i n t f r o m t h e r o o t C M a k e L i s t s . t x t
function ( ly_setup_o3de_install )
get_property ( all_targets GLOBAL PROPERTY LY_ALL_TARGETS )
unset ( find_package_list )
foreach ( target IN LISTS all_targets )
list ( APPEND find_package_list "find_package(${target})" )
endforeach ( )
ly_setup_cmake_install ( )
ly_setup_target_generator ( )
ly_setup_others ( )
string ( REPLACE ";" "\n" FIND_PACKAGES_PLACEHOLDER "${find_package_list}" )
endfunction ( )
configure_file ( ${ LY_ROOT_FOLDER } /cmake/Findo3de.cmake.in ${ CMAKE_CURRENT_BINARY_DIR } /Findo3de.cmake @ONLY )
# ! l y _ s e t u p _ c m a k e _ i n s t a l l : i n s t a l l t h e " c m a k e " f o l d e r
function ( ly_setup_cmake_install )
ly_install_launcher_target_generator ( )
install ( DIRECTORY "${CMAKE_SOURCE_DIR}/cmake"
D E S T I N A T I O N .
R E G E X " F i n d o 3 d e . c m a k e " E X C L U D E
R E G E X " P l a t f o r m \ / . * \ / B u i l t I n P a c k a g e s _ . * \ . c m a k e " E X C L U D E
)
install (
F I L E S
" $ { C M A K E _ S O U R C E _ D I R } / C M a k e L i s t s . t x t "
" $ { C M A K E _ S O U R C E _ D I R } / e n g i n e . j s o n "
D E S T I N A T I O N .
)
ly_install_o3de_directories ( )
# C o l l e c t a l l F i n d f i l e s t h a t w e r e a d d e d w i t h l y _ a d d _ e x t e r n a l _ t a r g e t _ p a t h
unset ( additional_find_files )
get_property ( additional_module_paths GLOBAL PROPERTY LY_ADDITIONAL_MODULE_PATH )
foreach ( additional_module_path ${ additional_module_paths } )
unset ( find_files )
file ( GLOB find_files "${additional_module_path}/Find*.cmake" )
list ( APPEND additional_find_files "${find_files}" )
endforeach ( )
install ( FILES ${ additional_find_files }
D E S T I N A T I O N c m a k e / 3 r d P a r t y
)
install ( FILES "${CMAKE_CURRENT_BINARY_DIR}/Findo3de.cmake"
# F i n d o 3 d e . c m a k e f i l e : w e g e n e r a t e a d i f f e r e n t F i n d o 3 d e . c a m k e f i l e t h a n t h e o n e w e h a v e i n c m a k e . T h i s o n e i s g o i n g t o e x p o s e a l l
# t a r g e t s t h a t a r e p r e - b u i l t
get_property ( all_targets GLOBAL PROPERTY LY_ALL_TARGETS )
unset ( FIND_PACKAGES_PLACEHOLDER )
foreach ( target IN LISTS all_targets )
string ( APPEND FIND_PACKAGES_PLACEHOLDER " find_package(${target})\n" )
endforeach ( )
configure_file ( ${ LY_ROOT_FOLDER } /cmake/Findo3de.cmake.in ${ CMAKE_CURRENT_BINARY_DIR } /cmake/Findo3de.cmake @ONLY )
install ( FILES "${CMAKE_CURRENT_BINARY_DIR}/cmake/Findo3de.cmake"
D E S T I N A T I O N c m a k e
)
install ( FILES "${CMAKE_SOURCE_DIR}/CMakeLists.txt"
D E S T I N A T I O N .
# B u i l t I n P a c k a g e _ < p l a t f o r m > . c m a k e : s i n c e a s s o c i a t i o n s c o u l d h a p p e n i n a n y c m a k e f i l e a c r o s s t h e e n g i n e . W e c o l l e c t
# a l l t h e a s s o c i a t i o n s i n l y _ a s s o c i a t e _ p a c k a g e a n d t h e n g e n e r a t e t h e m i n t o B u i l t I n P a c k a g e s _ < p l a t f o r m > . c m a k e . T h i s
# w i l l c o n s o l i d a t e a l l a s s o c i a t i o n s i n o n e f i l e
get_property ( all_package_names GLOBAL PROPERTY LY_PACKAGE_NAMES )
set ( builtinpackages "# Generated by O3DE install\n\n" )
foreach ( package_name IN LISTS all_package_names )
get_property ( package_hash GLOBAL PROPERTY LY_PACKAGE_HASH_ ${ package_name } )
get_property ( targets GLOBAL PROPERTY LY_PACKAGE_TARGETS_ ${ package_name } )
string ( APPEND builtinpackages "ly_associate_package(PACKAGE_NAME ${package_name} TARGETS ${targets} PACKAGE_HASH ${package_hash})\n" )
endforeach ( )
ly_get_absolute_pal_filename ( pal_builtin_file ${ CMAKE_CURRENT_BINARY_DIR } /cmake/3rdParty/Platform/ ${ PAL_PLATFORM_NAME } /BuiltInPackages_ ${ PAL_PLATFORM_NAME_LOWERCASE } .cmake )
file ( GENERATE OUTPUT ${ pal_builtin_file }
C O N T E N T $ { b u i l t i n p a c k a g e s }
)
install ( FILES "${pal_builtin_file}"
D E S T I N A T I O N c m a k e / 3 r d P a r t y / P l a t f o r m / $ { P A L _ P L A T F O R M _ N A M E }
)
endfunction ( )
# ! l y _ i n s t a l l _ o 3 d e _ d i r e c t o r i e s : i n s t a l l d i r e c t o r i e s r e q u i r e d b y t h e e n g i n e
function ( ly_install_o3de_directories )
# ! l y _ s e t u p _ o t h e r s : i n s t a l l d i r e c t o r i e s r e q u i r e d b y t h e e n g i n e
function ( ly_setup_others )
# L i s t o f d i r e c t o r i e s w e w a n t t o i n s t a l l r e l a t i v e t o e n g i n e r o o t
set ( DIRECTORIES_TO_INSTALL Tools/LyTestTools Tools/RemoteConsole ctest_scripts scripts )
@ -242,12 +259,6 @@ function(ly_install_o3de_directories)
endforeach ( )
# D i r e c t o r i e s w h i c h h a v e e x c l u d e s
install ( DIRECTORY "${CMAKE_SOURCE_DIR}/cmake"
D E S T I N A T I O N .
R E G E X " F i n d o 3 d e . c m a k e " E X C L U D E
)
install ( DIRECTORY "${CMAKE_SOURCE_DIR}/python"
D E S T I N A T I O N .
R E G E X " d o w n l o a d e d _ p a c k a g e s " E X C L U D E
@ -257,8 +268,8 @@ function(ly_install_o3de_directories)
endfunction ( )
# ! l y _ in s t a l l _ l a u n c h e r _ t a r g e t _ g e n e r a t o r : i n s t a l l s o u r c e f i l e s n e e d e d f o r p r o j e c t l a u n c h e r g e n e r a t i o n
function ( ly_ install_launcher _target_generator)
# ! l y _ se t u p _ t a r g e t _ g e n e r a t o r : i n s t a l l s o u r c e f i l e s n e e d e d f o r p r o j e c t l a u n c h e r g e n e r a t i o n
function ( ly_ setup _target_generator)
install ( FILES
$ { C M A K E _ S O U R C E _ D I R } / C o d e / L a u n c h e r U n i f i e d / l a u n c h e r _ g e n e r a t o r . c m a k e