@@ -10,8 +10,6 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
1010 add_compile_options (-Wall -Wextra -Wpedantic)
1111endif ()
1212
13- option (BUILD_FOR_ARM64 "Link to RDK library for arm64 processor, otherwise link to x64" OFF )
14-
1513# find dependencies
1614find_package (ament_cmake REQUIRED)
1715find_package (rclcpp REQUIRED)
@@ -31,15 +29,35 @@ target_include_directories(
3129 ${CMAKE_CURRENT_SOURCE_DIR} /rdk/include
3230)
3331
34- # Link arm64 or x64 version of libFlexivRdk
35- if (${BUILD_FOR_ARM64} )
36- target_link_libraries (${PROJECT_NAME}
37- ${CMAKE_CURRENT_SOURCE_DIR} /rdk/lib/libFlexivRdk.arm64-darwin.a)
38- else ()
39- target_link_libraries (${PROJECT_NAME}
40- ${CMAKE_CURRENT_SOURCE_DIR} /rdk/lib/libFlexivRdk.x86_64-linux-gnu.a)
32+ # Set static library
33+ message ("OS: ${CMAKE_SYSTEM_NAME} " )
34+ message ("Processor: ${CMAKE_SYSTEM_PROCESSOR} " )
35+ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux" )
36+ if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64" )
37+ set (RDK_STATIC_LIBRARY "${CMAKE_CURRENT_SOURCE_DIR} /rdk/lib/libFlexivRdk.x86_64-linux-gnu.a" )
38+ elseif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64" )
39+ set (RDK_STATIC_LIBRARY "${CMAKE_CURRENT_SOURCE_DIR} /rdk/lib/libFlexivRdk.aarch64-linux-gnu.a" )
40+ else ()
41+ message (FATAL_ERROR "Linux with ${CMAKE_SYSTEM_PROCESSOR} processor is currently not supported." )
42+ endif ()
43+ elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" )
44+ if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm64" )
45+ set (RDK_STATIC_LIBRARY "${CMAKE_CURRENT_SOURCE_DIR} /rdk/lib/libFlexivRdk.arm64-darwin.a" )
46+ else ()
47+ message (FATAL_ERROR "Mac with ${CMAKE_SYSTEM_PROCESSOR} processor is currently not supported." )
48+ endif ()
49+ elseif (${CMAKE_SYSTEM_NAME} MATCHES "Windows" )
50+ if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "AMD64" )
51+ set (RDK_STATIC_LIBRARY "${CMAKE_CURRENT_SOURCE_DIR} /rdk/lib/FlexivRdk.win_amd64.lib" )
52+ else ()
53+ message (FATAL_ERROR "Windows with ${CMAKE_SYSTEM_PROCESSOR} processor is currently not supported." )
54+ endif ()
4155endif ()
4256
57+ target_link_libraries (${PROJECT_NAME}
58+ ${RDK_STATIC_LIBRARY}
59+ )
60+
4361# Link ROS packages
4462ament_target_dependencies(
4563 ${PROJECT_NAME}
0 commit comments