Notice to GitKraken users: A vulnerability has been found in the SSH key generation of GitKraken versions 7.6.0 to 8.0.0 (https://www.gitkraken.com/blog/weak-ssh-key-fix). If you use GitKraken and have generated a SSH key using one of these versions, please remove it both from your local workstation and from your LRZ GitLab profile.

21.10.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

Commit 02d432e8 authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

added grouping by directory to CMake files

parent 03b640b6
......@@ -21,6 +21,7 @@ OPTION(CAMPVIS_BUILD_LIB_KISSCL "Build KissCL Library"
OPTION(CAMPVIS_BUILD_DOXYGEN "Build Doxygen Documentation" ON)
OPTION(CAMPVIS_DEPLOY_SHADERS "Deploy Shader files to binary directory" OFF)
OPTION(CAMPVIS_GROUP_SOURCE_FILES "Group source files by directory" OFF)
IF(WIN32)
OPTION(CAMPVIS_COPY_EXTERNAL_DLLS "Copy external DLLs to bin directory?" ON)
......@@ -34,8 +35,6 @@ ENDIF()
include(cmake/commonconf.cmake)
include(cmake/parseModulesDir.cmake)
SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
MESSAGE(STATUS "--------------------------------------------------------------------------------")
IF(CAMPVIS_BUILD_LIB_TGT)
......
......@@ -75,6 +75,13 @@ ADD_DEFINITIONS(${CampvisGlobalDefinitions} ${CampvisModulesDefinitions} ${Campv
INCLUDE_DIRECTORIES(${CampvisGlobalIncludeDirs} ${CampvisModulesIncludeDirs})
TARGET_LINK_LIBRARIES(campvis-application campvis-core campvis-modules tgt ${CampvisGlobalExternalLibs} ${CampvisModulesExternalLibs} ${QT_LIBRARIES})
IF(CAMPVIS_GROUP_SOURCE_FILES)
DEFINE_SOURCE_GROUPS_FROM_SUBDIR(CampvisApplicationSources ${CampvisHome} "")
DEFINE_SOURCE_GROUPS_FROM_SUBDIR(CampvisApplicationHeaders ${CampvisHome} "")
ENDIF()
IF(CAMPVIS_DEPLOY_SHADERS)
LIST(APPEND CampvisShaderDirectories "application/glsl")
LIST(APPEND CampvisShaderDirectories "core/glsl")
......
# copy and pasted from Voreen...
MACRO(LIST_SUBDIRECTORIES Result Directory AbsolutePath)
FILE(GLOB sub-dirs RELATIVE ${Directory} ${Directory}/*)
......@@ -129,3 +130,49 @@ MACRO(ADD_GCC_PRECOMPILED_HEADER _targetName _input )
)
ENDMACRO(ADD_GCC_PRECOMPILED_HEADER)
# Assigns the passed Files to source groups according to their file path.
# The path prefixes as well as dot operators are removed from the path.
# E.g.: path/to/my/file.cpp => path\\to\\my
# <PathPrefix>/path/to/my/file.cpp => path\\to\\my
# ../../path/to/my/file.cpp => path\\to\\my
MACRO(DEFINE_SOURCE_GROUPS_FROM_SUBDIR Files BasePath RemovePathPrefixes)
FOREACH(f ${${Files}})
SET(f_cat "")
# extract relative file path
IF(IS_ABSOLUTE ${f})
FILE(RELATIVE_PATH f_rel ${BasePath} ${f})
GET_FILENAME_COMPONENT(f_rel ${f_rel} PATH)
ELSE()
GET_FILENAME_COMPONENT(f_rel ${f} PATH)
ENDIF()
# create source group specifier from rel path
IF(f_rel)
# remove ../
string(REGEX REPLACE "\\.\\./" "" f_cat ${f_rel})
# remove specified prefixes
FOREACH(prefix ${${RemovePathPrefixes}})
IF(f_cat)
string(REGEX REPLACE "${prefix}" "" f_cat ${f_cat})
ENDIF()
ENDFOREACH()
# convert path separators into source group separators:
# path/to/my => path\\to\\my
IF(f_cat)
string(REGEX REPLACE "\\\\|/" "\\\\\\\\" f_cat ${f_cat})
ENDIF()
ENDIF()
# set extracted source group
IF(f_cat)
SOURCE_GROUP("${f_cat}" FILES ${f})
ELSE()
SOURCE_GROUP("" FILES ${f})
ENDIF()
# MESSAGE(STATUS "${f} -> ${f_cat}")
ENDFOREACH()
ENDMACRO(DEFINE_SOURCE_GROUPS_FROM_SUBDIR)
\ No newline at end of file
PROJECT(campvis-core)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0 FATAL_ERROR)
INCLUDE(../cmake/commonconf.cmake)
#INCLUDE(../cmake/commonconf.cmake)
MESSAGE(STATUS "Configuring CAMPVis Core")
......@@ -66,3 +66,9 @@ ADD_LIBRARY(campvis-core
ADD_DEFINITIONS(${CampvisGlobalDefinitions} ${QT_DEFINITIONS})
INCLUDE_DIRECTORIES(${CampvisGlobalIncludeDirs})
TARGET_LINK_LIBRARIES(campvis-core tgt ${CampvisGlobalExternalLibs} ${QT_LIBRARIES})
IF(CAMPVIS_GROUP_SOURCE_FILES)
DEFINE_SOURCE_GROUPS_FROM_SUBDIR(CampvisCoreSources ${CampvisHome} "")
DEFINE_SOURCE_GROUPS_FROM_SUBDIR(CampvisCoreHeaders ${CampvisHome} "")
ENDIF()
\ No newline at end of file
......@@ -17,3 +17,8 @@ INCLUDE(${QT_USE_FILE})
ADD_DEFINITIONS(${CampvisGlobalDefinitions} ${CampvisModulesDefinitions} ${QT_DEFINITIONS})
INCLUDE_DIRECTORIES(${CampvisGlobalIncludeDirs} ${CampvisModulesIncludeDirs})
TARGET_LINK_LIBRARIES(campvis-modules campvis-core tgt ${CampvisGlobalExternalLibs} ${CampvisModulesExternalLibs} ${QT_LIBRARIES})
IF(CAMPVIS_GROUP_SOURCE_FILES)
DEFINE_SOURCE_GROUPS_FROM_SUBDIR(CampvisModulesSources ${CampvisHome} "")
DEFINE_SOURCE_GROUPS_FROM_SUBDIR(CampvisModulesHeaders ${CampvisHome} "")
ENDIF()
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