[Bf-blender-cvs] [89014b51f12] master: Xcode: support cmake options for grouping in folders
Germano Cavalcante
noreply at git.blender.org
Thu Aug 5 20:31:53 CEST 2021
Commit: 89014b51f12779efbd9499f91a86b96c7407b2f7
Author: Germano Cavalcante
Date: Thu Aug 5 12:49:55 2021 -0300
Branches: master
https://developer.blender.org/rB89014b51f12779efbd9499f91a86b96c7407b2f7
Xcode: support cmake options for grouping in folders
The Xcode IDE can also benefit from the options:
- WINDOWS_USE_VISUAL_STUDIO_SOURCE_FOLDERS
- WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS
So add suport to these options and also renames them as they are no
longer limited to just Windows and Visual Studio.
Reviewed By: brecht, ankitm
Differential Revision: https://developer.blender.org/D12132
===================================================================
M CMakeLists.txt
M build_files/cmake/macros.cmake
M build_files/cmake/platform/platform_win32.cmake
M intern/cycles/cmake/macros.cmake
===================================================================
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3baebba4678..2868324bf46 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -612,12 +612,6 @@ if(WIN32)
option(WITH_WINDOWS_FIND_MODULES "Use find_package to locate libraries" OFF)
mark_as_advanced(WITH_WINDOWS_FIND_MODULES)
- 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)
-
- 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)
mark_as_advanced(WINDOWS_PYTHON_DEBUG)
@@ -635,6 +629,18 @@ if(WIN32)
endif()
+if(WIN32 OR XCODE)
+ option(IDE_GROUP_SOURCES_IN_FOLDERS "Organize the source files in filters matching the source folders." ON)
+ mark_as_advanced(IDE_GROUP_SOURCES_IN_FOLDERS)
+
+ option(IDE_GROUP_PROJECTS_IN_FOLDERS "Organize the projects according to source folder structure." ON)
+ mark_as_advanced(IDE_GROUP_PROJECTS_IN_FOLDERS)
+
+ if (IDE_GROUP_PROJECTS_IN_FOLDERS)
+ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
+ endif()
+endif()
+
if(UNIX)
# See WITH_WINDOWS_SCCACHE for Windows.
option(WITH_COMPILER_CCACHE "Use ccache to improve rebuild times (Works with Ninja, Makefiles and Xcode)" OFF)
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 8ad3f77c7d3..1471aa21505 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -208,7 +208,7 @@ function(blender_source_group
)
# if enabled, use the sources directories as filters.
- if(WINDOWS_USE_VISUAL_STUDIO_SOURCE_FOLDERS)
+ if(IDE_GROUP_SOURCES_IN_FOLDERS)
foreach(_SRC ${sources})
# remove ../'s
get_filename_component(_SRC_DIR ${_SRC} REALPATH)
@@ -240,8 +240,8 @@ function(blender_source_group
endforeach()
endif()
- # if enabled, set the FOLDER property for visual studio projects
- if(WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS)
+ # if enabled, set the FOLDER property for the projects
+ if(IDE_GROUP_PROJECTS_IN_FOLDERS)
get_filename_component(FolderDir ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
string(REPLACE ${CMAKE_SOURCE_DIR} "" FolderDir ${FolderDir})
set_target_properties(${name} PROPERTIES FOLDER ${FolderDir})
diff --git a/build_files/cmake/platform/platform_win32.cmake b/build_files/cmake/platform/platform_win32.cmake
index 113c41c545b..3773aaaffed 100644
--- a/build_files/cmake/platform/platform_win32.cmake
+++ b/build_files/cmake/platform/platform_win32.cmake
@@ -57,8 +57,6 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang")
endif()
endif()
-set_property(GLOBAL PROPERTY USE_FOLDERS ${WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS})
-
if(NOT WITH_PYTHON_MODULE)
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT blender)
endif()
diff --git a/intern/cycles/cmake/macros.cmake b/intern/cycles/cmake/macros.cmake
index ff62b816e6c..47196dfd1ce 100644
--- a/intern/cycles/cmake/macros.cmake
+++ b/intern/cycles/cmake/macros.cmake
@@ -13,7 +13,7 @@
# limitations under the License.
function(cycles_set_solution_folder target)
- if(WINDOWS_USE_VISUAL_STUDIO_FOLDERS)
+ if(IDE_GROUP_PROJECTS_IN_FOLDERS)
get_filename_component(folderdir ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
string(REPLACE ${CMAKE_SOURCE_DIR} "" folderdir ${folderdir})
set_target_properties(${target} PROPERTIES FOLDER ${folderdir})
More information about the Bf-blender-cvs
mailing list