|
@@ -1,6 +1,8 @@
|
|
# Usage:
|
|
# Usage:
|
|
# cmake -P GenerateMappings.cmake <path/to/mappings.h.in> <path/to/mappings.h>
|
|
# cmake -P GenerateMappings.cmake <path/to/mappings.h.in> <path/to/mappings.h>
|
|
|
|
|
|
|
|
+cmake_policy(VERSION 3.16)
|
|
|
|
+
|
|
set(source_url "https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt")
|
|
set(source_url "https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt")
|
|
set(source_path "${CMAKE_CURRENT_BINARY_DIR}/gamecontrollerdb.txt")
|
|
set(source_path "${CMAKE_CURRENT_BINARY_DIR}/gamecontrollerdb.txt")
|
|
set(template_path "${CMAKE_ARGV3}")
|
|
set(template_path "${CMAKE_ARGV3}")
|
|
@@ -22,24 +24,24 @@ if (status_code)
|
|
endif()
|
|
endif()
|
|
|
|
|
|
file(STRINGS "${source_path}" lines)
|
|
file(STRINGS "${source_path}" lines)
|
|
-foreach(line ${lines})
|
|
|
|
- if (line MATCHES "^[0-9a-fA-F]")
|
|
|
|
- if (line MATCHES "platform:Windows")
|
|
|
|
- if (GLFW_WIN32_MAPPINGS)
|
|
|
|
- string(APPEND GLFW_WIN32_MAPPINGS "\n")
|
|
|
|
- endif()
|
|
|
|
- string(APPEND GLFW_WIN32_MAPPINGS "\"${line}\",")
|
|
|
|
- elseif (line MATCHES "platform:Mac OS X")
|
|
|
|
- if (GLFW_COCOA_MAPPINGS)
|
|
|
|
- string(APPEND GLFW_COCOA_MAPPINGS "\n")
|
|
|
|
- endif()
|
|
|
|
- string(APPEND GLFW_COCOA_MAPPINGS "\"${line}\",")
|
|
|
|
- elseif (line MATCHES "platform:Linux")
|
|
|
|
- if (GLFW_LINUX_MAPPINGS)
|
|
|
|
- string(APPEND GLFW_LINUX_MAPPINGS "\n")
|
|
|
|
- endif()
|
|
|
|
- string(APPEND GLFW_LINUX_MAPPINGS "\"${line}\",")
|
|
|
|
|
|
+list(FILTER lines INCLUDE REGEX "^[0-9a-fA-F]")
|
|
|
|
+
|
|
|
|
+foreach(line IN LISTS lines)
|
|
|
|
+ if (line MATCHES "platform:Windows")
|
|
|
|
+ if (GLFW_WIN32_MAPPINGS)
|
|
|
|
+ string(APPEND GLFW_WIN32_MAPPINGS "\n")
|
|
|
|
+ endif()
|
|
|
|
+ string(APPEND GLFW_WIN32_MAPPINGS "\"${line}\",")
|
|
|
|
+ elseif (line MATCHES "platform:Mac OS X")
|
|
|
|
+ if (GLFW_COCOA_MAPPINGS)
|
|
|
|
+ string(APPEND GLFW_COCOA_MAPPINGS "\n")
|
|
|
|
+ endif()
|
|
|
|
+ string(APPEND GLFW_COCOA_MAPPINGS "\"${line}\",")
|
|
|
|
+ elseif (line MATCHES "platform:Linux")
|
|
|
|
+ if (GLFW_LINUX_MAPPINGS)
|
|
|
|
+ string(APPEND GLFW_LINUX_MAPPINGS "\n")
|
|
endif()
|
|
endif()
|
|
|
|
+ string(APPEND GLFW_LINUX_MAPPINGS "\"${line}\",")
|
|
endif()
|
|
endif()
|
|
endforeach()
|
|
endforeach()
|
|
|
|
|