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

Commit

Permalink
Import CMake build system from https://github.com/notspiff/peripheral…
Browse files Browse the repository at this point in the history
….joystick

Only linux side is handled ATM
  • Loading branch information
garbear committed Feb 16, 2015
1 parent 6394cdd commit c049266
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -4,6 +4,9 @@
.libs
.project

build
Build

.dummy
.dummy.in
aclocal.m4
Expand Down
41 changes: 41 additions & 0 deletions CMakeLists.txt
@@ -0,0 +1,41 @@
project(peripheral.joystick)

cmake_minimum_required(VERSION 2.6)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR})

enable_language(CXX)

find_package(kodi REQUIRED)
find_package(kodiplatform REQUIRED)
find_package(Sdl)

include_directories(${kodiplatform_INCLUDE_DIRS}
${SDL_INCLUDE_DIRS}
${KODI_INCLUDE_DIR}
${PROJECT_SOURCE_DIR}/src)

set(DEPLIBS ${kodiplatform_LIBRARIES})

set(JOYSTICK_SOURCES src/addon.cpp
src/api/Joystick.cpp
src/api/JoystickInterface.cpp
src/api/JoystickManager.cpp
src/log/Log.cpp
src/log/LogAddon.cpp
src/log/LogConsole.cpp
src/log/LogSyslog.cpp)

if(SDL_FOUND)
list(APPEND JOYSTICK_SOURCES src/api/sdl/JoystickInterfaceSDL.cpp
src/api/sdl/JoystickSDL.cpp)
list(APPEND DEPLIBS ${SDL_LIBRARIES})
endif()
if(LINUX)
list(APPEND JOYSTICK_SOURCES src/api/linux/JoystickInterfaceLinux.cpp
src/api/linux/JoystickLinux.cpp)
endif()

build_addon(peripheral.joystick JOYSTICK DEPLIBS)

include(CPack)
22 changes: 22 additions & 0 deletions FindSdl.cmake
@@ -0,0 +1,22 @@
# - Try to find SDL2
# Once done this will define
#
# SDL_FOUND - system has libSDL
# SDL_INCLUDE_DIRS - the libSDL include directory
# SDL_LIBRARIES - The libSDL libraries

find_package(PkgConfig)
if(PKG_CONFIG_FOUND)
pkg_check_modules (SDL sdl2)
else()
find_package(SDL)
list(APPEND SDL_INCLUDE_DIRS ${SDL_INCLUDE_DIR})
list(APPEND SDL_LIBRARIES ${SDL_LIBRARIES})
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Sdl DEFAULT_MSG SDL_INCLUDE_DIRS SDL_LIBRARIES)

list(APPEND SDL_DEFINITIONS -DHAVE_SDL=1)

mark_as_advanced(SDL_INCLUDE_DIRS SDL_LIBRARIES SDL_DEFINITIONS)

0 comments on commit c049266

Please sign in to comment.