diff options
| author | Ahmad Fatoum <[email protected]> | 2018-05-10 22:40:41 +0200 |
|---|---|---|
| committer | Ahmad Fatoum <[email protected]> | 2018-05-10 23:07:26 +0200 |
| commit | 0df501be91a09af6b4b06bf44df86d8d06cdcada (patch) | |
| tree | 9f9d0a7222b562952d0551bc17b6ca753b5f12ec /src/external/glfw/CMake/GenerateMappings.cmake | |
| parent | f11fe801809f5697c96010e0f08e26dc87c85b1b (diff) | |
| download | raylib-0df501be91a09af6b4b06bf44df86d8d06cdcada.tar.gz raylib-0df501be91a09af6b4b06bf44df86d8d06cdcada.zip | |
Add GLFW source tree to src/external
We need the CMake stuff for wayland configuration.
Otherwise, we would have to replicate that ourselves.
This is the full 7ef34eb06de54dd9186d3d21a401b2ef819b59e7 tree except
for tests/ examples/ and docs/
Diffstat (limited to 'src/external/glfw/CMake/GenerateMappings.cmake')
| -rw-r--r-- | src/external/glfw/CMake/GenerateMappings.cmake | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/external/glfw/CMake/GenerateMappings.cmake b/src/external/glfw/CMake/GenerateMappings.cmake new file mode 100644 index 00000000..7a88e3d4 --- /dev/null +++ b/src/external/glfw/CMake/GenerateMappings.cmake @@ -0,0 +1,33 @@ +# Usage: +# cmake -P GenerateMappings.cmake <path/to/mappings.h.in> <path/to/mappings.h> + +set(source_url "https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt") +set(source_path "${CMAKE_CURRENT_BINARY_DIR}/gamecontrollerdb.txt") +set(template_path "${CMAKE_ARGV3}") +set(target_path "${CMAKE_ARGV4}") + +if (NOT EXISTS "${template_path}") + message(FATAL_ERROR "Failed to find template file ${template_path}") +endif() + +file(DOWNLOAD "${source_url}" "${source_path}" + STATUS download_status + TLS_VERIFY on) + +list(GET download_status 0 status_code) +list(GET download_status 1 status_message) + +if (status_code) + message(FATAL_ERROR "Failed to download ${source_url}: ${status_message}") +endif() + +file(STRINGS "${source_path}" lines) +foreach(line ${lines}) + if ("${line}" MATCHES "^[0-9a-fA-F].*$") + set(GLFW_GAMEPAD_MAPPINGS "${GLFW_GAMEPAD_MAPPINGS}\"${line}\",\n") + endif() +endforeach() + +configure_file("${template_path}" "${target_path}" @ONLY NEWLINE_STYLE UNIX) +file(REMOVE "${source_path}") + |
