changeset 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 f15529add7b0
children 458ab069f313
files Resources/CMake/Utilities.cmake Samples/Sdl/SimpleViewer/CMakeLists.txt
diffstat 2 files changed, 53 insertions(+), 1 deletions(-) [+]
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()
+
--- a/Samples/Sdl/SimpleViewer/CMakeLists.txt	Mon Apr 20 16:21:09 2020 +0200
+++ b/Samples/Sdl/SimpleViewer/CMakeLists.txt	Wed Apr 22 11:54:57 2020 +0200
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 2.8.3)
+cmake_minimum_required(VERSION 2.8.10)
 
 project(SdlSimpleViewer)
 
@@ -18,6 +18,7 @@
 SET(ORTHANC_SANDBOXED OFF)
 
 include(${STONE_ROOT}/Resources/CMake/OrthancStoneConfiguration.cmake)
+include(${STONE_ROOT}/Resources/CMake/Utilities.cmake)
 
 include_directories(${STONE_ROOT})
 
@@ -28,10 +29,14 @@
   -DORTHANC_DEFAULT_DICOM_ENCODING=Encoding_Latin1
   )
 
+SortFilesInSourceGroups()
+
 add_executable(SdlSimpleViewer
   SdlSimpleViewerApplication.h
   SdlSimpleViewer.cpp
   ${ORTHANC_STONE_SOURCES}
   )
 
+
 target_link_libraries(SdlSimpleViewer ${DCMTK_LIBRARIES})
+