Permalink
Browse files

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

recent updates from Master dev
  • Loading branch information...
gralkapk committed Dec 10, 2018
2 parents 8cd8abb + 4dcca4c commit 1d960a6716567b21c2b786d854f5e2e37ff76655
Showing 669 changed files with 166,448 additions and 108,899 deletions.
@@ -38,42 +38,18 @@ matrix:
- CC=gcc-7
- CXX=g++-7

- os: linux
addons:
apt:
sources:
- llvm-toolchain-trusty-5.0
- ubuntu-toolchain-r-test
packages:
- clang-5.0
env:
- CC=clang-5.0
- CXX=clang++-5.0

- os: linux
addons:
apt:
sources:
- llvm-toolchain-trusty-6.0
- ubuntu-toolchain-r-test
packages:
- clang-6.0
env:
- CC=clang-6.0
- CXX=clang++-6.0

before_install:
- wget https://cmake.org/files/v3.12/cmake-3.12.4-Linux-x86_64.sh
- sh cmake-3.12.4-Linux-x86_64.sh --prefix=. --exclude-subdir
- sudo apt-get -qq update
- sudo apt-get install -y uuid-dev
- sudo apt-get install -y libunwind8-dev
- sudo apt-get install -y libxrandr-dev
- sudo apt-get install -y libxinerama-dev
- sudo apt-get install -y libxcursor-dev
- sudo apt-get install -y libxi-dev
- mkdir build
- cd build
- cmake ..
- mkdir build && cd build
- ../bin/cmake ..

install:
- make install

@@ -4,7 +4,7 @@
# Alle Rechte vorbehalten. All rights reserved.
#

cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.12)
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)

@@ -23,7 +23,7 @@ function(add_clang_format TARGET)
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]+")
set(CLANG_FORMAT_VERSION_PATTERN "[67].[0-9]+.[0-9]+")

if(CLANG_FORMAT AND CLANG_FORMAT_VERSION MATCHES ${CLANG_FORMAT_VERSION_PATTERN})
add_custom_target("${TARGET}_clangformat"
@@ -1,6 +1,8 @@
include(CMakeParseArguments)
include(ExternalProject)

set(CURRENT_LIST_DIR "${CMAKE_CURRENT_LIST_DIR}")

function(_argument_default VARIABLE)
if(args_${VARIABLE})
set(${VARIABLE} "${args_${VARIABLE}}" PARENT_SCOPE)
@@ -9,6 +11,76 @@ function(_argument_default VARIABLE)
endif()
endfunction(_argument_default)

#
# Builds an external cmake package, as generated by install(EXPORT ...)
# and to be used by find_package(...).
#
# bootstrap_external_package(<target> <name> CONFIG <path> ...)
function(bootstrap_external_package TARGET NAME)
set(ARGS_ONE_VALUE GIT_TAG CONFIG)
cmake_parse_arguments(args "" "${ARGS_ONE_VALUE}" "" ${ARGN})

if(NOT args_CONFIG)
message(FATAL_ERROR "Missing external package CONFIG for ${TARGET}")
endif()
_argument_default(CONFIG "")
_argument_default(GIT_TAG "[unknown]")

# Set source and build directory.
set(SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}/")
set(BUILD_DIR "${SOURCE_DIR}/build/")
file(MAKE_DIRECTORY ${SOURCE_DIR})
file(MAKE_DIRECTORY ${BUILD_DIR})

# Set variable for find_package().
set(CONFIG_PATH "${BUILD_DIR}/content-prefix/${CONFIG}")
get_filename_component(${NAME}_ROOT ${CONFIG_PATH} DIRECTORY)
set(${NAME}_ROOT ${${NAME}_ROOT} PARENT_SCOPE)

if(NOT EXISTS "${CONFIG_PATH}")
message(STATUS "${TARGET} tag: ${GIT_TAG}")

# Compose arguments for ExternalProject_Add.
set(ARGN_EXT "${ARGN}")
list(FIND ARGN_EXT "CONFIG" CONFIG_INDEX)
list(REMOVE_AT ARGN_EXT ${CONFIG_INDEX})
list(REMOVE_AT ARGN_EXT ${CONFIG_INDEX})
list(APPEND ARGN_EXT CMAKE_ARGS
"-G${CMAKE_GENERATOR}"
"-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}"
"-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>")

# Generate a CMakeLists.txt.
file(WRITE "${SOURCE_DIR}/CMakeLists.txt"
"cmake_minimum_required(VERSION 3.0)\n"
"include(ExternalProject)\n"
"project(${TARGET})\n"
"ExternalProject_Add(content \"${ARGN_EXT}\")\n")

# Configure package.
message(STATUS "Configuring ${TARGET}...")
execute_process(
COMMAND ${CMAKE_COMMAND} ${SOURCE_DIR}
"-G${CMAKE_GENERATOR}"
"-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}"
WORKING_DIRECTORY ${BUILD_DIR}
OUTPUT_QUIET
RESULT_VARIABLE CONFIG_RESULT)
if(NOT "${CONFIG_RESULT}" STREQUAL "0")
message(FATAL_ERROR "Fatal error while configuring ${TARGET}.")
endif()

# Build package.
message(STATUS "Compiling ${TARGET}...")
execute_process(
COMMAND ${CMAKE_COMMAND} --build . --parallel
OUTPUT_QUIET
WORKING_DIRECTORY ${BUILD_DIR})
else()
message(STATUS "${TARGET} tag: ${GIT_TAG} (cached)")
endif()
endfunction(bootstrap_external_package)

#
# Adds an external project.
#
@@ -21,14 +93,14 @@ function(add_external_project TARGET)
if(args_GIT_TAG)
message(STATUS "${TARGET} tag: ${args_GIT_TAG}")
endif()
# Compile arguments for ExternalProject_Add.

# Compose arguments for ExternalProject_Add.
set(ARGN_EXT "${ARGN}")
list(APPEND ARGN_EXT CMAKE_ARGS
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)
@@ -47,12 +119,12 @@ endfunction(add_external_project)
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 "")
@@ -85,7 +157,7 @@ function(add_external_library TARGET LINKAGE)
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"
@@ -109,7 +181,7 @@ endfunction(add_external_library)
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)
@@ -1,6 +1,6 @@
#message(WARNING "setting msvc compiler flags")

set(COMMON_CXX_FLAGS "/Gm /DNOMINMAX /W3 /openmp /MP /GR")
set(COMMON_CXX_FLAGS "/DNOMINMAX /W3 /openmp /MP /GR")

set(CMAKE_CXX_FLAGS_DEBUG "${COMMON_CXX_FLAGS} /MDd /Od /DDEBUG /D_DEBUG /Zi" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_RELEASE "${COMMON_CXX_FLAGS} /MD /DNDEBUG /D_NDEBUG /Ob2 /Ox /Oi" CACHE STRING "" FORCE)
@@ -48,16 +48,8 @@ if(BUILD_CONFIGURATOR AND CMAKE_GENERATOR MATCHES "Visual Studio")
endif()

# Install binaries and libraries
install(CODE "configure_file(${CMAKE_CURRENT_BINARY_DIR}/bin/MegaMolConf.exe ${CMAKE_INSTALL_PREFIX}/bin/MegaMolConf.exe COPYONLY)")
#install(CODE "configure_file(${CMAKE_CURRENT_BINARY_DIR}/bin/MegaMolConf.pdb ${CMAKE_INSTALL_PREFIX}/bin/MegaMolConf.pdb COPYONLY)")
install(CODE "configure_file(${CMAKE_CURRENT_BINARY_DIR}/bin/ZeroMQ.dll ${CMAKE_INSTALL_PREFIX}/bin/ZeroMQ.dll COPYONLY)")

if(BITS EQUAL 64)
set(sub_dir "amd64")
else()
set(sub_dir "i386")
endif()
install(CODE "configure_file(${CMAKE_CURRENT_BINARY_DIR}/bin/${sub_dir}/libsodium.dll ${CMAKE_INSTALL_PREFIX}/bin/${sub_dir}/libsodium.dll COPYONLY)")
install(CODE "configure_file(${CMAKE_CURRENT_BINARY_DIR}/bin/${sub_dir}/libzmq.dll ${CMAKE_INSTALL_PREFIX}/bin/${sub_dir}/libzmq.dll COPYONLY)")

install(CODE " \
file(INSTALL \"${CMAKE_CURRENT_BINARY_DIR}/bin\" \
DESTINATION ${CMAKE_INSTALL_PREFIX} \
FILES_MATCHING REGEX \"\\.(exe|dll|pdb)$\")")
endif()
@@ -163,8 +163,31 @@ private struct IconInfo {
}
#endif

public enum DpiType {
Effective = 0,
Angular = 1,
Raw = 2,
}

[DllImport("User32.dll")]
private static extern IntPtr MonitorFromPoint([In]System.Drawing.Point pt, [In]uint dwFlags);

[DllImport("Shcore.dll")]
private static extern IntPtr GetDpiForMonitor([In]IntPtr hmonitor, [In]DpiType dpiType, [Out]out uint dpiX, [Out]out uint dpiY);



public Form1() {
InitializeComponent();
var rect = Screen.FromHandle(this.Handle).Bounds;
var mon = MonitorFromPoint(new Point(rect.Left + 1, rect.Top + 1), 2);
try {
uint dpiX, dpiY;
GetDpiForMonitor(mon, DpiType.Effective, out dpiX, out dpiY);
GraphicalModule.DpiFactor = dpiX / 96.0f;
} catch {
GraphicalModule.DpiFactor = 1.0f;
}
Font = SystemFonts.DefaultFont;
toolStripStatusLabel1.Text = string.Empty;
Icon = Properties.Resources.MegaMol_Ctrl;
@@ -18,14 +18,24 @@ public class GraphicalModule : INotifyPropertyChanged {
static Pen compatibleSlotBorder = new Pen(selectedSlotBrush, 2.0f);
static StringFormat moduleClassFormat = new StringFormat() { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Near, FormatFlags = StringFormatFlags.NoWrap };
static StringFormat moduleNameFormat = new StringFormat() { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Far, FormatFlags = StringFormatFlags.NoWrap };
static int slotWidth = 8;
static int slotHeight = 10;
static int slotSpacing = 16;
private static int slotWidth => (int)Math.Round((float)slotWidth_ * DpiFactor);
private static int slotHeight => (int)Math.Round((float)slotHeight_ * DpiFactor);
private static int slotSpacing => (int)Math.Round((float)slotSpacing_ * DpiFactor);
private const int slotWidth_ = 8;
static int slotHeight_ = 10;
static int slotSpacing_ = 16;
static int slotBorder = (slotSpacing - slotHeight) / 2;
//static float slotScale = 1.8f;
static int moduleBorder = 10;
static Pen selectedModulPen1 = makeMyPen1();
static Pen selectedModulPen2 = makeMyPen2();
private static float _dpiFactor = 1.0f;

public static float DpiFactor
{
get { return _dpiFactor; }
set { _dpiFactor = value; }
}

static Pen makeMyPen1() {
Pen p = new Pen(Color.FromArgb(0x60, 0x8f, 0xbf));
@@ -444,9 +444,14 @@ public enum MegaMolProcessState {
string GetAnswer(ref string answer) {
string err = "";
bool good = false;
while (!(good = TryGetAnswer(ref answer, ref err))) {
int numTries = 500;
while (!(good = TryGetAnswer(ref answer, ref err)) && numTries > 0) {
numTries--;
System.Threading.Thread.Sleep(10);
}

if (!good)
err = "timeout";
return err;
}

@@ -22,8 +22,7 @@ if(BUILD_CONSOLE)
PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
OUTPUT_NAME ${PROJECT_NAME})
target_include_directories(${PROJECT_NAME} PRIVATE
${GLFW3_INCLUDE_DIRS} ${LIBUNWIND_INCLUDE_DIR} ${EGL_INCLUDE_DIR}
"src" "include")
${LIBUNWIND_INCLUDE_DIR} "src" "include")
target_link_libraries(${PROJECT_NAME} PRIVATE core)

if(UNIX)
@@ -40,27 +39,27 @@ if(BUILD_CONSOLE)
endif()
if(USE_EGL)
find_package(EGL REQUIRED)
target_include_directories(${PROJECT_NAME} PRIVATE ${EGL_INCLUDE_DIR})
target_link_libraries(${PROJECT_NAME} PRIVATE ${EGL_LIBRARIES})
endif()
endif()

if(WIN32)
set(VERSION_LIBRARY "Version.lib")
endif()

if(NOT USE_EGL)
option(USE_INTERNAL_GLFW "use internal GLFW" ON)
if(USE_INTERNAL_GLFW)
add_subdirectory(glfw)
set(GLFW3_LIBRARIES glfw)
else()
find_package(glfw3 3.2 MODULE)
if(NOT GLFW3_FOUND)
find_package(glfw3 3.2 CONFIG REQUIRED)
set(GLFW3_LIBRARIES glfw)
# include dirs are included in the imported library (add_library(glfw STATIC IMPORTED))
set(GLFW3_INCLUDE_DIRS "")
endif()
endif()
if(NOT USE_EGL)
bootstrap_external_package(glfw_ext glfw3
CONFIG "lib/cmake/glfw3/glfw3Config.cmake"
GIT_REPOSITORY https://github.com/glfw/glfw.git
GIT_TAG "3.2.1"
CMAKE_ARGS
-DBUILD_SHARED_LIBS=OFF
-DGLFW_BUILD_EXAMPLES=OFF
-DGLFW_BUILD_TESTS=OFF
-DGLFW_BUILD_DOCS=OFF)
find_package(glfw3 REQUIRED CONFIG)
target_link_libraries(${PROJECT_NAME} PRIVATE glfw)
endif()

# AntTweakBar
@@ -79,7 +78,7 @@ if(BUILD_CONSOLE)
endif()

target_link_libraries(${PROJECT_NAME} PRIVATE
${GLFW3_LIBRARIES} ${VERSION_LIBRARY} ${LIBUNWIND_LIBRARIES} ${EGL_LIBRARIES})
${VERSION_LIBRARY} ${LIBUNWIND_LIBRARIES} ${CMAKE_DL_LIBS})

# Grouping in Visual Studio
set_target_properties(${CONSOLE_NAME} PROPERTIES FOLDER base)
@@ -99,11 +98,12 @@ if(BUILD_CONSOLE)

# Configuration of the megamol.cfg megamol.sh remoteconsole.sh files
set(cfg_LIB_PATH "${CMAKE_INSTALL_PREFIX}/lib")

set(cfg_MEGAMOLCON "${CMAKE_INSTALL_PREFIX}/bin/${PROJECT_NAME}")

if(UNIX)
include(GNUInstallDirs)
set(cfg_EXTERNAL_LIB_PATH "${CMAKE_INSTALL_LIBDIR}")
set(cfg_EXTERNAL_LIB_PATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
set(MEGAMOL_SHELL_START_SCRIPT "megamol.sh")
configure_file(extra/megamol.sh.in ${CMAKE_BINARY_DIR}/${MEGAMOL_SHELL_START_SCRIPT} @ONLY)
install(PROGRAMS ${CMAKE_BINARY_DIR}/${MEGAMOL_SHELL_START_SCRIPT} DESTINATION "bin")
@@ -8,6 +8,7 @@ mmSetLogLevel(0)
mmSetEchoLevel("*")
mmSetAppDir(basePath .. "${MMPLG_DIR}")
mmAddShaderDir(basePath .. "share/shaders")
mmAddResourceDir(basePath .. "share/shaders")
mmAddResourceDir(basePath .. "share/resources")
mmPluginLoaderInfo(basePath .. "${MMPLG_DIR}", "*.mmplg", "include")

Oops, something went wrong.

0 comments on commit 1d960a6

Please sign in to comment.