diff Resources/CMake/Utilities.cmake @ 1376:dc5acb03ad93 broker

Better source groups for SDL samples (retry)
author Benjamin Golinvaux <bgo@osimis.io>
date Wed, 22 Apr 2020 11:54:57 +0200
parents 5055031f4a06
children
line wrap: on
line diff
--- a/Resources/CMake/Utilities.cmake	Mon Apr 20 16:21:09 2020 +0200
+++ b/Resources/CMake/Utilities.cmake	Wed Apr 22 11:54:57 2020 +0200
@@ -35,3 +35,50 @@
 endmacro()
 
 Test_GetFilenameFromPath()
+
+macro(SortFilesInSourceGroups)
+  if(FALSE)
+    foreach(source IN LISTS ORTHANC_STONE_SOURCES)
+        # if("${source}" MATCHES ".*/pixman.*\\.c")
+        #   message("pixman source: ${source}")
+        # elseif("${source}" MATCHES ".*/pixman.*\\.c")
+        #   message("pixman header: ${source}")
+        # endif()
+        
+        if("${source}" MATCHES ".*\\.\\./.*")
+          message("source raw: ${source}")
+          #file(TO_CMAKE_PATH ${source} sourceCMakePath)
+          get_filename_component(sourceCMakePath ${source} ABSOLUTE)
+          message("source CMake: ${sourceCMakePath}")
+        endif()
+
+        # returns the containing directory with forward slashes
+        # get_filename_component(source_path "${source}" PATH) 
+
+        # converts / to \
+        # string(REPLACE "/" "\\" source_path_msvc "${source_path}")
+        #source_group("Stone ${source_path_msvc}" FILES "${source}")
+    endforeach()
+  endif()
+
+  source_group("Orthanc Framework\\Sources" REGULAR_EXPRESSION ".*/orthanc/(Core|Plugins)/.*cpp")
+  source_group("Orthanc Framework\\Headers" REGULAR_EXPRESSION ".*/orthanc/(Core|Plugins)/.*hpp")
+  source_group("Orthanc Framework\\Headers" REGULAR_EXPRESSION ".*/orthanc/(Core|Plugins)/.*h")
+
+  source_group("Stone Library\\Sources" REGULAR_EXPRESSION ".*/orthanc-stone/.*cpp")
+  source_group("Stone Library\\Headers" REGULAR_EXPRESSION ".*/orthanc-stone/.*hpp")
+  source_group("Stone Library\\Headers" REGULAR_EXPRESSION ".*/orthanc-stone/.*h")
+
+  source_group("Stone Samples\\Source" REGULAR_EXPRESSION ".*orthanc-stone/Samples/.*\\.cpp")
+  source_group("Stone Samples\\Headers" REGULAR_EXPRESSION ".*orthanc-stone/Samples/.*\\.h")
+
+  source_group("ThirdParty\\cairo" REGULAR_EXPRESSION ".*${CMAKE_BINARY_DIR}/cairo[^/]*/.*")
+  source_group("ThirdParty\\pixman" REGULAR_EXPRESSION ".*${CMAKE_BINARY_DIR}/pixman[^/]*/.*")
+  source_group("ThirdParty\\base64" REGULAR_EXPRESSION ".*ThirdParty/base64.*")
+  source_group("ThirdParty\\SDL2" REGULAR_EXPRESSION ".*${CMAKE_BINARY_DIR}/SDL2.*")
+  source_group("ThirdParty\\glew" REGULAR_EXPRESSION ".*${CMAKE_BINARY_DIR}/glew.*")
+  source_group("AUTOGENERATED" REGULAR_EXPRESSION ".*${CMAKE_BINARY_DIR}/AUTOGENERATED/.*")
+  source_group("ThirdParty\\minizip" REGULAR_EXPRESSION ".*ThirdParty/minizip/.*")
+  source_group("ThirdParty\\md5" REGULAR_EXPRESSION ".*ThirdParty/md5/.*")
+endmacro()
+