Commit 0ab71d6f authored by Jan Möbius's avatar Jan Möbius

Introduced type directories

parent f0c26b72
Pipeline #3995 failed with stage
in 20 minutes and 25 seconds
......@@ -297,6 +297,42 @@ endif()
# ========================================================================
add_subdirectory (OpenFlipper/PluginLib)
# ========================================================================
# Build DataTypes
# ========================================================================
# Search for all available data types
file (
GLOB _data_types
RELATIVE "${CMAKE_SOURCE_DIR}"
"${CMAKE_SOURCE_DIR}/Type-*/ObjectTypes/*"
"${CMAKE_SOURCE_DIR}/Package-*/Type-*/ObjectTypes/*"
)
# add all found libs to the build
foreach (DATATYPE_DIR ${_data_types})
add_subdirectory(${DATATYPE_DIR})
# Extract Name of type from directory
string(REGEX MATCH "[^/\\]*$" TYPENAME ${DATATYPE_DIR})
string(TOUPPER ${TYPENAME} TYPENAME )
list(APPEND TYPE_LIST ${TYPENAME})
set(${TYPENAME}_INCLUDE ${CMAKE_SOURCE_DIR}/${DATATYPE_DIR}/../../ )
endforeach()
# info header for Available data types
acg_color_message ("\n${_escape}[40;37m************************************************************${_escape}[0m")
acg_color_message ("${_escape}[40;37m* Available OpenFlipper Types: *${_escape}[0m")
acg_color_message ("${_escape}[40;37m************************************************************${_escape}[0m")
acg_color_message (" ")
foreach (DATATYPE ${TYPE_LIST})
acg_color_message ("${DATATYPE}")
endforeach()
acg_color_message (" ")
# ========================================================================
# Tests
# ========================================================================
......
......@@ -42,11 +42,13 @@ function (of_add_plugins)
"${CMAKE_SOURCE_DIR}/PluginCollection-*/Plugin-*/CMakeLists.txt"
"${CMAKE_SOURCE_DIR}/Package*/Plugin-*/CMakeLists.txt"
"${CMAKE_SOURCE_DIR}/Package*/PluginCollection-*/Plugin-*/CMakeLists.txt"
"${CMAKE_SOURCE_DIR}/Type-*/Plugin-*/CMakeLists.txt"
"${CMAKE_SOURCE_DIR}/*/Type-*/Plugin-*/CMakeLists.txt"
)
foreach (_plugin ${_plugins_in})
get_filename_component (_plugin_dir ${_plugin} PATH)
# In INSTALLDATA_DIRS the resource directories will be handed down.
set(INSTALLDATA_DIRS)
add_subdirectory (${CMAKE_SOURCE_DIR}/${_plugin_dir})
......@@ -120,6 +122,8 @@ function (of_print_plugin_stats)
"${CMAKE_SOURCE_DIR}/PluginCollection-*/Plugin-*"
"${CMAKE_SOURCE_DIR}/Package*/Plugin-*"
"${CMAKE_SOURCE_DIR}/Package*/PluginCollection-*/Plugin-*"
"${CMAKE_SOURCE_DIR}/Type-*/Plugin-*"
"${CMAKE_SOURCE_DIR}/*/Type-*/Plugin-*"
)
......
# This module provides the following macro:
#
# openflipper_plugin ( [DIRS dir1 dir2 ...]
# [TYPES type1 type2 ...]
# [OPT_TYPES type1 type2 ...]
# [DEPS dep1 dep2 ...]
# [OPTDEPS dep1 dep2 ...]
# [LDFLAGSADD flag1 flag2 ...]
......@@ -18,6 +20,8 @@
#
# DIRS = additional directories with source files
# TYPES = List of datatypes required by this plugin (uppercase)
# OPT_TYPES = List of optional datatypes for this plugin (uppercase)
# DEPS = required dependencies for find_package macro
# OPTDEPS = optional dependencies for find_package macro, if found, a define ENABLE_<Depname> will be added automatically
# LDFLAGSADD = flags added to the link command
......@@ -72,7 +76,7 @@ endmacro ()
# parse plugin macro parameter
macro (_get_plugin_parameters _prefix)
set (_current_var _foo)
set (_supported_var DIRS DEPS OPTDEPS LDFLAGSADD CFLAGSADD CDEFINITIONSADD
set (_supported_var DIRS TYPES OPT_TYPES DEPS OPTDEPS LDFLAGSADD CFLAGSADD CDEFINITIONSADD
LIBRARIES ADD_CORE_APP_LIBRARIES LIBDIRS INCDIRS ADDSRC INSTALLDATA GLEWDEFINITIONS TRANSLATION_LANGUAGES TRANSLATION_ADDFILES)
set (_supported_flags LICENSEMANAGER)
foreach (_val ${_supported_var})
......@@ -319,6 +323,44 @@ macro (_check_plugin_deps _prefix _optional )
endif ()
endforeach ()
if ( NOT ${_optional} STREQUAL "TRUE" )
if ( DEFINED ${_prefix}_TYPES )
foreach (_TYPE ${${_prefix}_TYPES})
if ( DEFINED ${_TYPE}_INCLUDE )
list(APPEND ${_prefix}_TYPE_INCLUDES "${${_TYPE}_INCLUDE}")
list(APPEND ${_prefix}_TYPE_DEPENDENCIES "${_TYPE}")
set(${_prefix}_TYPE_DEFINITIONS "${${_prefix}_TYPE_DEFENITIONS} -DENABLE_${_TYPE}_SUPPORT")
else()
acg_set (_${_prefix}_MISSING_DEPS "${_${_prefix}_MISSING_DEPS} TYPE_${_TYPE} ")
set (${_prefix}_HAS_DEPS FALSE)
endif()
endforeach()
endif()
endif()
# Optional types
if ( ${_optional} STREQUAL "TRUE" )
if ( DEFINED ${_prefix}_OPT_TYPES )
foreach (_TYPE ${${_prefix}_OPT_TYPES})
if ( DEFINED ${_TYPE}_INCLUDE )
list(APPEND ${_prefix}_TYPE_INCLUDES "${${_TYPE}_INCLUDE}")
list(APPEND ${_prefix}_TYPE_DEPENDENCIES "${_TYPE}")
set(${_prefix}_TYPE_DEFINITIONS "${${_prefix}_TYPE_DEFENITIONS} -DENABLE_${_TYPE}_SUPPORT")
else()
message(warning "Optional Datatype ${_TYPE} not available, proceeding without it")
endif()
endforeach()
endif()
endif()
set(LOADED_PACKAGES ${LOADED_PACKAGES} ${LOADED_PACKAGES_})
set(LOADED_PACKAGES ${LOADED_PACKAGES} PARENT_SCOPE)
endmacro ()
......@@ -478,6 +520,9 @@ function (_build_openflipper_plugin plugin)
# ${CMAKE_BINARY_DIR}/OpenFlipper/libs_required/ACG : Required due to ui files creating headers there
include_directories (
.
${PACKAGE_DIRS}
......@@ -494,6 +539,7 @@ function (_build_openflipper_plugin plugin)
${GLUT_INCLUDE_DIR}
${CMAKE_BINARY_DIR}/OpenFlipper/PluginLib
${PACKAGE_INCLUDES}
${${_PLUGIN}_TYPE_INCLUDES}
)
# Linking for apple is special here as the linker pulls in the dependencies, we have to set them like in PluginLib!
......@@ -610,7 +656,7 @@ function (_build_openflipper_plugin plugin)
acg_qt4_autoqrc (qrc_targets ${qrc})
endif ()
add_definitions(${${_PLUGIN}_TYPE_DEFINITIONS})
add_library (Plugin-${plugin} MODULE ${uic_targets} ${sources} ${headers} ${moc_targets} ${qrc_targets} ${${_PLUGIN}_ADDSRC})
#group projects by parent folder name on MSVC (used for e.g. plugincollection)
......@@ -696,6 +742,7 @@ function (_build_openflipper_plugin plugin)
target_link_libraries (Plugin-${plugin}
${${_PLUGIN}_DEPS_LIBRARIES}
${${_PLUGIN}_LIBRARIES}
${${_PLUGIN}_TYPE_DEPENDENCIES}
)
# no install on mac, because the whole bundle will be installed in the
......
......@@ -5,6 +5,7 @@ if (EXISTS ${CMAKE_SOURCE_DIR}/libs/PhySim)
openflipper_plugin ( DEPS PhySim CGAL Boost GMP CoMISo BLAS
INSTALLDATA Icons
TYPES POLYLINE
)
if ( WIN32 )
......@@ -15,6 +16,6 @@ if (EXISTS ${CMAKE_SOURCE_DIR}/libs/PhySim)
endif ( WIN32 )
else()
openflipper_plugin ( INSTALLDATA
Icons )
openflipper_plugin ( INSTALLDATA Icons
TYPES POLYLINE)
endif ()
include (plugin)
openflipper_plugin ( TRANSLATION_LANGUAGES de_DE )
openflipper_plugin ( TRANSLATION_LANGUAGES de_DE
TYPES POLYLINE )
include (plugin)
if (EXISTS ${CMAKE_SOURCE_DIR}/ObjectTypes/PolyLine/PolyLine.hh)
openflipper_plugin (INSTALLDATA Icons)
else()
message( WARNING "Plugin TypePolyLine disabled due to missing PolyLine ObjectType" )
endif ()
include (plugin)
if (EXISTS ${CMAKE_SOURCE_DIR}/ObjectTypes/PolyLineCollection/PolyLineCollection.hh)
openflipper_plugin (INSTALLDATA Icons )
else()
message( WARNING "Plugin TypePolyLineCollection disabled due to missing ObjectType" )
endif ()
include(ACGCommon)
include_directories (
..
${ACG_INCLUDE_DIR}
${OPENMESH_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${OPENGL_INCLUDE_DIR}
${GLEW_INCLUDE_DIR}
${GLUT_INCLUDE_DIR}
)
link_directories (
${GLEW_LIBRARY_DIR}
${ADDITIONAL_PLUGINLIB_LINK_DIRS}
)
#=======================================================
# General defines
#=======================================================
# generate dllexport macros on windows
if (WIN32)
add_definitions (
-DPLUGINLIBDLL
-DACGDLL
-DUSEACG
)
endif ()
#=======================================================
# Cleanup
#=======================================================
# remove template cc files from source file list
acg_drop_templates (sources)
# collect all header,source files
acg_append_files (headers "*.hh" . )
acg_append_files (sources "*.cc" . )
# Match our current directory name
string (REGEX MATCH "[^/\\]*$" TYPENAME ${CMAKE_CURRENT_SOURCE_DIR})
string(TOUPPER ${TYPENAME} TYPENAME )
include_directories (
..
${ACG_INCLUDE_DIR}
${OPENMESH_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../..
${CMAKE_CURRENT_BINARY_DIR}
${OPENGL_INCLUDE_DIR}
${GLEW_INCLUDE_DIR}
${GLUT_INCLUDE_DIR}
)
acg_add_library ( ${TYPENAME} SHARED ${sources} ${headers} )
add_dependencies( ${TYPENAME} OpenMeshCore OpenMeshTools ACG OpenFlipperPluginLib)
target_link_libraries (${TYPENAME}
${OPENMESH_LIBRARIES}
ACG
${QT_LIBRARIES}
${OPENGL_LIBRARIES}
${GLEW_LIBRARY}
${GLUT_LIBRARIES}
)
include(ACGCommon)
include_directories (
..
${ACG_INCLUDE_DIR}
${OPENMESH_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${OPENGL_INCLUDE_DIR}
${GLEW_INCLUDE_DIR}
${GLUT_INCLUDE_DIR}
)
link_directories (
${GLEW_LIBRARY_DIR}
${ADDITIONAL_PLUGINLIB_LINK_DIRS}
)
#=======================================================
# General defines
#=======================================================
# generate dllexport macros on windows
if (WIN32)
add_definitions (
-DPLUGINLIBDLL
-DACGDLL
-DUSEACG
)
endif ()
#=======================================================
# Cleanup
#=======================================================
# remove template cc files from source file list
acg_drop_templates (sources)
# collect all header,source files
acg_append_files (headers "*.hh" . )
acg_append_files (sources "*.cc" . )
# Match our current directory name
string (REGEX MATCH "[^/\\]*$" TYPENAME ${CMAKE_CURRENT_SOURCE_DIR})
string(TOUPPER ${TYPENAME} TYPENAME )
include_directories (
..
${ACG_INCLUDE_DIR}
${OPENMESH_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../..
${CMAKE_CURRENT_BINARY_DIR}
${OPENGL_INCLUDE_DIR}
${GLEW_INCLUDE_DIR}
${GLUT_INCLUDE_DIR}
)
acg_add_library ( ${TYPENAME} SHARED ${sources} ${headers} )
add_dependencies( ${TYPENAME} OpenMeshCore OpenMeshTools ACG OpenFlipperPluginLib)
target_link_libraries (${TYPENAME}
${OPENMESH_LIBRARIES}
ACG
${QT_LIBRARIES}
${OPENGL_LIBRARIES}
${GLEW_LIBRARY}
${GLUT_LIBRARIES}
)
include (plugin)
openflipper_plugin (INSTALLDATA Icons
TYPES POLYLINE)
include (plugin)
openflipper_plugin (INSTALLDATA Icons
TYPES POLYLINECOLLECTION )
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment