forked from bartvdbraak/blender
Cmake: Add WINDOWS_USE_VISUAL_STUDIO_SOURCE_FOLDERS
option
This allows grouping files in a filter corresponding to the source files name. Differential Revision: https://developer.blender.org/D5077
This commit is contained in:
parent
bfd18c471d
commit
22b705d2cb
@ -561,6 +561,9 @@ if(WIN32)
|
|||||||
option(WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS "Organize the visual studio projects according to source folder structure." ON)
|
option(WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS "Organize the visual studio projects according to source folder structure." ON)
|
||||||
mark_as_advanced(WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS)
|
mark_as_advanced(WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS)
|
||||||
|
|
||||||
|
option(WINDOWS_USE_VISUAL_STUDIO_SOURCE_FOLDERS "Organize the source files in filters matching the source folders." ON)
|
||||||
|
mark_as_advanced(WINDOWS_USE_VISUAL_STUDIO_SOURCE_FOLDERS)
|
||||||
|
|
||||||
option(WINDOWS_PYTHON_DEBUG "Include the files needed for debugging python scripts with visual studio 2017+." OFF)
|
option(WINDOWS_PYTHON_DEBUG "Include the files needed for debugging python scripts with visual studio 2017+." OFF)
|
||||||
mark_as_advanced(WINDOWS_PYTHON_DEBUG)
|
mark_as_advanced(WINDOWS_PYTHON_DEBUG)
|
||||||
endif()
|
endif()
|
||||||
|
@ -173,23 +173,36 @@ function(blender_source_group
|
|||||||
sources
|
sources
|
||||||
)
|
)
|
||||||
|
|
||||||
# Group by location on disk
|
#if enabled, use the sources directories as filters.
|
||||||
source_group("Source Files" FILES CMakeLists.txt)
|
if(WINDOWS_USE_VISUAL_STUDIO_SOURCE_FOLDERS)
|
||||||
|
foreach(_SRC ${sources})
|
||||||
|
# remove ../'s
|
||||||
|
get_filename_component(_SRC_DIR ${_SRC} REALPATH)
|
||||||
|
get_filename_component(_SRC_DIR ${_SRC_DIR} DIRECTORY)
|
||||||
|
if(${_SRC_DIR} MATCHES "${CMAKE_CURRENT_SOURCE_DIR}/")
|
||||||
|
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" GROUP_ID ${_SRC_DIR})
|
||||||
|
string(REPLACE "/" "\\" GROUP_ID ${GROUP_ID})
|
||||||
|
source_group("${GROUP_ID}" FILES ${_SRC})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
else()
|
||||||
|
# Group by location on disk
|
||||||
|
source_group("Source Files" FILES CMakeLists.txt)
|
||||||
|
foreach(_SRC ${sources})
|
||||||
|
get_filename_component(_SRC_EXT ${_SRC} LAST_EXT)
|
||||||
|
if((${_SRC_EXT} MATCHES ".h") OR
|
||||||
|
(${_SRC_EXT} MATCHES ".hpp") OR
|
||||||
|
(${_SRC_EXT} MATCHES ".hh"))
|
||||||
|
|
||||||
foreach(_SRC ${sources})
|
set(GROUP_ID "Header Files")
|
||||||
get_filename_component(_SRC_EXT ${_SRC} LAST_EXT)
|
elseif(${_SRC_EXT} MATCHES ".glsl")
|
||||||
if((${_SRC_EXT} MATCHES ".h") OR
|
set(GROUP_ID "Shaders")
|
||||||
(${_SRC_EXT} MATCHES ".hpp") OR
|
else()
|
||||||
(${_SRC_EXT} MATCHES ".hh"))
|
set(GROUP_ID "Source Files")
|
||||||
|
endif()
|
||||||
set(GROUP_ID "Header Files")
|
source_group("${GROUP_ID}" FILES ${_SRC})
|
||||||
elseif(${_SRC_EXT} MATCHES ".glsl")
|
endforeach()
|
||||||
set(GROUP_ID "Shaders")
|
endif()
|
||||||
else()
|
|
||||||
set(GROUP_ID "Source Files")
|
|
||||||
endif()
|
|
||||||
source_group("${GROUP_ID}" FILES ${_SRC})
|
|
||||||
endforeach()
|
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user