Skip to content
Snippets Groups Projects
CMakeLists.txt 1.22 KiB
Newer Older
  • Learn to ignore specific revisions
  • set(EXTRA_SRC)
    
    if (ANDROID)
    	list(APPEND EXTRA_SRC
    		JoystickAndroid.cc
    	)
    endif()
    
    
    add_library(Joystick
    	Joystick.cc
    	JoystickManager.cc
    	JoystickSDL.cc
    
    )
    
    target_link_libraries(Joystick
    
    Daniel Agar's avatar
    Daniel Agar committed
            PRIVATE
                ui
    
    Daniel Agar's avatar
    Daniel Agar committed
    		ui
    
    )
    
    target_include_directories(Joystick PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
    
    
            include_directories(${CMAKE_SOURCE_DIR}/libs/sdl2/msvc/include)
    
    	# Support both 32 and 64 bit builds
    	if (${CMAKE_SIZEOF_VOID_P} MATCHES 8)
    
                    set(SDL2_LIBRARIES "${CMAKE_SOURCE_DIR}/libs/sdl2/msvc/lib/x64/SDL2.lib;${CMAKE_SOURCE_DIR}/libs/sdl2/msvc/lib/x64/SDL2main.lib")
    
                    set(SDL2_LIBRARIES "${CMAKE_SOURCE_DIR}/libs/sdl2/msvc/lib/x86/SDL2.lib;${CMAKE_SOURCE_DIR}/libs/sdl2/msvc/lib/x86/SDL2main.lib")
    
    	endif ()
    
    	string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES)
    
    	target_link_libraries(Joystick PUBLIC ${SDL2_LIBRARIES})
    
    else()
    	find_package(SDL2 REQUIRED)
    	if (IS_DIRECTORY ${SDL2_INCLUDE_DIRS})
    		include_directories(${SDL2_INCLUDE_DIRS})
    		string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES)
    		target_link_libraries(Joystick PRIVATE ${SDL2_LIBRARIES})
    	else()
    		include_directories(${SDL2_DIR})
    		target_link_libraries(Joystick PRIVATE SDL2::SDL2)
    	endif()