cmake: initial attempt at adding os/2 support.

This commit is contained in:
Ozkan Sezer 2022-01-11 11:33:02 +03:00
parent b424665e08
commit b265677610
2 changed files with 74 additions and 1 deletions

View file

@ -2429,6 +2429,77 @@ elseif(PSP)
pspvram
GL
)
elseif(OS2)
list(APPEND EXTRA_CFLAGS "-DOS2EMX_PLAIN_CHAR")
list(APPEND EXTRA_CFLAGS "-DBUILD_SDL")
file(GLOB CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/os2/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${CORE_SOURCES})
if(NOT (HAVE_ICONV AND HAVE_ICONV_H))
file(GLOB CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/os2/geniconv/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${CORE_SOURCES})
endif()
if(SDL_THREADS)
set(SDL_THREAD_OS2 1)
file(GLOB OS2_THREAD_SOURCES ${SDL2_SOURCE_DIR}/src/thread/os2/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${OS2_THREAD_SOURCES})
set(HAVE_SDL_THREADS TRUE)
endif()
if(SDL_TIMERS)
set(SDL_TIMER_UNIX 1)
file(GLOB OS2_TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/os2/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${OS2_TIMER_SOURCES})
set(HAVE_SDL_TIMERS TRUE)
endif()
if(SDL_LOADSO)
set(SDL_LOADSO_OS2 1)
file(GLOB OS2_LOADSO_SOURCES ${SDL2_SOURCE_DIR}/src/loadso/os2/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${OS2_LOADSO_SOURCES})
set(HAVE_SDL_LOADSO TRUE)
endif()
if(SDL_FILESYSTEM)
set(SDL_FILESYSTEM_OS2 1)
file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/os2/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${FILESYSTEM_SOURCES})
set(HAVE_SDL_FILESYSTEM TRUE)
endif()
if(SDL_LOCALE)
file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/unix/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${LOCALE_SOURCES})
set(HAVE_SDL_LOCALE TRUE)
endif()
if(SDL_VIDEO)
set(SDL_VIDEO_DRIVER_OS2 1)
file(GLOB OS2_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/os2/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${OS2_VIDEO_SOURCES})
set(HAVE_SDL_VIDEO TRUE)
endif()
if(SDL_AUDIO)
set(SDL_AUDIO_DRIVER_OS2 1)
file(GLOB OS2_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/os2/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${OS2_AUDIO_SOURCES})
set(HAVE_SDL_AUDIO TRUE)
list(APPEND EXTRA_LIBS mmpm2)
endif()
if(SDL_JOYSTICK)
set(SDL_JOYSTICK_OS2 1)
file(GLOB OS2_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/os2/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${OS2_JOYSTICK_SOURCES})
set(HAVE_SDL_JOYSTICK TRUE)
endif()
if(SDL_HIDAPI)
CheckHIDAPI()
endif()
endif()
if(SDL_VULKAN AND NOT SDL_LOADSO)
@ -2937,7 +3008,7 @@ if(NOT (WINDOWS OR CYGWIN) OR MINGW)
if(SDL_SHARED)
set(SOEXT ${CMAKE_SHARED_LIBRARY_SUFFIX}) # ".so", ".dylib", etc.
get_target_property(SONAME SDL2 OUTPUT_NAME)
if(NOT ANDROID AND NOT MINGW)
if(NOT ANDROID AND NOT MINGW AND NOT OS2)
install(CODE "
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
\"lib${SONAME}${SOPOSTFIX}${SOEXT}\" \"libSDL2${SOPOSTFIX}${SOEXT}\"

View file

@ -1170,6 +1170,8 @@ macro(CheckHIDAPI)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBUSB_CFLAGS}")
if(HIDAPI_ONLY_LIBUSB)
list(APPEND EXTRA_LIBS ${LIBUSB_LIBS})
elseif(OS2)
set(SDL_LIBUSB_DYNAMIC "\"usb100.dll\"")
else()
# libusb is loaded dynamically, so don't add it to EXTRA_LIBS
FindLibraryAndSONAME("usb-1.0")