CMake: Attempting to around SDL2 issues on macOS

This commit is contained in:
Connor McLaughlin 2020-02-15 17:40:21 +09:00
parent 65b5013da0
commit 1c17d5495e
2 changed files with 10 additions and 19 deletions

View File

@ -12,23 +12,13 @@ endif()
# Common include/library directories on Windows. # Common include/library directories on Windows.
if(WIN32) if(WIN32)
set(SDL2_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/include/SDL") set(SDL2_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/sdl2/include")
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
if(CMAKE_SIZEOF_VOID_P EQUAL 8) if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(SDL2_LIBRARY "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/lib64-debug/SDL2.lib") set(SDL2_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/sdl2/lib64/SDL2.lib")
set(SDL2MAIN_LIBRARY "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/lib64-debug/SDL2main.lib") set(SDL2MAIN_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/sdl2/lib64/SDL2main.lib")
else() else()
set(SDL2_LIBRARY "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/lib32-debug/SDL2.lib") set(SDL2_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/sdl2/lib32/SDL2.lib")
set(SDL2MAIN_LIBRARY "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/lib32-debug/SDL2main.lib") set(SDL2MAIN_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/sdl2/lib32/SDL2main.lib")
endif()
else()
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(SDL2_LIBRARY "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/lib64/SDL2.lib")
set(SDL2MAIN_LIBRARY "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/lib64/SDL2main.lib")
else()
set(SDL2_LIBRARY "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/lib32/SDL2.lib")
set(SDL2MAIN_LIBRARY "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/lib32/SDL2main.lib")
endif()
endif() endif()
endif() endif()

View File

@ -16,12 +16,13 @@ add_executable(duckstation-sdl
sdl_settings_interface.h sdl_settings_interface.h
) )
target_include_directories(duckstation-sdl PRIVATE ${SDL2_INCLUDE_DIRS})
target_link_libraries(duckstation-sdl PRIVATE core common imgui nativefiledialog glad simpleini ${SDL2_LIBRARIES})
if(WIN32) if(WIN32)
target_sources(duckstation-sdl PRIVATE target_sources(duckstation-sdl PRIVATE
d3d11_host_display.cpp d3d11_host_display.cpp
d3d11_host_display.h d3d11_host_display.h
) )
target_link_libraries(duckstation-sdl PRIVATE d3d11.lib dxgi.lib winmm.lib) target_link_libraries(duckstation-sdl PRIVATE d3d11.lib dxgi.lib winmm.lib ${SDL2MAIN_LIBRARIES})
endif() endif()
target_link_libraries(duckstation-sdl PRIVATE core common imgui nativefiledialog glad simpleini SDL2::Main)