diff --git a/AI/CMakeLists.txt b/AI/CMakeLists.txt index 729b3b384..8e97d6aff 100644 --- a/AI/CMakeLists.txt +++ b/AI/CMakeLists.txt @@ -40,4 +40,6 @@ add_subdirectory(BattleAI) add_subdirectory(StupidAI) add_subdirectory(EmptyAI) add_subdirectory(VCAI) -add_subdirectory(Nullkiller) +if(ENABLE_NULLKILLER_AI) + add_subdirectory(Nullkiller) +endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f56b7f76..14c6c5666 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,6 +48,7 @@ option(ENABLE_ERM "Enable compilation of ERM scripting module" OFF) option(ENABLE_LUA "Enable compilation of LUA scripting module" OFF) option(ENABLE_LAUNCHER "Enable compilation of launcher" ON) option(ENABLE_EDITOR "Enable compilation of map editor" ON) +option(ENABLE_NULLKILLER_AI "Enable compilation of Nullkiller AI library" ON) if(APPLE_IOS) set(BUNDLE_IDENTIFIER_PREFIX "" CACHE STRING "Bundle identifier prefix") set(APP_DISPLAY_NAME "VCMI" CACHE STRING "App name on the home screen") @@ -323,7 +324,6 @@ find_package(SDL2_ttf REQUIRED) if(TARGET SDL2_ttf::SDL2_ttf) add_library(SDL2::TTF ALIAS SDL2_ttf::SDL2_ttf) endif() -find_package(TBB REQUIRED) if(ENABLE_LAUNCHER OR ENABLE_EDITOR) # Widgets finds its own dependencies (QtGui and QtCore). @@ -331,6 +331,10 @@ if(ENABLE_LAUNCHER OR ENABLE_EDITOR) find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets Network) endif() +if(ENABLE_NULLKILLER_AI) + find_package(TBB REQUIRED) +endif() + if(ENABLE_LUA) find_package(luajit) # MXE paths hardcoded for current dependencies pack - tried and could not make it work another way @@ -397,6 +401,11 @@ else() set(BIN_DIR "." CACHE STRING "Where to install binaries") set(LIB_DIR "." CACHE STRING "Where to install main library") set(DATA_DIR "." CACHE STRING "Where to install data files") + + # following constants only used for platforms using XDG (Linux, BSD, etc) + add_definitions(-DM_DATA_DIR="${DATA_DIR}") + add_definitions(-DM_BIN_DIR="${BIN_DIR}") + add_definitions(-DM_LIB_DIR="${LIB_DIR}") else() if(NOT BIN_DIR) set(BIN_DIR "bin" CACHE STRING "Where to install binaries") @@ -407,12 +416,12 @@ else() if(NOT DATA_DIR) set(DATA_DIR "share/vcmi" CACHE STRING "Where to install data files") endif() - endif() - # following constants only used for platforms using XDG (Linux, BSD, etc) - add_definitions(-DM_DATA_DIR="${CMAKE_INSTALL_PREFIX}/${DATA_DIR}") - add_definitions(-DM_BIN_DIR="${CMAKE_INSTALL_PREFIX}/${BIN_DIR}") - add_definitions(-DM_LIB_DIR="${CMAKE_INSTALL_PREFIX}/${LIB_DIR}") + # following constants only used for platforms using XDG (Linux, BSD, etc) + add_definitions(-DM_DATA_DIR="${CMAKE_INSTALL_PREFIX}/${DATA_DIR}") + add_definitions(-DM_BIN_DIR="${CMAKE_INSTALL_PREFIX}/${BIN_DIR}") + add_definitions(-DM_LIB_DIR="${CMAKE_INSTALL_PREFIX}/${LIB_DIR}") + endif() endif() # iOS has flat libs directory structure diff --git a/client/CMT.cpp b/client/CMT.cpp index f18d522d7..9977ac2c7 100644 --- a/client/CMT.cpp +++ b/client/CMT.cpp @@ -1085,7 +1085,6 @@ static bool recreateWindow(int w, int h, int bpp, bool fullscreen, int displayIn if(!checkVideoMode(displayIndex, w, h)) { logGlobal->error("Error: SDL says that %dx%d resolution is not available!", w, h); - return false; } #endif diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 5a136edd4..f49e423c5 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -197,7 +197,10 @@ else() add_executable(vcmiclient WIN32 ${client_SRCS} ${client_HEADERS} ${client_ICON}) endif(ENABLE_DEBUG_CONSOLE) -add_dependencies(vcmiclient vcmiserver BattleAI StupidAI VCAI Nullkiller) +add_dependencies(vcmiclient vcmiserver BattleAI StupidAI VCAI) +if(ENABLE_NULLKILLER_AI) + add_dependencies(vcmiclient Nullkiller) +endif() if(APPLE_IOS) if(ENABLE_ERM) add_dependencies(vcmiclient vcmiERM) diff --git a/lib/CModHandler.h b/lib/CModHandler.h index aee7704ae..f152fdbd9 100644 --- a/lib/CModHandler.h +++ b/lib/CModHandler.h @@ -14,6 +14,12 @@ #include "VCMI_Lib.h" #include "JsonNode.h" +#ifdef __UCLIBC__ +#undef major +#undef minor +#undef patch +#endif + VCMI_LIB_NAMESPACE_BEGIN class CModHandler; diff --git a/server/CVCMIServer.cpp b/server/CVCMIServer.cpp index f4bbc0a1f..bd9e46125 100644 --- a/server/CVCMIServer.cpp +++ b/server/CVCMIServer.cpp @@ -55,7 +55,7 @@ #include "../lib/CGameState.h" -#if defined(__GNUC__) && !defined(__MINGW32__) && !defined(VCMI_ANDROID) && !defined(VCMI_IOS) +#if defined(__GNUC__) && !defined(__UCLIBC__) && !defined(__MINGW32__) && !defined(VCMI_ANDROID) && !defined(VCMI_IOS) #include #endif @@ -958,7 +958,7 @@ ui8 CVCMIServer::getIdOfFirstUnallocatedPlayer() const return 0; } -#if defined(__GNUC__) && !defined(__MINGW32__) && !defined(VCMI_ANDROID) && !defined(VCMI_IOS) +#if defined(__GNUC__) && !defined(__UCLIBC__) && !defined(__MINGW32__) && !defined(VCMI_ANDROID) && !defined(VCMI_IOS) void handleLinuxSignal(int sig) { const int STACKTRACE_SIZE = 100; @@ -1049,7 +1049,7 @@ int main(int argc, char * argv[]) #endif // Installs a sig sev segmentation violation handler // to log stacktrace -#if defined(__GNUC__) && !defined(__MINGW32__) && !defined(VCMI_ANDROID) && !defined(VCMI_IOS) +#if defined(__GNUC__) && !defined(__UCLIBC__) && !defined(__MINGW32__) && !defined(VCMI_ANDROID) && !defined(VCMI_IOS) signal(SIGSEGV, handleLinuxSignal); #endif