Commit fe518bd2 authored by Jan Möbius's avatar Jan Möbius

Merge branch 'feature_CMAKE_Folders_MSVC' into 'master'

Feature cmake folders msvc

I added a cmake macro to display the files on msvc grouped by folders.

@moebius  please test this on Visual studio version 2013, i was not able to test it since the installation on Krone crashes when opening the project files. Since i saw this behaviour already a few ays ago when @lyon wanted to compile something on the same machine, i assume there might be something broken or bad configured on Krone. ;)

See merge request !103
parents d189835e 809ce2a0
Pipeline #2040 passed with stage
in 78 minutes and 36 seconds
......@@ -156,6 +156,8 @@ endif ()
# display results
acg_print_configure_header (ACG "ACG")
RECURSE_GROUPS( ${CMAKE_CURRENT_SOURCE_DIR} )
target_link_libraries ( ACG ${OPENMESH_LIBRARIES}
${QT_LIBRARIES}
${OPENGL_LIBRARIES}
......
......@@ -40,6 +40,7 @@ set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${_more_macro_directories})
# include our cmake files
include (ACGCommon)
include (MSVCMacros)
acg_get_version (OpenFlipper)
......@@ -246,6 +247,12 @@ foreach (_localLib ${REMAINING_LOCAL_LIBS})
endif()
endforeach ()
# Group the external libraries in a folder libs_required
GROUP_PROJECT(OpenMeshTools libs_required)
GROUP_PROJECT(OpenMeshCore libs_required)
GROUP_PROJECT(OpenVolumeMesh libs_required)
GROUP_PROJECT(doc-install Documentation)
# ========================================================================
# Core Library Components (Except the Core application)
# ========================================================================
......
......@@ -119,6 +119,8 @@ file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/static_plugins.cc" ";\n} /* namespace c
list(APPEND RC_SRC "${CMAKE_CURRENT_BINARY_DIR}/static_plugins.cc")
RECURSE_GROUPS( ${CMAKE_CURRENT_SOURCE_DIR}/../../ )
if (WIN32)
# add app icon rc file to windows build
acg_add_executable (${OPENFLIPPER_PRODUCT_STRING} WIN32 ${CMAKE_CURRENT_SOURCE_DIR}/CoreApp.rc ${uic_targets} ${sources} ${headers} ${moc_targets} ${RC_SRC})
......
......@@ -157,6 +157,7 @@ endif ()
#=======================================================
# Create library
#=======================================================
RECURSE_GROUPS( ${CMAKE_CURRENT_SOURCE_DIR}/../../ )
if (QT5_FOUND)
acg_add_library (OpenFlipperPluginLib SHARED ${uic_targets} ${sources} ${headers} ${moc_targets})
......@@ -164,6 +165,7 @@ elseif (QT4_FOUND)
acg_add_library (OpenFlipperPluginLib SHARED ${uic_targets} ${sources} ${headers} ${moc_targets})
endif ()
if( ADDITIONAL_PLUGINLIB_COMPILER_FLAGS )
set_target_properties (
OpenFlipperPluginLib PROPERTIES
......@@ -171,6 +173,7 @@ if( ADDITIONAL_PLUGINLIB_COMPILER_FLAGS )
)
endif()
target_link_libraries (OpenFlipperPluginLib
${OPENMESH_LIBRARIES}
ACG
......
......@@ -77,6 +77,8 @@ function (of_add_plugins)
# dependency of the plugin target.
add_custom_target(RSRC-${_plugin} DEPENDS ${DATA_FILES})
add_dependencies(Plugin-${_plugin} RSRC-${_plugin})
# group by folder on msvc
GROUP_PROJECT(RSRC-${_plugin} "Ressources")
endif()
endforeach ()
......
......@@ -61,6 +61,7 @@ endif(OPENFLIPPER_PLUGIN_INCLUDED)
set(OPENFLIPPER_PLUGIN_INCLUDED TRUE PARENT_SCOPE)
include (ACGCommon)
include (MSVCMacros)
# get plugin name from directory name
macro (_get_plugin_name var)
......@@ -402,7 +403,6 @@ endmacro ()
# main function
#======================================================
function (_build_openflipper_plugin plugin)
acg_set (OPENFLIPPER_${_PLUGIN}_BUILD "0")
# get upper plugin name
......@@ -609,6 +609,10 @@ function (_build_openflipper_plugin plugin)
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)
get_filename_component(PARENT_DIR ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
get_filename_component(PARENT_DIR_NAME "${PARENT_DIR}" NAME)
GROUP_PROJECT(Plugin-${plugin} ${PARENT_DIR_NAME})
# add this plugin to build plugin list for dependency tracking
acg_set (OPENFLIPPER_PLUGINS "${OPENFLIPPER_PLUGINS};Plugin-${plugin}")
acg_set (OPENFLIPPER_${_PLUGIN}_BUILD "1")
......@@ -784,7 +788,6 @@ endfunction ()
macro (openflipper_plugin)
_get_plugin_name (_plugin)
string (TOUPPER ${_plugin} _PLUGIN)
# add option to disable plugin build
......@@ -803,6 +806,8 @@ macro (openflipper_plugin)
)
if (NOT DISABLE_PLUGIN_${_PLUGIN})
#group the files in msvc
RECURSE_GROUPS( ${CMAKE_CURRENT_SOURCE_DIR} )
_build_openflipper_plugin (${_plugin} ${ARGN})
set(LOADED_PACKAGES ${LOADED_PACKAGES} PARENT_SCOPE)
set(INSTALLDATA_DIRS ${INSTALLDATA_DIRS} PARENT_SCOPE)
......
include (MSVCMacros)
if (EXISTS ${CMAKE_SOURCE_DIR}/${CMAKE_PROJECT_NAME}.cmake)
include (${CMAKE_SOURCE_DIR}/${CMAKE_PROJECT_NAME}.cmake)
endif ()
......@@ -38,6 +39,7 @@ endif ()
if ( NOT TARGET doc )
ADD_CUSTOM_TARGET( doc )
SET_TARGET_PROPERTIES( doc PROPERTIES EchoString "Building Documentation" )
GROUP_PROJECT(doc Documentation)
endif()
# read version from file
......@@ -945,6 +947,7 @@ function (acg_add_translations _target _languages _sources)
# create a target for the translation files ( and object files )
# Use this target, to update only the translations
add_custom_target (translations_target_${_target} DEPENDS ${_qm_files})
GROUP_PROJECT( translations_target_${_target} "Translations")
# Build translations with the application
add_dependencies(${_target} translations_target_${_target} )
......
......@@ -103,6 +103,8 @@ IF (DOXYGEN_FOUND)
ENDIF(EXISTS "${DOC_DIRECTORY}/doxy.config.in")
ADD_CUSTOM_TARGET(${target} ${DOXYGEN_EXECUTABLE} ${DOXY_CONFIG})
# Group by folders on MSVC
GROUP_PROJECT( ${target} "Documentation")
add_dependencies( ${DOC_DEPENDENCY} ${target} )
......
if(MSVC_MACROS_INCLUDED)
return()
endif(MSVC_MACROS_INCLUDED)
set(MSVC_MACROS_INCLUDED TRUE)
set (MSVC_GROUPING ON CACHE BOOL "Group Files by folder structure on MSVC.")
# Enable project folders to group targets in solution folders on MSVC.
if(${MSVC_GROUPING})
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
endif(${MSVC_GROUPING})
MACRO (RECURSE_GROUPS dirname)
if(${MSVC_GROUPING})
SET(ALL_FILES)
FILE(GLOB_RECURSE allfiles "${dirname}/*.*")
SET(ALL_FILES ${ALL_FILES} ${allfiles})
STRING(REGEX REPLACE ".*/([^/]*)" "\\1" maindir "${dirname}")
FOREACH(file ${allfiles})
STRING(REGEX REPLACE "${dirname}/(.*)/[^/]*" "\\1" loopdirname "${file}")
STRING(REGEX REPLACE "/" "\\\\" loopdirname "${loopdirname}")
IF(NOT "${file}" MATCHES "${dirname}/(.*)/[^/]*")
source_group("${maindir}" FILES ${file})
ELSE()
source_group("${maindir}\\${loopdirname}" FILES ${file})
ENDIF()
ENDFOREACH()
endif(${MSVC_GROUPING})
ENDMACRO (RECURSE_GROUPS)
MACRO (GROUP_PROJECT targetname groupname)
if(${MSVC_GROUPING})
set_target_properties(${targetname}
PROPERTIES
FOLDER "${groupname}")
endif(${MSVC_GROUPING})
ENDMACRO (GROUP_PROJECT)
\ No newline at end of file
......@@ -15,11 +15,11 @@ if(BUILD_TESTING)
copy_if_different
${OPENFLIPPER_TEST_BINARIES}/${CMAKE_CFG_INTDIR}/minimalExecTest.exe
${OPENFLIPPER_TEST_BINARIES}/minimalExecTest.exe)
GROUP_PROJECT(minimalExecutionTest Tests)
endif()
ADD_TEST(NAME "Minimal_Execution_Test"
COMMAND ${OPENFLIPPER_TEST_BINARIES}/minimalExecTest )
set_tests_properties( Minimal_Execution_Test PROPERTIES
TIMEOUT 10
)
......
......@@ -12,6 +12,8 @@ ENDIF()
add_executable (compareTool compareTool.cc )
GROUP_PROJECT(compareTool Tests)
target_link_libraries (compareTool
${QT_LIBRARIES}
)
......
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