Only link necessary libraries to DirectX

This commit is contained in:
Louis Gombert 2024-06-23 12:40:14 +02:00
parent 18c9950b97
commit ce852d3a14
4 changed files with 12 additions and 7 deletions

View File

@ -271,8 +271,7 @@ set(CPPS
weather.cpp)
if(WIN32)
set(PLATFORM_LIBS linux wsock32.lib winmm.lib SDL2::SDL2
${DSOUND_LIBRARY} ${DINPUT_LIBRARY} ${DXGUID_LIBRARY} ${DDRAW_LIBRARY})
set(PLATFORM_LIBS linux wsock32.lib winmm.lib SDL2::SDL2)
set(PLATFORM_CPPS loki_utils.c lnxmain.cpp)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO /NODEFAULTLIB:LIBC")
endif()
@ -294,7 +293,7 @@ add_executable(Descent3
WIN32
${HEADERS} ${CPPS} ${PLATFORM_CPPS} ${INCS}
)
target_link_libraries(Descent3
target_link_libraries(Descent3 PRIVATE
2dlib AudioEncode bitmap cfile czip d3music dd_video ddebug ddio libmve libacm
fix grtext manage mem misc model module movie stream_audio
music networking physics renderer rtperformance sndlib ui unzip vecmat md5

View File

@ -13,3 +13,4 @@ target_link_libraries(dd_grwin32 PRIVATE
misc
)
target_compile_definitions(dd_grwin32 PRIVATE DX_APP)
target_link_libraries(dd_grwin32 PRIVATE ${DDRAW_LIBRARY})

View File

@ -562,8 +562,7 @@ set(SOURCE
)
# Editor only works in Windows, because of MFC and DirectX dependencies
set(PLATFORM_LIBS linux wsock32.lib winmm.lib dd_grwin32 win32 SDL2::SDL2
${DSOUND_LIBRARY} ${DINPUT_LIBRARY} ${DXGUID_LIBRARY} ${DDRAW_LIBRARY})
set(PLATFORM_LIBS linux wsock32.lib winmm.lib dd_grwin32 win32 SDL2::SDL2)
set(PLATFORM_CPPS ../Descent3/loki_utils.c ../Descent3/lnxmain.cpp)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO /NODEFAULTLIB:LIBC")
@ -573,7 +572,7 @@ target_include_directories(Descent3Editor PRIVATE ../lib ../ ../manage/ ${PROJEC
target_compile_definitions(Descent3Editor PUBLIC _AFXDLL EDITOR)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_STANDARD} /Zc:forScope-")
target_link_libraries(Descent3Editor
target_link_libraries(Descent3Editor PRIVATE
2dlib AudioEncode bitmap cfile czip d3music dd_video ddebug ddio libmve libacm
fix grtext manage mem misc model module movie stream_audio
music networking physics renderer rtperformance sndlib ui unzip vecmat md5

View File

@ -6,9 +6,15 @@ set(CPPS
>
)
add_library(networking STATIC ${HEADERS} ${CPPS})
if(WIN32)
set(PLATFORMCPPS "directplay.cpp")
set(PLATFORM_LIBS ${DXGUID_LIBRARY})
endif()
add_library(networking STATIC ${HEADERS} ${CPPS} ${PLATFORMCPPS})
target_link_libraries(networking PRIVATE
ddio
mem
misc
${PLATFORM_LIBS}
)