annotate Applications/Samples/Sdl/Utilities.cmake @ 1739:9ac2a65d4172

upgrade to year 2021
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 06 Jan 2021 17:50:00 +0100
parents 8c5f9864545f
children 3889ae96d2e9
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
1739
9ac2a65d4172 upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1589
diff changeset
4 # Copyright (C) 2017-2021 Osimis S.A., Belgium
1589
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
5 #
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
6 # 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
7 # 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
8 # 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
9 # the License, or (at your option) any later version.
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
10 #
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
11 # 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
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
14 # Affero General Public License for more details.
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
15 #
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
16 # 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
17 # 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
18
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 macro(GetFilenameFromPath TargetVariable Path)
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
21 #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
22 string(REPLACE "\\" "/" PathWithFwdSlashes "${Path}")
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
23 string(REGEX REPLACE "^.*/" "" ${TargetVariable} "${PathWithFwdSlashes}")
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
24 #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
25 endmacro()
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
26
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
27 macro(GetFilePathWithoutLastExtension TargetVariable FilePath)
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
28 string(REGEX REPLACE "(^.*)\\.([^\\.]+)" "\\1" ${TargetVariable} "${FilePath}")
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
29 #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
30 endmacro()
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
31
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
32 macro(Test_GetFilePathWithoutLastExtension)
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
33 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
34 GetFilePathWithoutLastExtension(TargetVariable "${tmp}")
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
35 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
36 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
37 else()
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
38 #message(STATUS "Test_GetFilePathWithoutLastExtension: <<OK>>")
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
39 endif()
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
40 endmacro()
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
41
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
42 Test_GetFilePathWithoutLastExtension()
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
43
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
44 macro(Test_GetFilenameFromPath)
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
45 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
46 GetFilenameFromPath(TargetVariable "${tmp}")
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
47 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
48 message(FATAL_ERROR "Test_GetFilenameFromPath failed")
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
49 else()
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
50 #message(STATUS "Test_GetFilenameFromPath: <<OK>>")
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
51 endif()
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
52 endmacro()
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
53
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
54 Test_GetFilenameFromPath()
1376
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
55
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
56 macro(SortFilesInSourceGroups)
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
57 if(FALSE)
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
58 foreach(source IN LISTS ORTHANC_STONE_SOURCES)
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
59 # if("${source}" MATCHES ".*/pixman.*\\.c")
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
60 # message("pixman source: ${source}")
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
61 # elseif("${source}" MATCHES ".*/pixman.*\\.c")
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
62 # message("pixman header: ${source}")
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
63 # endif()
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
64
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
65 if("${source}" MATCHES ".*\\.\\./.*")
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
66 message("source raw: ${source}")
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
67 #file(TO_CMAKE_PATH ${source} sourceCMakePath)
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
68 get_filename_component(sourceCMakePath ${source} ABSOLUTE)
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
69 message("source CMake: ${sourceCMakePath}")
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
70 endif()
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
71
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
72 # returns the containing directory with forward slashes
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
73 # get_filename_component(source_path "${source}" PATH)
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
74
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
75 # converts / to \
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
76 # string(REPLACE "/" "\\" source_path_msvc "${source_path}")
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
77 #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
78 endforeach()
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
79 endif()
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
80
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
81 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
82 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
83 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
84
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
85 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
86 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
87 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
88
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
89 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
90 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
91
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
92 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
93 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
94 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
95 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
96 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
97 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
98 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
99 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
100 endmacro()
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
101