From faf4c9696938a78cb7189b5e6c7cf1321e937d99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Kov=C3=A1=C5=99?= Date: Tue, 16 Apr 2024 12:52:18 +0200 Subject: [PATCH] Modified the R3D SDK CMake module for macOS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Peter Kovář --- src/cmake/modules/FindR3DSDK.cmake | 38 +++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/src/cmake/modules/FindR3DSDK.cmake b/src/cmake/modules/FindR3DSDK.cmake index d5ad128983..3bca88bb3c 100644 --- a/src/cmake/modules/FindR3DSDK.cmake +++ b/src/cmake/modules/FindR3DSDK.cmake @@ -20,21 +20,28 @@ include (FindPackageHandleStandardArgs) # Assuming only C++11 and 64 bit support is needed. # Set R3DSDK_LIB_NAME before invoking this file to override. if (NOT DEFINED R3DSDK_LIB_NAME) - set(R3DSDK_LIB_NAME R3DSDKPIC-cpp11) + if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + set(R3DSDK_LIB_NAME R3DSDKPIC-cpp11) + elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") + set(R3DSDK_LIB_NAME R3DSDK-libcpp) + elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") + set(R3DSDK_LIB_NAME R3DSDK-2017MT) + endif() endif() if(DEFINED ENV{R3DSDK_ROOT}) set(R3DSDK_ROOT $ENV{R3DSDK_ROOT}) - # message("Using R3D SDK Root: " ${R3DSDK_ROOT}) + message("Using R3D SDK Root: " ${R3DSDK_ROOT}) else() - # message("Looking for R3D SDK") + message("Looking for R3D SDK") # The R3D SDK is supplied as a zip file that you can unpack anywhere. # So try some plausible locations and hope for the best. # Use a glob to try and avoid dealing with exact SDK version numbers. file(GLOB R3DSDK_PATHS "/opt/R3DSDKv*" + "/Library/R3DSDKv*" "C:/R3DSDKv*" ${CMAKE_CURRENT_SOURCE_DIR}/../R3DSDKv* ${CMAKE_CURRENT_SOURCE_DIR}/../../R3DSDKv* @@ -46,19 +53,28 @@ else() endif() set(R3DSDK_INCLUDE_DIR ${R3DSDK_ROOT}/Include) -find_library(R3DSDK_LIBRARY NAMES ${R3DSDK_LIB_NAME} - PATHS ${R3DSDK_ROOT}/Lib/linux64/ - ${R3DSDK_ROOT}/Lib/mac64/ - ${R3DSDK_ROOT}/Lib/win64/ - NO_DEFAULT_PATH - ) +if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + find_library(R3DSDK_LIBRARY NAMES ${R3DSDK_LIB_NAME} + PATHS ${R3DSDK_ROOT}/Lib/linux64/ + NO_DEFAULT_PATH + ) +elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") + find_library(R3DSDK_LIBRARY NAMES ${R3DSDK_LIB_NAME} + PATHS ${R3DSDK_ROOT}/Lib/mac64/ + NO_DEFAULT_PATH + ) +elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") + find_library(R3DSDK_LIBRARY NAMES ${R3DSDK_LIB_NAME} + PATHS ${R3DSDK_ROOT}/Lib/win64/ + NO_DEFAULT_PATH + ) +endif() # handle the QUIETLY and REQUIRED arguments and set R3DSDK_FOUND to TRUE if # all listed variables are TRUE FIND_PACKAGE_HANDLE_STANDARD_ARGS(R3DSDK DEFAULT_MSG R3DSDK_LIBRARY R3DSDK_INCLUDE_DIR) -# TODO : Ask somebody with a Mac to add support. if(R3DSDK_FOUND) if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") set(R3DSDK_LIBRARIES ${R3DSDK_LIBRARY} dl) @@ -66,7 +82,7 @@ if(R3DSDK_FOUND) elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") set(R3DSDK_LIBRARIES ${R3DSDK_LIBRARY} dl) set(R3DSDK_RUNTIME_LIBRARIES ${R3DSDK_ROOT}/Redistributable/mac) - else() + elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") set(R3DSDK_LIBRARIES ${R3DSDK_LIBRARY}) set(R3DSDK_RUNTIME_LIBRARIES ${R3DSDK_ROOT}/Redistributable/win) endif()