annotate Applications/Samples/Sdl/Utilities.cmake @ 2112:1bc9f6157833

todo
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 18 Jan 2024 07:48:07 +0100
parents 07964689cb0b
children c23eef785569
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1589
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
1 # Stone of Orthanc
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
2 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
3 # Department, University Hospital of Liege, Belgium
2077
07964689cb0b upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
4 # Copyright (C) 2017-2023 Osimis S.A., Belgium
07964689cb0b upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
5 # Copyright (C) 2021-2023 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
1589
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
6 #
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
7 # This program is free software: you can redistribute it and/or
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
8 # modify it under the terms of the GNU Affero General Public License
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
9 # as published by the Free Software Foundation, either version 3 of
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
10 # the License, or (at your option) any later version.
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
11 #
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
12 # This program is distributed in the hope that it will be useful, but
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
15 # Affero General Public License for more details.
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
16 #
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
17 # You should have received a copy of the GNU Affero General Public License
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
466
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
19
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
20
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
21 macro(GetFilenameFromPath TargetVariable Path)
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
22 #message(STATUS "GetFilenameFromPath (1): Path = ${Path} TargetVariable = ${${TargetVariable}}")
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
23 string(REPLACE "\\" "/" PathWithFwdSlashes "${Path}")
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
24 string(REGEX REPLACE "^.*/" "" ${TargetVariable} "${PathWithFwdSlashes}")
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
25 #message(STATUS "GetFilenameFromPath (2): Path = ${Path} Path = ${PathWithFwdSlashes} TargetVariable = ${TargetVariable}")
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
26 endmacro()
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
27
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
28 macro(GetFilePathWithoutLastExtension TargetVariable FilePath)
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
29 string(REGEX REPLACE "(^.*)\\.([^\\.]+)" "\\1" ${TargetVariable} "${FilePath}")
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
30 #message(STATUS "GetFileNameWithoutLastExtension: FilePath = ${FilePath} TargetVariable = ${${TargetVariable}}")
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
31 endmacro()
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
32
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
33 macro(Test_GetFilePathWithoutLastExtension)
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
34 set(tmp "/prout/zi/goui.goui.cpp")
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
35 GetFilePathWithoutLastExtension(TargetVariable "${tmp}")
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
36 if(NOT ("${TargetVariable}" STREQUAL "/prout/zi/goui.goui"))
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
37 message(FATAL_ERROR "Test_GetFilePathWithoutLastExtension failed (1)")
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
38 else()
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
39 #message(STATUS "Test_GetFilePathWithoutLastExtension: <<OK>>")
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
40 endif()
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
41 endmacro()
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
42
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
43 Test_GetFilePathWithoutLastExtension()
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
44
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
45 macro(Test_GetFilenameFromPath)
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
46 set(tmp "/prout/../../dada/zi/goui.goui.cpp")
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
47 GetFilenameFromPath(TargetVariable "${tmp}")
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
48 if(NOT ("${TargetVariable}" STREQUAL "goui.goui.cpp"))
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
49 message(FATAL_ERROR "Test_GetFilenameFromPath failed")
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
50 else()
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
51 #message(STATUS "Test_GetFilenameFromPath: <<OK>>")
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
52 endif()
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
53 endmacro()
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
54
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
55 Test_GetFilenameFromPath()
1376
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
56
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
57 macro(SortFilesInSourceGroups)
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
58 if(FALSE)
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
59 foreach(source IN LISTS ORTHANC_STONE_SOURCES)
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
60 # if("${source}" MATCHES ".*/pixman.*\\.c")
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
61 # message("pixman source: ${source}")
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
62 # elseif("${source}" MATCHES ".*/pixman.*\\.c")
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
63 # message("pixman header: ${source}")
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
64 # endif()
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
65
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
66 if("${source}" MATCHES ".*\\.\\./.*")
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
67 message("source raw: ${source}")
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
68 #file(TO_CMAKE_PATH ${source} sourceCMakePath)
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
69 get_filename_component(sourceCMakePath ${source} ABSOLUTE)
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
70 message("source CMake: ${sourceCMakePath}")
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
71 endif()
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
72
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
73 # returns the containing directory with forward slashes
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
74 # get_filename_component(source_path "${source}" PATH)
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
75
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
76 # converts / to \
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
77 # string(REPLACE "/" "\\" source_path_msvc "${source_path}")
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
78 #source_group("Stone ${source_path_msvc}" FILES "${source}")
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
79 endforeach()
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
80 endif()
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
81
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
82 source_group("Orthanc Framework\\Sources" REGULAR_EXPRESSION ".*/orthanc/(Core|Plugins)/.*cpp")
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
83 source_group("Orthanc Framework\\Headers" REGULAR_EXPRESSION ".*/orthanc/(Core|Plugins)/.*hpp")
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
84 source_group("Orthanc Framework\\Headers" REGULAR_EXPRESSION ".*/orthanc/(Core|Plugins)/.*h")
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
85
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
86 source_group("Stone Library\\Sources" REGULAR_EXPRESSION ".*/orthanc-stone/.*cpp")
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
87 source_group("Stone Library\\Headers" REGULAR_EXPRESSION ".*/orthanc-stone/.*hpp")
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
88 source_group("Stone Library\\Headers" REGULAR_EXPRESSION ".*/orthanc-stone/.*h")
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
89
1521
bc4c50a53bd3 changed a few remaining instances of orthanc-stone/Samples to orthanc-stone/OrthancStone/Samples
Benjamin Golinvaux <bgo@osimis.io>
parents: 1512
diff changeset
90 source_group("Stone Samples\\Source" REGULAR_EXPRESSION ".*orthanc-stone/OrthancStone/Samples/.*\\.cpp")
bc4c50a53bd3 changed a few remaining instances of orthanc-stone/Samples to orthanc-stone/OrthancStone/Samples
Benjamin Golinvaux <bgo@osimis.io>
parents: 1512
diff changeset
91 source_group("Stone Samples\\Headers" REGULAR_EXPRESSION ".*orthanc-stone/OrthancStone/Samples/.*\\.h")
1376
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
92
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
93 source_group("ThirdParty\\cairo" REGULAR_EXPRESSION ".*${CMAKE_BINARY_DIR}/cairo[^/]*/.*")
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
94 source_group("ThirdParty\\pixman" REGULAR_EXPRESSION ".*${CMAKE_BINARY_DIR}/pixman[^/]*/.*")
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
95 source_group("ThirdParty\\base64" REGULAR_EXPRESSION ".*ThirdParty/base64.*")
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
96 source_group("ThirdParty\\SDL2" REGULAR_EXPRESSION ".*${CMAKE_BINARY_DIR}/SDL2.*")
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
97 source_group("ThirdParty\\glew" REGULAR_EXPRESSION ".*${CMAKE_BINARY_DIR}/glew.*")
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
98 source_group("AUTOGENERATED" REGULAR_EXPRESSION ".*${CMAKE_BINARY_DIR}/AUTOGENERATED/.*")
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
99 source_group("ThirdParty\\minizip" REGULAR_EXPRESSION ".*ThirdParty/minizip/.*")
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
100 source_group("ThirdParty\\md5" REGULAR_EXPRESSION ".*ThirdParty/md5/.*")
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
101 endmacro()
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
102