diff --git a/CMakeLists.txt b/CMakeLists.txt index 7c1325885..6be16c29a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) endif() cmake_minimum_required(VERSION 2.8.11) -project(SDL2 C) +project(SDL2 C CXX) # !!! FIXME: this should probably do "MACOSX_RPATH ON" as a target property # !!! FIXME: for the SDL2 shared library (so you get an @@ -914,6 +914,8 @@ if(ANDROID) endif() endif() + file(GLOB ANDROID_HIDAPI_SOURCES ${SDL2_SOURCE_DIR}/src/hidapi/android/*.cpp) + CheckPTHREAD() endif() @@ -1776,6 +1778,17 @@ if(SDL_SHARED) endif() endif() +if(ANDROID) + add_library(hidapi SHARED ${ANDROID_HIDAPI_SOURCES}) + if(MSVC AND NOT LIBC) + # Don't try to link with the default set of libraries. + set_target_properties(hidapi PROPERTIES LINK_FLAGS_RELEASE "/NODEFAULTLIB") + set_target_properties(hidapi PROPERTIES LINK_FLAGS_DEBUG "/NODEFAULTLIB") + set_target_properties(hidapi PROPERTIES STATIC_LIBRARY_FLAGS "/NODEFAULTLIB") + endif() + target_link_libraries(hidapi log) +endif() + if(SDL_STATIC) set (BUILD_SHARED_LIBS FALSE) add_library(SDL2-static STATIC ${SOURCE_FILES})