1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

CMake: add ENABLE_DEBUG_CONSOLE option for Windows enabled by default

For now we'll keep console, but in future we need a way to toggle it at runtime.
This commit is contained in:
Arseniy Shestakov 2017-08-16 16:29:18 +03:00
parent 03c7bf5ee6
commit 5fce56d23e
3 changed files with 16 additions and 7 deletions

View File

@ -52,6 +52,7 @@ option(ENABLE_LAUNCHER "Enable compilation of launcher" ON)
option(ENABLE_TEST "Enable compilation of unit tests" ON) option(ENABLE_TEST "Enable compilation of unit tests" ON)
option(ENABLE_PCH "Enable compilation using precompiled headers" ON) option(ENABLE_PCH "Enable compilation using precompiled headers" ON)
option(ENABLE_GITVERSION "Enable Version.cpp with Git commit hash" ON) option(ENABLE_GITVERSION "Enable Version.cpp with Git commit hash" ON)
option(ENABLE_DEBUG_CONSOLE "Enable debug console for Windows builds" ON)
# Useful for debugging # Useful for debugging
option(ENABLE_MONOLITHIC_INSTALL "Install everything in single directory on Linux and Mac" OFF) option(ENABLE_MONOLITHIC_INSTALL "Install everything in single directory on Linux and Mac" OFF)
@ -134,7 +135,10 @@ if(WIN32)
set(Boost_USE_STATIC_LIBS OFF) set(Boost_USE_STATIC_LIBS OFF)
# Don't link with SDLMain # Don't link with SDLMain
#set(SDL2_BUILDING_LIBRARY ON) if(ENABLE_DEBUG_CONSOLE)
set(SDL2_BUILDING_LIBRARY ON)
add_definitions(-DVCMI_WITH_DEBUG_CONSOLE)
endif()
# Suppress warnings # Suppress warnings
add_definitions(-D_CRT_SECURE_NO_WARNINGS) add_definitions(-D_CRT_SECURE_NO_WARNINGS)

View File

@ -219,10 +219,9 @@ static void SDLLogCallback(void* userdata,
logGlobal->debug("SDL(category %d; priority %d) %s", category, priority, message); logGlobal->debug("SDL(category %d; priority %d) %s", category, priority, message);
} }
//#if defined(VCMI_WINDOWS) && !defined (__GNUC__) #if defined(VCMI_WINDOWS) && !defined(__GNUC__) && defined(VCMI_WITH_DEBUG_CONSOLE)
//int wmain(int argc, wchar_t* argv[]) int wmain(int argc, wchar_t* argv[])
//#el #elif defined(VCMI_APPLE) || defined(VCMI_ANDROID)
#if defined(VCMI_APPLE) || defined(VCMI_ANDROID)
int SDL_main(int argc, char *argv[]) int SDL_main(int argc, char *argv[])
#else #else
int main(int argc, char * argv[]) int main(int argc, char * argv[])

View File

@ -125,7 +125,11 @@ elseif(WIN32)
set(client_ICON "VCMI_client.rc") set(client_ICON "VCMI_client.rc")
endif() endif()
add_executable(vcmiclient WIN32 ${client_SRCS} ${client_HEADERS} ${client_ICON}) if(ENABLE_DEBUG_CONSOLE)
add_executable(vcmiclient ${client_SRCS} ${client_HEADERS} ${client_ICON})
else()
add_executable(vcmiclient WIN32 ${client_SRCS} ${client_HEADERS} ${client_ICON})
endif(ENABLE_DEBUG_CONSOLE)
if(WIN32) if(WIN32)
set_target_properties(vcmiclient set_target_properties(vcmiclient
@ -133,7 +137,9 @@ if(WIN32)
OUTPUT_NAME "VCMI_client" OUTPUT_NAME "VCMI_client"
PROJECT_LABEL "VCMI_client" PROJECT_LABEL "VCMI_client"
) )
target_link_libraries(vcmiclient ${SDLMAIN_LIBRARY}) if(NOT ENABLE_DEBUG_CONSOLE)
target_link_libraries(vcmiclient ${SDLMAIN_LIBRARY})
endif()
endif() endif()
target_link_libraries(vcmiclient vcmi ${Boost_LIBRARIES} target_link_libraries(vcmiclient vcmi ${Boost_LIBRARIES}