Reordering ddio_common module

Merge ddio_lnx and ddio_win into ddio_common module.
This commit is contained in:
Azamat H. Hackimov 2024-05-22 12:33:33 +03:00
parent 4723d363ff
commit 6bc3c71a83
44 changed files with 80 additions and 39 deletions

View File

@ -176,10 +176,8 @@ add_subdirectory(ddebug)
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
add_subdirectory(dd_grwin32)
add_subdirectory(win32)
add_subdirectory(ddio_win)
else()
add_subdirectory(linux)
add_subdirectory(ddio_lnx)
endif()
add_subdirectory(ddio_common)

View File

@ -273,19 +273,19 @@ set(CPPS
weather.cpp)
if(WIN32)
set(PLATFORM_LIBS dd_grwin32 ddio_win win32 wsock32.lib winmm.lib
set(PLATFORM_LIBS dd_grwin32 win32 wsock32.lib winmm.lib
${DSOUND_LIBRARY} ${DINPUT_LIBRARY} ${DXGUID_LIBRARY} ${DDRAW_LIBRARY})
set(PLATFORM_CPPS winmain.cpp)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO /NODEFAULTLIB:LIBC")
endif()
if(UNIX AND NOT APPLE)
set(PLATFORM_LIBS linux ddio_lnx SDL2::SDL2 m ${CMAKE_DL_LIBS} ${CURSES_LIBRARIES})
set(PLATFORM_LIBS linux SDL2::SDL2 m ${CMAKE_DL_LIBS} ${CURSES_LIBRARIES})
set(PLATFORM_CPPS loki_utils.c lnxmain.cpp)
endif()
if(APPLE)
set(PLATFORM_LIBS linux ddio_lnx SDL2::SDL2 ${CURSES_LIBRARIES})
set(PLATFORM_LIBS linux SDL2::SDL2 ${CURSES_LIBRARIES})
set(PLATFORM_CPPS loki_utils.c lnxmain.cpp)
set(CMAKE_EXE_LINKER_FLAGS "-framework IOKit -framework Cocoa -framework OpenGL -framework Carbon")
endif()

View File

@ -17,3 +17,6 @@ target_link_libraries(bitmap PRIVATE
stb
)
target_include_directories(bitmap PUBLIC .)
target_link_libraries(bitmap PRIVATE
ddio_common
)

View File

@ -5,6 +5,9 @@ set(CPPS
)
add_library(cfile STATIC ${CPPS})
target_link_libraries(cfile PRIVATE
ddio_common
)
target_include_directories(cfile PUBLIC
$<BUILD_INTERFACE:
${PROJECT_SOURCE_DIR}/cfile

View File

@ -1,5 +1,34 @@
set(HEADERS)
set(CPPS
ddio.cpp
key.cpp)
add_library(ddio_common STATIC ${HEADERS} ${CPPS})
key.cpp
$<$<PLATFORM_ID:Darwin,Linux>:
lnxfile.cpp
lnxforcefeedback.cpp
lnxio.cpp
sdljoy.cpp
lnxkey.cpp
lnxkey_null.cpp
lnxmouse.cpp
lnxtimer.cpp
lnxcdrom.cpp
lnxkey_sdl.cpp
>
$<$<PLATFORM_ID:Windows>:
winfile.cpp
winforcefeedback.cpp
winio.cpp
winjoy.cpp
winkey.cpp
winmouse.cpp
wintimer.cpp
>
)
add_library(ddio_common STATIC ${CPPS})
target_link_libraries(ddio_common
ddebug
)
target_include_directories(ddio_common PUBLIC
$<BUILD_INTERFACE:
${PROJECT_SOURCE_DIR}/ddio_common
>
)

View File

@ -1,17 +0,0 @@
set(HEADERS ddio_lnx.h)
set(CPPS
lnxfile.cpp
lnxforcefeedback.cpp
lnxio.cpp
sdljoy.cpp
lnxkey.cpp
lnxkey_null.cpp
lnxmouse.cpp
lnxtimer.cpp
lnxcdrom.cpp
lnxkey_sdl.cpp)
add_library(ddio_lnx STATIC ${HEADERS} ${CPPS})
target_link_libraries(ddio_lnx
ddebug
)

View File

@ -1,11 +0,0 @@
set(HEADERS ddio_win.h)
set(CPPS
winfile.cpp
winforcefeedback.cpp
winio.cpp
winjoy.cpp
winkey.cpp
winmouse.cpp
wintimer.cpp)
add_library(ddio_win STATIC ${HEADERS} ${CPPS})

View File

@ -5,3 +5,6 @@ set(CPPS
textaux.cpp)
add_library(grtext STATIC ${HEADERS} ${CPPS})
target_link_libraries(grtext PRIVATE
ddio_common
)

View File

@ -17,3 +17,6 @@ target_include_directories(linux PUBLIC
${PROJECT_SOURCE_DIR}/linux
>
)
target_link_libraries(linux PRIVATE
ddio_common
)

View File

@ -24,6 +24,7 @@ set(CPPS
add_library(manage STATIC ${HEADERS} ${CPPS})
target_link_libraries(manage PRIVATE
cfile
ddio_common
sndlib
stream_audio
)

View File

@ -4,3 +4,6 @@ set(CPPS
polymodel.cpp)
add_library(model STATIC ${HEADERS} ${CPPS})
target_link_libraries(model PRIVATE
ddio_common
)

View File

@ -3,3 +3,6 @@ set(CPPS
module.cpp)
add_library(module STATIC ${HEADERS} ${CPPS})
target_link_libraries(module PRIVATE
ddio_common
)

View File

@ -3,4 +3,7 @@ set(CPPS
d3movie.cpp)
add_library(movie STATIC ${HEADERS} ${CPPS})
target_link_libraries(movie libmve)
target_link_libraries(movie PRIVATE
ddio_common
libmve
)

View File

@ -8,6 +8,7 @@ set(CPPS
add_library(music STATIC ${HEADERS} ${CPPS})
target_link_libraries(music
cfile
ddio_common
stream_audio
)
target_include_directories(music PUBLIC

View File

@ -5,6 +5,7 @@ set_target_properties(Direct_TCP_IP PROPERTIES PREFIX "")
set_target_properties(Direct_TCP_IP PROPERTIES CXX_VISIBILITY_PRESET "hidden")
set_target_properties(Direct_TCP_IP PROPERTIES OUTPUT_NAME "Direct TCP~IP")
target_link_libraries(Direct_TCP_IP PRIVATE
ddio_common
inetfile
$<$<PLATFORM_ID:Windows>:
ws2_32

View File

@ -9,3 +9,6 @@ if(WIN32)
endif()
add_library(networking STATIC ${HEADERS} ${CPPS} ${PLATFORMCPPS})
target_link_libraries(networking PRIVATE
ddio_common
)

View File

@ -7,5 +7,6 @@ set(CPPS
add_library(physics STATIC ${HEADERS} ${CPPS})
target_link_libraries(physics PRIVATE
ddio_common
sndlib
)

View File

@ -24,4 +24,7 @@ endif()
#Direct3D.cpp
add_library(renderer STATIC ${HEADERS} ${CPPS})
target_link_libraries(renderer PRIVATE bitmap)
target_link_libraries(renderer PRIVATE
bitmap
ddio_common
)

View File

@ -3,3 +3,6 @@ set(CPPS
rtperformance.cpp)
add_library(rtperformance STATIC ${HEADERS} ${CPPS})
target_link_libraries(rtperformance PRIVATE
ddio_common
)

View File

@ -20,6 +20,7 @@ set(CPPS
add_library(sndlib STATIC ${CPPS})
target_link_libraries(sndlib PRIVATE
cfile
ddio_common
stream_audio
)
target_include_directories(sndlib PUBLIC

View File

@ -4,7 +4,8 @@ set(CPPS
streamaudio.cpp)
add_library(stream_audio STATIC ${HEADERS} ${CPPS})
target_link_libraries(stream_audio
target_link_libraries(stream_audio PRIVATE
ddio_common
libacm
sndlib
)

View File

@ -17,3 +17,6 @@ set(CPPS
UIWindow.cpp)
add_library(ui STATIC ${HEADERS} ${CPPS})
target_link_libraries(ui PRIVATE
ddio_common
)

View File

@ -9,3 +9,6 @@ set(CPPS
add_library(win32 STATIC ${CPPS})
add_dependencies(win32 get_git_hash)
target_include_directories(win32 PRIVATE ${PROJECT_BINARY_DIR}/lib)
target_link_libraries(win32 PRIVATE
ddio_common
)