From d988ed76a01b418471fc879bd952d6bedbf5fc1c Mon Sep 17 00:00:00 2001 From: Simon Dierl Date: Thu, 5 Sep 2019 11:16:25 +0200 Subject: [PATCH] Use ${CMAKE_SYSTEM_PROCESSOR} to determine target architecture instead of guessing using the linker search path. This method works on Arch Linux and related distros that do not prefix their library paths. Fixes #39. --- externals/cmakemodules/GetCompilerAndPlatform.cmake | 8 ++++---- physx/snippets/compiler/cmake/linux/CMakeLists.txt | 2 +- physx/snippets/compiler/cmake/linux/SnippetTemplate.cmake | 4 ++-- .../compiler/cmake/linux/SnippetVehicleTemplate.cmake | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/externals/cmakemodules/GetCompilerAndPlatform.cmake b/externals/cmakemodules/GetCompilerAndPlatform.cmake index efaee8805..dd6b67101 100644 --- a/externals/cmakemodules/GetCompilerAndPlatform.cmake +++ b/externals/cmakemodules/GetCompilerAndPlatform.cmake @@ -117,10 +117,10 @@ FUNCTION (GetPlatformBinName PLATFORM_BIN_NAME LIBPATH_SUFFIX) ELSEIF(TARGET_BUILD_PLATFORM STREQUAL "android") SET(RETVAL "android.${ANDROID_ABI}.fp-soft") ELSEIF(TARGET_BUILD_PLATFORM STREQUAL "linux") - IF (${CMAKE_LIBRARY_ARCHITECTURE} STREQUAL "x86_64-unknown-linux-gnu" OR ${CMAKE_LIBRARY_ARCHITECTURE} STREQUAL "x86_64-linux-gnu") - SET(RETVAL "linux.clang") - ELSEIF(${CMAKE_LIBRARY_ARCHITECTURE} STREQUAL "aarch64-unknown-linux-gnueabi" OR ${CMAKE_LIBRARY_ARCHITECTURE} STREQUAL "aarch64-linux-gnu") - SET(RETVAL "linux.aarch64") + IF(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64") + SET(RETVAL "linux.clang") + ELSEIF(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64") + SET(RETVAL "linux.aarch64") ENDIF() ENDIF() diff --git a/physx/snippets/compiler/cmake/linux/CMakeLists.txt b/physx/snippets/compiler/cmake/linux/CMakeLists.txt index c0cfddbbd..98b926b45 100644 --- a/physx/snippets/compiler/cmake/linux/CMakeLists.txt +++ b/physx/snippets/compiler/cmake/linux/CMakeLists.txt @@ -53,7 +53,7 @@ SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath='$ORIGIN'") # Include all of the projects SET(PLATFORM_SNIPPETS_LIST Convert LoadCollection) -IF(${CMAKE_LIBRARY_ARCHITECTURE} STREQUAL "aarch64-linux-gnu") +IF(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64") SET(SNIPPET_RENDER_ENABLED 0) ELSE() SET(SNIPPET_RENDER_ENABLED 1) diff --git a/physx/snippets/compiler/cmake/linux/SnippetTemplate.cmake b/physx/snippets/compiler/cmake/linux/SnippetTemplate.cmake index 5e05c6f1a..4eff22c41 100644 --- a/physx/snippets/compiler/cmake/linux/SnippetTemplate.cmake +++ b/physx/snippets/compiler/cmake/linux/SnippetTemplate.cmake @@ -29,7 +29,7 @@ # Build Snippet linux template # -IF(${CMAKE_LIBRARY_ARCHITECTURE} STREQUAL "aarch64-linux-gnu") +IF(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64") SET(SNIPPET_COMPILE_DEFS # Common to all configurations @@ -71,7 +71,7 @@ IF(${SNIPPET_NAME} STREQUAL "ArticulationLoader") ) ENDIF() -IF(${CMAKE_LIBRARY_ARCHITECTURE} STREQUAL "aarch64-linux-gnu") +IF(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64") SET(SNIPPET_PLATFORM_LINKED_LIBS rt pthread dl ) diff --git a/physx/snippets/compiler/cmake/linux/SnippetVehicleTemplate.cmake b/physx/snippets/compiler/cmake/linux/SnippetVehicleTemplate.cmake index 1e257cb78..b5efd77f9 100644 --- a/physx/snippets/compiler/cmake/linux/SnippetVehicleTemplate.cmake +++ b/physx/snippets/compiler/cmake/linux/SnippetVehicleTemplate.cmake @@ -29,7 +29,7 @@ # Build SnippetVehicle linux template # -IF(${CMAKE_LIBRARY_ARCHITECTURE} STREQUAL "aarch64-linux-gnu") +IF(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64") SET(SNIPPET_COMPILE_DEFS # Common to all configurations @@ -61,7 +61,7 @@ SET(SNIPPET_PLATFORM_INCLUDES ) -IF(${CMAKE_LIBRARY_ARCHITECTURE} STREQUAL "aarch64-linux-gnu") +IF(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64") SET(SNIPPET_PLATFORM_LINKED_LIBS rt pthread dl )