Skip to content

Commit

Permalink
Cleaned up CMakeLists.txt files
Browse files Browse the repository at this point in the history
  • Loading branch information
adnanmunawar committed Jan 7, 2022
1 parent 10ee1f1 commit c144500
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 62 deletions.
1 change: 1 addition & 0 deletions AMBFConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ endif()
# IMPORTED target created by AMBFTargets.cmake
set(AMBF_LIBRARY_DIRS "@CONF_LIBRARY_DIRS@")
set(AMBF_LIBRARIES "@CONF_LIBRARIES@")
set(AMBF_ROS_LIBRARIES "@CONF_ROS_LIBRARIES@")
25 changes: 10 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ include_directories(${Boost_INCLUDE_DIRS})

find_package(yaml-cpp QUIET)
if (NOT ${yaml-cpp_FOUND})
message("-- *** YAML-CPP NOT FOUND, ADDING IT AS AN EXTERNAL PROJECT")
message(STATUS "-- *** YAML-CPP NOT FOUND, ADDING IT AS AN EXTERNAL PROJECT")
include(cmake/ExternalYamlCpp.cmake)
endif()
include_directories(${YAML_CPP_INCLUDE_DIR})
Expand All @@ -129,7 +129,7 @@ if (${CMAKE_SYSTEM_NAME} MATCHES Linux)
find_package(tf_function REQUIRED)

if(${ambf_server_FOUND} AND ${ambf_msgs_FOUND} AND ${dvrk_arm_FOUND} AND ${ambf_client_FOUND})
message("-- *** FOUND AMBF_COMM, AMBF_MSGS, AMBF_CLIENT and DVRK_ARM, ENABLING DVRK DEVICE SUPPORT")
message(STATUS "-- *** FOUND AMBF_COMM, AMBF_MSGS, AMBF_CLIENT and DVRK_ARM, ENABLING DVRK DEVICE SUPPORT")

set(AMBF_ROS_INCLUDE_DIRS ${AMBF_ROS_INCLUDE_DIRS} ${catkin_INCLUDE_DIRS})
set(AMBF_ROS_LIBRARIES ${AMBF_ROS_LIBRARIES} ${catkin_LIBRARIES})
Expand All @@ -138,25 +138,25 @@ if (${CMAKE_SYSTEM_NAME} MATCHES Linux)
list(APPEND CHAI3D_DEFINITIONS -DC_ENABLE_AMBF_DVRK_DEVICE_SUPPORT)

else()
message("-- *** AMBF_COMM, AMBF_MSGS, AMBF_CLIENT and DVRK_ARM NOT FOUND")
message(STATUS "-- *** AMBF_COMM, AMBF_MSGS, AMBF_CLIENT and DVRK_ARM NOT FOUND")
endif()

find_package(OpenCV QUIET)
if(${OpenCV_FOUND})
message("-- *** FOUND OPENCV")
message(STATUS "-- *** FOUND OPENCV")
if(${cv_bridge_FOUND} AND ${image_transport_FOUND})
message("-- *** FOUND ROS_CV_BRIDGE and IMAGE_TRANSPORT, ENABLING VIDEO PUBLISHING SUPPORT")
message(STATUS "-- *** FOUND ROS_CV_BRIDGE and IMAGE_TRANSPORT, ENABLING VIDEO PUBLISHING SUPPORT")

list(APPEND AMBF_DEFINITIONS -DAF_ENABLE_OPEN_CV_SUPPORT)
set(AMBF_ROS_INCLUDE_DIRS ${AMBF_ROS_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS})
set(AMBF_ROS_LIBRARIES ${AMBF_ROS_LIBRARIES} ${OpenCV_LIBRARIES})
else()
message("-- *** ROS CV_BRIDGE and IMAGE_TRANSPORT NOT FOUND")
message(STATUS "-- *** ROS CV_BRIDGE and IMAGE_TRANSPORT NOT FOUND")
endif()
endif()

if (${razer_hydra_FOUND})
message("-- *** FOUND RAZER HYDRA'S ROS PACKAGE, ENABLING DEVICE SUPPORT")
message(STATUS "-- *** FOUND RAZER HYDRA'S ROS PACKAGE, ENABLING DEVICE SUPPORT")

set(AMBF_ROS_INCLUDE_DIRS ${AMBF_ROS_INCLUDE_DIRS} ${razer_hydra_INCLUDE_DIRS})
set(AMBF_ROS_LIBRARIES ${AMBF_ROS_LIBRARIES} ${razer_hydra_LIBRARIES})
Expand All @@ -165,7 +165,7 @@ if (${CMAKE_SYSTEM_NAME} MATCHES Linux)
list(APPEND CHAI3D_DEFINITIONS -DC_ENABLE_RAZER_HYDRA_DEVICE_SUPPORT)

else()
message("-- *** RAZER HYDRA'S ROS PACKAGE NOT FOUND")
message(STATUS "-- *** RAZER HYDRA'S ROS PACKAGE NOT FOUND")
endif()

endif()
Expand Down Expand Up @@ -335,11 +335,6 @@ add_library(bullet STATIC ${source_bullet_collision} ${source_bullet_dynamics} $
# static library
add_library (ambf_framework STATIC ${source_ambf_framework} ${source_ambf_plugins})

#message("1) CHAI3D_DEFINITIONS" ${CHAI3D_DEFINITIONS})
#message("2) BULLET_DEFINITIONS" ${BULLET_DEFINITIONS})
#message("3) AMBF_DEFINITIONS" ${AMBF_DEFINITIONS})
#message("4) COMMON_DEFINITIONS" ${COMMON_DEFINITIONS})

add_definitions(${CHAI3D_DEFINITIONS})
add_definitions(${BULLET_DEFINITIONS})
add_definitions(${AMBF_DEFINITIONS})
Expand Down Expand Up @@ -375,12 +370,11 @@ set (AMBF_LIBRARIES ambf_framework chai3d bullet ${GLFW_LIBRARIES} ${OPENGL_LIBR
# ROS CATKIN INCLUDES AND LIBRARIES
if (${CMAKE_SYSTEM_NAME} MATCHES Linux)
set (AMBF_INCLUDE_DIRS ${AMBF_INCLUDE_DIRS} ${AMBF_ROS_INCLUDE_DIRS})
set (AMBF_LIBRARIES ${AMBF_LIBRARIES} ${AMBF_ROS_LIBRARIES})
endif()

if (NOT ${CMAKE_SYSTEM_NAME} MATCHES Windows)
if (${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "aarch64")
set (AMBF_LIBRARIES ${AMBF_LIBRARIES})
# set (AMBF_LIBRARIES ${AMBF_LIBRARIES})
else ()
set (AMBF_LIBRARIES ${AMBF_LIBRARIES} drd)
endif ()
Expand Down Expand Up @@ -423,6 +417,7 @@ export (PACKAGE AMBF)
set (CONF_INCLUDE_DIRS ${AMBF_INCLUDE_DIRS})
set (CONF_LIBRARY_DIRS ${AMBF_LIBRARY_DIRS})
set (CONF_LIBRARIES ${AMBF_LIBRARIES})
set (CONF_ROS_LIBRARIES ${AMBF_ROS_LIBRARIES})
set (CONF_DEFINITIONS ${AMBF_DEFINITIONS} ${CHAI3D_DEFINITIONS} ${BULLET_DEFINITIONS} ${COMMON_DEFINITIONS})

# create package configuration and version files
Expand Down
6 changes: 3 additions & 3 deletions ambf_controller/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ add_executable (raven_controller raven2/include/ambf_defines.h
raven2/src/ambf_defines.cpp
raven2/src/main.cpp )

target_link_libraries (raven_controller ${AMBF_LIBRARIES})
target_link_libraries (raven_controller ${AMBF_ROS_LIBRARIES})

set (PSM_IK_HDR_FILES
dvrk/cpp_controller/include/psm_ik_test.h
Expand All @@ -62,7 +62,7 @@ set(PSM_IK_SOURCE_FILES
dvrk/cpp_controller/src/Utilities.cpp)

add_executable (psm_ik_test ${PSM_IK_HDR_FILES} ${PSM_IK_SOURCE_FILES})
target_link_libraries (psm_ik_test ${AMBF_LIBRARIES} ${AMBF_CLIEMT_LIBRARIES} ${GLFW_LIBRARIES} ${Boost_LIBRARIES} ambf_client_cpp)
target_link_libraries (psm_ik_test ${AMBF_CLIENT_LIBRARIES} ${GLFW_LIBRARIES} ${Boost_LIBRARIES} ambf_client_cpp)


set (ECM_IK_HDR_FILES
Expand All @@ -76,4 +76,4 @@ set(ECM_IK_SOURCE_FILES
dvrk/cpp_controller/src/Utilities.cpp)

add_executable (ecm_ik_test ${ECM_IK_HDR_FILES} ${ECM_IK_SOURCE_FILES})
target_link_libraries (ecm_ik_test ${AMBF_LIBRARIES} ${AMBF_CLIEMT_LIBRARIES} ${GLFW_LIBRARIES} ${Boost_LIBRARIES} ambf_client_cpp)
target_link_libraries (ecm_ik_test ${AMBF_CLIENT_LIBRARIES} ${GLFW_LIBRARIES} ${Boost_LIBRARIES} ambf_client_cpp)
7 changes: 4 additions & 3 deletions ambf_ros_modules/ambf_client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ message_generation)

catkin_python_setup()

catkin_package( INCLUDE_DIRS include
LIBRARIES ambf_client_cpp
CATKIN_DEPENDS ambf_msgs message_runtime
catkin_package(
INCLUDE_DIRS include
LIBRARIES ambf_client_cpp
CATKIN_DEPENDS ambf_msgs message_runtime
# DEPENDS system_lib
)

Expand Down
68 changes: 28 additions & 40 deletions ambf_ros_modules/ambf_server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ cmake_minimum_required(VERSION 3.0.2)
project(ambf_server)

## Compile as C++11, supported in ROS Kinetic and newer
add_compile_options(-std=c++11)
add_compile_options(-std=c++11)

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
Expand All @@ -52,9 +52,10 @@ ambf_msgs
tf
message_generation)

catkin_package( INCLUDE_DIRS include
LIBRARIES ambf_obj ambf_world
CATKIN_DEPENDS ambf_msgs message_runtime
catkin_package(
INCLUDE_DIRS include
LIBRARIES ambf_server
CATKIN_DEPENDS ambf_msgs message_runtime
# DEPENDS system_lib
)

Expand All @@ -66,63 +67,50 @@ catkin_package( INCLUDE_DIRS include
## Your package locations should be listed before other locations
include_directories( include ${catkin_INCLUDE_DIRS})

set (OBJ_HDR_FILES
include/${PROJECT_NAME}/Actuator.h
include/${PROJECT_NAME}/Camera.h
include/${PROJECT_NAME}/Light.h
include/${PROJECT_NAME}/Object.h
include/${PROJECT_NAME}/RigidBody.h
include/${PROJECT_NAME}/Sensor.h
include/${PROJECT_NAME}/Vehicle.h
set (HDR_FILES
include/${PROJECT_NAME}/RosComBase.h
include/${PROJECT_NAME}/CmdWatchDog.h
include/${PROJECT_NAME}/Actuator.h
include/${PROJECT_NAME}/ActuatorRosCom.h
include/${PROJECT_NAME}/Camera.h
include/${PROJECT_NAME}/CameraRosCom.h
include/${PROJECT_NAME}/Light.h
include/${PROJECT_NAME}/LightRosCom.h
include/${PROJECT_NAME}/Object.h
include/${PROJECT_NAME}/ObjectRosCom.h
include/${PROJECT_NAME}/RigidBody.h
include/${PROJECT_NAME}/RigidBodyRosCom.h
include/${PROJECT_NAME}/Sensor.h
include/${PROJECT_NAME}/SensorRosCom.h
include/${PROJECT_NAME}/Vehicle.h
include/${PROJECT_NAME}/VehicleRosCom.h
include/${PROJECT_NAME}/CmdWatchDog.h )
include/${PROJECT_NAME}/World.h
include/${PROJECT_NAME}/WorldRosCom.h)

set (OBJ_SRC_FILES
set (SRC_FILES
src/RosComBase.cpp
src/Actuator.cpp
src/Camera.cpp
src/Light.cpp
src/Object.cpp
src/RigidBody.cpp
src/Sensor.cpp
src/Vehicle.cpp
src/ActuatorRosCom.cpp
src/Camera.cpp
src/CameraRosCom.cpp
src/Light.cpp
src/LightRosCom.cpp
src/Object.cpp
src/ObjectRosCom.cpp
src/RigidBody.cpp
src/RigidBodyRosCom.cpp
src/Sensor.cpp
src/SensorRosCom.cpp
src/Vehicle.cpp
src/VehicleRosCom.cpp
src/RosComBase.cpp )


set (WORLD_HDR_FILES
include/${PROJECT_NAME}/World.h
include/${PROJECT_NAME}/RosComBase.h
include/${PROJECT_NAME}/WorldRosCom.h
include/${PROJECT_NAME}/CmdWatchDog.h )

set (WORLD_SRC_FILES
src/World.cpp
src/WorldRosCom.cpp
src/RosComBase.cpp )
)

## Declare a C++ library
add_library(ambf_obj ${OBJ_HDR_FILES} ${OBJ_SRC_FILES})
add_library(ambf_world ${WORLD_HDR_FILES} ${WORLD_SRC_FILES})
add_library(ambf_server ${HDR_FILES} ${SRC_FILES})

add_dependencies(ambf_obj ${catkin_EXPORTED_TARGETS})
add_dependencies(ambf_world ${catkin_EXPORTED_TARGETS})
add_dependencies(ambf_server ${catkin_EXPORTED_TARGETS})

## Specify libraries to link a library or executable target against
target_link_libraries(ambf_obj ${catkin_LIBRARIES})
target_link_libraries(ambf_world ${catkin_LIBRARIES})

set (AMBF_COMM_INCLUDE_DIRS include)
set (AMBF_COMM_LIBRARIES ambf_obj ambf_world)
target_link_libraries(ambf_server ${catkin_LIBRARIES})
2 changes: 1 addition & 1 deletion ambf_simulator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ find_package (Boost COMPONENTS program_options REQUIRED)

add_executable (ambf_simulator src/ambf_simulator.cpp)
#message("AMBF LIBS ARE: " ${AMBF_LIBRARIES})
target_link_libraries (ambf_simulator ${AMBF_LIBRARIES} ${ADF_LOADER_LIBRARIES} ${Boost_LIBRARIES})
target_link_libraries (ambf_simulator ${AMBF_LIBRARIES} ${AMBF_ROS_LIBRARIES} ${ADF_LOADER_LIBRARIES} ${Boost_LIBRARIES})

0 comments on commit c144500

Please sign in to comment.