mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
- Updated PCH to use our StdInc.h as the prefix header (not generated one from cotire) -> no exclude headers from ffmpeg/etc... statements required
- Fixed compilation error (VCAI ResourceSet logging)
This commit is contained in:
parent
486cd4b001
commit
95034b9fa0
@ -4,6 +4,7 @@ cmake_minimum_required(VERSION 2.6)
|
||||
include_directories(${Boost_INCLUDE_DIRS} ${CMAKE_HOME_DIRECTORY} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/lib)
|
||||
|
||||
set(battleAI_SRCS
|
||||
StdInc.cpp
|
||||
BattleAI.cpp
|
||||
main.cpp
|
||||
)
|
||||
@ -11,9 +12,8 @@ set(battleAI_SRCS
|
||||
add_library(BattleAI SHARED ${battleAI_SRCS})
|
||||
target_link_libraries(BattleAI vcmi)
|
||||
|
||||
if(COMMAND cotire)
|
||||
set_target_properties(BattleAI PROPERTIES ${PCH_PROPERTIES})
|
||||
cotire(BattleAI)
|
||||
endif()
|
||||
|
||||
if (NOT APPLE) # Already inside vcmiclient bundle
|
||||
install(TARGETS BattleAI DESTINATION ${AI_LIB_DIR})
|
||||
|
@ -4,6 +4,7 @@ cmake_minimum_required(VERSION 2.6)
|
||||
include_directories(${Boost_INCLUDE_DIRS} ${CMAKE_HOME_DIRECTORY} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/lib)
|
||||
|
||||
set(stupidAI_SRCS
|
||||
StdInc.cpp
|
||||
StupidAI.cpp
|
||||
main.cpp
|
||||
)
|
||||
@ -11,9 +12,8 @@ set(stupidAI_SRCS
|
||||
add_library(StupidAI SHARED ${stupidAI_SRCS})
|
||||
target_link_libraries(StupidAI vcmi)
|
||||
|
||||
if(COMMAND cotire)
|
||||
set_target_properties(StupidAI PROPERTIES ${PCH_PROPERTIES})
|
||||
cotire(StupidAI)
|
||||
endif()
|
||||
|
||||
if (NOT APPLE) # Already inside vcmiclient bundle
|
||||
install(TARGETS StupidAI DESTINATION ${AI_LIB_DIR})
|
||||
|
@ -4,6 +4,7 @@ cmake_minimum_required(VERSION 2.6)
|
||||
include_directories(${Boost_INCLUDE_DIRS} ${CMAKE_HOME_DIRECTORY} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/lib ${CMAKE_HOME_DIRECTORY}/AI/FuzzyLite)
|
||||
|
||||
set(VCAI_SRCS
|
||||
StdInc.cpp
|
||||
VCAI.cpp
|
||||
Goals.cpp
|
||||
AIUtility.cpp
|
||||
@ -11,16 +12,11 @@ set(VCAI_SRCS
|
||||
Fuzzy.cpp
|
||||
)
|
||||
|
||||
set(VCAI_HEADERS
|
||||
StdInc.h
|
||||
)
|
||||
|
||||
add_library(VCAI SHARED ${VCAI_SRCS} ${VCAI_HEADERS})
|
||||
add_library(VCAI SHARED ${VCAI_SRCS})
|
||||
target_link_libraries(VCAI FuzzyLite_lib vcmi)
|
||||
|
||||
if(COMMAND cotire)
|
||||
set_target_properties(VCAI PROPERTIES ${PCH_PROPERTIES})
|
||||
cotire(VCAI)
|
||||
endif()
|
||||
|
||||
if (NOT APPLE) # Already inside vcmiclient bundle
|
||||
install(TARGETS VCAI DESTINATION ${AI_LIB_DIR})
|
||||
|
@ -21,7 +21,7 @@ option(ENABLE_ERM "Enable compilation of ERM scripting module" OFF)
|
||||
option(ENABLE_EDITOR "Enable compilation of map editor" OFF)
|
||||
option(ENABLE_LAUNCHER "Enable compilation of launcher" ON)
|
||||
option(ENABLE_TEST "Enable compilation of unit tests" OFF)
|
||||
option(ENABLE_PCH "Enable precompiled headers" OFF)
|
||||
option(ENABLE_PCH "Enable compilation using precompiled headers" OFF)
|
||||
|
||||
############################################
|
||||
# Building section #
|
||||
@ -59,10 +59,7 @@ find_package(SDL_image REQUIRED)
|
||||
find_package(SDL_mixer REQUIRED)
|
||||
find_package(SDL_ttf REQUIRED)
|
||||
find_package(ZLIB REQUIRED)
|
||||
|
||||
if(ENABLE_PCH)
|
||||
include(cotire)
|
||||
endif()
|
||||
|
||||
if (ENABLE_EDITOR OR ENABLE_LAUNCHER)
|
||||
# Widgets finds its own dependencies (QtGui and QtCore).
|
||||
@ -145,6 +142,13 @@ add_definitions(-DM_LIB_DIR="${CMAKE_INSTALL_PREFIX}/${LIB_DIR}")
|
||||
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/vcmi")
|
||||
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
|
||||
# precompiled header configuration
|
||||
SET(PCH_PROPERTIES
|
||||
COTIRE_ENABLE_PRECOMPILED_HEADER ${ENABLE_PCH}
|
||||
COTIRE_ADD_UNITY_BUILD FALSE
|
||||
COTIRE_CXX_PREFIX_HEADER_INIT "StdInc.h"
|
||||
)
|
||||
|
||||
if (ENABLE_ERM)
|
||||
add_subdirectory(scripting/erm)
|
||||
endif()
|
||||
|
18
Global.h
18
Global.h
@ -90,7 +90,7 @@ static_assert(sizeof(bool) == 1, "Bool needs to be 1 byte in size.");
|
||||
#include <boost/version.hpp>
|
||||
|
||||
#define BOOST_FILESYSTEM_VERSION 3
|
||||
#if ( BOOST_VERSION>105000 && !defined(BOOST_THREAD_VERSION))
|
||||
#if BOOST_VERSION > 105000
|
||||
#define BOOST_THREAD_VERSION 3
|
||||
#endif
|
||||
#define BOOST_THREAD_DONT_PROVIDE_THREAD_DESTRUCTOR_CALLS_TERMINATE_IF_JOINABLE 1
|
||||
@ -527,8 +527,12 @@ namespace vstd
|
||||
template<class ForwardRange, class ValueFunction>
|
||||
auto minElementByFun(const ForwardRange& rng, ValueFunction vf) -> decltype(std::begin(rng))
|
||||
{
|
||||
typedef decltype(*std::begin(rng)) ElemType;
|
||||
return boost::min_element(rng, [&] (ElemType lhs, ElemType rhs) -> bool
|
||||
/* Clang crashes when instantiating this function template and having PCH compilation enabled.
|
||||
* There is a bug report here: http://llvm.org/bugs/show_bug.cgi?id=18744
|
||||
* Current bugfix is to don't use a typedef for decltype(*std::begin(rng)) and to use decltype
|
||||
* directly for both function parameters.
|
||||
*/
|
||||
return boost::min_element(rng, [&] (decltype(*std::begin(rng)) lhs, decltype(*std::begin(rng)) rhs) -> bool
|
||||
{
|
||||
return vf(lhs) < vf(rhs);
|
||||
});
|
||||
@ -538,8 +542,12 @@ namespace vstd
|
||||
template<class ForwardRange, class ValueFunction>
|
||||
auto maxElementByFun(const ForwardRange& rng, ValueFunction vf) -> decltype(std::begin(rng))
|
||||
{
|
||||
typedef decltype(*std::begin(rng)) ElemType;
|
||||
return boost::max_element(rng, [&] (ElemType lhs, ElemType rhs) -> bool
|
||||
/* Clang crashes when instantiating this function template and having PCH compilation enabled.
|
||||
* There is a bug report here: http://llvm.org/bugs/show_bug.cgi?id=18744
|
||||
* Current bugfix is to don't use a typedef for decltype(*std::begin(rng)) and to use decltype
|
||||
* directly for both function parameters.
|
||||
*/
|
||||
return boost::max_element(rng, [&] (decltype(*std::begin(rng)) lhs, decltype(*std::begin(rng)) rhs) -> bool
|
||||
{
|
||||
return vf(lhs) < vf(rhs);
|
||||
});
|
||||
|
@ -6,6 +6,7 @@ include_directories(${SDL_INCLUDE_DIR} ${SDLIMAGE_INCLUDE_DIR} ${SDLMIXER_INCLUD
|
||||
include_directories(${Boost_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR} ${FFMPEG_INCLUDE_DIRS})
|
||||
|
||||
set(client_SRCS
|
||||
StdInc.cpp
|
||||
../CCallback.cpp
|
||||
|
||||
battle/CBattleInterface.cpp
|
||||
@ -108,11 +109,9 @@ endif()
|
||||
|
||||
target_link_libraries(vcmiclient vcmi ${Boost_LIBRARIES} ${SDL_LIBRARY} ${SDLIMAGE_LIBRARY} ${SDLMIXER_LIBRARY} ${SDLTTF_LIBRARY} ${ZLIB_LIBRARIES} ${FFMPEG_LIBRARIES} ${RT_LIB} ${DL_LIB})
|
||||
|
||||
set_property(DIRECTORY PROPERTY COTIRE_PREFIX_HEADER_IGNORE_PATH "${FFMPEG_INCLUDE_DIRS}" "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}")
|
||||
|
||||
if(COMMAND cotire)
|
||||
set_target_properties(vcmiclient PROPERTIES ${PCH_PROPERTIES})
|
||||
cotire(vcmiclient)
|
||||
endif()
|
||||
|
||||
|
||||
install(TARGETS vcmiclient DESTINATION ${BIN_DIR})
|
||||
|
||||
|
@ -6,6 +6,7 @@ include_directories(${Qt5Widgets_INCLUDE_DIRS})
|
||||
|
||||
|
||||
set(maped_SRCS
|
||||
StdInc.cpp
|
||||
Editor.cpp
|
||||
Main.cpp
|
||||
)
|
||||
@ -38,6 +39,8 @@ add_executable(vcmieditor ${maped_SRCS} ${maped_FORMS_OUT})
|
||||
|
||||
# The Qt5Widgets_LIBRARIES variable also includes QtGui and QtCore
|
||||
target_link_libraries(vcmieditor vcmi ${Qt5Widgets_LIBRARIES})
|
||||
|
||||
set_target_properties(vcmieditor PROPERTIES ${PCH_PROPERTIES})
|
||||
cotire(vcmieditor)
|
||||
|
||||
if (NOT APPLE) # Already inside bundle
|
||||
|
@ -17,6 +17,7 @@ set(launcher_settingsview_SRCS
|
||||
)
|
||||
|
||||
set(launcher_SRCS
|
||||
StdInc.cpp
|
||||
${launcher_modmanager_SRCS}
|
||||
${launcher_settingsview_SRCS}
|
||||
main.cpp
|
||||
@ -53,9 +54,8 @@ add_executable(vcmilauncher ${launcher_SRCS} ${launcher_UI_HEADERS})
|
||||
# The Qt5Widgets_LIBRARIES variable also includes QtGui and QtCore
|
||||
target_link_libraries(vcmilauncher vcmi ${Qt5Widgets_LIBRARIES} ${Qt5Network_LIBRARIES})
|
||||
|
||||
if(COMMAND cotire)
|
||||
set_target_properties(vcmilauncher PROPERTIES ${PCH_PROPERTIES})
|
||||
cotire(vcmilauncher)
|
||||
endif()
|
||||
|
||||
if (NOT APPLE) # Already inside bundle
|
||||
install(TARGETS vcmilauncher DESTINATION ${BIN_DIR})
|
||||
|
@ -5,6 +5,7 @@ include_directories(${CMAKE_HOME_DIRECTORY} ${CMAKE_CURRENT_SOURCE_DIRECTORY} ${
|
||||
include_directories(${Boost_INCLUDE_DIRS} ${SDL_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR})
|
||||
|
||||
set(lib_SRCS
|
||||
StdInc.cpp
|
||||
RegisterTypes.cpp
|
||||
IGameCallback.cpp
|
||||
CGameState.cpp
|
||||
@ -106,9 +107,8 @@ add_library(vcmi SHARED ${lib_SRCS} ${lib_HEADERS})
|
||||
set_target_properties(vcmi PROPERTIES XCODE_ATTRIBUTE_LD_DYLIB_INSTALL_NAME "@executable_path/libvcmi.dylib")
|
||||
target_link_libraries(vcmi minizip ${Boost_LIBRARIES} ${SDL_LIBRARY} ${ZLIB_LIBRARIES} ${RT_LIB} ${DL_LIB})
|
||||
|
||||
if(COMMAND cotire)
|
||||
set_target_properties(vcmi PROPERTIES ${PCH_PROPERTIES})
|
||||
cotire(vcmi)
|
||||
endif()
|
||||
|
||||
if (NOT APPLE) # Already inside vcmiclient bundle
|
||||
install(TARGETS vcmi DESTINATION ${LIB_DIR})
|
||||
|
@ -151,6 +151,8 @@ namespace Res
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
using ::operator<<;
|
||||
}
|
||||
|
||||
typedef Res::ResourceSet TResources;
|
||||
|
@ -4,6 +4,7 @@ cmake_minimum_required(VERSION 2.6)
|
||||
include_directories(${CMAKE_HOME_DIRECTORY} ${CMAKE_CURRENT_SOURCE_DIRECTORY})
|
||||
|
||||
set(lib_SRCS
|
||||
StdInc.cpp
|
||||
ERMParser.cpp
|
||||
ERMInterpreter.cpp
|
||||
ERMScriptModule.cpp
|
||||
@ -11,6 +12,8 @@ set(lib_SRCS
|
||||
|
||||
add_library(vcmiERM SHARED ${lib_SRCS})
|
||||
target_link_libraries(vcmiERM ${Boost_LIBRARIES})
|
||||
|
||||
set_target_properties(vcmiERM PROPERTIES ${PCH_PROPERTIES})
|
||||
cotire(vcmiERM)
|
||||
|
||||
install(TARGETS vcmiERM DESTINATION ${SCRIPTING_LIB_DIR})
|
||||
|
@ -5,6 +5,7 @@ include_directories(${CMAKE_HOME_DIRECTORY} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_
|
||||
include_directories(${Boost_INCLUDE_DIRS})
|
||||
|
||||
set(server_SRCS
|
||||
StdInc.cpp
|
||||
CGameHandler.cpp
|
||||
CVCMIServer.cpp
|
||||
CQuery.cpp
|
||||
@ -19,9 +20,9 @@ endif()
|
||||
|
||||
target_link_libraries(vcmiserver vcmi ${Boost_LIBRARIES} ${RT_LIB} ${DL_LIB})
|
||||
|
||||
if(COMMAND cotire)
|
||||
set_target_properties(vcmiserver PROPERTIES ${PCH_PROPERTIES})
|
||||
cotire(vcmiserver)
|
||||
endif()
|
||||
|
||||
|
||||
if (NOT APPLE) # Already inside vcmiclient bundle
|
||||
install(TARGETS vcmiserver DESTINATION ${BIN_DIR})
|
||||
|
@ -14,11 +14,8 @@ add_executable(vcmitest ${test_SRCS})
|
||||
target_link_libraries(vcmitest vcmi ${Boost_LIBRARIES} ${RT_LIB} ${DL_LIB})
|
||||
add_test(vcmitest vcmitest)
|
||||
|
||||
set_property(DIRECTORY PROPERTY COTIRE_PREFIX_HEADER_IGNORE_PATH "${Boost_INCLUDE_DIRS}/boost/test" "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}")
|
||||
|
||||
if(COMMAND cotire)
|
||||
set_target_properties(vcmitest PROPERTIES ${PCH_PROPERTIES})
|
||||
cotire(vcmitest)
|
||||
endif()
|
||||
|
||||
# Files to copy to the build directory
|
||||
add_custom_target(vcmitestFiles ALL)
|
||||
|
Loading…
Reference in New Issue
Block a user