cmake: initial attempt at adding os/2 support.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9686ecb..a0605e4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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}\"
diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake
index a5c0ec1..17d99b0 100644
--- a/cmake/sdlchecks.cmake
+++ b/cmake/sdlchecks.cmake
@@ -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")