Skip to content

Commit

Permalink
Load gamecontrollerdb.txt from data dir, add a default one
Browse files Browse the repository at this point in the history
  • Loading branch information
MCMrARM committed Nov 22, 2018
1 parent 22c0996 commit 5127a58
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 4 deletions.
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ endif()

option(ENABLE_DEV_PATHS "Enables lookup in source directories for misc files required by the launcher. This should be disabled for package builds." ON)
if (ENABLE_DEV_PATHS)
add_definitions(-DDEV_EXTRA_PATHS="${NATIVES_PATH_DIR}")
add_definitions(-DDEV_EXTRA_PATHS="${NATIVES_PATH_DIR}:${CMAKE_BINARY_DIR}/gamecontrollerdb")
endif()

option(USE_OWN_CURL "Builds CURL as an ExternalProject dependency" OFF)
Expand All @@ -52,6 +52,11 @@ endif()

include(ext/json.cmake)

option(USE_GAMECONTROLLERDB "Downloads gamecontrollerdb.txt from gabomdq/SDL_GameControllerDB" ON)
if (USE_GAMECONTROLLERDB)
include(ext/gamepad_mappings.cmake)
endif()

if (BUILD_CLIENT)
include(game-window/BuildSettings.cmake)
if (GAMEWINDOW_SYSTEM STREQUAL "EGLUT")
Expand Down
18 changes: 18 additions & 0 deletions ext/gamepad_mappings.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
include(ExternalProject)

set(GAMECONTROLLERDB_DIR ${CMAKE_BINARY_DIR}/gamecontrollerdb)

ExternalProject_Add(
gamecontrollerdb
DOWNLOAD_DIR ${GAMECONTROLLERDB_DIR}
URL "https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt"
"https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/master/LICENSE"
DOWNLOAD_NO_EXTRACT TRUE
DOWNLOAD_NO_PROGRESS TRUE
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)

install(FILES ${GAMECONTROLLERDB_DIR}/gamecontrollerdb.txt COMPONENT gamepad-mappings DESTINATION share/mcpelauncher
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)
2 changes: 1 addition & 1 deletion mcpelauncher-client
2 changes: 1 addition & 1 deletion mcpelauncher-common

0 comments on commit 5127a58

Please sign in to comment.