mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-28 21:57:57 +03:00
Compile SDL input/client and SDL OpenGL independently
This decouple the renderer from the client part of SDL (input), and only uses SDL for OpenGL
This commit is contained in:
parent
b5c32a41de
commit
21f631e733
4 changed files with 32 additions and 15 deletions
|
@ -190,7 +190,7 @@ if (NOT BUILD_NO_CLIENT)
|
||||||
target_link_libraries(openmohaa PRIVATE syslib)
|
target_link_libraries(openmohaa PRIVATE syslib)
|
||||||
target_link_libraries(openmohaa PRIVATE omohserver)
|
target_link_libraries(openmohaa PRIVATE omohserver)
|
||||||
target_link_libraries(openmohaa PRIVATE omohclient)
|
target_link_libraries(openmohaa PRIVATE omohclient)
|
||||||
target_link_libraries(openmohaa PRIVATE omohrenderer omohsdl)
|
target_link_libraries(openmohaa PRIVATE omohrenderer)
|
||||||
target_link_libraries(openmohaa PRIVATE qcommon qcommon_standalone)
|
target_link_libraries(openmohaa PRIVATE qcommon qcommon_standalone)
|
||||||
|
|
||||||
# Add the gamespy dependency
|
# Add the gamespy dependency
|
||||||
|
|
|
@ -12,7 +12,7 @@ add_library(omohclient INTERFACE)
|
||||||
target_compile_definitions(omohclient INTERFACE APP_MODULE)
|
target_compile_definitions(omohclient INTERFACE APP_MODULE)
|
||||||
target_compile_features(omohclient INTERFACE cxx_nullptr)
|
target_compile_features(omohclient INTERFACE cxx_nullptr)
|
||||||
target_compile_features(omohclient INTERFACE c_variadic_macros)
|
target_compile_features(omohclient INTERFACE c_variadic_macros)
|
||||||
target_link_libraries(omohclient INTERFACE omohsdl)
|
target_link_libraries(omohclient INTERFACE omohsdl_client)
|
||||||
target_link_libraries(omohclient INTERFACE gcd)
|
target_link_libraries(omohclient INTERFACE gcd)
|
||||||
|
|
||||||
# Sound stuff
|
# Sound stuff
|
||||||
|
|
|
@ -3,6 +3,7 @@ cmake_minimum_required(VERSION 3.12)
|
||||||
project(omohrenderer)
|
project(omohrenderer)
|
||||||
|
|
||||||
file(GLOB_RECURSE SOURCES_RENDERER "./*.c" "./*.cpp" "../renderercommon/tr_*.c")
|
file(GLOB_RECURSE SOURCES_RENDERER "./*.c" "./*.cpp" "../renderercommon/tr_*.c")
|
||||||
|
list(REMOVE_ITEM SOURCES_RENDERER "./tr_subs.c")
|
||||||
|
|
||||||
add_library(omohrenderer STATIC ${SOURCES_RENDERER})
|
add_library(omohrenderer STATIC ${SOURCES_RENDERER})
|
||||||
target_include_directories(omohrenderer PUBLIC "../sdl" "../renderercommon")
|
target_include_directories(omohrenderer PUBLIC "../sdl" "../renderercommon")
|
||||||
|
@ -10,7 +11,12 @@ target_compile_features(omohrenderer PUBLIC cxx_nullptr)
|
||||||
target_compile_features(omohrenderer PUBLIC c_variadic_macros)
|
target_compile_features(omohrenderer PUBLIC c_variadic_macros)
|
||||||
target_compile_definitions(omohrenderer PRIVATE USE_INTERNAL_JPEG=1)
|
target_compile_definitions(omohrenderer PRIVATE USE_INTERNAL_JPEG=1)
|
||||||
target_link_libraries(omohrenderer PRIVATE qcommon)
|
target_link_libraries(omohrenderer PRIVATE qcommon)
|
||||||
target_link_libraries(omohrenderer PRIVATE omohsdl)
|
target_link_libraries(omohrenderer PRIVATE omohsdl_gl)
|
||||||
|
|
||||||
|
get_target_property(target_type omohrenderer TYPE)
|
||||||
|
if (target_type STREQUAL "SHARED_LIBRARY")
|
||||||
|
target_sources(omohrenderer PRIVATE "./tr_subs.c")
|
||||||
|
endif ()
|
||||||
|
|
||||||
if(USE_INTERNAL_JPEG)
|
if(USE_INTERNAL_JPEG)
|
||||||
file(GLOB_RECURSE SOURCES_JPEG_8 "../jpeg-8c/*.c")
|
file(GLOB_RECURSE SOURCES_JPEG_8 "../jpeg-8c/*.c")
|
||||||
|
|
|
@ -2,39 +2,47 @@ cmake_minimum_required(VERSION 3.12)
|
||||||
|
|
||||||
project(omohsdl)
|
project(omohsdl)
|
||||||
|
|
||||||
file(GLOB SOURCES_SDL
|
file(GLOB SOURCES_SDL_CLIENT
|
||||||
|
"./sdl_input.c"
|
||||||
|
)
|
||||||
|
|
||||||
|
file(GLOB SOURCES_SDL_GL
|
||||||
"./sdl_gamma.c"
|
"./sdl_gamma.c"
|
||||||
"./sdl_glimp.c"
|
"./sdl_glimp.c"
|
||||||
"./sdl_input.c"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if (NO_MODERN_DMA)
|
if (NO_MODERN_DMA)
|
||||||
list(APPEND SOURCES_SDL "./sdl_snd.c")
|
list(APPEND SOURCES_SDL "./sdl_snd.c")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(omohsdl STATIC ${SOURCES_SDL})
|
add_library(omohsdl_client STATIC ${SOURCES_SDL_CLIENT})
|
||||||
target_compile_features(omohsdl PUBLIC c_variadic_macros)
|
target_compile_features(omohsdl_client PUBLIC c_variadic_macros)
|
||||||
target_link_libraries(omohsdl PRIVATE qcommon qcommon_standalone)
|
target_link_libraries(omohsdl_client PRIVATE qcommon qcommon_standalone)
|
||||||
|
|
||||||
if (NO_MODERN_DMA)
|
if (NO_MODERN_DMA)
|
||||||
target_compile_definitions(omohsdl PRIVATE NO_MODERN_DMA=1)
|
target_compile_definitions(omohsdl_client PRIVATE NO_MODERN_DMA=1)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
add_library(omohsdl_gl STATIC ${SOURCES_SDL_GL})
|
||||||
|
target_link_libraries(omohsdl_gl PRIVATE qcommon)
|
||||||
|
|
||||||
if(${CMAKE_VERSION} VERSION_GREATER "3.11")
|
if(${CMAKE_VERSION} VERSION_GREATER "3.11")
|
||||||
cmake_policy(SET CMP0074 NEW)
|
cmake_policy(SET CMP0074 NEW)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
add_library(sdllib INTERFACE)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
find_package(SDL2)
|
find_package(SDL2)
|
||||||
|
|
||||||
if (SDL2_FOUND)
|
if (SDL2_FOUND)
|
||||||
string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES)
|
string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES)
|
||||||
target_include_directories(omohsdl PUBLIC ${SDL2_INCLUDE_DIRS})
|
target_include_directories(sdllib INTERFACE ${SDL2_INCLUDE_DIRS})
|
||||||
target_link_libraries(omohsdl PRIVATE ${SDL2_LIBRARIES})
|
target_link_libraries(sdllib INTERFACE ${SDL2_LIBRARIES})
|
||||||
else()
|
else()
|
||||||
message(WARNING "SDL2 not found, falling back to using SDL2 from the source tree")
|
message(WARNING "SDL2 not found, falling back to using SDL2 from the source tree")
|
||||||
|
|
||||||
target_include_directories(omohsdl PUBLIC "../SDL2/include-2.0.22")
|
target_include_directories(sdllib INTERFACE "../SDL2/include-2.0.22")
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
|
@ -59,7 +67,7 @@ if(WIN32)
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(omohsdl PRIVATE sdl2 sdl2main)
|
target_link_libraries(sdllib INTERFACE sdl2 sdl2main)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -68,7 +76,10 @@ elseif(UNIX)
|
||||||
|
|
||||||
if (SDL2_FOUND)
|
if (SDL2_FOUND)
|
||||||
string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES)
|
string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES)
|
||||||
target_include_directories(omohsdl PUBLIC ${SDL2_INCLUDE_DIRS})
|
target_include_directories(sdllib INTERFACE ${SDL2_INCLUDE_DIRS})
|
||||||
target_link_libraries(omohsdl PRIVATE ${SDL2_LIBRARIES})
|
target_link_libraries(sdllib INTERFACE ${SDL2_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
target_link_libraries(omohsdl_client PUBLIC sdllib)
|
||||||
|
target_link_libraries(omohsdl_gl PUBLIC sdllib)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue