summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--.gitmodules3
-rw-r--r--.travis.yml1
-rw-r--r--CMakeLists.txt61
m---------data0
-rw-r--r--src/CBot/CMakeLists.txt2
-rw-r--r--src/CBot/tests/CBot_console/CMakeLists.txt9
-rw-r--r--src/CMakeLists.txt4
-rw-r--r--src/app/app.cpp16
-rw-r--r--src/common/config.h.cmake4
-rw-r--r--src/common/global.h1
-rw-r--r--src/common/test/CMakeLists.txt7
-rw-r--r--src/graphics/engine/test/CMakeLists.txt7
-rw-r--r--src/graphics/opengl/test/CMakeLists.txt7
-rw-r--r--src/math/test/CMakeLists.txt7
-rw-r--r--src/plugins/test/CMakeLists.txt7
-rw-r--r--src/po/CMakeLists.txt17
-rw-r--r--src/sound/plugins/oalsound/CMakeLists.txt3
-rw-r--r--src/sound/plugins/oalsound/test/CMakeLists.txt7
-rw-r--r--src/ui/test/CMakeLists.txt7
20 files changed, 106 insertions, 67 deletions
diff --git a/.gitignore b/.gitignore
index 4f78a85..bc2649c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,9 +1,6 @@
# Ignore the documentation folder
/doc
-# We don't want anyone to checkin /data folder
-/data
-
# Ignore local data
/colobot.ini
/savegame
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..2e2b0cc
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "data"]
+ path = data
+ url = git://github.com/colobot/colobot-data.git
diff --git a/.travis.yml b/.travis.yml
index c65683d..ed7cf35 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,4 +8,3 @@ before_install:
- sudo apt-get install -qq --no-install-recommends devscripts dpkg-dev lintian equivs
- mk-build-deps --root-cmd sudo --tool "apt-get -qq --no-install-recommends" --install --remove
- dch -v 0~git$(date +%Y%m%d%H%M)00-1~travis0 -m "Automated test-build."
- - mkdir -p ../data
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4640db6..ce56bdd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,12 +16,15 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${colobot_SOURCE_DIR}/cmake")
##
# Global build type
-set(CMAKE_BUILD_TYPE debug)
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE debug)
+endif()
# Global compile flags
# These are specific to GCC/MinGW; for other compilers, change as necessary
-set(CMAKE_CXX_FLAGS_RELEASE "-O2 -Wall -Wold-style-cast -std=gnu++0x")
-set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall -Wold-style-cast -std=gnu++0x")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wold-style-cast -std=gnu++0x")
+set(CMAKE_CXX_FLAGS_RELEASE "-O2")
+set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
# Asserts can be enabled/disabled regardless of build type
option(ASSERTS "Enable assert()s" ON)
@@ -32,6 +35,9 @@ option(TESTS "Enable tests" ON)
# CBot can also be a static library
option(CBOT_STATIC "Build CBot as static libary" OFF)
+# Doxygen docs are optional for installation
+option(INSTALL_DOCS "Install Doxygen-generated documentation" OFF)
+
##
# Required packages
@@ -43,6 +49,7 @@ find_package(SDL_image 1.2 REQUIRED)
find_package(SDL_ttf 2.0 REQUIRED)
find_package(PNG 1.2 REQUIRED)
find_package(LTDL 2.4.2 REQUIRED)
+find_package(Gettext REQUIRED)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
@@ -124,6 +131,21 @@ endif()
##
+# Doxygen docs
+##
+
+find_package(Doxygen)
+
+if(DOXYGEN_FOUND AND DOXYGEN_DOT_FOUND)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
+ add_custom_target(doc
+ ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMENT "Generating API documentation with Doxygen" VERBATIM)
+endif()
+
+
+##
# Targets
##
@@ -159,24 +181,27 @@ if(${TESTS})
endif()
-# TODO: provide data files as git submodule
-set(COLOBOT_DATA_DIR share/games/colobot CACHE PATH "Colobot shared data directory")
-set(COLOBOT_LIB_DIR lib/colobot CACHE PATH "Colobot libraries directory")
+# Installation paths defined before compiling sources
+set(COLOBOT_INSTALL_BIN_DIR ${CMAKE_INSTALL_PREFIX}/games CACHE PATH "Colobot binary directory")
+set(COLOBOT_INSTALL_DATA_DIR ${CMAKE_INSTALL_PREFIX}/share/games/colobot CACHE PATH "Colobot shared data directory")
+set(COLOBOT_INSTALL_LIB_DIR ${CMAKE_INSTALL_PREFIX}/lib/colobot CACHE PATH "Colobot libraries directory")
+set(COLOBOT_INSTALL_DOC_DIR ${CMAKE_INSTALL_PREFIX}/share/doc/colobot CACHE PATH "Colobot documentation directory")
+set(COLOBOT_INSTALL_I18N_DIR ${CMAKE_INSTALL_PREFIX}/share/locale CACHE PATH "Colobot translations directory")
# Subdirectory with sources
add_subdirectory(src bin)
-install(DIRECTORY ../data DESTINATION ${COLOBOT_DATA_DIR})
-# Build and install documentation
-set(COLOBOT_DOC_DIR ${CMAKE_INSTALL_PREFIX}/share/doc/colobot CACHE PATH "Colobot documentation directory")
+##
+# Installation
+##
-find_package(Doxygen)
-if(DOXYGEN_FOUND AND DOXYGEN_DOT_FOUND)
- configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
- add_custom_target(doc
- ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
- COMMENT "Generating API documentation with Doxygen" VERBATIM )
- install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc/ DESTINATION ${COLOBOT_DOC_DIR} OPTIONAL)
-endif(DOXYGEN_FOUND AND DOXYGEN_DOT_FOUND)
+file(GLOB DATA_FILES "data/*")
+
+# Data
+install(DIRECTORY data/ DESTINATION ${COLOBOT_INSTALL_DATA_DIR})
+
+# Documentation
+if(INSTALL_DOCS AND DOXYGEN_FOUND AND DOXYGEN_DOT_FOUND)
+ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc/ DESTINATION ${COLOBOT_INSTALL_DOC_DIR} OPTIONAL)
+endif()
diff --git a/data b/data
new file mode 160000
+Subproject 6b6e5a0ab56bf42f17d969c1bd4c09185605cad
diff --git a/src/CBot/CMakeLists.txt b/src/CBot/CMakeLists.txt
index e1c9b87..a347500 100644
--- a/src/CBot/CMakeLists.txt
+++ b/src/CBot/CMakeLists.txt
@@ -18,4 +18,4 @@ else()
add_library(CBot SHARED ${SOURCES})
endif()
-install(TARGETS CBot LIBRARY DESTINATION ${COLOBOT_LIB_DIR})
+install(TARGETS CBot LIBRARY DESTINATION ${COLOBOT_INSTALL_LIB_DIR})
diff --git a/src/CBot/tests/CBot_console/CMakeLists.txt b/src/CBot/tests/CBot_console/CMakeLists.txt
index 7d9f034..9f0f244 100644
--- a/src/CBot/tests/CBot_console/CMakeLists.txt
+++ b/src/CBot/tests/CBot_console/CMakeLists.txt
@@ -3,11 +3,14 @@ cmake_minimum_required(VERSION 2.8)
project(CBot_console C CXX)
# Build with debugging symbols
-set(CMAKE_BUILD_TYPE debug)
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE debug)
+endif(NOT CMAKE_BUILD_TYPE)
# Global compile flags
-set(CMAKE_CXX_FLAGS_RELEASE "-O2 -Wall -Wold-style-cast -std=gnu++0x")
-set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall -Wold-style-cast -std=gnu++0x")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wold-style-cast -std=gnu++0x")
+set(CMAKE_CXX_FLAGS_RELEASE "-O2")
+set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
# Include cmake directory
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${colobot_SOURCE_DIR}/cmake")
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 7096bff..be50e94 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -195,5 +195,5 @@ add_executable(colobot ${SOURCES})
target_link_libraries(colobot ${LIBS})
-install(TARGETS colobot RUNTIME DESTINATION games/)
-set_target_properties(colobot PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${COLOBOT_LIB_DIR}")
+install(TARGETS colobot RUNTIME DESTINATION ${COLOBOT_INSTALL_BIN_DIR})
+set_target_properties(colobot PROPERTIES INSTALL_RPATH ${COLOBOT_INSTALL_LIB_DIR})
diff --git a/src/app/app.cpp b/src/app/app.cpp
index 04f8d2a..3073d77 100644
--- a/src/app/app.cpp
+++ b/src/app/app.cpp
@@ -30,12 +30,11 @@
#include "object/robotmain.h"
+#include <boost/filesystem.hpp>
#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
-#include <fstream>
-
#include <stdlib.h>
#include <libintl.h>
#include <unistd.h>
@@ -131,7 +130,7 @@ CApplication::CApplication()
m_mouseButtonsState = 0;
m_trackedKeys = 0;
- m_dataPath = CBOT_DEFAULT_DATADIR;
+ m_dataPath = COLOBOT_DEFAULT_DATADIR;
m_language = LANGUAGE_ENV;
@@ -274,13 +273,10 @@ bool CApplication::Create()
{
GetLogger()->Info("Creating CApplication\n");
- // I know, a primitive way to check for dir, but works
- std::string readmePath = m_dataPath + "/README.txt";
- std::ifstream testReadme;
- testReadme.open(readmePath.c_str(), std::ios_base::in);
- if (!testReadme.good())
+ boost::filesystem::path dataPath(m_dataPath);
+ if (! (boost::filesystem::exists(dataPath) && boost::filesystem::is_directory(dataPath)) )
{
- GetLogger()->Error("Could not open test file in data dir: '%s'\n", readmePath.c_str());
+ GetLogger()->Error("Data directory '%s' doesn't exist or is not a directory\n", m_dataPath.c_str());
m_errorMessage = std::string("Could not read from data directory:\n") +
std::string("'") + m_dataPath + std::string("'\n") +
std::string("Please check your installation, or supply a valid data directory by -datadir option.");
@@ -322,7 +318,7 @@ bool CApplication::Create()
setlocale(LC_ALL, "");
GetLogger()->Debug("Set locale to '%s'\n", locale.c_str());
- bindtextdomain("colobot", CBOT_I18N_DIR);
+ bindtextdomain("colobot", COLOBOT_I18N_DIR);
bind_textdomain_codeset("colobot", "UTF-8");
textdomain("colobot");
diff --git a/src/common/config.h.cmake b/src/common/config.h.cmake
index 23b6de8..9b30720 100644
--- a/src/common/config.h.cmake
+++ b/src/common/config.h.cmake
@@ -8,5 +8,5 @@
#cmakedefine USE_GLEW @USE_GLEW@
#cmakedefine GLEW_STATIC
-#define CBOT_DEFAULT_DATADIR "@COLOBOT_DATA_DIR@"
-#define CBOT_I18N_DIR "@CMAKE_INSTALL_PREFIX@/share/locale/"
+#define COLOBOT_DEFAULT_DATADIR "@COLOBOT_INSTALL_DATA_DIR@"
+#define COLOBOT_I18N_DIR "@COLOBOT_INSTALL_I18N_DIR@"
diff --git a/src/common/global.h b/src/common/global.h
index 2d57ee0..0b2d8ec 100644
--- a/src/common/global.h
+++ b/src/common/global.h
@@ -181,7 +181,6 @@ enum DataDir
DIR_AI, //! < ai scripts
DIR_FONT, //! < fonts
DIR_HELP, //! < help files
- DIR_I18N, //! < translations
DIR_ICON, //! < icons & images
DIR_LEVEL, //! < levels
DIR_MODEL, //! < models
diff --git a/src/common/test/CMakeLists.txt b/src/common/test/CMakeLists.txt
index 08efdb3..26a31c9 100644
--- a/src/common/test/CMakeLists.txt
+++ b/src/common/test/CMakeLists.txt
@@ -1,7 +1,10 @@
cmake_minimum_required(VERSION 2.8)
-set(CMAKE_BUILD_TYPE debug)
-set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall -Wold-style-cast -std=gnu++0x")
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE debug)
+endif(NOT CMAKE_BUILD_TYPE)
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wold-style-cast -std=gnu++0x")
+set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
include_directories(
.
diff --git a/src/graphics/engine/test/CMakeLists.txt b/src/graphics/engine/test/CMakeLists.txt
index 775abe5..46509f4 100644
--- a/src/graphics/engine/test/CMakeLists.txt
+++ b/src/graphics/engine/test/CMakeLists.txt
@@ -1,7 +1,10 @@
cmake_minimum_required(VERSION 2.8)
-set(CMAKE_BUILD_TYPE debug)
-set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall -Wold-style-cast -std=gnu++0x")
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE debug)
+endif(NOT CMAKE_BUILD_TYPE)
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wold-style-cast -std=gnu++0x")
+set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
set(MODELFILE_TEST_SOURCES
modelfile_test.cpp
diff --git a/src/graphics/opengl/test/CMakeLists.txt b/src/graphics/opengl/test/CMakeLists.txt
index be33ac6..154fec8 100644
--- a/src/graphics/opengl/test/CMakeLists.txt
+++ b/src/graphics/opengl/test/CMakeLists.txt
@@ -5,8 +5,11 @@ find_package(SDL REQUIRED)
find_package(SDL_image REQUIRED)
find_package(PNG REQUIRED)
-set(CMAKE_BUILD_TYPE debug)
-set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -O0 -Wold-style-cast -std=gnu++0x")
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE debug)
+endif(NOT CMAKE_BUILD_TYPE)
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wold-style-cast -std=gnu++0x")
+set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
set(ADD_LIBS "")
diff --git a/src/math/test/CMakeLists.txt b/src/math/test/CMakeLists.txt
index 5bc9027..dae4018 100644
--- a/src/math/test/CMakeLists.txt
+++ b/src/math/test/CMakeLists.txt
@@ -1,7 +1,10 @@
cmake_minimum_required(VERSION 2.8)
-set(CMAKE_BUILD_TYPE debug)
-set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall -Wold-style-cast -std=gnu++0x")
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE debug)
+endif(NOT CMAKE_BUILD_TYPE)
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wold-style-cast -std=gnu++0x")
+set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
include_directories(
.
diff --git a/src/plugins/test/CMakeLists.txt b/src/plugins/test/CMakeLists.txt
index a68de2c..31b4163 100644
--- a/src/plugins/test/CMakeLists.txt
+++ b/src/plugins/test/CMakeLists.txt
@@ -1,7 +1,10 @@
cmake_minimum_required(VERSION 2.8)
-set(CMAKE_BUILD_TYPE debug)
-set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -O0 -std=c++11 -rdynamic")
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE debug)
+endif(NOT CMAKE_BUILD_TYPE)
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -rdynamic")
+set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
add_executable(manager_test manager_test.cpp ../../common/logger.cpp ../../common/profile.cpp ../../common/iman.cpp ../pluginmanager.cpp ../pluginloader.cpp)
diff --git a/src/po/CMakeLists.txt b/src/po/CMakeLists.txt
index 02a4d37..3b26571 100644
--- a/src/po/CMakeLists.txt
+++ b/src/po/CMakeLists.txt
@@ -1,13 +1,10 @@
cmake_minimum_required(VERSION 2.8)
-SET(_potFile colobot.pot)
+set(_potFile colobot.pot)
-# TODO: Use a finder
-SET(XGETTEXT_CMD /usr/bin/xgettext)
+find_program(XGETTEXT_CMD xgettext)
-find_package(Gettext REQUIRED)
-
-ADD_CUSTOM_COMMAND(OUTPUT ${_potFile}
+add_custom_command(OUTPUT ${_potFile}
COMMAND ${XGETTEXT_CMD} ../app/app.cpp --output=${_potFile}
COMMAND ${XGETTEXT_CMD} ../common/restext_strings.c --output=${_potFile} --join-existing --extract-all --no-location
@@ -15,10 +12,8 @@ ADD_CUSTOM_COMMAND(OUTPUT ${_potFile}
COMMENT "Extract translatable messages to ${_potFile}"
)
-ADD_CUSTOM_TARGET(_${potFile} ${_all}
-DEPENDS ${_potFile}
-)
+add_custom_target(_${potFile} ${_all} DEPENDS ${_potFile})
-FILE(GLOB _poFiles *.po)
+file(GLOB _poFiles *.po)
-GETTEXT_CREATE_TRANSLATIONS(${_potFile} ALL ${_poFiles})
+gettext_create_translations(${_potFile} ALL ${_poFiles})
diff --git a/src/sound/plugins/oalsound/CMakeLists.txt b/src/sound/plugins/oalsound/CMakeLists.txt
index 0bc9482..bb7e9ff 100644
--- a/src/sound/plugins/oalsound/CMakeLists.txt
+++ b/src/sound/plugins/oalsound/CMakeLists.txt
@@ -6,7 +6,8 @@ set(SOURCES
channel.cpp
)
-SET (CMAKE_CXX_FLAGS "-Wall -g -std=c++0x -fPIC")
+SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++0x -fPIC")
+SET (CMAKE_CXX_FLAGS_DEBUG "-g")
include(FindPkgConfig)
include(FindOpenAL)
diff --git a/src/sound/plugins/oalsound/test/CMakeLists.txt b/src/sound/plugins/oalsound/test/CMakeLists.txt
index f7b165c..dd208ea 100644
--- a/src/sound/plugins/oalsound/test/CMakeLists.txt
+++ b/src/sound/plugins/oalsound/test/CMakeLists.txt
@@ -1,7 +1,10 @@
cmake_minimum_required(VERSION 2.8)
-set(CMAKE_BUILD_TYPE debug)
-set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -O0 -std=c++11 -rdynamic")
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE debug)
+endif(NOT CMAKE_BUILD_TYPE)
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -rdynamic")
+set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
add_executable(plugin_test plugin_test.cpp ../../../../common/iman.cpp ../../../../common/logger.cpp ../../../../plugins/pluginloader.cpp)
diff --git a/src/ui/test/CMakeLists.txt b/src/ui/test/CMakeLists.txt
index 7562a04..e411067 100644
--- a/src/ui/test/CMakeLists.txt
+++ b/src/ui/test/CMakeLists.txt
@@ -1,7 +1,10 @@
cmake_minimum_required(VERSION 2.8)
-set(CMAKE_BUILD_TYPE debug)
-set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall -Wold-style-cast -std=gnu++0x")
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE debug)
+endif(NOT CMAKE_BUILD_TYPE)
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wold-style-cast -std=gnu++0x")
+set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
include_directories(
.