From d5b46e864dbef8a3e06c0f680f925331b991b624 Mon Sep 17 00:00:00 2001 From: fuzzard Date: Mon, 25 Apr 2022 10:54:48 +1000 Subject: [cmake] rename CORE_HOST_IS_TARGET to HOST_CAN_EXECUTE_TARGET We are now in a time where some platforms/archs can execute "foreign" (x86_64) arch code locally (Apple via Rosetta, Windows on arm). Rename CORE_HOST_IS_TARGET to HOST_CAN_EXECUTE_TARGET to allow platforms ArchSetup to set and therefore execute tests if desired. --- cmake/modules/FindTexturePacker.cmake | 6 +++--- cmake/scripts/common/ArchSetup.cmake | 8 ++++++-- cmake/scripts/osx/ArchSetup.cmake | 6 ++++++ 3 files changed, 15 insertions(+), 5 deletions(-) (limited to 'cmake') diff --git a/cmake/modules/FindTexturePacker.cmake b/cmake/modules/FindTexturePacker.cmake index 173b74d0ff..ce6311ec3b 100644 --- a/cmake/modules/FindTexturePacker.cmake +++ b/cmake/modules/FindTexturePacker.cmake @@ -57,9 +57,9 @@ if(NOT TARGET TexturePacker::TexturePacker::Executable) set(INTERNAL_TEXTUREPACKER_INSTALLABLE TRUE) endif() - # Use it during build if build architecture is same as host - # (not cross-compiling) and TEXTUREPACKER_EXECUTABLE is not found - if(CORE_HOST_IS_TARGET AND NOT TEXTUREPACKER_EXECUTABLE) + # Use it during build if build architecture can be executed on host + # and TEXTUREPACKER_EXECUTABLE is not found + if(HOST_CAN_EXECUTE_TARGET AND NOT TEXTUREPACKER_EXECUTABLE) set(INTERNAL_TEXTUREPACKER_EXECUTABLE TRUE) endif() diff --git a/cmake/scripts/common/ArchSetup.cmake b/cmake/scripts/common/ArchSetup.cmake index 52f6276e79..97a09b4433 100644 --- a/cmake/scripts/common/ArchSetup.cmake +++ b/cmake/scripts/common/ArchSetup.cmake @@ -59,9 +59,13 @@ endif() # this variable is set if we can execute build artefacts on the host system (for example unit tests). if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL CMAKE_SYSTEM_PROCESSOR AND CMAKE_HOST_SYSTEM_NAME STREQUAL CMAKE_SYSTEM_NAME) - set(CORE_HOST_IS_TARGET TRUE) + if(NOT HOST_CAN_EXECUTE_TARGET) + set(HOST_CAN_EXECUTE_TARGET TRUE) + endif() else() - set(CORE_HOST_IS_TARGET FALSE) + if(NOT HOST_CAN_EXECUTE_TARGET) + set(HOST_CAN_EXECUTE_TARGET FALSE) + endif() endif() # system specific arch setup diff --git a/cmake/scripts/osx/ArchSetup.cmake b/cmake/scripts/osx/ArchSetup.cmake index dd2b9f2936..ec72737894 100644 --- a/cmake/scripts/osx/ArchSetup.cmake +++ b/cmake/scripts/osx/ArchSetup.cmake @@ -23,6 +23,12 @@ else() endif() endif() +# m1 macs can execute x86_64 code via rosetta +if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "arm64" AND + CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") + set(HOST_CAN_EXECUTE_TARGET TRUE) +endif() + if(NOT TARBALL_DIR) set(TARBALL_DIR "/Users/Shared/xbmc-depends/xbmc-tarballs") endif() -- cgit v1.2.3