parent
7665f8870a
commit
7f1c6e82b9
|
@ -5,6 +5,18 @@ endif()
|
||||||
cmake_minimum_required(VERSION 3.0.0)
|
cmake_minimum_required(VERSION 3.0.0)
|
||||||
project(SDL2 C CXX)
|
project(SDL2 C CXX)
|
||||||
|
|
||||||
|
if(WINDOWS_STORE)
|
||||||
|
enable_language(CXX)
|
||||||
|
cmake_minimum_required(VERSION 3.11)
|
||||||
|
add_definitions(-DSDL_BUILDING_WINRT=1 -ZW)
|
||||||
|
link_libraries(
|
||||||
|
-nodefaultlib:vccorlib$<$<CONFIG:Debug>:d>
|
||||||
|
-nodefaultlib:msvcrt$<$<CONFIG:Debug>:d>
|
||||||
|
vccorlib$<$<CONFIG:Debug>:d>.lib
|
||||||
|
msvcrt$<$<CONFIG:Debug>:d>.lib
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
# !!! FIXME: this should probably do "MACOSX_RPATH ON" as a target property
|
# !!! FIXME: this should probably do "MACOSX_RPATH ON" as a target property
|
||||||
# !!! FIXME: for the SDL2 shared library (so you get an
|
# !!! FIXME: for the SDL2 shared library (so you get an
|
||||||
# !!! FIXME: install_name ("soname") of "@rpath/libSDL-whatever.dylib"
|
# !!! FIXME: install_name ("soname") of "@rpath/libSDL-whatever.dylib"
|
||||||
|
@ -1367,6 +1379,11 @@ elseif(WINDOWS)
|
||||||
file(GLOB CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/windows/*.c)
|
file(GLOB CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/windows/*.c)
|
||||||
set(SOURCE_FILES ${SOURCE_FILES} ${CORE_SOURCES})
|
set(SOURCE_FILES ${SOURCE_FILES} ${CORE_SOURCES})
|
||||||
|
|
||||||
|
if(WINDOWS_STORE)
|
||||||
|
file(GLOB WINRT_SOURCE_FILES ${SDL2_SOURCE_DIR}/src/core/winrt/*.c ${SDL2_SOURCE_DIR}/src/core/winrt/*.cpp)
|
||||||
|
list(APPEND SOURCE_FILES ${WINRT_SOURCE_FILES})
|
||||||
|
endif()
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
# Prevent codegen that would use the VC runtime libraries.
|
# Prevent codegen that would use the VC runtime libraries.
|
||||||
set_property(DIRECTORY . APPEND PROPERTY COMPILE_OPTIONS "/GS-")
|
set_property(DIRECTORY . APPEND PROPERTY COMPILE_OPTIONS "/GS-")
|
||||||
|
@ -1416,6 +1433,9 @@ elseif(WINDOWS)
|
||||||
check_include_file(ddraw.h HAVE_DDRAW_H)
|
check_include_file(ddraw.h HAVE_DDRAW_H)
|
||||||
check_include_file(dsound.h HAVE_DSOUND_H)
|
check_include_file(dsound.h HAVE_DSOUND_H)
|
||||||
check_include_file(dinput.h HAVE_DINPUT_H)
|
check_include_file(dinput.h HAVE_DINPUT_H)
|
||||||
|
if(WINDOWS_STORE OR VCPKG_TARGET_TRIPLET MATCHES "arm-windows")
|
||||||
|
set(HAVE_DINPUT_H 0)
|
||||||
|
endif()
|
||||||
check_include_file(dxgi.h HAVE_DXGI_H)
|
check_include_file(dxgi.h HAVE_DXGI_H)
|
||||||
if(HAVE_D3D_H OR HAVE_D3D11_H OR HAVE_DDRAW_H OR HAVE_DSOUND_H OR HAVE_DINPUT_H)
|
if(HAVE_D3D_H OR HAVE_D3D11_H OR HAVE_DDRAW_H OR HAVE_DSOUND_H OR HAVE_DINPUT_H)
|
||||||
set(HAVE_DIRECTX TRUE)
|
set(HAVE_DIRECTX TRUE)
|
||||||
|
@ -1434,18 +1454,20 @@ elseif(WINDOWS)
|
||||||
check_include_file(sensorsapi.h HAVE_SENSORSAPI_H)
|
check_include_file(sensorsapi.h HAVE_SENSORSAPI_H)
|
||||||
|
|
||||||
if(SDL_AUDIO)
|
if(SDL_AUDIO)
|
||||||
|
if(NOT WINDOWS_STORE)
|
||||||
set(SDL_AUDIO_DRIVER_WINMM 1)
|
set(SDL_AUDIO_DRIVER_WINMM 1)
|
||||||
file(GLOB WINMM_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/winmm/*.c)
|
file(GLOB WINMM_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/winmm/*.c)
|
||||||
set(SOURCE_FILES ${SOURCE_FILES} ${WINMM_AUDIO_SOURCES})
|
set(SOURCE_FILES ${SOURCE_FILES} ${WINMM_AUDIO_SOURCES})
|
||||||
|
endif()
|
||||||
set(HAVE_SDL_AUDIO TRUE)
|
set(HAVE_SDL_AUDIO TRUE)
|
||||||
|
|
||||||
if(HAVE_DSOUND_H)
|
if(HAVE_DSOUND_H AND NOT WINDOWS_STORE)
|
||||||
set(SDL_AUDIO_DRIVER_DSOUND 1)
|
set(SDL_AUDIO_DRIVER_DSOUND 1)
|
||||||
file(GLOB DSOUND_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/directsound/*.c)
|
file(GLOB DSOUND_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/directsound/*.c)
|
||||||
set(SOURCE_FILES ${SOURCE_FILES} ${DSOUND_AUDIO_SOURCES})
|
set(SOURCE_FILES ${SOURCE_FILES} ${DSOUND_AUDIO_SOURCES})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WASAPI AND HAVE_AUDIOCLIENT_H AND HAVE_MMDEVICEAPI_H)
|
if(WASAPI AND HAVE_AUDIOCLIENT_H AND HAVE_MMDEVICEAPI_H AND NOT WINDOWS_STORE)
|
||||||
set(SDL_AUDIO_DRIVER_WASAPI 1)
|
set(SDL_AUDIO_DRIVER_WASAPI 1)
|
||||||
file(GLOB WASAPI_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/wasapi/*.c)
|
file(GLOB WASAPI_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/wasapi/*.c)
|
||||||
set(SOURCE_FILES ${SOURCE_FILES} ${WASAPI_AUDIO_SOURCES})
|
set(SOURCE_FILES ${SOURCE_FILES} ${WASAPI_AUDIO_SOURCES})
|
||||||
|
@ -1457,11 +1479,20 @@ elseif(WINDOWS)
|
||||||
if(NOT SDL_LOADSO)
|
if(NOT SDL_LOADSO)
|
||||||
message_error("SDL_VIDEO requires SDL_LOADSO, which is not enabled")
|
message_error("SDL_VIDEO requires SDL_LOADSO, which is not enabled")
|
||||||
endif()
|
endif()
|
||||||
|
if(WINDOWS_STORE)
|
||||||
|
set(SDL_VIDEO_DRIVER_WINRT 1)
|
||||||
|
file(GLOB WIN_VIDEO_SOURCES
|
||||||
|
${SDL2_SOURCE_DIR}/src/video/winrt/*.c
|
||||||
|
${SDL2_SOURCE_DIR}/src/video/winrt/*.cpp
|
||||||
|
${SDL2_SOURCE_DIR}/src/render/direct3d11/*.cpp
|
||||||
|
)
|
||||||
|
else()
|
||||||
set(SDL_VIDEO_DRIVER_WINDOWS 1)
|
set(SDL_VIDEO_DRIVER_WINDOWS 1)
|
||||||
file(GLOB WIN_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/windows/*.c)
|
file(GLOB WIN_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/windows/*.c)
|
||||||
|
endif()
|
||||||
set(SOURCE_FILES ${SOURCE_FILES} ${WIN_VIDEO_SOURCES})
|
set(SOURCE_FILES ${SOURCE_FILES} ${WIN_VIDEO_SOURCES})
|
||||||
|
|
||||||
if(RENDER_D3D AND HAVE_D3D_H)
|
if(RENDER_D3D AND HAVE_D3D_H AND NOT WINDOWS_STORE)
|
||||||
set(SDL_VIDEO_RENDER_D3D 1)
|
set(SDL_VIDEO_RENDER_D3D 1)
|
||||||
set(HAVE_RENDER_D3D TRUE)
|
set(HAVE_RENDER_D3D TRUE)
|
||||||
endif()
|
endif()
|
||||||
|
@ -1491,9 +1522,14 @@ elseif(WINDOWS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(SDL_POWER)
|
if(SDL_POWER)
|
||||||
set(SDL_POWER_WINDOWS 1)
|
if(WINDOWS_STORE)
|
||||||
set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/power/windows/SDL_syspower.c)
|
set(SDL_POWER_WINRT 1)
|
||||||
set(HAVE_SDL_POWER TRUE)
|
set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/power/winrt/SDL_syspower.cpp)
|
||||||
|
else()
|
||||||
|
set(SDL_POWER_WINDOWS 1)
|
||||||
|
set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/power/windows/SDL_syspower.c)
|
||||||
|
set(HAVE_SDL_POWER TRUE)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(SDL_LOCALE)
|
if(SDL_LOCALE)
|
||||||
|
@ -1504,13 +1540,19 @@ elseif(WINDOWS)
|
||||||
|
|
||||||
if(SDL_FILESYSTEM)
|
if(SDL_FILESYSTEM)
|
||||||
set(SDL_FILESYSTEM_WINDOWS 1)
|
set(SDL_FILESYSTEM_WINDOWS 1)
|
||||||
file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/windows/*.c)
|
if(WINDOWS_STORE)
|
||||||
|
file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/winrt/*.cpp)
|
||||||
|
else()
|
||||||
|
file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/windows/*.c)
|
||||||
|
endif()
|
||||||
set(SOURCE_FILES ${SOURCE_FILES} ${FILESYSTEM_SOURCES})
|
set(SOURCE_FILES ${SOURCE_FILES} ${FILESYSTEM_SOURCES})
|
||||||
set(HAVE_SDL_FILESYSTEM TRUE)
|
set(HAVE_SDL_FILESYSTEM TRUE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Libraries for Win32 native and MinGW
|
# Libraries for Win32 native and MinGW
|
||||||
list(APPEND EXTRA_LIBS user32 gdi32 winmm imm32 ole32 oleaut32 version uuid advapi32 setupapi shell32)
|
if(NOT WINDOWS_STORE)
|
||||||
|
list(APPEND EXTRA_LIBS user32 gdi32 winmm imm32 ole32 oleaut32 version uuid advapi32 setupapi shell32)
|
||||||
|
endif()
|
||||||
|
|
||||||
# TODO: in configure.ac the check for timers is set on
|
# TODO: in configure.ac the check for timers is set on
|
||||||
# cygwin | mingw32* - does this include mingw32CE?
|
# cygwin | mingw32* - does this include mingw32CE?
|
||||||
|
@ -1532,7 +1574,7 @@ elseif(WINDOWS)
|
||||||
set(SOURCE_FILES ${SOURCE_FILES} ${CORE_SOURCES})
|
set(SOURCE_FILES ${SOURCE_FILES} ${CORE_SOURCES})
|
||||||
|
|
||||||
if(SDL_VIDEO)
|
if(SDL_VIDEO)
|
||||||
if(VIDEO_OPENGL)
|
if(VIDEO_OPENGL AND NOT WINDOWS_STORE)
|
||||||
set(SDL_VIDEO_OPENGL 1)
|
set(SDL_VIDEO_OPENGL 1)
|
||||||
set(SDL_VIDEO_OPENGL_WGL 1)
|
set(SDL_VIDEO_OPENGL_WGL 1)
|
||||||
set(SDL_VIDEO_RENDER_OGL 1)
|
set(SDL_VIDEO_RENDER_OGL 1)
|
||||||
|
@ -2145,12 +2187,14 @@ endif()
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
|
||||||
|
|
||||||
# Always build SDLmain
|
# Always build SDLmain
|
||||||
|
if(NOT WINDOWS_STORE)
|
||||||
add_library(SDL2main STATIC ${SDLMAIN_SOURCES})
|
add_library(SDL2main STATIC ${SDLMAIN_SOURCES})
|
||||||
target_include_directories(SDL2main PUBLIC "$<BUILD_INTERFACE:${SDL2_SOURCE_DIR}/include>" $<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include/SDL2>)
|
target_include_directories(SDL2main PUBLIC "$<BUILD_INTERFACE:${SDL2_SOURCE_DIR}/include>" $<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include/SDL2>)
|
||||||
set(_INSTALL_LIBS "SDL2main")
|
set(_INSTALL_LIBS "SDL2main")
|
||||||
if (NOT ANDROID)
|
if (NOT ANDROID)
|
||||||
set_target_properties(SDL2main PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}")
|
set_target_properties(SDL2main PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}")
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
if (ANDROID AND HAVE_HIDAPI)
|
if (ANDROID AND HAVE_HIDAPI)
|
||||||
set(_INSTALL_LIBS ${_INSTALL_LIBS} "hidapi")
|
set(_INSTALL_LIBS ${_INSTALL_LIBS} "hidapi")
|
||||||
|
|
|
@ -343,6 +343,7 @@
|
||||||
#cmakedefine SDL_VIDEO_DRIVER_DUMMY @SDL_VIDEO_DRIVER_DUMMY@
|
#cmakedefine SDL_VIDEO_DRIVER_DUMMY @SDL_VIDEO_DRIVER_DUMMY@
|
||||||
#cmakedefine SDL_VIDEO_DRIVER_OFFSCREEN @SDL_VIDEO_DRIVER_OFFSCREEN@
|
#cmakedefine SDL_VIDEO_DRIVER_OFFSCREEN @SDL_VIDEO_DRIVER_OFFSCREEN@
|
||||||
#cmakedefine SDL_VIDEO_DRIVER_WINDOWS @SDL_VIDEO_DRIVER_WINDOWS@
|
#cmakedefine SDL_VIDEO_DRIVER_WINDOWS @SDL_VIDEO_DRIVER_WINDOWS@
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_WINRT @SDL_VIDEO_DRIVER_WINRT@
|
||||||
#cmakedefine SDL_VIDEO_DRIVER_WAYLAND @SDL_VIDEO_DRIVER_WAYLAND@
|
#cmakedefine SDL_VIDEO_DRIVER_WAYLAND @SDL_VIDEO_DRIVER_WAYLAND@
|
||||||
#cmakedefine SDL_VIDEO_DRIVER_RPI @SDL_VIDEO_DRIVER_RPI@
|
#cmakedefine SDL_VIDEO_DRIVER_RPI @SDL_VIDEO_DRIVER_RPI@
|
||||||
#cmakedefine SDL_VIDEO_DRIVER_VIVANTE @SDL_VIDEO_DRIVER_VIVANTE@
|
#cmakedefine SDL_VIDEO_DRIVER_VIVANTE @SDL_VIDEO_DRIVER_VIVANTE@
|
||||||
|
@ -411,6 +412,7 @@
|
||||||
#cmakedefine SDL_POWER_ANDROID @SDL_POWER_ANDROID@
|
#cmakedefine SDL_POWER_ANDROID @SDL_POWER_ANDROID@
|
||||||
#cmakedefine SDL_POWER_LINUX @SDL_POWER_LINUX@
|
#cmakedefine SDL_POWER_LINUX @SDL_POWER_LINUX@
|
||||||
#cmakedefine SDL_POWER_WINDOWS @SDL_POWER_WINDOWS@
|
#cmakedefine SDL_POWER_WINDOWS @SDL_POWER_WINDOWS@
|
||||||
|
#cmakedefine SDL_POWER_WINRT @SDL_POWER_WINRT@
|
||||||
#cmakedefine SDL_POWER_MACOSX @SDL_POWER_MACOSX@
|
#cmakedefine SDL_POWER_MACOSX @SDL_POWER_MACOSX@
|
||||||
#cmakedefine SDL_POWER_UIKIT @SDL_POWER_UIKIT@
|
#cmakedefine SDL_POWER_UIKIT @SDL_POWER_UIKIT@
|
||||||
#cmakedefine SDL_POWER_HAIKU @SDL_POWER_HAIKU@
|
#cmakedefine SDL_POWER_HAIKU @SDL_POWER_HAIKU@
|
||||||
|
@ -439,7 +441,7 @@
|
||||||
#cmakedefine SDL_IPHONE_KEYBOARD @SDL_IPHONE_KEYBOARD@
|
#cmakedefine SDL_IPHONE_KEYBOARD @SDL_IPHONE_KEYBOARD@
|
||||||
#cmakedefine SDL_IPHONE_LAUNCHSCREEN @SDL_IPHONE_LAUNCHSCREEN@
|
#cmakedefine SDL_IPHONE_LAUNCHSCREEN @SDL_IPHONE_LAUNCHSCREEN@
|
||||||
|
|
||||||
#if !defined(__WIN32__)
|
#if !defined(__WIN32__) && !defined(__WINRT__)
|
||||||
# if !defined(_STDINT_H_) && !defined(_STDINT_H) && !defined(HAVE_STDINT_H) && !defined(_HAVE_STDINT_H)
|
# if !defined(_STDINT_H_) && !defined(_STDINT_H) && !defined(HAVE_STDINT_H) && !defined(_HAVE_STDINT_H)
|
||||||
typedef unsigned int size_t;
|
typedef unsigned int size_t;
|
||||||
typedef signed char int8_t;
|
typedef signed char int8_t;
|
||||||
|
|
Loading…
Reference in New Issue