comparison Applications/Samples/Sdl/Utilities.cmake @ 1538:d1806b4e4839

moving OrthancStone/Samples/ as Applications/Samples/
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 11 Aug 2020 13:24:38 +0200
parents OrthancStone/Samples/Sdl/Utilities.cmake@bc4c50a53bd3
children 8c5f9864545f
comparison
equal deleted inserted replaced
1537:de8cf5859e84 1538:d1806b4e4839
1
2
3 macro(GetFilenameFromPath TargetVariable Path)
4 #message(STATUS "GetFilenameFromPath (1): Path = ${Path} TargetVariable = ${${TargetVariable}}")
5 string(REPLACE "\\" "/" PathWithFwdSlashes "${Path}")
6 string(REGEX REPLACE "^.*/" "" ${TargetVariable} "${PathWithFwdSlashes}")
7 #message(STATUS "GetFilenameFromPath (2): Path = ${Path} Path = ${PathWithFwdSlashes} TargetVariable = ${TargetVariable}")
8 endmacro()
9
10 macro(GetFilePathWithoutLastExtension TargetVariable FilePath)
11 string(REGEX REPLACE "(^.*)\\.([^\\.]+)" "\\1" ${TargetVariable} "${FilePath}")
12 #message(STATUS "GetFileNameWithoutLastExtension: FilePath = ${FilePath} TargetVariable = ${${TargetVariable}}")
13 endmacro()
14
15 macro(Test_GetFilePathWithoutLastExtension)
16 set(tmp "/prout/zi/goui.goui.cpp")
17 GetFilePathWithoutLastExtension(TargetVariable "${tmp}")
18 if(NOT ("${TargetVariable}" STREQUAL "/prout/zi/goui.goui"))
19 message(FATAL_ERROR "Test_GetFilePathWithoutLastExtension failed (1)")
20 else()
21 #message(STATUS "Test_GetFilePathWithoutLastExtension: <<OK>>")
22 endif()
23 endmacro()
24
25 Test_GetFilePathWithoutLastExtension()
26
27 macro(Test_GetFilenameFromPath)
28 set(tmp "/prout/../../dada/zi/goui.goui.cpp")
29 GetFilenameFromPath(TargetVariable "${tmp}")
30 if(NOT ("${TargetVariable}" STREQUAL "goui.goui.cpp"))
31 message(FATAL_ERROR "Test_GetFilenameFromPath failed")
32 else()
33 #message(STATUS "Test_GetFilenameFromPath: <<OK>>")
34 endif()
35 endmacro()
36
37 Test_GetFilenameFromPath()
38
39 macro(SortFilesInSourceGroups)
40 if(FALSE)
41 foreach(source IN LISTS ORTHANC_STONE_SOURCES)
42 # if("${source}" MATCHES ".*/pixman.*\\.c")
43 # message("pixman source: ${source}")
44 # elseif("${source}" MATCHES ".*/pixman.*\\.c")
45 # message("pixman header: ${source}")
46 # endif()
47
48 if("${source}" MATCHES ".*\\.\\./.*")
49 message("source raw: ${source}")
50 #file(TO_CMAKE_PATH ${source} sourceCMakePath)
51 get_filename_component(sourceCMakePath ${source} ABSOLUTE)
52 message("source CMake: ${sourceCMakePath}")
53 endif()
54
55 # returns the containing directory with forward slashes
56 # get_filename_component(source_path "${source}" PATH)
57
58 # converts / to \
59 # string(REPLACE "/" "\\" source_path_msvc "${source_path}")
60 #source_group("Stone ${source_path_msvc}" FILES "${source}")
61 endforeach()
62 endif()
63
64 source_group("Orthanc Framework\\Sources" REGULAR_EXPRESSION ".*/orthanc/(Core|Plugins)/.*cpp")
65 source_group("Orthanc Framework\\Headers" REGULAR_EXPRESSION ".*/orthanc/(Core|Plugins)/.*hpp")
66 source_group("Orthanc Framework\\Headers" REGULAR_EXPRESSION ".*/orthanc/(Core|Plugins)/.*h")
67
68 source_group("Stone Library\\Sources" REGULAR_EXPRESSION ".*/orthanc-stone/.*cpp")
69 source_group("Stone Library\\Headers" REGULAR_EXPRESSION ".*/orthanc-stone/.*hpp")
70 source_group("Stone Library\\Headers" REGULAR_EXPRESSION ".*/orthanc-stone/.*h")
71
72 source_group("Stone Samples\\Source" REGULAR_EXPRESSION ".*orthanc-stone/OrthancStone/Samples/.*\\.cpp")
73 source_group("Stone Samples\\Headers" REGULAR_EXPRESSION ".*orthanc-stone/OrthancStone/Samples/.*\\.h")
74
75 source_group("ThirdParty\\cairo" REGULAR_EXPRESSION ".*${CMAKE_BINARY_DIR}/cairo[^/]*/.*")
76 source_group("ThirdParty\\pixman" REGULAR_EXPRESSION ".*${CMAKE_BINARY_DIR}/pixman[^/]*/.*")
77 source_group("ThirdParty\\base64" REGULAR_EXPRESSION ".*ThirdParty/base64.*")
78 source_group("ThirdParty\\SDL2" REGULAR_EXPRESSION ".*${CMAKE_BINARY_DIR}/SDL2.*")
79 source_group("ThirdParty\\glew" REGULAR_EXPRESSION ".*${CMAKE_BINARY_DIR}/glew.*")
80 source_group("AUTOGENERATED" REGULAR_EXPRESSION ".*${CMAKE_BINARY_DIR}/AUTOGENERATED/.*")
81 source_group("ThirdParty\\minizip" REGULAR_EXPRESSION ".*ThirdParty/minizip/.*")
82 source_group("ThirdParty\\md5" REGULAR_EXPRESSION ".*ThirdParty/md5/.*")
83 endmacro()
84