Merge pull request #3254 from akien-mga/pr-joydev-opt-out

Make joydev build using libudev and libevdev opt-out
This commit is contained in:
punto- 2016-01-06 22:05:42 -03:00
commit 0ba9b267a4

View file

@ -55,6 +55,7 @@ def get_opts():
('use_sanitizer','Use llvm compiler sanitize address','no'), ('use_sanitizer','Use llvm compiler sanitize address','no'),
('use_leak_sanitizer','Use llvm compiler sanitize memory leaks','no'), ('use_leak_sanitizer','Use llvm compiler sanitize memory leaks','no'),
('pulseaudio','Detect & Use pulseaudio','yes'), ('pulseaudio','Detect & Use pulseaudio','yes'),
('gamepad','Gamepad support, requires libudev and libevdev','yes'),
('new_wm_api', 'Use experimental window management API','no'), ('new_wm_api', 'Use experimental window management API','no'),
('debug_release', 'Add debug symbols to release version','no'), ('debug_release', 'Add debug symbols to release version','no'),
] ]
@ -145,23 +146,29 @@ def configure(env):
env.Append(CPPPATH=['#tools/freetype/freetype/include']) env.Append(CPPPATH=['#tools/freetype/freetype/include'])
env.Append(CPPFLAGS=['-DOPENGL_ENABLED','-DGLEW_ENABLED']) env.Append(CPPFLAGS=['-DOPENGL_ENABLED','-DGLEW_ENABLED'])
if platform.system() == 'Linux': if platform.system() == 'Linux':
env.Append(CPPFLAGS=["-DALSA_ENABLED"]) env.Append(CPPFLAGS=["-DALSA_ENABLED"])
env.Append(LIBS=['asound']) env.Append(LIBS=['asound'])
if not os.system("pkg-config --exists libudev"): if (env["gamepad"]=="yes" and platform.system() == "Linux"):
if not os.system("pkg-config --exists libevdev"): # pkg-config returns 0 when the lib exists...
print("Enabling udev/evdev") found_udev = not os.system("pkg-config --exists libudev")
env.Append(CPPFLAGS=["-DJOYDEV_ENABLED"]) found_evdev = not os.system("pkg-config --exists libevdev")
env.ParseConfig('pkg-config libudev --cflags --libs')
env.ParseConfig('pkg-config libevdev --cflags --libs') if (found_udev and found_evdev):
else: print("Enabling gamepad support with udev/evdev")
print("libevdev development libraries not found, disabling gamepad support") env.Append(CPPFLAGS=["-DJOYDEV_ENABLED"])
env.ParseConfig('pkg-config libudev --cflags --libs')
env.ParseConfig('pkg-config libevdev --cflags --libs')
else: else:
print("libudev development libraries not found, disabling gamepad support") if (not found_udev):
print("libudev development libraries not found")
if (not found_evdev):
print("libevdev development libraries not found")
print("Some libraries are missing for the required gamepad support, aborting!")
print("Install the mentioned libraries or build with 'gamepad=no' to disable gamepad support.")
sys.exit(255)
if (env["pulseaudio"]=="yes"): if (env["pulseaudio"]=="yes"):
if not os.system("pkg-config --exists libpulse-simple"): if not os.system("pkg-config --exists libpulse-simple"):