Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Scripts/cmake/o3de_package_utilities.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ function(o3de_import_targets)
if (to_namespace_prefix)
set(target_alias_name ${to_namespace_prefix}${component})
if(NOT "${target_alias_name}" STREQUAL "${component_target_name}")
add_library(${target_alias_name} ALIAS ${component_target_name})
if (NOT TARGET ${target_alias_name})
add_library(${target_alias_name} ALIAS ${component_target_name})
endif()
endif()
endif()

Expand Down
11 changes: 11 additions & 0 deletions package-system/Imath/FindImath.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#
# Copyright (c) Contributors to the Open 3D Engine Project.
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
#
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
#

# force this into config mode, so that it uses the config files instead of module files.
set(Imath_DIR ${CMAKE_CURRENT_LIST_DIR})
find_package(Imath 3.2.2 REQUIRED CONFIG)
100 changes: 100 additions & 0 deletions package-system/Imath/build_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{
"git_url":"https://github.com/AcademySoftwareFoundation/Imath.git",
"git_tag":"v3.2.2",
"package_name":"Imath",
"package_version":"3.2.2-rev2",
"package_url":"https://imath.readthedocs.io/en/latest/",
"package_license":"BSD-3-Clause",
"package_license_file":"Imath/LICENSE.md",
"cmake_build_args_common" : [
"--parallel"
],
"cmake_generate_args_common" : [
"-DCMAKE_CXX_STANDARD=17",
"-DBUILD_SHARED_LIBS=FALSE",
"-DCMAKE_POSITION_INDEPENDENT_CODE=ON",
"-DPYTHON=OFF",
"-DPYBIND11=OFF",
"-DBUILD_WEBSITE=OFF",
"-DBUILD_TESTING=OFF",
"-DCMAKE_DEBUG_POSTFIX=_d"
],
"cmake_find_source" : "FindImath.cmake",
"cmake_find_target" : "FindImath.cmake",
"cmake_install_filter":[
"*.h",
"*.lib",
"*.a"
],
"extra_files_to_copy": [
["imath-config-version.cmake", "imath-config-version.cmake"],
["imath-config.cmake", "imath-config.cmake"]
],
"Platforms":{
"Windows":{
"Windows":{
"cmake_generate_args" : ["-G\"Visual Studio 17 2022\""],
"build_configs" : ["Debug","Release"],
"custom_test_cmd" : [
"imath-test-windows.cmd"
]
},
"Android":{
"build_configs" : ["Release"],
"cmake_generate_args" : [
"-G",
"\"Ninja Multi-Config\"",
"-DCMAKE_TOOLCHAIN_FILE=../../../../Scripts/cmake/Platform/Android/Toolchain_android.cmake"
],
"custom_test_cmd" : [
"imath-test-android.cmd"
]
}
},
"Darwin":{
"Mac-arm64":{
"build_configs" : ["Release"],
"cmake_generate_args": [
"-G", "Xcode",
"-DCMAKE_POLICY_VERSION_MINIMUM=3.5",
"-DCMAKE_TOOLCHAIN_FILE=../../../../Scripts/cmake/Platform/Mac/Toolchain_mac.cmake"
],
"custom_test_cmd" : [
"./imath-test-mac.sh"
]
},
"iOS":{
"build_configs" : ["Release"],
"cmake_generate_args": [
"-G", "Xcode",
"-DCMAKE_TOOLCHAIN_FILE=../../../../Scripts/cmake/Platform/iOS/Toolchain_ios.cmake"
],
"custom_test_cmd" : [
"./imath-test-ios.sh"
]
}
},
"Linux":{
"Linux":{
"build_configs" : ["Release"],
"cmake_generate_args": [
"-G",
"\"Ninja Multi-Config\""
],
"custom_test_cmd" : [
"./imath-test-linux.sh"
]
},
"Linux-aarch64": {
"build_configs" : ["Release"],
"cmake_generate_args": [
"-G",
"\"Ninja Multi-Config\""
],
"custom_test_cmd" : [
"./imath-test-linux.sh"
]
}
}
}
}
39 changes: 39 additions & 0 deletions package-system/Imath/imath-config-version.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#
# Copyright (c) Contributors to the Open 3D Engine Project.
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
#
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
#

# this file is called to make sure that if we request a specific version
# we respond only to that version

set(PACKAGE_VERSION 3.2.2)
set(PACKAGE_VERSION_EXACT False)
set(PACKAGE_VERSION_COMPATIBLE False)

if (NOT ${PACKAGE_FIND_NAME} STREQUAL "Imath")
return()
endif()

# if the requested is greater than 3.x.x we cannot provide it
if (PACKAGE_FIND_VERSION_COUNT GREATER 0 AND PACKAGE_FIND_VERSION_MAJOR GREATER 3)
return()
endif()

# if the requested version is greater than 3.2.x we cannot provide it
if (PACKAGE_FIND_VERSION_COUNT GREATER 1 AND PACKAGE_FIND_VERSION_MINOR GREATER 2)
return()
endif()

# if the requested version is greater than 3.2.2 we cannot provide it.
if (PACKAGE_FIND_VERSION_COUNT GREATER 2 AND PACKAGE_FIND_VERSION_PATCH GREATER 2)
return()
endif()

if (PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION)
set(PACKAGE_VERSION_EXACT TRUE)
endif()

set(PACKAGE_VERSION_COMPATIBLE TRUE)
50 changes: 50 additions & 0 deletions package-system/Imath/imath-config.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#
# Copyright (c) Contributors to the Open 3D Engine Project.
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
#
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
#

# we're trying to be a drop-in replacement for the FindImath.cmake
# this means not using O3DE-specific functions.

set(Imath_INCLUDE_DIRS ${CMAKE_CURRENT_LIST_DIR}/Imath/include)
set(Imath_LIB_DIR ${CMAKE_CURRENT_LIST_DIR}/Imath/lib)
set(Imath_VERSION_STRING "3.2.2")
set(Imath_VERSION ${Imath_VERSION_STRING})
set(Imath_FOUND True)

if (NOT TARGET Imath::Imath)
add_library(Imath::Imath STATIC IMPORTED GLOBAL)
set_target_properties(Imath::Imath
PROPERTIES
IMPORTED_LOCATION ${Imath_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}Imath-3_2${CMAKE_STATIC_LIBRARY_SUFFIX}
)
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
set_target_properties(Imath::Imath
PROPERTIES
IMPORTED_LOCATION_DEBUG ${Imath_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}Imath-3_2_d${CMAKE_STATIC_LIBRARY_SUFFIX}
)
endif()
# frustratingly, some 3rd party libraries expect the include dir to be like
# #include <Imath/ImathConfig.h>
# while others expect
# #include <ImathConfig.h>
# so spoon feed it...
target_include_directories(Imath::Imath SYSTEM INTERFACE ${Imath_INCLUDE_DIRS} ${Imath_INCLUDE_DIRS}/Imath)

endif()

if (NOT TARGET 3rdParty::Imath::Imath)
add_library(3rdParty::Imath::Imath ALIAS Imath::Imath)
endif()

# if we're not in O3DE, it's also extremely helpful to show a message to logs that indicate that this
# library was successfully picked up, as opposed to the system one.
# A good way to know if you're in O3DE or not is that O3DE sets various cache variables before
# calling find_package, specifically, LY_VERSION_ENGINE_NAME is always set very early:
if (NOT LY_VERSION_ENGINE_NAME)
message(STATUS "Using O3DE's Imath (${Imath_VERSION_STRING}) from ${CMAKE_CURRENT_LIST_DIR}")
endif()

35 changes: 35 additions & 0 deletions package-system/Imath/imath-test-android.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@rem #
@rem # Copyright (c) Contributors to the Open 3D Engine Project.
@rem # For complete copyright and license terms please see the LICENSE at the root of this distribution.
@rem #
@rem # SPDX-License-Identifier: Apache-2.0 OR MIT
@rem #
@rem #

rmdir /S /Q temp\build_test
mkdir temp\build_test

@rem in this case, we really just want to make sure the package is found successfully

@rem CMAKE demands forward slashes but PACKAGE_ROOT is in native path:
set "PACKAGE_ROOT=%PACKAGE_ROOT:\=/%"
set "DOWNLOADED_PACKAGE_FOLDERS=%DOWNLOADED_PACKAGE_FOLDERS:\=/%"

cmake -S test/find-using-config -B temp/build_test/find-using-config ^
-G Ninja ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_TOOLCHAIN_FILE=../../../../Scripts/cmake/Platform/Android/Toolchain_android.cmake ^
-DCMAKE_MODULE_PATH="%DOWNLOADED_PACKAGE_FOLDERS%;%PACKAGE_ROOT%" ^
-DCMAKE_FIND_ROOT_PATH="%DOWNLOADED_PACKAGE_FOLDERS%;%PACKAGE_ROOT%" || exit /b 1

cmake -S test/find-using-module -B temp/build_test/find-using-module ^
-G Ninja ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_TOOLCHAIN_FILE=../../../../Scripts/cmake/Platform/Android/Toolchain_android.cmake ^
-DCMAKE_MODULE_PATH="%DOWNLOADED_PACKAGE_FOLDERS%;%PACKAGE_ROOT%" ^
-DCMAKE_FIND_ROOT_PATH="%DOWNLOADED_PACKAGE_FOLDERS%;%PACKAGE_ROOT%" || exit /b 1

cmake --build temp/build_test/find-using-config --config Release || exit /b 1
cmake --build temp/build_test/find-using-module --config Release || exit /b 1

exit /b 0
31 changes: 31 additions & 0 deletions package-system/Imath/imath-test-ios.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
#
# Copyright (c) Contributors to the Open 3D Engine Project.
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
#
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
#

# in this case, we really just want to make sure the package is found successfully
# as it is mostly used as a header library

rm -rf temp/build_test
mkdir temp/build_test

cmake -S test/find-using-config -B temp/build_test/find-using-config \
-G Xcode \
-DCMAKE_TOOLCHAIN_FILE=../../../../Scripts/cmake/Platform/iOS/Toolchain_ios.cmake \
-DCMAKE_MODULE_PATH="$DOWNLOADED_PACKAGE_FOLDERS;$PACKAGE_ROOT" \
-DCMAKE_BUILD_TYPE=Release || exit 1

cmake -S test/find-using-module -B temp/build_test/find-using-module \
-G Xcode \
-DCMAKE_TOOLCHAIN_FILE=../../../../Scripts/cmake/Platform/iOS/Toolchain_ios.cmake \
-DCMAKE_MODULE_PATH="$DOWNLOADED_PACKAGE_FOLDERS;$PACKAGE_ROOT" \
-DCMAKE_BUILD_TYPE=Release || exit 1

cmake --build temp/build_test/find-using-config --config Release || exit 1
cmake --build temp/build_test/find-using-module --config Release || exit 1

exit 0
31 changes: 31 additions & 0 deletions package-system/Imath/imath-test-linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
#
# Copyright (c) Contributors to the Open 3D Engine Project.
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
#
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
#

# in this case, we really just want to make sure the package is found successfully

rm -rf temp/build_test
mkdir temp/build_test

cmake -S test/find-using-config -B temp/build_test/find-using-config \
-G Ninja \
-DCMAKE_MODULE_PATH="$DOWNLOADED_PACKAGE_FOLDERS;$PACKAGE_ROOT" \
-DCMAKE_BUILD_TYPE=Release || exit 1

cmake -S test/find-using-module -B temp/build_test/find-using-module \
-G Ninja \
-DCMAKE_MODULE_PATH="$DOWNLOADED_PACKAGE_FOLDERS;$PACKAGE_ROOT" \
-DCMAKE_BUILD_TYPE=Release || exit 1

cmake --build temp/build_test/find-using-config || exit 1
cmake --build temp/build_test/find-using-module || exit 1

./temp/build_test/find-using-config/test_imath || exit 1
./temp/build_test/find-using-module/test_imath || exit 1

exit 0
34 changes: 34 additions & 0 deletions package-system/Imath/imath-test-mac.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash
#
# Copyright (c) Contributors to the Open 3D Engine Project.
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
#
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
#

# in this case, we really just want to make sure the package is found successfully
# as it is mostly used as a header library

rm -rf temp/build_test
mkdir temp/build_test

cmake -S test/find-using-config -B temp/build_test/find-using-config \
-G Xcode \
-DCMAKE_TOOLCHAIN_FILE=../../../../Scripts/cmake/Platform/Mac/Toolchain_mac.cmake \
-DCMAKE_MODULE_PATH="$DOWNLOADED_PACKAGE_FOLDERS;$PACKAGE_ROOT" \
-DCMAKE_BUILD_TYPE=Release || exit 1

cmake -S test/find-using-module -B temp/build_test/find-using-module \
-G Xcode \
-DCMAKE_TOOLCHAIN_FILE=../../../../Scripts/cmake/Platform/Mac/Toolchain_mac.cmake \
-DCMAKE_MODULE_PATH="$DOWNLOADED_PACKAGE_FOLDERS;$PACKAGE_ROOT" \
-DCMAKE_BUILD_TYPE=Release || exit 1

cmake --build temp/build_test/find-using-config --config Release || exit 1
cmake --build temp/build_test/find-using-module --config Release || exit 1

./temp/build_test/find-using-config/Release/test_imath.app/Contents/MacOS/test_imath || exit 1
./temp/build_test/find-using-module/Release/test_imath.app/Contents/MacOS/test_imath || exit 1

exit 0
37 changes: 37 additions & 0 deletions package-system/Imath/imath-test-windows.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
@rem #
@rem # Copyright (c) Contributors to the Open 3D Engine Project.
@rem # For complete copyright and license terms please see the LICENSE at the root of this distribution.
@rem #
@rem # SPDX-License-Identifier: Apache-2.0 OR MIT
@rem #
@rem #

rmdir /S /Q temp\build_test
mkdir temp\build_test

@rem in this case, we really just want to make sure the package is found successfully

@rem CMAKE demands forward slashes but PACKAGE_ROOT is in native path:
set "PACKAGE_ROOT=%PACKAGE_ROOT:\=/%"
set "DOWNLOADED_PACKAGE_FOLDERS=%DOWNLOADED_PACKAGE_FOLDERS:\=/%"

cmake -S test/find-using-config -B temp/build_test/find-using-config ^
-G "Visual Studio 17 2022" ^
-DCMAKE_MODULE_PATH="%DOWNLOADED_PACKAGE_FOLDERS%;%PACKAGE_ROOT%" || exit /b 1

cmake -S test/find-using-module -B temp/build_test/find-using-module ^
-G "Visual Studio 17 2022" ^
-DCMAKE_MODULE_PATH="%DOWNLOADED_PACKAGE_FOLDERS%;%PACKAGE_ROOT%" || exit /b 1

cmake --build temp/build_test/find-using-config --config Release || exit /b 1
cmake --build temp/build_test/find-using-config --config Debug || exit /b 1
cmake --build temp/build_test/find-using-module --config Release || exit /b 1
cmake --build temp/build_test/find-using-module --config Debug || exit /b 1

temp\build_test\find-using-config\Release\test_imath.exe || exit /b 1
temp\build_test\find-using-config\Debug\test_imath.exe || exit /b 1
temp\build_test\find-using-module\Release\test_imath.exe || exit /b 1
temp\build_test\find-using-module\Debug\test_imath.exe || exit /b 1


exit /b 0
Loading
Loading