Fix compilation and debugging on Windows.

Core code has too many #define dependencies on interface-specific
defines. This means that it's currently not possible to safely
separate the core and interface code into different contexts. The
core code should be refactored to accomadate for this because we
should not have any interface-specific code in core in the first
place.

This reverts the static library SRB2Core from a7135094 and instead
adds the core sources to the SRB2SDL2 target directly.

So frustrating...
This commit is contained in:
Ronald Kinard 2015-03-24 19:32:58 -05:00
parent 2f52a5d34f
commit 53680903e5
3 changed files with 41 additions and 13 deletions

View file

@ -48,7 +48,7 @@ macro(copy_files_to_build_dir target dlllist_var)
add_custom_command(TARGET ${target} POST_BUILD add_custom_command(TARGET ${target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different COMMAND ${CMAKE_COMMAND} -E copy_if_different
${dlllist_item} ${dlllist_item}
${CMAKE_CURRENT_BINARY_DIR}/\$\(Configuration\)/${dllname} $<TARGET_FILE_DIR:${target}>/${dllname}
) )
endforeach() endforeach()
endif() endif()

View file

@ -109,7 +109,6 @@ set(SRB2_CORE_HEADERS
z_zone.h z_zone.h
config.h.in config.h.in
${CMAKE_CURRENT_BINARY_DIR}/config.h
) )
set(SRB2_CORE_RENDER_SOURCES set(SRB2_CORE_RENDER_SOURCES
@ -171,10 +170,17 @@ if(NOT CLANG)
set(SRB2_CORE_SOURCES ${SRB2_CORE_SOURCES} string.c) set(SRB2_CORE_SOURCES ${SRB2_CORE_SOURCES} string.c)
endif() endif()
prepend_sources(SRB2_CORE_SOURCES)
prepend_sources(SRB2_CORE_HEADERS)
prepend_sources(SRB2_CORE_RENDER_SOURCES)
prepend_sources(SRB2_CORE_GAME_SOURCES)
set(SRB2_CORE_HEADERS ${SRB2_CORE_HEADERS} ${CMAKE_CURRENT_BINARY_DIR}/config.h)
source_group("Main" FILES ${SRB2_CORE_SOURCES} ${SRB2_CORE_HEADERS}) source_group("Main" FILES ${SRB2_CORE_SOURCES} ${SRB2_CORE_HEADERS})
source_group("Renderer" FILES ${SRB2_CORE_RENDER_SOURCES}) source_group("Renderer" FILES ${SRB2_CORE_RENDER_SOURCES})
source_group("Game" FILES ${SRB2_CORE_GAME_SOURCES}) source_group("Game" FILES ${SRB2_CORE_GAME_SOURCES})
set(SRB2_ASM_SOURCES set(SRB2_ASM_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/vid_copy.s ${CMAKE_CURRENT_SOURCE_DIR}/vid_copy.s
) )
@ -241,6 +247,9 @@ if(${SRB2_CONFIG_HAVE_BLUA})
lua_script.h lua_script.h
) )
prepend_sources(SRB2_LUA_SOURCES)
prepend_sources(SRB2_LUA_HEADERS)
source_group("LUA" FILES ${SRB2_LUA_SOURCES} ${SRB2_LUA_HEADERS}) source_group("LUA" FILES ${SRB2_LUA_SOURCES} ${SRB2_LUA_HEADERS})
set(SRB2_BLUA_SOURCES set(SRB2_BLUA_SOURCES
@ -294,6 +303,10 @@ if(${SRB2_CONFIG_HAVE_BLUA})
blua/lvm.h blua/lvm.h
blua/lzio.h blua/lzio.h
) )
prepend_sources(SRB2_BLUA_SOURCES)
prepend_sources(SRB2_BLUA_HEADERS)
source_group("LUA\\Interpreter" FILES ${SRB2_BLUA_SOURCES} ${SRB2_BLUA_HEADERS}) source_group("LUA\\Interpreter" FILES ${SRB2_BLUA_SOURCES} ${SRB2_BLUA_HEADERS})
endif() endif()
@ -397,16 +410,16 @@ endif()
add_definitions(-DCMAKECONFIG) add_definitions(-DCMAKECONFIG)
add_library(SRB2Core STATIC #add_library(SRB2Core STATIC
${SRB2_CORE_SOURCES} # ${SRB2_CORE_SOURCES}
${SRB2_CORE_HEADERS} # ${SRB2_CORE_HEADERS}
${SRB2_CORE_RENDER_SOURCES} # ${SRB2_CORE_RENDER_SOURCES}
${SRB2_CORE_GAME_SOURCES} # ${SRB2_CORE_GAME_SOURCES}
${SRB2_LUA_SOURCES} # ${SRB2_LUA_SOURCES}
${SRB2_LUA_HEADERS} # ${SRB2_LUA_HEADERS}
${SRB2_BLUA_SOURCES} # ${SRB2_BLUA_SOURCES}
${SRB2_BLUA_HEADERS} # ${SRB2_BLUA_HEADERS}
) #)
add_subdirectory(sdl) add_subdirectory(sdl)

View file

@ -46,9 +46,24 @@ find_package(SDL2)
if(${SDL2_FOUND}) if(${SDL2_FOUND})
set(SRB2_SDL2_TOTAL_SOURCES set(SRB2_SDL2_TOTAL_SOURCES
${SRB2_CORE_SOURCES}
${SRB2_CORE_HEADERS}
${SRB2_CORE_RENDER_SOURCES}
${SRB2_CORE_GAME_SOURCES}
${SRB2_LUA_SOURCES}
${SRB2_LUA_HEADERS}
${SRB2_BLUA_SOURCES}
${SRB2_BLUA_HEADERS}
${SRB2_SDL2_SOURCES} ${SRB2_SDL2_SOURCES}
${SRB2_SDL2_HEADERS} ${SRB2_SDL2_HEADERS}
) )
source_group("Main" FILES ${SRB2_CORE_SOURCES} ${SRB2_CORE_HEADERS})
source_group("Renderer" FILES ${SRB2_CORE_RENDER_SOURCES})
source_group("Game" FILES ${SRB2_CORE_GAME_SOURCES})
source_group("Assembly" FILES ${SRB2_ASM_SOURCES} ${SRB2_NASM_SOURCES})
source_group("LUA" FILES ${SRB2_LUA_SOURCES} ${SRB2_LUA_HEADERS})
source_group("LUA\\Interpreter" FILES ${SRB2_BLUA_SOURCES} ${SRB2_BLUA_HEADERS})
if(${SRB2_CONFIG_HWRENDER}) if(${SRB2_CONFIG_HWRENDER})
set(SRB2_SDL2_TOTAL_SOURCES ${SRB2_SDL2_TOTAL_SOURCES} set(SRB2_SDL2_TOTAL_SOURCES ${SRB2_SDL2_TOTAL_SOURCES}
@ -129,7 +144,7 @@ if(${SDL2_FOUND})
endif() endif()
endif() endif()
target_link_libraries(SRB2SDL2 PRIVATE SRB2Core) #target_link_libraries(SRB2SDL2 PRIVATE SRB2Core)
if(${SRB2_USEASM}) if(${SRB2_USEASM})
if(${SRB2_CONFIG_YASM}) if(${SRB2_CONFIG_YASM})