summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPiotr Dziwinski <piotrdz@gmail.com>2013-03-22 18:19:53 +0100
committerPiotr Dziwinski <piotrdz@gmail.com>2013-03-22 19:17:08 +0100
commit4a30800cf16d403a7c25d78388e2822aa396ac86 (patch)
tree772753228bab7b0b4ba47e89580ed86de0ca098f /src
parent1406464f0ce0b804298e2ee034bdd8bc7856e0dc (diff)
downloadcolobot-4a30800cf16d403a7c25d78388e2822aa396ac86.tar.gz
colobot-4a30800cf16d403a7c25d78388e2822aa396ac86.tar.bz2
colobot-4a30800cf16d403a7c25d78388e2822aa396ac86.zip
Fixes for compiling on MSYS
* fixed SDL_main() and putenv() issues * disabled desktop subdir for MSYS * disabled building CBot_console for now
Diffstat (limited to 'src')
-rw-r--r--src/CBot/CMakeLists.txt5
-rw-r--r--src/CMakeLists.txt20
-rw-r--r--src/app/app.cpp4
-rw-r--r--src/app/main.cpp7
-rw-r--r--src/app/system_other.h2
-rw-r--r--src/common/config.h.cmake12
-rw-r--r--src/common/image.cpp4
-rw-r--r--src/common/key.h2
-rw-r--r--src/common/restext.cpp2
-rw-r--r--src/desktop/CMakeLists.txt2
-rw-r--r--src/graphics/engine/terrain.cpp2
-rw-r--r--src/graphics/engine/text.cpp4
-rw-r--r--src/graphics/opengl/gldevice.cpp2
-rw-r--r--src/tools/CMakeLists.txt2
14 files changed, 42 insertions, 28 deletions
diff --git a/src/CBot/CMakeLists.txt b/src/CBot/CMakeLists.txt
index daf08c6..fecd18e 100644
--- a/src/CBot/CMakeLists.txt
+++ b/src/CBot/CMakeLists.txt
@@ -16,5 +16,8 @@ if(${CBOT_STATIC})
add_library(CBot STATIC ${SOURCES})
else()
add_library(CBot SHARED ${SOURCES})
- install(TARGETS CBot LIBRARY DESTINATION ${COLOBOT_INSTALL_LIB_DIR})
+ install(TARGETS CBot LIBRARY
+ DESTINATION ${COLOBOT_INSTALL_LIB_DIR}
+ ARCHIVE DESTINATION ${COLOBOT_INSTALL_LIB_DIR}
+ RUNTIME DESTINATION ${COLOBOT_INSTALL_BIN_DIR})
endif()
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index cc181f2..3d6908d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -12,22 +12,18 @@ add_subdirectory(tools)
add_subdirectory(po)
-add_subdirectory(desktop)
+if(${DESKTOP})
+ add_subdirectory(desktop)
+endif()
# Optional libraries
set(OPTIONAL_LIBS "")
+set(OPTIONAL_INCLUDES "")
if (${OPENAL_SOUND})
- if (${PLATFORM_WINDOWS})
- set(OPTIONAL_LIBS
- OpenAL32
- )
- else()
- set(OPTIONAL_LIBS
- openal
- )
- endif()
+ set(OPTIONAL_LIBS ${OPENAL_LIBRARY})
+ set(OPTIONAL_INCLUDES ${OPENAL_INCLUDE_DIR})
endif()
# Additional libraries per platform
@@ -196,8 +192,8 @@ ${OPENGL_LIBRARY}
${PNG_LIBRARIES}
${GLEW_LIBRARY}
${Boost_LIBRARIES}
-${OPTIONAL_LIBS}
${LIBSNDFILE_LIBRARY}
+${OPTIONAL_LIBS}
${PLATFORM_LIBS}
)
@@ -217,8 +213,8 @@ ${SDLTTF_INCLUDE_DIR}
${PNG_INCLUDE_DIRS}
${GLEW_INCLUDE_PATH}
${Boost_INCLUDE_DIRS}
-${OPTIONAL_INCLUDE_DIRS}
${LIBSNDFILE_INCLUDE_DIR}
+${OPTIONAL_INCLUDE_DIRS}
)
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/CBot)
diff --git a/src/app/app.cpp b/src/app/app.cpp
index cb1ac34..e84091b 100644
--- a/src/app/app.cpp
+++ b/src/app/app.cpp
@@ -33,8 +33,8 @@
#include <boost/filesystem.hpp>
-#include <SDL/SDL.h>
-#include <SDL/SDL_image.h>
+#include <SDL.h>
+#include <SDL_image.h>
#include <stdlib.h>
#include <libintl.h>
diff --git a/src/app/main.cpp b/src/app/main.cpp
index e621065..0622370 100644
--- a/src/app/main.cpp
+++ b/src/app/main.cpp
@@ -23,6 +23,7 @@
#include "app/app.h"
#include "app/system.h"
+#include "common/config.h"
#include "common/logger.h"
#include "common/misc.h"
#include "common/restext.h"
@@ -70,7 +71,10 @@ The current layout is the following:
//! Entry point to the program
-int main(int argc, char *argv[])
+extern "C"
+{
+
+int SDL_MAIN_FUNC(int argc, char *argv[])
{
CLogger logger; // Create the logger
@@ -111,3 +115,4 @@ int main(int argc, char *argv[])
return code;
}
+} // extern "C"
diff --git a/src/app/system_other.h b/src/app/system_other.h
index 6fb4b86..aee3536 100644
--- a/src/app/system_other.h
+++ b/src/app/system_other.h
@@ -22,7 +22,7 @@
#include "app/system.h"
-#include <SDL/SDL.h>
+#include <SDL.h>
#include <iostream>
diff --git a/src/common/config.h.cmake b/src/common/config.h.cmake
index 1595e09..d5a03b4 100644
--- a/src/common/config.h.cmake
+++ b/src/common/config.h.cmake
@@ -7,11 +7,19 @@
#cmakedefine GLEW_STATIC
+#cmakedefine OPENAL_SOUND
+
+#cmakedefine USE_SDL_MAIN @USE_SDL_MAIN@
+
+#ifdef USE_SDL_MAIN
+#define SDL_MAIN_FUNC SDL_main
+#else
+#define SDL_MAIN_FUNC main
+#endif
+
#define COLOBOT_VERSION "@COLOBOT_VERSION_FULL@"
#define COLOBOT_CODENAME "@COLOBOT_VERSION_CODENAME@"
#define COLOBOT_FULLNAME "Colobot @COLOBOT_VERSION_CODENAME@"
#define COLOBOT_DEFAULT_DATADIR "@COLOBOT_INSTALL_DATA_DIR@"
#define COLOBOT_I18N_DIR "@COLOBOT_INSTALL_I18N_DIR@"
-
-#cmakedefine OPENAL_SOUND
diff --git a/src/common/image.cpp b/src/common/image.cpp
index be5711d..db14797 100644
--- a/src/common/image.cpp
+++ b/src/common/image.cpp
@@ -22,8 +22,8 @@
#include <string.h>
#include <assert.h>
-#include <SDL/SDL.h>
-#include <SDL/SDL_image.h>
+#include <SDL.h>
+#include <SDL_image.h>
#include <png.h>
diff --git a/src/common/key.h b/src/common/key.h
index 196f66d..84ee618 100644
--- a/src/common/key.h
+++ b/src/common/key.h
@@ -22,7 +22,7 @@
#pragma once
-#include "SDL/SDL_keysym.h"
+#include <SDL_keysym.h>
/* Key definitions are specially defined here so that it is clear in other parts of the code
that these are used. It is to avoid having SDL-related enum values or #defines lying around
diff --git a/src/common/restext.cpp b/src/common/restext.cpp
index 4768aed..a6c33a3 100644
--- a/src/common/restext.cpp
+++ b/src/common/restext.cpp
@@ -30,7 +30,7 @@
#include "object/robotmain.h"
#include <libintl.h>
-#include <SDL/SDL_keyboard.h>
+#include <SDL_keyboard.h>
const char* stringsText[RT_MAX] = { nullptr };
const char* stringsEvent[EVENT_STD_MAX] = { nullptr };
diff --git a/src/desktop/CMakeLists.txt b/src/desktop/CMakeLists.txt
index ce4f48d..9a00dd4 100644
--- a/src/desktop/CMakeLists.txt
+++ b/src/desktop/CMakeLists.txt
@@ -39,7 +39,7 @@ endif()
# Create manpage from pod-formatted file
find_program(POD2MAN pod2man)
-if(POD2MAN)
+if(POD2MAN AND (NOT MSYS))
set(COLOBOT_MANPAGE_SECTION 6)
macro(podman)
diff --git a/src/graphics/engine/terrain.cpp b/src/graphics/engine/terrain.cpp
index 8f7ad26..c2a7855 100644
--- a/src/graphics/engine/terrain.cpp
+++ b/src/graphics/engine/terrain.cpp
@@ -30,7 +30,7 @@
#include <sstream>
-#include <SDL/SDL.h>
+#include <SDL.h>
// Graphics module namespace
diff --git a/src/graphics/engine/text.cpp b/src/graphics/engine/text.cpp
index 9dea129..308c813 100644
--- a/src/graphics/engine/text.cpp
+++ b/src/graphics/engine/text.cpp
@@ -26,8 +26,8 @@
#include "math/func.h"
-#include <SDL/SDL.h>
-#include <SDL/SDL_ttf.h>
+#include <SDL.h>
+#include <SDL_ttf.h>
// Graphics module namespace
diff --git a/src/graphics/opengl/gldevice.cpp b/src/graphics/opengl/gldevice.cpp
index beeb85e..df64e34 100644
--- a/src/graphics/opengl/gldevice.cpp
+++ b/src/graphics/opengl/gldevice.cpp
@@ -27,7 +27,7 @@
// Using GLEW so only glew.h is needed
#include <GL/glew.h>
-#include <SDL/SDL.h>
+#include <SDL.h>
#include <cassert>
diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt
index 3653357..0be2bd5 100644
--- a/src/tools/CMakeLists.txt
+++ b/src/tools/CMakeLists.txt
@@ -7,6 +7,8 @@ convert_model.cpp
include_directories(. ..)
+include_directories(SYSTEM ${SDL_INCLUDE_DIR})
+
add_definitions(-DMODELFILE_NO_ENGINE)
add_executable(convert_model ${CONVERT_MODEL_SOURCES})