summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt105
1 files changed, 71 insertions, 34 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ed6008a..4a22138 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,8 +15,10 @@ set(COLOBOT_VERSION_MAJOR 0)
set(COLOBOT_VERSION_MINOR 1)
set(COLOBOT_VERSION_REVISION 0)
-# Comment out when releasing
-set(COLOBOT_VERSION_UNRELEASED "~pre-alpha")
+# Used on official releases
+set(COLOBOT_VERSION_RELEASE_CODENAME "-alpha")
+# Used on unreleased, development builds
+#set(COLOBOT_VERSION_UNRELEASED "+alpha")
# Append git characteristics to version
if(DEFINED COLOBOT_VERSION_UNRELEASED AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
@@ -30,21 +32,20 @@ if(DEFINED COLOBOT_VERSION_UNRELEASED AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
set(COLOBOT_VERSION_UNRELEASED "${COLOBOT_VERSION_UNRELEASED}-git-${GIT_BRANCH}~r${GIT_REVISION}")
endif()
-set(COLOBOT_VERSION_FULL "${COLOBOT_VERSION_MAJOR}.${COLOBOT_VERSION_MINOR}.${COLOBOT_VERSION_REVISION}${COLOBOT_VERSION_UNRELEASED}")
+set(COLOBOT_VERSION_FULL "${COLOBOT_VERSION_MAJOR}.${COLOBOT_VERSION_MINOR}.${COLOBOT_VERSION_REVISION}${COLOBOT_VERSION_UNRELEASED}${COLOBOT_VERSION_RELEASE_CODENAME}")
message(STATUS "Building Colobot \"${COLOBOT_VERSION_CODENAME}\" (${COLOBOT_VERSION_FULL})")
-# Include cmake directory with some additional scripts
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${colobot_SOURCE_DIR}/cmake")
##
# Build options
##
-# Global build type
-if(NOT CMAKE_BUILD_TYPE)
- set(CMAKE_BUILD_TYPE debug)
-endif()
+# Build targets should be placed in the root build directory
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+
+# Include cmake directory with some additional scripts
+set(CMAKE_MODULE_PATH "${colobot_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
# Compiler detection
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
@@ -83,8 +84,14 @@ set(COLOBOT_CXX_FLAGS_DEBUG "-g -O0")
# Asserts can be enabled/disabled regardless of build type
option(ASSERTS "Enable assert()s" ON)
+# Development build can be enabled/disabled regardless of build type
+option(DEV_BUILD "Enable development build (enables some debugging tools, local setting paths, etc.)" OFF)
+
# Building tests can be enabled/disabled
-option(TESTS "Enable tests" ON)
+option(TESTS "Build tests" OFF)
+
+# Building tool programs can be enabled/disabled
+option(TOOLS "Build tool programs" OFF)
# CBot can also be a static library
option(CBOT_STATIC "Build CBot as static libary" OFF)
@@ -95,11 +102,27 @@ option(DESKTOP "Generate desktop files, manpages, etc" ON)
# Doxygen docs are optional for installation
option(INSTALL_DOCS "Install Doxygen-generated documentation" OFF)
-# Build openal sound support
-option(OPENAL_SOUND "Build openal sound support" OFF)
+# Build OpenAL sound support
+option(OPENAL_SOUND "Build OpenAL sound support" ON)
# Change to false in case static boost libraries are not available
-option(STATIC_BOOST "Link with static boost libraries" ON)
+option(BOOST_STATIC "Link with static boost libraries" OFF)
+
+# This is useful on Windows, if linking against standard GLEW dll fails
+option(GLEW_STATIC "Link statically with GLEW" OFF)
+
+
+# Default build type if not given is debug
+if(NOT DEFINED CMAKE_BUILD_TYPE)
+ message(STATUS "Build type not specified - assuming debug")
+ set(CMAKE_BUILD_TYPE debug)
+endif()
+
+# Warn about development build
+if(DEV_BUILD)
+ message("Building with development extensions")
+endif()
+
##
# Searching for packages
@@ -112,21 +135,18 @@ find_package(SDL_ttf 2.0 REQUIRED)
find_package(PNG 1.2 REQUIRED)
find_package(Gettext REQUIRED)
-set(Boost_USE_STATIC_LIBS ${STATIC_BOOST})
+set(Boost_USE_STATIC_LIBS ${BOOST_STATIC})
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
set(Boost_ADDITIONALVERSION "1.51" "1.51.0")
find_package(Boost COMPONENTS system filesystem regex REQUIRED)
-# This is useful on Windows, if linking against standard GLEW dll fails
-option(GLEW_STATIC "Link statically with GLEW" OFF)
-
find_package(GLEW REQUIRED)
-if (${OPENAL_SOUND})
+if (OPENAL_SOUND)
find_package(OpenAL REQUIRED)
- include("${colobot_SOURCE_DIR}/cmake/FindLibSndFile.cmake")
+ find_package(LibSndFile REQUIRED)
endif()
@@ -134,11 +154,11 @@ endif()
# Platform detection and some related checks
##
-if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
+if("${CMAKE_SYSTEM_NAME}" MATCHES "Windows")
set(PLATFORM_WINDOWS 1)
set(PLATFORM_LINUX 0)
set(PLATFORM_OTHER 0)
-elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
set(PLATFORM_WINDOWS 0)
set(PLATFORM_LINUX 1)
set(PLATFORM_OTHER 0)
@@ -148,11 +168,11 @@ else()
set(PLATFORM_OTHER 1)
endif()
-if(NOT ${ASSERTS})
+if(NOT ASSERTS)
add_definitions(-DNDEBUG)
endif()
-if(${TESTS})
+if(TESTS)
add_definitions(-DTESTS -DTEST_VIRTUAL=virtual)
else()
add_definitions(-DTEST_VIRTUAL=)
@@ -174,9 +194,9 @@ include("${colobot_SOURCE_DIR}/cmake/msys.cmake")
##
# Summary of detected things
##
-if (${PLATFORM_WINDOWS})
+if (PLATFORM_WINDOWS)
message(STATUS "Build for Windows system")
-elseif(${PLATFORM_LINUX})
+elseif(PLATFORM_LINUX)
message(STATUS "Build for Linux system")
else()
message(STATUS "Build for other system")
@@ -187,7 +207,14 @@ endif()
# Clipboard support
##
set(CLIPBOARD_INCLUDE_DIR ${colobot_SOURCE_DIR}/lib/clipboard/include)
-add_subdirectory(${colobot_SOURCE_DIR}/lib/clipboard bin/clipboard)
+add_subdirectory(lib/clipboard)
+
+
+##
+# Localename
+##
+set(LOCALENAME_INCLUDE_DIR ${colobot_SOURCE_DIR}/lib/localename)
+add_subdirectory(lib/localename)
##
@@ -209,7 +236,7 @@ endif()
# Targets
##
-if(${TESTS})
+if(TESTS)
# Google Test library
find_path(GTEST_SRC_DIR NAMES src/gtest.cc src/gtest-all.cc PATHS /usr/src PATH_SUFFIXES gtest)
find_path(GTEST_INCLUDE_DIR gtest/gtest.h PATHS /usr/include)
@@ -221,7 +248,7 @@ if(${TESTS})
set(GTEST_INCLUDE_DIR ${colobot_SOURCE_DIR}/lib/gtest/include)
endif()
- add_subdirectory(${GTEST_SRC_DIR} bin/gtest)
+ add_subdirectory(${GTEST_SRC_DIR} lib/gtest)
# Google Mock library
find_path(GMOCK_SRC_DIR NAMES src/gmock.cc src/gmock-all.cc PATHS /usr/src PATH_SUFFIXES gmock)
@@ -236,19 +263,19 @@ if(${TESTS})
message(STATUS "Using bundled gmock library")
set(GMOCK_SRC_DIR ${colobot_SOURCE_DIR}/lib/gmock)
set(GMOCK_INCLUDE_DIR ${colobot_SOURCE_DIR}/lib/gmock/include)
- add_subdirectory(${GMOCK_SRC_DIR} bin/gmock)
+ add_subdirectory(${GMOCK_SRC_DIR} lib/gmock)
endif()
# Tests targets
enable_testing()
- add_subdirectory(test bin/test)
+ add_subdirectory(test)
endif()
# Installation paths defined before compiling sources
-if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
- if (${MXE})
+if(PLATFORM_WINDOWS)
+ if(MXE)
# We need to use STRING because PATH doesn't accept relative paths
set(COLOBOT_INSTALL_BIN_DIR ./ CACHE STRING "Colobot binary directory")
set(COLOBOT_INSTALL_LIB_DIR ./ CACHE STRING "Colobot libraries directory")
@@ -259,7 +286,7 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(COLOBOT_INSTALL_BIN_DIR ${CMAKE_INSTALL_PREFIX}/ CACHE PATH "Colobot binary directory")
set(COLOBOT_INSTALL_LIB_DIR ${CMAKE_INSTALL_PREFIX}/ CACHE PATH "Colobot libraries directory")
set(COLOBOT_INSTALL_DATA_DIR ${CMAKE_INSTALL_PREFIX}/data CACHE PATH "Colobot shared data directory")
- set(COLOBOT_INSTALL_I18N_DIR ${CMAKE_INSTALL_PREFIX}/ CACHE PATH "Colobot translations directory")
+ set(COLOBOT_INSTALL_I18N_DIR ${CMAKE_INSTALL_PREFIX}/lang CACHE PATH "Colobot translations directory")
set(COLOBOT_INSTALL_DOC_DIR ${CMAKE_INSTALL_PREFIX}/doc CACHE PATH "Colobot documentation directory")
endif()
else()
@@ -271,7 +298,17 @@ else()
endif()
# Subdirectory with sources
-add_subdirectory(src bin)
+add_subdirectory(src)
+
+add_subdirectory(po)
+
+if(DESKTOP)
+ if(PLATFORM_WINDOWS)
+ message("Desktop files ignored on Windows")
+ else()
+ add_subdirectory(desktop)
+ endif()
+endif()
##