annotate Resources/CMake/Utilities.cmake @ 1442:11f291ac3ef5 legacy-loader-refactoring

This branch is useless.
author Benjamin Golinvaux <bgo@osimis.io>
date Tue, 26 May 2020 10:11:49 +0200
parents dc5acb03ad93
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
466
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
1
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
2
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
3 macro(GetFilenameFromPath TargetVariable Path)
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
4 #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
5 string(REPLACE "\\" "/" PathWithFwdSlashes "${Path}")
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
6 string(REGEX REPLACE "^.*/" "" ${TargetVariable} "${PathWithFwdSlashes}")
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
7 #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
8 endmacro()
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
9
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
10 macro(GetFilePathWithoutLastExtension TargetVariable FilePath)
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
11 string(REGEX REPLACE "(^.*)\\.([^\\.]+)" "\\1" ${TargetVariable} "${FilePath}")
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
12 #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
13 endmacro()
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
14
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
15 macro(Test_GetFilePathWithoutLastExtension)
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
16 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
17 GetFilePathWithoutLastExtension(TargetVariable "${tmp}")
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
18 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
19 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
20 else()
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
21 #message(STATUS "Test_GetFilePathWithoutLastExtension: <<OK>>")
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
22 endif()
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
23 endmacro()
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
24
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
25 Test_GetFilePathWithoutLastExtension()
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(Test_GetFilenameFromPath)
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
28 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
29 GetFilenameFromPath(TargetVariable "${tmp}")
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
30 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
31 message(FATAL_ERROR "Test_GetFilenameFromPath failed")
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
32 else()
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
33 #message(STATUS "Test_GetFilenameFromPath: <<OK>>")
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
34 endif()
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
35 endmacro()
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
36
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents:
diff changeset
37 Test_GetFilenameFromPath()
1376
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
38
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
39 macro(SortFilesInSourceGroups)
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
40 if(FALSE)
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
41 foreach(source IN LISTS ORTHANC_STONE_SOURCES)
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
42 # if("${source}" MATCHES ".*/pixman.*\\.c")
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
43 # message("pixman source: ${source}")
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
44 # elseif("${source}" MATCHES ".*/pixman.*\\.c")
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
45 # message("pixman header: ${source}")
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
46 # endif()
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
47
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
48 if("${source}" MATCHES ".*\\.\\./.*")
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
49 message("source raw: ${source}")
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
50 #file(TO_CMAKE_PATH ${source} sourceCMakePath)
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
51 get_filename_component(sourceCMakePath ${source} ABSOLUTE)
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
52 message("source CMake: ${sourceCMakePath}")
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
53 endif()
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
54
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
55 # returns the containing directory with forward slashes
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
56 # get_filename_component(source_path "${source}" PATH)
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
57
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
58 # converts / to \
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
59 # string(REPLACE "/" "\\" source_path_msvc "${source_path}")
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
60 #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
61 endforeach()
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
62 endif()
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
63
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
64 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
65 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
66 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
67
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
68 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
69 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
70 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
71
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
72 source_group("Stone Samples\\Source" REGULAR_EXPRESSION ".*orthanc-stone/Samples/.*\\.cpp")
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
73 source_group("Stone Samples\\Headers" REGULAR_EXPRESSION ".*orthanc-stone/Samples/.*\\.h")
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 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
76 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
77 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
78 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
79 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
80 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
81 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
82 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
83 endmacro()
dc5acb03ad93 Better source groups for SDL samples (retry)
Benjamin Golinvaux <bgo@osimis.io>
parents: 466
diff changeset
84