BCIgui/Masterarbeit/openvibe/extras-master/cmake-modules/FindLibMensiaAdvancedVisualisation.cmake
2021-10-14 13:47:35 +02:00

66 lines
2.1 KiB
CMake

# ---------------------------------
# Finds mensia's advanced visualization toolkit
# Adds library to target
# Adds include path
# ---------------------------------
option(LINK_LIBADVVIZ "By default, link libadvviz, otherwise only use the includes" ON)
option(DYNAMIC_LINK_LIBADVVIZ "Dynamically link libadvviz" OFF)
if(NOT CMAKE_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio*")
set(MULTI_BUILD TRUE)
elseif(CMAKE_BUILD_TYPE AND OV_PACKAGE)
set(SOLO_PACKAGE TRUE)
elseif(CMAKE_BUILD_TYPE)
set(SOLO_BUILD TRUE)
else()
message(FATAL_ERROR "Build should specify a type or use a multi-type generator (like Visual Studio)")
endif()
if(DYNAMIC_LINK_LIBADVVIZ)
message(STATUS "Dynamic linking libadvviz")
set(LIBADVVIZ_LINKING "")
add_definitions(-DADVVIZ_Shared)
if(WIN32)
set(LIB_EXT lib)
elseif(APPLE)
set(LIB_PREFIX "lib")
set(LIB_EXT "dylib")
elseif(UNIX)
set(LIB_PREFIX "lib")
set(LIB_EXT "so")
endif()
else()
message(STATUS "Static linking libadvviz")
set(LIBADVVIZ_LINKING "-static")
add_definitions(-DADVVIZ_Static)
if(WIN32)
set(LIB_EXT lib)
elseif(UNIX)
set(LIB_PREFIX "lib")
set(LIB_EXT "a")
endif()
endif()
# set(PATH_LIBADVVIZ "PATH_LIBADVVIZ-NOTFOUND")
if(MULTI_BUILD)
# set(DESIGNER_SDK_PATH ${DESIGNER_SDK_PATH}/$<UPPER_CASE:$<CONFIG>>)
set(PATH_LIBADVVIZ ${DESIGNER_SDK_PATH}/include)
else()
find_path(PATH_LIBADVVIZ mensia/ PATHS ${DESIGNER_SDK_PATH}/include/ NO_DEFAULT_PATH)
endif()
if(PATH_LIBADVVIZ)
message(STATUS " Found libadvviz... ${PATH_LIBADVVIZ}")
include_directories(${PATH_LIBADVVIZ}/)
if(LINK_LIBADVVIZ)
# find_library(PATH libadvviz${LIBADVVIZ_LINKING} PATHS ${DESIGNER_SDK_PATH}/lib NO_DEFAULT_PATH)
# set(VISUALIZATION_TOOLKIT_LIBRARY ${DESIGNER_SDK_PATH}/lib/${LIB_PREFIX}libadvviz${LIBADVVIZ_LINKING}.${LIB_EXT})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${PATH_LIBADVVIZ}/../lib/${LIB_PREFIX}mensia-advanced-visualization${LIBADVVIZ_LINKING}.${LIB_EXT})
endif()
add_definitions(-DTARGET_HAS_LibAdvancedVisualization)
else()
message(WARNING " FAILED to find libadvviz... [${PATH_LIBADVVIZ}]")
endif()