Permalink
Browse files

Merge pull request #22 from UniStuttgart-VISUS/master-dev

Master dev
  • Loading branch information...
reinago committed Oct 9, 2018
2 parents 5f97af7 + 76080a8 commit 8cd8abbe28bb10390d0061842eecf4f922c3fc29
Showing 335 changed files with 27,132 additions and 5,559 deletions.
View
@@ -1,12 +1,14 @@
build/**/*
build-*/**/*
build_*/**/*
bin/**/*
include/**/*
external/**/*
share/**/*
stage/**/*
lib/**/*
issues/**/*
mmprjs/**/*
configurator/.vs/
configurator/bin/
configurator/MegaMolConf/obj/
View
@@ -1,77 +1,86 @@
#
# MegaMol™ Core
# Copyright 2017, by MegaMol Team
# Alle Rechte vorbehalten. All rights reserved.
#
cmake_minimum_required(VERSION 3.0)
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
if(POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
cmake_policy(SET CMP0054 NEW)
endif()
project(megamol)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR} CACHE PATH "default install path" FORCE)
set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}
CACHE PATH "default install path" FORCE)
endif()
# configure directories
# Directories
set(MEGAMOL_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(MEGAMOL_VISLIB_DIR ${MEGAMOL_DIR}/vislib)
set(MEGAMOL_CORE_DIR ${MEGAMOL_DIR}/core)
set(MEGAMOL_CONSOLE_DIR ${MEGAMOL_DIR}/console)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
if(UNIX)
option(USE_EGL "Use EGL instead of GLFW" OFF)
if(USE_EGL)
add_definitions("-DUSE_EGL")
endif()
option(USE_EGL "Use EGL instead of GLFW" OFF)
if(USE_EGL)
add_definitions("-DUSE_EGL")
endif()
endif()
# GLOBAL DLL DEFINITIONS
if(WIN32)
#add_definitions(-DGL_LOAD_DLL)
endif()
# Global definitions
#if(WIN32)
# add_definitions(-DGL_LOAD_DLL)
#endif()
# VERSIONS
# Versions
include(global_versioninfo)
# MEGAMOL OPTIONS
# MegaMol options
include(megamol_options)
# MEGAMOL MAKROS
# MegaMol macros
include(check_mmdep)
# Clang-format
include(ClangFormat)
# NUGET SETTINGS
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/NuGet.Config NuGet.Config COPYONLY)
# External
include(External)
# NuGet
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/NuGet.Config
${CMAKE_CURRENT_BINARY_DIR}/NuGet.Config COPYONLY)
###############################
# vislib
# Vislib
###############################
add_subdirectory(${MEGAMOL_VISLIB_DIR})
###############################
# core
# Core
###############################
add_subdirectory(${MEGAMOL_CORE_DIR})
###############################
# console
# Console
###############################
set(CONSOLE_NAME mmconsole)
add_subdirectory(${MEGAMOL_CONSOLE_DIR})
# add directory structure for visual studio
# Add directory structure for visual studio
if(WIN32)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD TRUE)
endif()
###############################
# configurator
# Configurator
###############################
if(WIN32)
add_subdirectory(configurator)
@@ -83,7 +92,7 @@ endif()
add_subdirectory(plugins)
###############################
# utils
# Utils
###############################
add_subdirectory(utils)
@@ -92,7 +101,7 @@ foreach(d ${DEP_LIST})
string(REGEX REPLACE " +" ";" SINGLE_LIST "${d}")
list(GET SINGLE_LIST 0 plugin)
list(REMOVE_AT SINGLE_LIST 0)
CHECK_MMDEP(${plugin} "${SINGLE_LIST}")
check_mmdep(${plugin} "${SINGLE_LIST}")
endforeach()
unset(DEP_LIST CACHE)
View
@@ -15,6 +15,17 @@ function(add_clang_format TARGET)
find_program(CLANG_FORMAT clang-format)
if(CLANG_FORMAT)
# Query for version.
execute_process(
COMMAND ${CLANG_FORMAT} "--version"
OUTPUT_VARIABLE CLANG_FORMAT_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" CLANG_FORMAT_VERSION ${CLANG_FORMAT_VERSION})
endif()
set(CLANG_FORMAT_VERSION_PATTERN "6.[0-9]+.[0-9]+")
if(CLANG_FORMAT AND CLANG_FORMAT_VERSION MATCHES ${CLANG_FORMAT_VERSION_PATTERN})
add_custom_target("${TARGET}_clangformat"
COMMAND ${CLANG_FORMAT}
"-i"
@@ -25,7 +36,12 @@ function(add_clang_format TARGET)
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
VERBATIM)
add_dependencies(${TARGET} "${TARGET}_clangformat")
elseif(CLANG_FORMAT)
message(WARNING "clang-format version ${CLANG_FORMAT_VERSION} is unsuitable.\n"
"Please download and install a version matching ${CLANG_FORMAT_VERSION_PATTERN}"
" from http://releases.llvm.org/download.html\n"
"Also adjust Visual Studio options and PATH variable as necessary!")
else()
message(WARNING "clang-format was not found")
message(STATUS "clang-format: not found")
endif()
endfunction(add_clang_format)
View
@@ -0,0 +1,133 @@
include(CMakeParseArguments)
include(ExternalProject)
function(_argument_default VARIABLE)
if(args_${VARIABLE})
set(${VARIABLE} "${args_${VARIABLE}}" PARENT_SCOPE)
else()
set(${VARIABLE} "${ARGN}" PARENT_SCOPE)
endif()
endfunction(_argument_default)
#
# Adds an external project.
#
# See ExternalProject_Add(...) for usage.
#
function(add_external_project TARGET)
set(ARGS_ONE_VALUE GIT_TAG)
cmake_parse_arguments(args "" "${ARGS_ONE_VALUE}" "" ${ARGN})
if(args_GIT_TAG)
message(STATUS "${TARGET} tag: ${args_GIT_TAG}")
endif()
# Compile arguments for ExternalProject_Add.
set(ARGN_EXT "${ARGN}")
list(APPEND ARGN_EXT CMAKE_ARGS
"-G${CMAKE_GENERATOR}"
"-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}"
"-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>")
# Add external project.
ExternalProject_Add(${TARGET} "${ARGN_EXT}")
endfunction(add_external_project)
#
# Adds an external library, depending on an external project.
#
# add_external_library(<target> (STATIC|SHARED|INTERFACE)
# DEPENDS <external_project>
# LIBRARY_DEBUG "Debug.dll"
# LIBRARY_RELEASE "Release.dll"
# IMPORT_LIBRARY_DEBUG "Debug.lib"
# IMPORT_LIBRARY_RELEASE "Release.lib"
# INTERFACE_LIBRARIES <external_library>*")
#
function(add_external_library TARGET LINKAGE)
set(ARGS_ONE_VALUE DEPENDS COMPILE_DEFINITIONS INCLUDE_DIR LIBRARY LIBRARY_DEBUG LIBRARY_RELEASE IMPORT_LIBRARY IMPORT_LIBRARY_DEBUG IMPORT_LIBRARY_RELEASE INTERFACE_LIBRARIES)
cmake_parse_arguments(args "" "${ARGS_ONE_VALUE}" "" ${ARGN})
if(NOT args_DEPENDS)
message(FATAL_ERROR "Missing external project for ${TARGET} to depend on")
endif()
_argument_default(DEPENDS "")
# Guess library properties, unless set.
ExternalProject_Get_Property(${DEPENDS} INSTALL_DIR)
_argument_default(COMPILE_DEFINITIONS "")
_argument_default(INCLUDE_DIR include)
_argument_default(LIBRARY "NOTFOUND")
_argument_default(LIBRARY_DEBUG "${LIBRARY}")
_argument_default(LIBRARY_RELEASE "${LIBRARY}")
_argument_default(IMPORT_LIBRARY "NOTFOUND")
_argument_default(IMPORT_LIBRARY_DEBUG "${IMPORT_LIBRARY}")
_argument_default(IMPORT_LIBRARY_RELEASE "${IMPORT_LIBRARY}")
# Create include directory as required by INTERFACE_INCLUDE_DIRECTORIES.
file(MAKE_DIRECTORY "${INSTALL_DIR}/${INCLUDE_DIR}")
# Add an imported library.
add_library(${TARGET} ${LINKAGE} IMPORTED GLOBAL)
add_dependencies(${TARGET} ${DEPENDS})
set_target_properties(${TARGET} PROPERTIES
INTERFACE_COMPILE_DEFINITIONS "${COMPILE_DEFINITIONS}"
INTERFACE_INCLUDE_DIRECTORIES "${INSTALL_DIR}/${INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "${INTERFACE_LIBRARIES}")
if(LINKAGE STREQUAL "STATIC" OR LINKAGE STREQUAL "SHARED")
set_target_properties(${TARGET} PROPERTIES
IMPORTED_CONFIGURATIONS "Debug;Release"
IMPORTED_LOCATION_DEBUG "${INSTALL_DIR}/${LIBRARY_DEBUG}"
IMPORTED_LOCATION_RELEASE "${INSTALL_DIR}/${LIBRARY_RELEASE}")
endif()
if(LINKAGE STREQUAL "SHARED")
set_target_properties(${TARGET} PROPERTIES
IMPORTED_IMPLIB_DEBUG "${INSTALL_DIR}/${IMPORT_LIBRARY_DEBUG}"
IMPORTED_IMPLIB_RELEASE "${INSTALL_DIR}/${IMPORT_LIBRARY_RELEASE}")
endif()
#message(STATUS
# "${DEPENDS} / ${TARGET} settings:\n"
# " Definitions:\t${COMPILE_DEFINITIONS}\n"
# " Include:\t\t${INSTALL_DIR}/${INCLUDE_DIR}\n"
# " Library (debug):\t${INSTALL_DIR}/${LIBRARY_DEBUG}\n"
# " Library (release):\t${INSTALL_DIR}/${LIBRARY_RELEASE}\n"
# " Import (debug):\t${INSTALL_DIR}/${IMPORT_LIBRARY_DEBUG}\n"
# " Import (release):\t${INSTALL_DIR}/${IMPORT_LIBRARY_RELEASE}\n"
# " Interface:\t${INTERFACE_LIBRARIES}")
endfunction(add_external_library)
#
# Installs external targets.
#
# install_external(TARGET libA BLib C)
#
# This is a workaround for limitations of install(TARGETS ...) [1][2].
# [1] https://gitlab.kitware.com/cmake/cmake/issues/14311
# [2] https://gitlab.kitware.com/cmake/cmake/issues/14444
#
function(install_external)
set(ARGS_MULTI_VALUE TARGETS)
cmake_parse_arguments(args "" "" "${ARGS_MULTI_VALUE}" ${ARGN})
foreach(target ${args_TARGETS})
get_target_property(IMPORTED_IMPLIB_DEBUG ${target} IMPORTED_IMPLIB_DEBUG)
get_target_property(IMPORTED_IMPLIB_RELEASE ${target} IMPORTED_IMPLIB_RELEASE)
get_target_property(IMPORTED_LOCATION_DEBUG ${target} IMPORTED_LOCATION_DEBUG)
get_target_property(IMPORTED_LOCATION_RELEASE ${target} IMPORTED_LOCATION_RELEASE)
if(WIN32)
install(FILES ${IMPORTED_IMPLIB_DEBUG} DESTINATION "lib" OPTIONAL)
install(FILES ${IMPORTED_IMPLIB_RELEASE} DESTINATION "lib" OPTIONAL)
set(TARGET_DESTINATION "bin")
else()
set(TARGET_DESTINATION "lib")
endif()
# Wildcard-based install to catch PDB files and symlinks.
install(CODE "\
file(GLOB DEBUG_FILES \"${IMPORTED_LOCATION_DEBUG}*\")\n \
file(GLOB RELEASE_FILES \"${IMPORTED_LOCATION_RELEASE}*\")\n \
file(INSTALL \${DEBUG_FILES} \${RELEASE_FILES} DESTINATION \"${CMAKE_INSTALL_PREFIX}/${TARGET_DESTINATION}\")")
endforeach()
endfunction(install_external)
View
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<add key="repositoryPath" value="../external/nuget/" />
<add key="repositoryPath" value="packages" />
</config>
<packageRestore>
<add key="enabled" value="True" />
View
@@ -0,0 +1,8 @@
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -fPIC -DUNIX -pedantic -std=c99 ${OpenMP_C_FLAGS}")
set(COMMON_CXX_FLAGS "-Wall -Wno-narrowing -pedantic -fPIC -DUNIX -D_GNU_SOURCE -D_LIN${BITS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${COMMON_CXX_FLAGS} -DDEBUG -D_DEBUG -g -ggdb")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${COMMON_CXX_FLAGS} -DNDEBUG -D_NDEBUG -O3 -g0")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${COMMON_CXX_FLAGS} -DNDEBUG -D_NDEBUG -O3 -g")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-Bsymbolic")
@@ -8,7 +8,7 @@ endif()
set(CMAKE_CXX_STANDARD 14)
if(UNIX)
find_package(OpenMP)
find_package(OpenMP)
endif()
set(CMAKE_CONFIGURATION_TYPES "Debug;Release;RelWithDebInfo")
@@ -19,39 +19,39 @@ set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CMAKE_CONFIGURATION_TYPES
# Compiler flags (inspired by OSPRay build)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
set(MEGAMOL_COMPILER_ICC TRUE)
include(icc)
set(MEGAMOL_COMPILER_ICC TRUE)
include(icc)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(MEGAMOL_COMPILER_GCC TRUE)
include(gcc)
# TODO: clang is unsupported for now
#elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# set(MEGAMOL_COMPILER_CLANG TRUE)
# include(clang)
set(MEGAMOL_COMPILER_GCC TRUE)
include(gcc)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(MEGAMOL_COMPILER_CLANG TRUE)
include(clang)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(MEGAMOL_COMPILER_MSVC TRUE)
include(msvc)
set(MEGAMOL_COMPILER_MSVC TRUE)
include(msvc)
else()
message(FATAL_ERROR
"Unsupported compiler specified: '${CMAKE_CXX_COMPILER_ID}'")
message(FATAL_ERROR
"Unsupported compiler specified: '${CMAKE_CXX_COMPILER_ID}'")
endif()
option(USE_MPI "enable MPI in build" OFF)
set(MPI_GUESS_LIBRARY_NAME "undef" CACHE STRING "override MPI library, if necessary. ex: MSMPI, MPICH2")
if(USE_MPI)
if(MPI_GUESS_LIBRARY_NAME STREQUAL "undef")
if(MPI_GUESS_LIBRARY_NAME STREQUAL "undef")
message(FATAL_ERROR "you must set MPI_GUESS_LIBRARY_NAME to ovveride automatic finding of unwanted MPI libraries (or empty for default)")
endif()
find_package(MPI REQUIRED)
endif()
find_package(MPI REQUIRED)
endif()
if(MPI_C_FOUND)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MPI_C_COMPILE_FLAGS}")
include_directories(${MPI_C_INCLUDE_PATH})
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${MPI_C_LINK_FLAGS}")
set(LIBS ${LIBS} ${MPI_C_LIBRARIES})
add_definitions(-DWITH_MPI -DOMPI_SKIP_MPICXX -DMPICH_SKIP_MPICXX)
# THIS IS THE APEX OF SHIT AND MUST DIE
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MPI_C_COMPILE_FLAGS}")
include_directories(${MPI_C_INCLUDE_PATH})
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${MPI_C_LINK_FLAGS}")
set(LIBS ${LIBS} ${MPI_C_LIBRARIES})
add_definitions(-DWITH_MPI -DOMPI_SKIP_MPICXX -DMPICH_SKIP_MPICXX)
endif()
option(MEGAMOL_INSTALL_DEPENDENCIES "MegaMol dependencies in install" ON)
Oops, something went wrong.

0 comments on commit 8cd8abb

Please sign in to comment.