#------------------------------------------------------------------- # This file is part of the CMake build system for Scol # # The contents of this file are placed in the public domain. Feel # free to make use of it in any way you like. #------------------------------------------------------------------- ############################################################ # CmakeList file for joypad plugin ############################################################ PROJECT(joypad) if (NOT ANDROID) if (Scol_BUILD_WITH_QT) set(SCOL_USE_QT TRUE) elseif (Scol_BUILD_WITH_SDL) set(SCOL_USE_SDL TRUE) elseif (UNIX OR APPLE) # default set(SCOL_USE_QT TRUE) endif() endif(NOT ANDROID) if (ANDROID) set (JOYPAD_HEADER_FILES include/joypadandroid.h ) set (JOYPAD_SOURCE_FILES src/joypadandroid.cpp ) elseif (SCOL_USE_QT) set (JOYPAD_HEADER_FILES include/joypadqt.h ) set (JOYPAD_SOURCE_FILES src/joypadqt.cpp ) elseif (SCOL_USE_SDL) set (JOYPAD_HEADER_FILES include/joypadsdl.h ) set (JOYPAD_SOURCE_FILES src/joypadsdl.cpp ) elseif (WIN32) set (JOYPAD_HEADER_FILES include/joypadwin.h ) set (JOYPAD_SOURCE_FILES src/joypadwin.cpp ) endif () if (Scol_STATIC) set (JOYPAD_HEADER_FILES ${JOYPAD_HEADER_FILES} include/loadScolJoypad.h) endif() set (JOYPAD_SOURCE_FILES ${JOYPAD_SOURCE_FILES} src/scolplugin.cpp ) scol_include_plugin("JOYPAD" "${PROJECT_SOURCE_DIR}/include" "loadScolJoypad.h") # Add directories includes if (SCOL_USE_QT) add_definitions(-DSCOL_QT) include_directories(include) elseif (SCOL_USE_SDL) add_definitions(-DSCOL_SDL) include_directories(include) elseif (WIN32) include_directories(include ${DIRECTINPUT_INCLUDE_DIRS}) set(JOYPAD_LIBRARIES ${DIRECTINPUT_LIBRARIES}) else() include_directories(include) endif () # Add definition for P4 optimizations, warnings removal. add_definitions(-DOPTI_P4 -D_CRT_SECURE_NO_WARNINGS) # setup Scol joypad plugin target add_library(joypad ${Scol_LIB_TYPE} ${JOYPAD_HEADER_FILES} ${JOYPAD_SOURCE_FILES} ) add_dependencies(joypad kernel) if(SCOL_USE_QT) if(APPLE) if (NOT Qt5Gamepad_FOUND) #find_host_package(Qt5 COMPONENTS Gamepad REQUIRED) set(QtModule "Gamepad") find_host_package(Qt5 REQUIRED) endif() set(JOYPAD_LIBRARIES ${JOYPAD_LIBRARIES} Qt5::Gamepad ${Qt5Gamepad_STATIC_DEPS}) else() if (NOT Qt5Gamepad_FOUND) find_package(Qt5 COMPONENTS Core Gamepad) endif() set(JOYPAD_LIBRARIES ${JOYPAD_LIBRARIES} Qt5::Gamepad) endif() set_target_properties(joypad PROPERTIES AUTOMOC ON) elseif(SCOL_USE_SDL) if (NOT SDL2_FOUND) find_host_package(SDL2 REQUIRED) endif() set(JOYPAD_LIBRARIES ${JOYPAD_LIBRARIES} ${SDL2_LIBRARIES}) include_directories(${SDL2_INCLUDE_DIRS}) endif() if (ANDROID) set(JOYPAD_LIBRARIES ${JOYPAD_LIBRARIES} ndk_helper log android cpufeatures native_app_glue) set(Scol_ANDROID_DEPENDENCIES ${Scol_ANDROID_DEPENDENCIES} joypad CACHE INTERNAL "" FORCE) message(STATUS "[${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE}] Scol_ANDROID_DEPENDENCIES: ${Scol_ANDROID_DEPENDENCIES} -- added Joypad to android project deps") endif() # set the dll version. #set_target_properties(joypad PROPERTIES VERSION ${Scol_VERSION} SOVERSION ${Scol_VERSION_MAJOR}) target_link_libraries(joypad ${JOYPAD_LIBRARIES} ${Boost_LIBRARIES}) # install Scol joypad scol_config_plugin(joypad) #install(FILES ${JOYPAD_HEADER_FILES} DESTINATION include/SCOL/plugins/joypad)