aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfuzzard <fuzzard@kodi.tv>2022-04-25 10:54:48 +1000
committerfuzzard <fuzzard@kodi.tv>2022-04-28 13:20:16 +1000
commitd5b46e864dbef8a3e06c0f680f925331b991b624 (patch)
tree97e016b7cc01c8b3ec8238bd08a58e9e44421832
parent2b6cc755abf04aa51192de9f1bfa00dd9ceb075d (diff)
[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.
-rw-r--r--CMakeLists.txt2
-rw-r--r--cmake/modules/FindTexturePacker.cmake6
-rw-r--r--cmake/scripts/common/ArchSetup.cmake8
-rw-r--r--cmake/scripts/osx/ArchSetup.cmake6
4 files changed, 16 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e5824f0d20..84e58467f7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -392,7 +392,7 @@ else()
endif()
# testing
-if(CORE_HOST_IS_TARGET AND ENABLE_TESTING)
+if(HOST_CAN_EXECUTE_TARGET AND ENABLE_TESTING)
find_package(Gtest)
copy_files_from_filelist_to_buildtree(${CMAKE_SOURCE_DIR}/cmake/installdata/test-reference-data.txt NO_INSTALL)
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()