mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Merge #951
951: Activate C++11 in old CMake as well r=Learath2 a=heinrich5991 Old CMake doesn't understand `CMAKE_CXX_STANDARD` and similar, add the parameter directly.
This commit is contained in:
commit
add0b88976
|
@ -55,11 +55,17 @@ if(NOT(CMAKE_BUILD_TYPE))
|
|||
set(CMAKE_BUILD_TYPE Release)
|
||||
endif()
|
||||
|
||||
set(DBG $<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>)
|
||||
if(CMAKE_VERSION VERSION_LESS 3.1)
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES Clang OR CMAKE_CXX_COMPILER_ID MATCHES GNU)
|
||||
if(CMAKE_CXX_FLAGS)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS -std=gnu++11)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
set(DBG $<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>)
|
||||
|
||||
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
|
||||
src/game/version.h
|
||||
|
@ -1304,6 +1310,10 @@ foreach(target ${TARGETS_LINK})
|
|||
endforeach()
|
||||
|
||||
foreach(target ${TARGETS_OWN})
|
||||
if(CMAKE_VERSION VERSION_GREATER 3.1 OR CMAKE_VERSION VERSION_EQUAL 3.1)
|
||||
set_property(TARGET ${target} PROPERTY CXX_STANDARD 11)
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
target_compile_options(${target} PRIVATE /wd4244) # Possible loss of data (float -> int, int -> float, etc.).
|
||||
target_compile_options(${target} PRIVATE /wd4267) # Possible loss of data (size_t - int on win64).
|
||||
|
|
13
circle.yml
13
circle.yml
|
@ -4,7 +4,7 @@ dependencies:
|
|||
sudo add-apt-repository -y ppa:zoogie/sdl2-snapshots
|
||||
sudo apt-get update
|
||||
sudo apt-get build-dep teeworlds
|
||||
sudo apt-get install libsdl2-dev xz-utils
|
||||
sudo apt-get install cmake libsdl2-dev xz-utils
|
||||
|
||||
- |
|
||||
if [ ! -x ~/bam/bam ]; then
|
||||
|
@ -12,15 +12,6 @@ dependencies:
|
|||
cd ~/bam; ./make_unix.sh
|
||||
fi
|
||||
|
||||
- |
|
||||
if [ ! -d ~/cmake ]; then
|
||||
mkdir ~/cmake
|
||||
cd ~/cmake
|
||||
curl -o cmake.tar.gz https://cmake.org/files/v3.9/cmake-3.9.2.tar.gz
|
||||
tar --strip-components=1 -zxf cmake.tar.gz
|
||||
./bootstrap && make
|
||||
fi
|
||||
|
||||
cache_directories:
|
||||
- "~/bam/"
|
||||
- "~/cmake/"
|
||||
|
@ -36,7 +27,7 @@ compile:
|
|||
- |
|
||||
mkdir build
|
||||
cd build
|
||||
env CFLAGS="-Wdeclaration-after-statement -Werror" CXXFLAGS="-Werror" ~/cmake/bin/cmake -DDOWNLOAD_GTEST=ON ..
|
||||
env CFLAGS="-Wdeclaration-after-statement -Werror" CXXFLAGS="-Werror" cmake -DDOWNLOAD_GTEST=ON ..
|
||||
make everything
|
||||
|
||||
test:
|
||||
|
|
|
@ -2760,21 +2760,19 @@ void shell_execute(const char *file)
|
|||
#endif
|
||||
}
|
||||
|
||||
int os_compare_version(unsigned int major, unsigned int minor)
|
||||
int os_is_winxp_or_lower(unsigned int major, unsigned int minor)
|
||||
{
|
||||
#if defined(CONF_FAMILY_WINDOWS)
|
||||
static const DWORD WINXP_MAJOR = 5;
|
||||
static const DWORD WINXP_MINOR = 1;
|
||||
OSVERSIONINFO ver;
|
||||
mem_zero(&ver, sizeof(OSVERSIONINFO));
|
||||
ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
||||
GetVersionEx(&ver);
|
||||
if(ver.dwMajorVersion > major || (ver.dwMajorVersion == major && ver.dwMinorVersion > minor))
|
||||
return 1;
|
||||
else if(ver.dwMajorVersion == major && ver.dwMinorVersion == minor)
|
||||
return 0;
|
||||
else
|
||||
return -1;
|
||||
return ver.dwMajorVersion < WINXP_MAJOR
|
||||
|| (ver.dwMajorVersion == WINXP_MAJOR && ver.dwMinorVersion <= WINXP_MINOR);
|
||||
#else
|
||||
return 0; // unimplemented
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -1512,19 +1512,14 @@ int pid();
|
|||
void shell_execute(const char *file);
|
||||
|
||||
/*
|
||||
Function: os_compare_version
|
||||
Compares the OS version to a given major and minor.
|
||||
|
||||
Parameters:
|
||||
major - Major version to compare to.
|
||||
minor - Minor version to compare to.
|
||||
Function: os_is_winxp_or_lower
|
||||
Checks whether the program runs on Windows XP or lower.
|
||||
|
||||
Returns:
|
||||
1 - OS version higher.
|
||||
0 - OS version same.
|
||||
-1 - OS version lower.
|
||||
1 - Windows XP or lower.
|
||||
0 - Higher Windows version, Linux, macOS, etc.
|
||||
*/
|
||||
int os_compare_version(unsigned int major, unsigned int minor);
|
||||
int os_is_winxp_or_lower();
|
||||
|
||||
/*
|
||||
Function: generate_password
|
||||
|
|
|
@ -3623,11 +3623,7 @@ bool CClient::RaceRecord_IsRecording()
|
|||
void CClient::RequestDDNetInfo()
|
||||
{
|
||||
char aUrl[256];
|
||||
#if defined(CONF_FAMILY_WINDOWS)
|
||||
static bool s_IsWinXP = os_compare_version(5U, 1U) <= 0;
|
||||
#else
|
||||
static bool s_IsWinXP = false;
|
||||
#endif
|
||||
static bool s_IsWinXP = os_is_winxp_or_lower();
|
||||
if(s_IsWinXP)
|
||||
str_copy(aUrl, "http://info.ddnet.tw/info", sizeof(aUrl));
|
||||
else
|
||||
|
|
|
@ -25,11 +25,7 @@ void CUpdater::Init()
|
|||
m_pClient = Kernel()->RequestInterface<IClient>();
|
||||
m_pStorage = Kernel()->RequestInterface<IStorage>();
|
||||
m_pFetcher = Kernel()->RequestInterface<IFetcher>();
|
||||
#if defined(CONF_FAMILY_WINDOWS)
|
||||
m_IsWinXP = os_compare_version(5U, 1U) <= 0;
|
||||
#else
|
||||
m_IsWinXP = false;
|
||||
#endif
|
||||
m_IsWinXP = os_is_winxp_or_lower();
|
||||
}
|
||||
|
||||
void CUpdater::ProgressCallback(IFetchTask *pTask, void *pUser)
|
||||
|
@ -117,7 +113,7 @@ void CUpdater::ReplaceClient()
|
|||
{
|
||||
dbg_msg("updater", "replacing " PLAT_CLIENT_EXEC);
|
||||
|
||||
//Replace running executable by renaming twice...
|
||||
// Replace running executable by renaming twice...
|
||||
if(!m_IsWinXP)
|
||||
{
|
||||
m_pStorage->RemoveBinaryFile("DDNet.old");
|
||||
|
|
Loading…
Reference in a new issue