From 53680903e574154fddc48ed3fe1cc106703d8455 Mon Sep 17 00:00:00 2001 From: Ronald Kinard Date: Tue, 24 Mar 2015 19:32:58 -0500 Subject: [PATCH] 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... --- CMakeLists.txt | 2 +- src/CMakeLists.txt | 35 ++++++++++++++++++++++++----------- src/sdl/CMakeLists.txt | 17 ++++++++++++++++- 3 files changed, 41 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e23d891c..0fb5cb28 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,7 +48,7 @@ macro(copy_files_to_build_dir target dlllist_var) add_custom_command(TARGET ${target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${dlllist_item} - ${CMAKE_CURRENT_BINARY_DIR}/\$\(Configuration\)/${dllname} + $/${dllname} ) endforeach() endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9b5089e3..6859e27c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -109,7 +109,6 @@ set(SRB2_CORE_HEADERS z_zone.h config.h.in - ${CMAKE_CURRENT_BINARY_DIR}/config.h ) set(SRB2_CORE_RENDER_SOURCES @@ -171,10 +170,17 @@ if(NOT CLANG) set(SRB2_CORE_SOURCES ${SRB2_CORE_SOURCES} string.c) 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("Renderer" FILES ${SRB2_CORE_RENDER_SOURCES}) source_group("Game" FILES ${SRB2_CORE_GAME_SOURCES}) + set(SRB2_ASM_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/vid_copy.s ) @@ -241,6 +247,9 @@ if(${SRB2_CONFIG_HAVE_BLUA}) lua_script.h ) + prepend_sources(SRB2_LUA_SOURCES) + prepend_sources(SRB2_LUA_HEADERS) + source_group("LUA" FILES ${SRB2_LUA_SOURCES} ${SRB2_LUA_HEADERS}) set(SRB2_BLUA_SOURCES @@ -294,6 +303,10 @@ if(${SRB2_CONFIG_HAVE_BLUA}) blua/lvm.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}) endif() @@ -397,16 +410,16 @@ endif() add_definitions(-DCMAKECONFIG) -add_library(SRB2Core STATIC - ${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} -) +#add_library(SRB2Core STATIC +# ${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} +#) add_subdirectory(sdl) diff --git a/src/sdl/CMakeLists.txt b/src/sdl/CMakeLists.txt index 56dcb674..b3fa5390 100644 --- a/src/sdl/CMakeLists.txt +++ b/src/sdl/CMakeLists.txt @@ -46,9 +46,24 @@ find_package(SDL2) if(${SDL2_FOUND}) 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_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}) set(SRB2_SDL2_TOTAL_SOURCES ${SRB2_SDL2_TOTAL_SOURCES} @@ -129,7 +144,7 @@ if(${SDL2_FOUND}) endif() endif() - target_link_libraries(SRB2SDL2 PRIVATE SRB2Core) + #target_link_libraries(SRB2SDL2 PRIVATE SRB2Core) if(${SRB2_USEASM}) if(${SRB2_CONFIG_YASM})