Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
Enable XInput2 by default (and improve CMake detection)
Browse files Browse the repository at this point in the history
closes #73
  • Loading branch information
sfan5 committed Jul 18, 2022
1 parent 538c9e5 commit 91edd21
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Install deps
run: |
sudo apt-get update
sudo apt-get install g++ cmake libxxf86vm-dev libgl1-mesa-dev libpng-dev libjpeg-dev zlib1g-dev -qyy
sudo apt-get install g++ cmake libxi-dev libgl1-mesa-dev libpng-dev libjpeg-dev zlib1g-dev -qyy
- name: Build
run: |
Expand All @@ -38,7 +38,7 @@ jobs:
- name: Install deps
run: |
sudo apt-get update
sudo apt-get install g++ cmake libxxf86vm-dev libgles2-mesa-dev libpng-dev libjpeg-dev zlib1g-dev xvfb -qyy
sudo apt-get install g++ cmake libxi-dev libgles2-mesa-dev libpng-dev libjpeg-dev zlib1g-dev xvfb -qyy
- name: Build
run: |
Expand Down
1 change: 1 addition & 0 deletions include/IrrCompileConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ define out. */

#if defined(_IRR_LINUX_PLATFORM_) && defined(_IRR_COMPILE_WITH_X11_)
//! XInput2 (library called Xi) is currently only used to support touch-input.
#define _IRR_LINUX_X11_XINPUT2_
#ifdef NO_IRR_LINUX_X11_XINPUT2_
#undef _IRR_LINUX_X11_XINPUT2_
#endif
Expand Down
10 changes: 5 additions & 5 deletions source/Irrlicht/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,8 @@ if(OGL_ENABLED)
set(OpenGL_GL_PREFERENCE "LEGACY")
find_package(OpenGL REQUIRED)
endif()
if(NOT ANDROID AND NOT APPLE)
if(UNIX AND NOT ANDROID AND NOT APPLE)
check_symbol_exists(_IRR_LINUX_X11_XINPUT2_ "IrrCompileConfig.h" XINPUT2_ENABLED)
if(XINPUT2_ENABLED)
find_library(XINPUT_LIBRARY Xi REQUIRED)
endif()
endif()
check_symbol_exists(_IRR_COMPILE_WITH_SDL_DEVICE_ "IrrCompileConfig.h" SDL_ENABLED)
if(SDL_ENABLED)
Expand All @@ -102,6 +99,9 @@ elseif(APPLE)
else()
# Unix probably
find_package(X11 REQUIRED)
if(XINPUT2_ENABLED AND NOT X11_Xi_FOUND)
message(FATAL_ERROR "XInput not found")
endif()
endif()

set(link_includes
Expand Down Expand Up @@ -131,14 +131,14 @@ set(link_libs
${OPENGLES_LIBRARY}
${OPENGLES2_LIBRARIES}
${EGL_LIBRARY}
${XINPUT_LIBRARY}

"$<$<PLATFORM_ID:Android>:native_app_glue -landroid -llog>"
${COCOA_LIB}
${IOKIT_LIB}
"$<$<PLATFORM_ID:Windows>:gdi32>"
"$<$<PLATFORM_ID:Windows>:winmm>"
${X11_X11_LIB}
${X11_Xi_LIB}
)

# Source files
Expand Down

0 comments on commit 91edd21

Please sign in to comment.