CMakeLists enhancements
- compiler detection (clang and gcc version check) - compile flags only for src/ subdir - system and local include paths - fix for clang compilationdev-ui
parent
5a6b3f005a
commit
1285712aa2
|
@ -47,10 +47,27 @@ if(NOT CMAKE_BUILD_TYPE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Global compile flags
|
# Global compile flags
|
||||||
# These are specific to GCC/MinGW; for other compilers, change as necessary
|
# These are specific to GCC/MinGW/clang; for other compilers, change as necessary
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wold-style-cast -std=c++11")
|
# The flags are used throughout src/ subdir
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "-O2")
|
set(COLOBOT_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wold-style-cast -std=c++11")
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
|
set(COLOBOT_CXX_FLAGS_RELEASE "-O2")
|
||||||
|
set(COLOBOT_CXX_FLAGS_DEBUG "-g -O0")
|
||||||
|
|
||||||
|
# Compiler detection
|
||||||
|
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
|
||||||
|
if (NOT (GCC_VERSION VERSION_GREATER 4.6 OR GCC_VERSION VERSION_EQUAL 4.6))
|
||||||
|
message(FATAL_ERROR "${PROJECT_NAME} requires GCC 4.6 or greater.")
|
||||||
|
else()
|
||||||
|
message(STATUS "Detected GCC version 4.6+")
|
||||||
|
endif()
|
||||||
|
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||||
|
message(STATUS "Detected Clang compiler")
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Your C++ compiler doesn't seem to support C++11.\n"
|
||||||
|
"Supported compilers at this time are GCC 4.6+ and clang.")
|
||||||
|
endif()
|
||||||
|
|
||||||
# Asserts can be enabled/disabled regardless of build type
|
# Asserts can be enabled/disabled regardless of build type
|
||||||
option(ASSERTS "Enable assert()s" ON)
|
option(ASSERTS "Enable assert()s" ON)
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
cmake_minimum_required(VERSION 2.8)
|
cmake_minimum_required(VERSION 2.8)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_FLAGS "${${ORIGINAL_CXX_FLAGS}}")
|
||||||
|
|
||||||
include_directories(. include ${GTEST_INCLUDE_DIR})
|
include_directories(. include ${GTEST_INCLUDE_DIR})
|
||||||
|
|
||||||
# gmock-all.cc includes all other sources
|
# gmock-all.cc includes all other sources
|
||||||
|
|
|
@ -1,7 +1,13 @@
|
||||||
# CBot library is built separately
|
# Compile flags as defined in global CMakeLists
|
||||||
|
set(CMAKE_CXX_FLAGS ${COLOBOT_CXX_FLAGS})
|
||||||
|
set(CMAKE_CXX_FLAGS_RELEASE ${COLOBOT_CXX_FLAGS_RELEASE})
|
||||||
|
set(CMAKE_CXX_FLAGS_DEBUG ${COLOBOT_CXX_FLAGS_DEBUG})
|
||||||
|
|
||||||
|
|
||||||
|
# Subdirectories
|
||||||
|
|
||||||
add_subdirectory(CBot)
|
add_subdirectory(CBot)
|
||||||
|
|
||||||
# Tools directory is built separately
|
|
||||||
add_subdirectory(tools)
|
add_subdirectory(tools)
|
||||||
|
|
||||||
add_subdirectory(po)
|
add_subdirectory(po)
|
||||||
|
@ -196,10 +202,16 @@ ${OPTIONAL_LIBS}
|
||||||
${PLATFORM_LIBS}
|
${PLATFORM_LIBS}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Local
|
||||||
include_directories(
|
include_directories(
|
||||||
.
|
.
|
||||||
..
|
..
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
# System
|
||||||
|
include_directories(
|
||||||
|
SYSTEM
|
||||||
${SDL_INCLUDE_DIR}
|
${SDL_INCLUDE_DIR}
|
||||||
${SDLIMAGE_INCLUDE_DIR}
|
${SDLIMAGE_INCLUDE_DIR}
|
||||||
${SDLTTF_INCLUDE_DIR}
|
${SDLTTF_INCLUDE_DIR}
|
||||||
|
|
|
@ -8,9 +8,9 @@
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
namespace Gfx {
|
template<> Gfx::CModelManager* CSingleton<Gfx::CModelManager>::mInstance = nullptr;
|
||||||
|
|
||||||
template<> CModelManager* CSingleton<CModelManager>::mInstance = nullptr;
|
namespace Gfx {
|
||||||
|
|
||||||
CModelManager::CModelManager(CEngine* engine)
|
CModelManager::CModelManager(CEngine* engine)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue