Skip to content
Snippets Groups Projects
Commit 10e8f45b authored by Jan Müller's avatar Jan Müller
Browse files

Merge branch 'feature/#1_Add_VTK_Demo' into 'master'

Feature/#1 add vtk demo

See merge request VR-Group/nest-streaming-module!1
parents 3e73e539 9b934656
Branches
No related tags found
2 merge requests!3Feature/#7 remove conan,!1Feature/#1 add vtk demo
Showing
with 1455 additions and 2 deletions
......@@ -296,6 +296,26 @@ if ( NOT CMAKE_CROSSCOMPILING )
)
endif ()
#--------------------------------------------------------------------
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include(ConanHelpers)
include(CTest)
include(GenerateExportHeader)
include(rwthvr)
enable_testing()
conan_or_find_package(catch REQUIRED)
conan_or_find_package(contra REQUIRED)
conan_or_find_package(nesci REQUIRED)
conan_or_find_package(cpplint REQUIRED)
include(cpplint)
conan_or_find_package(cppcheck REQUIRED)
include(cppcheck)
add_subdirectory(demos)
#--------------------------------------------------------------------
message( "" )
message( "-------------------------------------------------------" )
......
set noparent
filter=-readability/check,-build/c++tr1,-build/c++11,-build/c++14
linelength=80
headers=h,hpp
#-------------------------------------------------------------------------------
# nest-streaming-module
#
# Copyright (c) 2018 RWTH Aachen University, Germany,
# Virtual Reality & Immersive Visualization Group.
#-------------------------------------------------------------------------------
# License
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#-------------------------------------------------------------------------------
#download/build the missing dependencies
include(conan)
execute_process(COMMAND conan remote add bincrafters https://api.bintray.com/conan/bincrafters/public-conan False OUTPUT_QUIET)
execute_process(COMMAND conan remote add rwth-vr https://api.bintray.com/conan/rwth-vr/conan False OUTPUT_QUIET)
conan_cmake_run(CONANFILE conanfile.py
BUILD missing)
find_file(CONAN_COMMAND
NAMES conan conan.exe
PATHS ENV PATH ENV CONAN_DIR
)
if(CONAN_COMMAND)
option(USE_CONAN "Use conan for dependency managment." ON)
else()
message(STATUS
" NOTICE:\n"
" This project can use conan for dependency management.\n"
" Apparently, you do not have conan installed on your machine.\n"
" So you need to keep track of all dependencies.\n"
" In order to use conan, please install it:\n"
" pip install conan\n"
" More info: https://conan.io"
)
endif()
#we reset CONAN_BUILD_INFO, so it is searched everytime, e.g. if we want to change from multi to a specific config
set (CONAN_BUILD_INFO "CONAN_BUILD_INFO-NOTFOUND")
find_file(CONAN_BUILD_INFO conanbuildinfo_multi.cmake
NO_DEFAULT_PATH
PATHS ${CMAKE_BINARY_DIR}
)
if(${CONAN_BUILD_INFO} STREQUAL "CONAN_BUILD_INFO-NOTFOUND")
find_file(CONAN_BUILD_INFO conanbuildinfo.cmake
NO_DEFAULT_PATH
PATHS ${CMAKE_BINARY_DIR}
)
if(NOT ${CONAN_BUILD_INFO} STREQUAL "CONAN_BUILD_INFO-NOTFOUND")
set( USE_NOT_MULTI_CONAN_BUILD_INFO TRUE)
endif()
endif()
if(USE_CONAN AND NOT CONAN_BUILD_INFO)
message(FATAL_ERROR
" Error using conan:\n"
" You need to execute 'conan install' before running cmake!\n"
" Aborting.")
endif()
if(USE_CONAN AND CONAN_BUILD_INFO)
include(${CONAN_BUILD_INFO})
if(USE_NOT_MULTI_CONAN_BUILD_INFO)
conan_basic_setup(TARGETS NO_OUTPUT_DIRS KEEP_RPATHS)
else()
conan_basic_setup(TARGETS KEEP_RPATHS)
endif()
endif()
macro(CONAN_OR_FIND_PACKAGE package)
# parse arguments
set(options)
set(oneValueArgs CONAN_NAME)
set(multiValueArgs)
cmake_parse_arguments(CONAN_OR_FIND_PACKAGE
"${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
string(REPLACE ";" " " ADDITIONAL_PARAMS "${CONAN_OR_FIND_PACKAGE_UNPARSED_ARGUMENTS}")
# set default conan target name if CONAN_NAME was not specified
if(CONAN_OR_FIND_PACKAGE_CONAN_NAME)
set(CONAN_PACKAGE_NAME CONAN_PKG::${CONAN_OR_FIND_PACKAGE_CONAN_NAME})
else()
set(CONAN_PACKAGE_NAME CONAN_PKG::${package})
endif()
# set target variable to be used in target_link_libraries accordingly
option(USE_CONAN_${package} "Use conan for dependency ${package}" ${USE_CONAN})
string(REPLACE "." "_"
package_underscored
${package}
)
if(USE_CONAN AND USE_CONAN_${package})
set(CONAN_OR_CMAKE_${package_underscored} ${CONAN_PACKAGE_NAME})
else()
find_package(${package} ${ADDITIONAL_PARAMS})
set(CONAN_OR_CMAKE_${package_underscored} ${package})
endif()
endmacro()
###############################################################################
# Copyright (c) 2014-2017, Lawrence Livermore National Security, LLC.
#
# Produced at the Lawrence Livermore National Laboratory
#
# LLNL-CODE-666778
#
# All rights reserved.
#
# This file is part of Conduit.
#
# For details, see https://lc.llnl.gov/conduit/.
#
# Please also read conduit/LICENSE
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the disclaimer below.
#
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the disclaimer (as noted below) in the
# documentation and/or other materials provided with the distribution.
#
# * Neither the name of the LLNS/LLNL nor the names of its contributors may
# be used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL SECURITY,
# LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
###############################################################################
#
# Setup Conduit
#
###############################################################################
#
# Expects CONDUIT_DIR to point to a Conduit installations.
#
# This file defines the following CMake variables:
# CONDUIT_FOUND - If Conduit was found
# CONDUIT_INCLUDE_DIRS - The Conduit include directories
#
# If found, the conduit CMake targets will also be imported.
# The main conduit library targets are:
# conduit
# conduit_relay
# conduit_relay_mpi (if conduit was built with mpi support)
# conduit_blueprint
#
###############################################################################
###############################################################################
# Check for CONDUIT_DIR
###############################################################################
if(NOT CONDUIT_DIR)
MESSAGE(FATAL_ERROR "Could not find Conduit. Conduit requires explicit CONDUIT_DIR.")
endif()
if(NOT EXISTS ${CONDUIT_DIR}/lib/cmake/conduit.cmake)
MESSAGE(FATAL_ERROR "Could not find Conduit CMake include file (${CONDUIT_DIR}/lib/cmake/conduit.cmake)")
endif()
###############################################################################
# Import Conduit's CMake targets
###############################################################################
include(${CONDUIT_DIR}/lib/cmake/conduit.cmake)
###############################################################################
# Set remaning CMake variables
###############################################################################
# we found Conduit
set(CONDUIT_FOUND TRUE)
# provide location of the headers in CONDUIT_INCLUDE_DIRS
set(CONDUIT_INCLUDE_DIRS ${CONDUIT_DIR}/include/conduit)
#-------------------------------------------------------------------------------
# nest-streaming-module
#
# Copyright (c) 2018 RWTH Aachen University, Germany,
# Virtual Reality & Immersive Visualization Group.
#-------------------------------------------------------------------------------
# License
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#-------------------------------------------------------------------------------
# flags for default warning levels
set(WARNING_LEVELS_RWTH_CLANG
-Werror
-Weverything
-pedantic
-pedantic-errors
-Wextra-tokens
-Wambiguous-member-template
-Wbind-to-temporary-copy
-Wno-c++98-compat
-Wno-c++98-compat-pedantic
-Wno-weak-vtables
-Wno-exit-time-destructors
-Wno-global-constructors
-Wno-float-equal
-Wno-shadow-field-in-constructor
)
set(WARNING_LEVELS_RWTH_GCC
-Werror
-Wall
-Wextra
-Wmissing-braces
-pedantic
-pedantic-errors
-Wno-c++98-compat
)
set(WARNING_LEVELS_RWTH_MSVC
-D_SCL_SECURE_NO_WARNINGS
-WX
-W4
"$<$<CXX_COMPILER_ID:MSVC>:/w34062>"
"$<$<CXX_COMPILER_ID:MSVC>:/w24302>"
"$<$<CXX_COMPILER_ID:MSVC>:/w14311>"
"$<$<CXX_COMPILER_ID:MSVC>:/w14312>"
)
# compiler identification
if(CMAKE_C_COMPILER_ID MATCHES "Clang" AND
CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(IS_CLANG 1)
elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC" AND
CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
set(IS_MSVC 1)
elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" AND
CMAKE_CXX_COMPILER_ID MATCHES "GNU")
set(IS_GCC 1)
endif()
# warning level setter macros
macro(SET_WARNING_LEVELS_RWTH TARGET)
set(options)
set(oneValueArgs SUPPRESS_WARNINGS_HEADER)
set(multiValueArgs)
cmake_parse_arguments(SWLR
"${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if (SWLR_SUPPRESS_WARNINGS_HEADER)
set(SUPPRESS_WARNING_HEADER_FILE ${SWLR_SUPPRESS_WARNINGS_HEADER})
else()
set(SUPPRESS_WARNING_HEADER_FILE ${CMAKE_CURRENT_BINARY_DIR}/${target}/suppress_warnings.hpp)
endif()
find_file(SUPPRESS_WARNING_HEADER_TEMPLATE suppress_warnings.hpp.in
NO_DEFAULT_PATH
PATHS ${CMAKE_MODULE_PATH}
)
configure_file(${SUPPRESS_WARNING_HEADER_TEMPLATE} ${SUPPRESS_WARNING_HEADER_FILE})
if(IS_CLANG)
target_compile_options(${TARGET} PRIVATE ${WARNING_LEVELS_RWTH_CLANG})
elseif(IS_GCC)
target_compile_options(${TARGET} PRIVATE ${WARNING_LEVELS_RWTH_GCC})
elseif(IS_MSVC)
target_compile_options(${TARGET} PRIVATE ${WARNING_LEVELS_RWTH_MSVC})
else()
message(WARNING "SET_WARNING_LEVELS_RWTH not implemented for your compiler. "
"Implement it to support our no-warning policy.")
endif()
endmacro()
# copied from https://github.com/conan-io/cmake-conan
# which should be under MIT license
include(CMakeParseArguments)
function(_get_msvc_ide_version result)
set(${result} "" PARENT_SCOPE)
if(NOT MSVC_VERSION VERSION_LESS 1400 AND MSVC_VERSION VERSION_LESS 1500)
set(${result} 8 PARENT_SCOPE)
elseif(NOT MSVC_VERSION VERSION_LESS 1500 AND MSVC_VERSION VERSION_LESS 1600)
set(${result} 9 PARENT_SCOPE)
elseif(NOT MSVC_VERSION VERSION_LESS 1600 AND MSVC_VERSION VERSION_LESS 1700)
set(${result} 10 PARENT_SCOPE)
elseif(NOT MSVC_VERSION VERSION_LESS 1700 AND MSVC_VERSION VERSION_LESS 1800)
set(${result} 11 PARENT_SCOPE)
elseif(NOT MSVC_VERSION VERSION_LESS 1800 AND MSVC_VERSION VERSION_LESS 1900)
set(${result} 12 PARENT_SCOPE)
elseif(NOT MSVC_VERSION VERSION_LESS 1900 AND MSVC_VERSION VERSION_LESS 1910)
set(${result} 14 PARENT_SCOPE)
elseif(NOT MSVC_VERSION VERSION_LESS 1910 AND MSVC_VERSION VERSION_LESS 1920)
set(${result} 15 PARENT_SCOPE)
else()
message(FATAL_ERROR "Conan: Unknown MSVC compiler version [${MSVC_VERSION}]")
endif()
endfunction()
function(conan_cmake_settings result)
#message(STATUS "COMPILER " ${CMAKE_CXX_COMPILER})
#message(STATUS "COMPILER " ${CMAKE_CXX_COMPILER_ID})
#message(STATUS "VERSION " ${CMAKE_CXX_COMPILER_VERSION})
#message(STATUS "FLAGS " ${CMAKE_LANG_FLAGS})
#message(STATUS "LIB ARCH " ${CMAKE_CXX_LIBRARY_ARCHITECTURE})
#message(STATUS "BUILD TYPE " ${CMAKE_BUILD_TYPE})
#message(STATUS "GENERATOR " ${CMAKE_GENERATOR})
#message(STATUS "GENERATOR WIN64 " ${CMAKE_CL_64})
message(STATUS "Conan ** WARNING** : This detection of settings from cmake is experimental and incomplete. "
"Please check 'conan.cmake' and contribute")
if(CONAN_CMAKE_MULTI)
set(_SETTINGS -g cmake_multi)
else()
set(_SETTINGS -g cmake)
endif()
if(CMAKE_BUILD_TYPE)
set(_SETTINGS ${_SETTINGS} -s build_type=${CMAKE_BUILD_TYPE})
else()
message(FATAL_ERROR "Please specify in command line CMAKE_BUILD_TYPE (-DCMAKE_BUILD_TYPE=Release)")
endif()
#handle -s os setting
if(CMAKE_SYSTEM_NAME)
#use default conan os setting if CMAKE_SYSTEM_NAME is not defined
set(CONAN_SYSTEM_NAME ${CMAKE_SYSTEM_NAME})
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
set(CONAN_SYSTEM_NAME Macos)
endif()
set(CONAN_SUPPORTED_PLATFORMS Windows Linux Macos Android iOS FreeBSD)
list (FIND CONAN_SUPPORTED_PLATFORMS "${CONAN_SYSTEM_NAME}" _index)
if (${_index} GREATER -1)
#check if the cmake system is a conan supported one
set(_SETTINGS ${_SETTINGS} -s os=${CONAN_SYSTEM_NAME})
else()
message(FATAL_ERROR "cmake system ${CONAN_SYSTEM_NAME} is not supported by conan. Use one of ${CONAN_SUPPORTED_PLATFORMS}")
endif()
endif()
get_property(_languages GLOBAL PROPERTY ENABLED_LANGUAGES)
if (";${_languages};" MATCHES ";CXX;")
set(LANGUAGE CXX)
set(USING_CXX 1)
elseif (";${_languages};" MATCHES ";C;")
set(LANGUAGE C)
set(USING_CXX 0)
else ()
message(FATAL_ERROR "Conan: Neither C or C++ was detected as a language for the project. Unabled to detect compiler version.")
endif()
if (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL GNU)
# using GCC
# TODO: Handle other params
string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION})
list(GET VERSION_LIST 0 MAJOR)
list(GET VERSION_LIST 1 MINOR)
set(COMPILER_VERSION ${MAJOR}.${MINOR})
set(_SETTINGS ${_SETTINGS} -s compiler=gcc -s compiler.version=${COMPILER_VERSION})
if (USING_CXX)
conan_cmake_detect_gnu_libcxx(_LIBCXX)
set(_SETTINGS ${_SETTINGS} -s compiler.libcxx=${_LIBCXX})
endif ()
elseif (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL AppleClang)
# using AppleClang
string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION})
list(GET VERSION_LIST 0 MAJOR)
list(GET VERSION_LIST 1 MINOR)
set(_SETTINGS ${_SETTINGS} -s compiler=apple-clang -s compiler.version=${MAJOR}.${MINOR})
if (USING_CXX)
set(_SETTINGS ${_SETTINGS} -s compiler.libcxx=libc++)
endif ()
elseif (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL Clang)
string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION})
list(GET VERSION_LIST 0 MAJOR)
list(GET VERSION_LIST 1 MINOR)
if(APPLE)
cmake_policy(GET CMP0025 APPLE_CLANG_POLICY_ENABLED)
if(NOT APPLE_CLANG_POLICY_ENABLED)
message(STATUS "Conan: APPLE and Clang detected. Assuming apple-clang compiler. Set CMP0025 to avoid it")
set(_SETTINGS ${_SETTINGS} -s compiler=apple-clang -s compiler.version=${MAJOR}.${MINOR})
else()
set(_SETTINGS ${_SETTINGS} -s compiler=clang -s compiler.version=${MAJOR}.${MINOR})
endif()
if (USING_CXX)
set(_SETTINGS ${_SETTINGS} -s compiler.libcxx=libc++)
endif ()
else()
set(_SETTINGS ${_SETTINGS} -s compiler=clang -s compiler.version=${MAJOR}.${MINOR})
if (USING_CXX)
conan_cmake_detect_gnu_libcxx(_LIBCXX)
set(_SETTINGS ${_SETTINGS} -s compiler.libcxx=${_LIBCXX})
endif ()
endif()
elseif(${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL MSVC)
set(_VISUAL "Visual Studio")
_get_msvc_ide_version(_VISUAL_VERSION)
if("${_VISUAL_VERSION}" STREQUAL "")
message(FATAL_ERROR "Conan: Visual Studio not recognized")
else()
set(_SETTINGS ${_SETTINGS} -s compiler=${_VISUAL} -s compiler.version=${_VISUAL_VERSION})
endif()
if (MSVC_${LANGUAGE}_ARCHITECTURE_ID MATCHES "64")
set(_SETTINGS ${_SETTINGS} -s arch=x86_64)
elseif (MSVC_${LANGUAGE}_ARCHITECTURE_ID MATCHES "^ARM")
message(STATUS "Conan: Using default ARM architecture from MSVC")
set(_SETTINGS ${_SETTINGS} -s arch=armv6)
elseif (MSVC_${LANGUAGE}_ARCHITECTURE_ID MATCHES "86")
set(_SETTINGS ${_SETTINGS} -s arch=x86)
else ()
message(FATAL_ERROR "Conan: Unknown MSVC architecture [${MSVC_${LANGUAGE}_ARCHITECTURE_ID}]")
endif()
conan_cmake_detect_vs_runtime(_vs_runtime)
message(STATUS "Detected VS runtime: ${_vs_runtime}")
set(_SETTINGS ${_SETTINGS} -s compiler.runtime=${_vs_runtime})
else()
message(FATAL_ERROR "Conan: compiler setup not recognized")
endif()
set(${result} ${_SETTINGS} PARENT_SCOPE)
endfunction()
function(conan_cmake_detect_gnu_libcxx result)
# Allow -D_GLIBCXX_USE_CXX11_ABI=ON/OFF as argument to cmake
if(DEFINED _GLIBCXX_USE_CXX11_ABI)
if(_GLIBCXX_USE_CXX11_ABI)
set(${result} libstdc++11 PARENT_SCOPE)
return()
else()
set(${result} libstdc++ PARENT_SCOPE)
return()
endif()
endif()
# Check if there's any add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
get_directory_property(defines DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_DEFINITIONS)
foreach(define ${defines})
if(define STREQUAL "_GLIBCXX_USE_CXX11_ABI=0")
set(${result} libstdc++ PARENT_SCOPE)
return()
endif()
endforeach()
# Use C++11 stdlib as default if gcc is 5.1+
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.1")
set(${result} libstdc++ PARENT_SCOPE)
else()
set(${result} libstdc++11 PARENT_SCOPE)
endif()
endfunction()
function(conan_cmake_detect_vs_runtime result)
string(TOUPPER ${CMAKE_BUILD_TYPE} build_type)
set(variables CMAKE_CXX_FLAGS_${build_type} CMAKE_C_FLAGS_${build_type} CMAKE_CXX_FLAGS CMAKE_C_FLAGS)
foreach(variable ${variables})
string(REPLACE " " ";" flags ${${variable}})
foreach (flag ${flags})
if(${flag} STREQUAL "/MD" OR ${flag} STREQUAL "/MDd" OR ${flag} STREQUAL "/MT" OR ${flag} STREQUAL "/MTd")
string(SUBSTRING ${flag} 1 -1 runtime)
set(${result} ${runtime} PARENT_SCOPE)
return()
endif()
endforeach()
endforeach()
if(${build_type} STREQUAL "DEBUG")
set(${result} "MDd" PARENT_SCOPE)
else()
set(${result} "MD" PARENT_SCOPE)
endif()
endfunction()
macro(parse_arguments)
set(options BASIC_SETUP CMAKE_TARGETS UPDATE KEEP_RPATHS)
set(oneValueArgs CONANFILE DEBUG_PROFILE RELEASE_PROFILE PROFILE)
set(multiValueArgs REQUIRES OPTIONS IMPORTS BUILD CONAN_COMMAND)
cmake_parse_arguments(ARGUMENTS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
endmacro()
function(conan_cmake_install)
# Calls "conan install"
# Argument BUILD is equivalant to --build={missing, PkgName,...} or
# --build when argument is 'BUILD all' (which builds all packages from source)
# Argument CONAN_COMMAND, to specify the conan path, e.g. in case of running from source
# cmake does not identify conan as command, even if it is +x and it is in the path
parse_arguments(${ARGV})
set(CONAN_BUILD_POLICY "")
foreach(ARG ${ARGUMENTS_BUILD})
if(${ARG} STREQUAL "all")
set(CONAN_BUILD_POLICY ${CONAN_BUILD_POLICY} --build)
break()
else()
set(CONAN_BUILD_POLICY ${CONAN_BUILD_POLICY} --build=${ARG})
endif()
endforeach()
if(ARGUMENTS_CONAN_COMMAND)
set(conan_command ${ARGUMENTS_CONAN_COMMAND})
else()
set(conan_command conan)
endif()
set(CONAN_OPTIONS "")
if(ARGUMENTS_CONANFILE)
set(CONANFILE ${CMAKE_CURRENT_SOURCE_DIR}/${ARGUMENTS_CONANFILE})
# A conan file has been specified - apply specified options as well if provided
foreach(ARG ${ARGUMENTS_OPTIONS})
set(CONAN_OPTIONS ${CONAN_OPTIONS} -o ${ARG})
endforeach()
else()
set(CONANFILE ".")
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Debug" AND ARGUMENTS_DEBUG_PROFILE)
set(settings -pr ${ARGUMENTS_DEBUG_PROFILE})
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Release" AND ARGUMENTS_RELEASE_PROFILE)
set(settings -pr ${ARGUMENTS_RELEASE_PROFILE})
endif()
if(ARGUMENTS_PROFILE)
set(settings -pr ${ARGUMENTS_PROFILE})
endif()
if(ARGUMENTS_UPDATE)
set(CONAN_INSTALL_UPDATE --update)
endif()
set(conan_args install ${CONANFILE} ${settings} ${CONAN_BUILD_POLICY} ${CONAN_INSTALL_UPDATE} ${CONAN_OPTIONS})
string (REPLACE ";" " " _conan_args "${conan_args}")
message(STATUS "Conan executing: ${conan_command} ${_conan_args}")
execute_process(COMMAND ${conan_command} ${conan_args}
RESULT_VARIABLE return_code
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
if(NOT "${return_code}" STREQUAL "0")
message(FATAL_ERROR "Conan install failed='${return_code}'")
endif()
endfunction()
function(conan_cmake_setup_conanfile)
parse_arguments(${ARGV})
if(ARGUMENTS_CONANFILE)
# configure_file will make sure cmake re-runs when conanfile is updated
configure_file(${ARGUMENTS_CONANFILE} ${ARGUMENTS_CONANFILE}.junk)
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/${ARGUMENTS_CONANFILE}.junk)
else()
conan_cmake_generate_conanfile(${ARGV})
endif()
endfunction()
function(conan_cmake_generate_conanfile)
# Generate, writing in disk a conanfile.txt with the requires, options, and imports
# specified as arguments
# This will be considered as temporary file, generated in CMAKE_CURRENT_BINARY_DIR)
parse_arguments(${ARGV})
set(_FN "${CMAKE_CURRENT_BINARY_DIR}/conanfile.txt")
file(WRITE ${_FN} "[generators]\ncmake\n\n[requires]\n")
foreach(ARG ${ARGUMENTS_REQUIRES})
file(APPEND ${_FN} ${ARG} "\n")
endforeach()
file(APPEND ${_FN} ${ARG} "\n[options]\n")
foreach(ARG ${ARGUMENTS_OPTIONS})
file(APPEND ${_FN} ${ARG} "\n")
endforeach()
file(APPEND ${_FN} ${ARG} "\n[imports]\n")
foreach(ARG ${ARGUMENTS_IMPORTS})
file(APPEND ${_FN} ${ARG} "\n")
endforeach()
endfunction()
macro(conan_load_buildinfo)
if(CONAN_CMAKE_MULTI)
set(_CONANBUILDINFO conanbuildinfo_multi.cmake)
else()
set(_CONANBUILDINFO conanbuildinfo.cmake)
endif()
# Checks for the existence of conanbuildinfo.cmake, and loads it
# important that it is macro, so variables defined at parent scope
if(EXISTS "${CMAKE_CURRENT_BINARY_DIR}/${_CONANBUILDINFO}")
message(STATUS "Conan: Loading ${_CONANBUILDINFO}")
include(${CMAKE_CURRENT_BINARY_DIR}/${_CONANBUILDINFO})
else()
message(FATAL_ERROR "${_CONANBUILDINFO} doesn't exist in ${CMAKE_CURRENT_BINARY_DIR}")
endif()
endmacro()
macro(conan_cmake_run)
parse_arguments(${ARGV})
if(CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE AND NOT CONAN_EXPORTED)
set(CONAN_CMAKE_MULTI ON)
message(STATUS "Conan: Using cmake-multi generator")
else()
set(CONAN_CMAKE_MULTI OFF)
endif()
if(NOT CONAN_EXPORTED)
conan_cmake_setup_conanfile(${ARGV})
if(CONAN_CMAKE_MULTI)
foreach(CMAKE_BUILD_TYPE "Release" "Debug")
conan_cmake_settings(settings)
conan_cmake_install(SETTINGS ${settings} ${ARGV})
endforeach()
set(CMAKE_BUILD_TYPE)
else()
conan_cmake_settings(settings)
conan_cmake_install(SETTINGS ${settings} ${ARGV})
endif()
endif()
conan_load_buildinfo()
if(ARGUMENTS_BASIC_SETUP)
if(ARGUMENTS_CMAKE_TARGETS)
if(ARGUMENTS_KEEP_RPATHS)
conan_basic_setup(TARGETS KEEP_RPATHS)
else()
conan_basic_setup(TARGETS)
endif()
else()
if(ARGUMENTS_KEEP_RPATHS)
conan_basic_setup(KEEP_RPATHS)
else()
conan_basic_setup()
endif()
endif()
endif()
endmacro()
#-------------------------------------------------------------------------------
# nest-streaming-module
#
# Copyright (c) 2018 RWTH Aachen University, Germany,
# Virtual Reality & Immersive Visualization Group.
#-------------------------------------------------------------------------------
# License
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#-------------------------------------------------------------------------------
include(get_target_include_directories)
set(CPPCHECK_COMMAND NOTFOUND)
find_program(CPPCHECK_COMMAND NAMES cppcheck cppcheck.exe
PATHS ${CONAN_BIN_DIRS_CPPCHECK} ${CONAN_BIN_DIRS_CPPCHECK_RELEASE}
$ENV{PATH} $ENV{CPPCHECK_DIR})
if(NOT CPPCHECK_COMMAND)
message(SEND_ERROR
" ERROR: Could not find cppcheck.
Having cppcheck is a mandatory requirement.
CMake will not generate the project without it.
Add its location to the environments variables PATH or CPPCHECK_DIR.
However, this should normally be supplied by conan!")
else()
message(STATUS "Use cppcheck from: ${CPPCHECK_COMMAND}")
endif()
set(CPPCHECK_ARGUMENTS --enable=warning,performance,portability,missingInclude,style --suppress=missingIncludeSystem --error-exitcode=1)
if(MSVC)
list(APPEND CPPCHECK_ARGUMENTS --template=vs)
elseif(CLANG)
list(APPEND CPPCHECK_ARGUMENTS --template=clang)
elseif(GCC)
list(APPEND CPPCHECK_ARGUMENTS --template=gcc)
endif()
function(ADD_TEST_CPPCHECK)
set(options)
set(oneValueArgs TARGET)
set(multiValueArgs)
cmake_parse_arguments(ARGS
"${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
get_target_property(SOURCES ${ARGS_TARGET} SOURCES)
get_target_include_directories(INCLUDE_DIRECTORIES TARGET ${ARGS_TARGET})
set(INCLUDE_DIRECTORIES_PARAMETERS "")
foreach(VAL ${INCLUDE_DIRECTORIES})
set(INCLUDE_DIRECTORIES_PARAMETERS ${INCLUDE_DIRECTORIES_PARAMETERS};-I;${VAL})
endforeach(VAL ${INCLUDE_DIRECTORIES})
add_test(NAME "${ARGS_TARGET}--cppcheck"
COMMAND "${CPPCHECK_COMMAND}" ${CPPCHECK_ARGUMENTS} ${SOURCES} ${INCLUDE_DIRECTORIES_PARAMETERS})
set_tests_properties(${ARGS_NAME} PROPERTIES TIMEOUT 20.0)
endfunction()
#-------------------------------------------------------------------------------
# nest-streaming-module
#
# Copyright (c) 2018 RWTH Aachen University, Germany,
# Virtual Reality & Immersive Visualization Group.
#-------------------------------------------------------------------------------
# License
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#-------------------------------------------------------------------------------
find_package(PythonInterp 2.7 REQUIRED)
if(NOT PYTHON_EXECUTABLE)
message(SEND_ERROR
" ERROR: Could not find any python interpreter.
Having a python interpreter is a mandatory requirement for cpplint.
CMake will not generate the project without it. ")
endif()
if(NOT (PYTHON_VERSION_MAJOR EQUAL 2 AND PYTHON_VERSION_MINOR EQUAL 7))
message(SEND_ERROR
" ERROR: Did not find python 2.7.
Having python 2.7 is a mandatory requirement for cpplint.
CMake will not generate the project without it. ")
endif()
set(CONAN_CPPLINT_DIR)
if(TARGET CONAN_PKG::cpplint)
get_property(CONAN_CPPLINT_DIR
TARGET CONAN_PKG::cpplint
PROPERTY INTERFACE_INCLUDE_DIRECTORIES
)
else()
message("No cpplint found through conan, trying to find an installed one on the system")
endif()
set(CPPLINT_COMMAND NOTFOUND)
#this find_file also uses the direct CONAN_INCLUDE_DIRS to avoid generator expressions, furthermore the release one for multi config
find_file(CPPLINT_COMMAND cpplint.py
PATHS ${CONAN_CPPLINT_DIR} ${CONAN_INCLUDE_DIRS_CPPLINT} ${CONAN_INCLUDE_DIRS_CPPLINT_RELEASE}
$ENV{PATH} $ENV{CPPLINT_DIR}
)
if(NOT CPPLINT_COMMAND)
message(SEND_ERROR
" ERROR: Could not find cpplint.py.
Having cpplint.py is a mandatory requirement.
CMake will not generate the project without it.
Add its location to the environments variables PATH or CPPLINT_DIR.")
else()
message(STATUS "Using cpplint from: ${CPPLINT_COMMAND}")
endif()
function(ADD_TEST_CPPLINT)
set(options )
set(oneValueArgs NAME)
set(multiValueArgs )
cmake_parse_arguments(ADD_TEST_CPPLINT
"${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
set(CPPLINT_ARGS "--quiet")
if(MSVC)
set(CPPLINT_OUTPUT "--output=vs7")
else()
set(CPPLINT_OUTPUT "")
endif()
add_test(NAME "${ADD_TEST_CPPLINT_NAME}"
COMMAND ${PYTHON_EXECUTABLE} ${CPPLINT_COMMAND} ${CPPLINT_OUTPUT} ${CPPLINT_ARGS}
${ADD_TEST_CPPLINT_UNPARSED_ARGUMENTS}
)
set_tests_properties(${ADD_TEST_CPPLINT_NAME} PROPERTIES TIMEOUT 20.0)
endfunction()
function(get_target_include_directories VAR)
set(options)
set(oneValueArgs TARGET)
set(multiValueArgs)
cmake_parse_arguments(ARGS
"${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if (TARGET ${ARGS_TARGET})
# message("${ARGS_TARGET}")
get_target_property(IS_IMPORTED ${ARGS_TARGET} IMPORTED)
# message("imported: ${IS_IMPORTED}")
if (${IS_IMPORTED})
# get_target_property(INCLUDE_DIRECTORIES ${ARGS_TARGET} INTERFACE_INCLUDE_DIRECTORIES)
else (${IS_IMPORTED})
get_target_property(INCLUDE_DIRECTORIES ${ARGS_TARGET} INCLUDE_DIRECTORIES)
get_target_property(LINK_LIBRARIES ${ARGS_TARGET} LINK_LIBRARIES)
foreach(LIB ${LINK_LIBRARIES})
get_target_include_directories(LIB_INCLUDE_DIRECTORIES TARGET ${LIB})
if (${LIB_INCLUDE_DIRECTORIES})
set(INCLUDE_DIRECTORIES ${INCLUDE_DIRECTORIES} ${LIB_INCLUDE_DIRECTORIES})
endif (${LIB_INCLUDE_DIRECTORIES})
endforeach(LIB ${LINK_LIBRARIES})
endif(${IS_IMPORTED})
else (TARGET ${ARGS_TARGET})
set(INCLUDE_DIRECTORIES "")
endif (TARGET ${ARGS_TARGET})
if (${INCLUDE_DIRECTORIES})
set(${VAR} ${INCLUDE_DIRECTORIES} PARENT_SCOPE)
endif (${INCLUDE_DIRECTORIES})
endfunction(get_target_include_directories)
\ No newline at end of file
#-------------------------------------------------------------------------------
# nest-streaming-module
#
# Copyright (c) 2018 RWTH Aachen University, Germany,
# Virtual Reality & Immersive Visualization Group.
#-------------------------------------------------------------------------------
# License
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#-------------------------------------------------------------------------------
include(WarningLevels)
macro(RWTHVR_ADD_LIBRARY)
set(options)
set(oneValueArgs NAME SUPPRESS_WARNINGS_HEADER)
set(multiValueArgs SOURCES HEADERS)
cmake_parse_arguments(RWTHVR_ADD_LIBRARY_
"${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
add_library(${RWTHVR_ADD_LIBRARY__NAME}
${RWTHVR_ADD_LIBRARY__SOURCES}
${RWTHVR_ADD_LIBRARY__HEADERS})
get_property(RWTHVR_ALL_SOURCES GLOBAL PROPERTY RWTHVR_ALL_SOURCES)
set_property(GLOBAL PROPERTY RWTHVR_ALL_SOURCES
${RWTHVR_ALL_SOURCES}
${RWTHVR_ADD_LIBRARY__SOURCES}
)
get_property(RWTHVR_ALL_HEADERS GLOBAL PROPERTY RWTHVR_ALL_HEADERS)
set_property(GLOBAL PROPERTY RWTHVR_ALL_HEADERS
${RWTHVR_ALL_HEADERS}
${RWTHVR_ADD_LIBRARY__HEADERS}
)
set_warning_levels_rwth(${RWTHVR_ADD_LIBRARY__NAME}
SUPPRESS_WARNINGS_HEADER ${RWTHVR_ADD_LIBRARY__SUPPRESS_WARNINGS_HEADER}
)
add_test_cppcheck(TARGET ${RWTHVR_ADD_LIBRARY__NAME})
endmacro()
macro(RWTHVR_ADD_EXECUTABLE)
set(options)
set(oneValueArgs NAME SUPPRESS_WARNINGS_HEADER)
set(multiValueArgs SOURCES HEADERS)
cmake_parse_arguments(RWTHVR_ADD_EXECUTABLE_
"${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
add_executable(${RWTHVR_ADD_EXECUTABLE__NAME}
${RWTHVR_ADD_EXECUTABLE__SOURCES}
${RWTHVR_ADD_EXECUTABLE__HEADERS})
get_property(RWTHVR_ALL_SOURCES GLOBAL PROPERTY RWTHVR_ALL_SOURCES)
set_property(GLOBAL PROPERTY RWTHVR_ALL_SOURCES
${RWTHVR_ALL_SOURCES}
${RWTHVR_ADD_EXECUTABLE__SOURCES}
)
get_property(RWTHVR_ALL_HEADERS GLOBAL PROPERTY RWTHVR_ALL_HEADERS)
set_property(GLOBAL PROPERTY RWTHVR_ALL_HEADERS
${RWTHVR_ALL_HEADERS}
${RWTHVR_ADD_EXECUTABLE__HEADERS}
)
set_warning_levels_rwth(${RWTHVR_ADD_EXECUTABLE__NAME}
SUPPRESS_WARNINGS_HEADER ${RWTHVR_ADD_EXECUTABLE__SUPPRESS_WARNINGS_HEADER}
)
add_test_cppcheck(TARGET ${RWTHVR_ADD_EXECUTABLE__NAME})
endmacro()
//------------------------------------------------------------------------------
// nest-streaming-module
//
// Copyright (c) 2018 RWTH Aachen University, Germany,
// Virtual Reality & Immersive Visualization Group.
//------------------------------------------------------------------------------
// License
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//------------------------------------------------------------------------------
#ifndef NEST_STREAMING_MODULE_SUPPRESS_WARNINGS_
#define NEST_STREAMING_MODULE_SUPPRESS_WARNINGS_
// clang-format off
#if defined __clang__
#define SUPPRESS_WARNINGS_BEGIN \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wall\"") \
_Pragma("clang diagnostic ignored \"-Wextra\"") \
_Pragma("clang diagnostic ignored \"-Wreserved-id-macro\"") \
_Pragma("clang diagnostic ignored \"-Wimplicit-fallthrough\"") \
_Pragma("clang diagnostic ignored \"-Wdocumentation\"") \
_Pragma("clang diagnostic ignored \"-Wdocumentation-unknown-command\"") \
_Pragma("clang diagnostic ignored \"-Wpadded\"") \
_Pragma("clang diagnostic ignored \"-Wpessimizing-move\"") \
_Pragma("clang diagnostic ignored \"-Wunused-parameter\"") \
_Pragma("clang diagnostic ignored \"-Wold-style-cast\"") \
_Pragma("clang diagnostic ignored \"-Wsign-conversion\"") \
_Pragma("clang diagnostic ignored \"-Wnewline-eof\"") \
_Pragma("clang diagnostic ignored \"-Wnon-virtual-dtor\"") \
_Pragma("clang diagnostic ignored \"-Wmissing-prototypes\"") \
_Pragma("clang diagnostic ignored \"-Wextra-semi\"")
#define SUPPRESS_WARNINGS_BEGIN_PADDED \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wpadded\"")
#define SUPPRESS_WARNINGS_END _Pragma("clang diagnostic pop")
#elif defined _MSC_VER
#define SUPPRESS_WARNINGS_BEGIN __pragma(warning(push, 0));
#define SUPPRESS_WARNINGS_BEGIN_PADDED __pragma(warning(push));
#define SUPPRESS_WARNINGS_END __pragma(warning(pop));
#elif defined __GNUC__
#if __GNUC__ >= 7
#define SUPPRESS_WARNINGS_GCC7_AND_ABOVE \
_Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"")
#else
#define SUPPRESS_WARNINGS_GCC7_AND_ABOVE
#endif
#define SUPPRESS_WARNINGS_BEGIN \
_Pragma("GCC diagnostic push") \
SUPPRESS_WARNINGS_GCC7_AND_ABOVE \
_Pragma("GCC diagnostic ignored \"-Wall\"") \
_Pragma("GCC diagnostic ignored \"-Wextra\"") \
_Pragma("GCC diagnostic ignored \"-Wpadded\"")
#define SUPPRESS_WARNINGS_BEGIN_PADDED \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wpadded\"")
#define SUPPRESS_WARNINGS_END _Pragma("GCC diagnostic pop")
#endif
// clang-format on
#endif // NEST_STREAMING_MODULE_SUPPRESS_WARNINGS_
......@@ -27,7 +27,9 @@ class nest(ConanFile):
settings = "os", "compiler", "build_type", "arch"
requires = (("contra/18.05@RWTH-VR/develop"),
("nesci/18.05@RWTH-VR/develop"))
("nesci/18.05@RWTH-VR/develop"),
("Qt/5.11.1@bincrafters/stable"),
("conduit/0.3.1@RWTH-VR/thirdparty"))
generators = "cmake"
def configure(self):
......
#-------------------------------------------------------------------------------
# nest-streaming-module
#
# Copyright (c) 2018 RWTH Aachen University, Germany,
# Virtual Reality & Immersive Visualization Group.
#-------------------------------------------------------------------------------
# License
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#-------------------------------------------------------------------------------
add_subdirectory(QVTK-Demo)
#-------------------------------------------------------------------------------
# nest-streaming-module
#
# Copyright (c) 2018 RWTH Aachen University, Germany,
# Virtual Reality & Immersive Visualization Group.
#-------------------------------------------------------------------------------
# License
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#-------------------------------------------------------------------------------
#add_subdirectory(qvtk-app)
add_subdirectory(qvtk-lib)
#-------------------------------------------------------------------------------
# QVTK-Demo
#
# Copyright (c) 2018 RWTH Aachen University, Germany,
# Virtual Reality & Immersive Visualization Group.
#-------------------------------------------------------------------------------
# License
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#-------------------------------------------------------------------------------
set(CMAKE_AUTOMOC ON)
set(QVTK_DEMO_API_HEADER_DIR include/qvtk-lib)
file(GLOB QVTK_DEMO_SOURCES src/*.cpp)
file(GLOB QVTK_DEMO_HEADERS include/qvtk-lib/*.hpp)
file(GLOB QVTK_DEMO_API_HEADERS ${QVTK_DEMO_API_HEADER_DIR}/*.hpp)
set(QVTK_DEMO_INCLUDE_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}qvtk-lib/include
${PROJECT_BINARY_DIR}
CACHE PATH "Path to public headers in vtk's source tree."
)
rwthvr_add_library(NAME qvtk-lib
SOURCES ${QVTK_DEMO_SOURCES}
HEADERS ${QVTK_DEMO_HEADERS}
SUPPRESS_WARNINGS_HEADER "${CMAKE_CURRENT_BINARY_DIR}/include/contra/qvtk-lib/suppress_warnings.hpp"
)
target_include_directories(qvtk-lib
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC ${CMAKE_CURRENT_BINARY_DIR}
)
generate_export_header(qvtk-lib
EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/include/qvtk-lib/export.hpp
)
add_test_cpplint(NAME "qvtk-lib--cpplint"
${QVTK_DEMO_SOURCES}
${QVTK_DEMO_HEADERS}
)
#generate_configure_files(qvtk-lib)
include_directories(include)
# --- dependencies ---
# VTK
find_package(VTK REQUIRED)
include(${VTK_USE_FILE})
target_include_directories(qvtk-lib PUBLIC ${VTK_INCLUDE_DIR})
target_link_libraries(qvtk-lib debug ${VTK_LIBRARIES} optimized ${VTK_LIBRARIES})
target_include_directories(qvtk-lib PUBLIC
${CONAN_INCLUDE_DIRS}
)
target_link_libraries(qvtk-lib
PUBLIC ${CONAN_OR_CMAKE_conduit}
PUBLIC ${CONAN_OR_CMAKE_Qt}
PUBLIC ${CONAN_OR_CMAKE_nesci}
PUBLIC ${CONAN_OR_CMAKE_contra}
)
//------------------------------------------------------------------------------
// vtkexperiment
//
// Copyright (c) 2017-2018 RWTH Aachen University, Germany,
// Virtual Reality & Immersive Visualisation Group.
//------------------------------------------------------------------------------
// License
//
// This framework is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In the future, we may decide to add a commercial license
// at our own discretion without further notice.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//------------------------------------------------------------------------------
#ifndef VTKEXPERIMENT_INCLUDE_VTKEXPERIMENT_ANIMATE_HPP_
#define VTKEXPERIMENT_INCLUDE_VTKEXPERIMENT_ANIMATE_HPP_
#include "QObject"
#include "QTimer"
#include "include/qvtk-lib/suppress_warnings.hpp"
SUPPRESS_WARNINGS_BEGIN
#include "include/qvtk-lib/point_data.hpp"
SUPPRESS_WARNINGS_END
namespace vtkexp
{
class Animate : public QObject
{
Q_OBJECT
public:
explicit Animate(PointData *points);
~Animate() {}
void StartTimer();
signals:
void DataChanged();
void DataChanged(int time_step);
void NextStep();
void LastStep();
void SwitchRealtime();
void SwitchPlayPause();
public slots: // NOLINT
void ChangeData(int timestep = -1);
void IncreaseSpeed();
void DecreaseSpeed();
void Iterate();
void RealtimeButton();
void PlayButton();
void SpeedMenu(int index);
private:
PointData *points_;
QTimer *rt_timer_;
QTimer *play_timer_;
int play_speed_ = 1000;
};
} // namespace vtkexp
#endif // VTKEXPERIMENT_INCLUDE_VTKEXPERIMENT_ANIMATE_HPP_
//------------------------------------------------------------------------------
// vtkexperiment
//
// Copyright (c) 2017-2018 RWTH Aachen University, Germany,
// Virtual Reality & Immersive Visualisation Group.
//------------------------------------------------------------------------------
// License
//
// This framework is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In the future, we may decide to add a commercial license
// at our own discretion without further notice.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//------------------------------------------------------------------------------
#ifndef VTKEXPERIMENT_INCLUDE_VTKEXPERIMENT_DATA_STREAM_HPP_
#define VTKEXPERIMENT_INCLUDE_VTKEXPERIMENT_DATA_STREAM_HPP_
#include <vector>
#include "conduit/conduit_node.hpp"
#include "contra/relay.hpp"
#include "contra/shared_memory_transport.hpp"
#include "nesci/consumer/nest_multimeter.hpp"
namespace vtkexp {
class DataStream {
public:
DataStream();
~DataStream() {}
std::vector<double> GetMultValuesAt(int time_step);
std::vector<double> GetTimeSteps();
private:
void SetUpStream();
void Update(int time_step);
std::vector<double> mult_values_;
contra::Relay<contra::SharedMemoryTransport>* relay_;
nesci::consumer::NestMultimeter* multimeter_;
conduit::Node node_;
std::vector<conduit::Node> node_vec_;
};
} // namespace vtkexp
#endif // VTKEXPERIMENT_INCLUDE_VTKEXPERIMENT_DATA_STREAM_HPP_
//------------------------------------------------------------------------------
// vtkexperiment
//
// Copyright (c) 2017-2018 RWTH Aachen University, Germany,
// Virtual Reality & Immersive Visualisation Group.
//------------------------------------------------------------------------------
// License
//
// This framework is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In the future, we may decide to add a commercial license
// at our own discretion without further notice.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//------------------------------------------------------------------------------
#ifndef VTKEXPERIMENT_INCLUDE_VTKEXPERIMENT_INTERACTION_HPP_
#define VTKEXPERIMENT_INCLUDE_VTKEXPERIMENT_INTERACTION_HPP_
#include <string>
#include "include/qvtk-lib/suppress_warnings.hpp"
SUPPRESS_WARNINGS_BEGIN
#include <vtkActor.h>
#include <vtkDataSetMapper.h>
#include <vtkMapper.h>
#include <vtkPointGaussianMapper.h>
#include <vtkPointPicker.h>
#include <vtkUnstructuredGrid.h>
#include "vtkInteractorStyleTrackballCamera.h"
#include "vtkPolyData.h"
SUPPRESS_WARNINGS_END
namespace vtkexp
{
class Interaction : public vtkInteractorStyleTrackballCamera
{
public:
static Interaction *New();
vtkTypeMacro(Interaction, vtkInteractorStyleTrackballCamera)
Interaction();
virtual void OnLeftButtonUp();
void SetUpShaders();
void SetUpActor();
void SetUpMapper();
double GetNeuronValue();
vtkIdType GetNeuronId();
void SetData(vtkSmartPointer<vtkPolyData> data);
void SwitchMapper(int rendertype);
void ExtractSelection();
void HighlightSelection();
void Deselect();
void Pick();
private:
double neuron_value_;
vtkIdType id_;
vtkSmartPointer<vtkUnstructuredGrid> selected_;
vtkSmartPointer<vtkPolyData> data_;
vtkSmartPointer<vtkActor> actor_;
vtkSmartPointer<vtkPointGaussianMapper> mapper_;
vtkSmartPointer<vtkPointPicker> picker_;
std::string point_shader_;
std::string sphere_shader_;
};
} // namespace vtkexp
#endif // VTKEXPERIMENT_INCLUDE_VTKEXPERIMENT_INTERACTION_HPP_
//------------------------------------------------------------------------------
// vtkexperiment
//
// Copyright (c) 2017-2018 RWTH Aachen University, Germany,
// Virtual Reality & Immersive Visualisation Group.
//------------------------------------------------------------------------------
// License
//
// This framework is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In the future, we may decide to add a commercial license
// at our own discretion without further notice.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//------------------------------------------------------------------------------
#ifndef VTKEXPERIMENT_INCLUDE_VTKEXPERIMENT_MAIN_WIDGET_HPP_
#define VTKEXPERIMENT_INCLUDE_VTKEXPERIMENT_MAIN_WIDGET_HPP_
#include "include/qvtk-lib/visualize.hpp"
#include "include/qvtk-lib/interaction.hpp"
#include "QObject"
#include "include/qvtk-lib/suppress_warnings.hpp"
SUPPRESS_WARNINGS_BEGIN
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#include "QVTKOpenGLWidget.h"
#include "vtkGenericOpenGLRenderWindow.h"
#pragma GCC diagnostic pop
SUPPRESS_WARNINGS_END
namespace vtkexp
{
class MainWidget : public QVTKOpenGLWidget
{
Q_OBJECT
public:
explicit MainWidget(PointData *points, QVTKOpenGLWidget *parent = 0);
~MainWidget() {}
void Rerender();
public slots: // NOLINT
void ChangeRendertype(int rendertype);
protected:
void mouseReleaseEvent(QMouseEvent *event) override;
private:
Visualize *vispoints_;
vtkSmartPointer<Interaction> style_;
vtkSmartPointer<vtkGenericOpenGLRenderWindow> renderwindow_;
};
} // namespace vtkexp
#endif // VTKEXPERIMENT_INCLUDE_VTKEXPERIMENT_MAIN_WIDGET_HPP_
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment