Make mem module isolated from project

Properly define MEM_USE_RTL definition only for mem library. Link other dependant modules with mem.
This commit is contained in:
Azamat H. Hackimov 2024-06-20 00:31:58 +03:00
parent fa3f379e41
commit db8aa64d2f
20 changed files with 39 additions and 14 deletions

View File

@ -12,4 +12,5 @@ set(CPPS
add_library(2dlib STATIC ${HEADERS} ${CPPS}) add_library(2dlib STATIC ${HEADERS} ${CPPS})
target_link_libraries(2dlib PRIVATE target_link_libraries(2dlib PRIVATE
cfile cfile
mem
) )

View File

@ -149,8 +149,6 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
add_compile_options("/MP") # so msbuild builds with multiple processes add_compile_options("/MP") # so msbuild builds with multiple processes
endif() endif()
add_compile_definitions($<$<BOOL:${ENABLE_MEM_RTL}>:MEM_USE_RTL>)
add_compile_definitions($<$<CONFIG:Release>:RELEASE>) add_compile_definitions($<$<CONFIG:Release>:RELEASE>)
add_compile_definitions($<$<CONFIG:Debug>:_DEBUG>) add_compile_definitions($<$<CONFIG:Debug>:_DEBUG>)

View File

@ -15,6 +15,7 @@ target_link_libraries(bitmap PRIVATE
cfile cfile
ddebug ddebug
ddio ddio
mem
stb stb
) )
target_include_directories(bitmap PUBLIC target_include_directories(bitmap PUBLIC

View File

@ -7,6 +7,7 @@ set(CPPS
add_library(cfile STATIC ${CPPS}) add_library(cfile STATIC ${CPPS})
target_link_libraries(cfile PRIVATE target_link_libraries(cfile PRIVATE
ddio ddio
mem
) )
target_include_directories(cfile PUBLIC target_include_directories(cfile PUBLIC
$<BUILD_INTERFACE: $<BUILD_INTERFACE:

View File

@ -18,3 +18,6 @@ target_include_directories(ddebug PUBLIC
> >
PRIVATE ${PROJECT_BINARY_DIR}/lib # For d3_version.h PRIVATE ${PROJECT_BINARY_DIR}/lib # For d3_version.h
) )
target_link_libraries(ddebug PRIVATE
mem
)

View File

@ -24,8 +24,9 @@ set(CPPS
> >
) )
add_library(ddio STATIC ${CPPS}) add_library(ddio STATIC ${CPPS})
target_link_libraries(ddio target_link_libraries(ddio PRIVATE
ddebug ddebug
mem
) )
target_include_directories(ddio PUBLIC target_include_directories(ddio PUBLIC
$<BUILD_INTERFACE: $<BUILD_INTERFACE:

View File

@ -7,4 +7,5 @@ set(CPPS
add_library(grtext STATIC ${HEADERS} ${CPPS}) add_library(grtext STATIC ${HEADERS} ${CPPS})
target_link_libraries(grtext PRIVATE target_link_libraries(grtext PRIVATE
ddio ddio
mem
) )

View File

@ -25,6 +25,7 @@ add_library(manage STATIC ${HEADERS} ${CPPS})
target_link_libraries(manage PRIVATE target_link_libraries(manage PRIVATE
cfile cfile
ddio ddio
mem
sndlib sndlib
stream_audio stream_audio
) )

View File

@ -1,5 +1,13 @@
set(HEADERS)
set(CPPS set(CPPS
mem.cpp) mem.cpp
)
add_library(mem STATIC ${HEADERS} ${CPPS}) add_library(mem STATIC ${CPPS})
target_compile_definitions(mem PUBLIC
$<$<BOOL:${ENABLE_MEM_RTL}>:MEM_USE_RTL>
)
target_include_directories(mem PUBLIC
$<BUILD_INTERFACE:
${PROJECT_SOURCE_DIR}/mem
>
)

View File

@ -6,4 +6,5 @@ set(CPPS
add_library(model STATIC ${HEADERS} ${CPPS}) add_library(model STATIC ${HEADERS} ${CPPS})
target_link_libraries(model PRIVATE target_link_libraries(model PRIVATE
ddio ddio
mem
) )

View File

@ -6,4 +6,5 @@ add_library(movie STATIC ${HEADERS} ${CPPS})
target_link_libraries(movie PRIVATE target_link_libraries(movie PRIVATE
ddio ddio
libmve libmve
mem
) )

View File

@ -9,6 +9,7 @@ add_library(music STATIC ${HEADERS} ${CPPS})
target_link_libraries(music target_link_libraries(music
cfile cfile
ddio ddio
mem
sndlib sndlib
stream_audio stream_audio
) )

View File

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

View File

@ -1,14 +1,13 @@
set(HEADERS) set(HEADERS)
set(CPPS set(CPPS
networking.cpp) networking.cpp
$<$<PLATFORM_ID:Windows>:
directplay.cpp
>
)
set(PLATFORMCPPS) add_library(networking STATIC ${HEADERS} ${CPPS})
if(WIN32)
set(PLATFORMCPPS "directplay.cpp")
endif()
add_library(networking STATIC ${HEADERS} ${CPPS} ${PLATFORMCPPS})
target_link_libraries(networking PRIVATE target_link_libraries(networking PRIVATE
ddio ddio
mem
) )

View File

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

View File

@ -27,4 +27,5 @@ add_library(renderer STATIC ${HEADERS} ${CPPS})
target_link_libraries(renderer PRIVATE target_link_libraries(renderer PRIVATE
bitmap bitmap
ddio ddio
mem
) )

View File

@ -21,6 +21,7 @@ add_library(sndlib STATIC ${CPPS})
target_link_libraries(sndlib PRIVATE target_link_libraries(sndlib PRIVATE
cfile cfile
ddio ddio
mem
stream_audio stream_audio
) )
target_include_directories(sndlib PUBLIC target_include_directories(sndlib PUBLIC

View File

@ -7,6 +7,7 @@ add_library(stream_audio STATIC ${HEADERS} ${CPPS})
target_link_libraries(stream_audio PRIVATE target_link_libraries(stream_audio PRIVATE
ddio ddio
libacm libacm
mem
sndlib sndlib
) )
target_include_directories(stream_audio PUBLIC target_include_directories(stream_audio PUBLIC

View File

@ -19,4 +19,5 @@ set(CPPS
add_library(ui STATIC ${HEADERS} ${CPPS}) add_library(ui STATIC ${HEADERS} ${CPPS})
target_link_libraries(ui PRIVATE target_link_libraries(ui PRIVATE
ddio ddio
mem
) )