aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2012-03-25 04:03:51 +0300
committerPerttu Ahola <celeron55@gmail.com>2012-03-25 04:03:51 +0300
commitc8997e48c070b8fcc460f01ba90896ad3afbf8b5 (patch)
treee31c5e665fabb23bdfb66c353882180ba61ccb9a /src
parent77621568fd25c418f74518761fcdbd05f8c214d1 (diff)
downloadminetest-c8997e48c070b8fcc460f01ba90896ad3afbf8b5.tar.gz
minetest-c8997e48c070b8fcc460f01ba90896ad3afbf8b5.tar.bz2
minetest-c8997e48c070b8fcc460f01ba90896ad3afbf8b5.zip
Build configuration fixes/improvements on Windows
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt83
-rw-r--r--src/cmake_config.h.in4
-rw-r--r--src/config.h6
3 files changed, 57 insertions, 36 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 4807e871c..fd0650383 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -5,13 +5,22 @@ if(RUN_IN_PLACE)
add_definitions ( -DRUN_IN_PLACE )
endif(RUN_IN_PLACE)
+# Set some random things default to not being visible in the GUI
+mark_as_advanced(EXECUTABLE_OUTPUT_PATH LIBRARY_OUTPUT_PATH)
+mark_as_advanced(JTHREAD_INCLUDE_DIR JTHREAD_LIBRARY)
+mark_as_advanced(SQLITE3_INCLUDE_DIR SQLITE3_LIBRARY)
+
# user-visible option to enable/disable gettext usage
-OPTION(ENABLE_GETTEXT "Use GetText for internationalization" ON)
+OPTION(ENABLE_GETTEXT "Use GetText for internationalization" 0)
# this is only set to 1 if gettext is enabled _and_ available
set(USE_GETTEXT 0)
-find_package(GettextLib)
+if(ENABLE_GETTEXT)
+ find_package(GettextLib)
+else()
+ MARK_AS_ADVANCED(GETTEXT_ICONV_DLL GETTEXT_INCLUDE_DIR GETTEXT_LIBRARY GETTEXT_MSGFMT)
+endif()
if(GETTEXT_FOUND AND ENABLE_GETTEXT)
message(STATUS "gettext include path: ${GETTEXT_INCLUDE_DIR}")
@@ -29,36 +38,48 @@ else(GETTEXT_FOUND AND ENABLE_GETTEXT)
message(STATUS "GetText disabled")
endif(GETTEXT_FOUND AND ENABLE_GETTEXT)
-# user visible option to enable/disable audio
-OPTION(ENABLE_AUDIO "Enable audio" ON)
+# user visible option to enable/disable sound
+OPTION(ENABLE_SOUND "Enable sound" ON)
-# this is only set to 1 if audio is enabled _and_ available
-set(USE_AUDIO 0)
+# this is only set to 1 if sound is enabled _and_ available
+set(USE_SOUND 0)
+set(SOUND_PROBLEM 0)
-if(ENABLE_AUDIO)
+if(ENABLE_SOUND)
# Sound libraries
find_package(OpenAL)
- if (OPENAL_FOUND)
- find_package(Vorbis)
- if (VORBIS_FOUND)
- set(USE_AUDIO 1)
- set(audio_SRCS sound_openal.cpp)
- set(AUDIO_INCLUDE_DIRS
- ${OPENAL_INCLUDE_DIR}
- ${VORBIS_INCLUDE_DIR}
- )
- set(AUDIO_LIBRARIES
- ${OPENAL_LIBRARY}
- ${VORBIS_LIBRARIES}
- )
- message(STATUS "Sound enabled")
- else(VORBIS_FOUND)
- message(FATAL_ERROR "Sound enabled, but Vorbis libraries not found!")
- endif(VORBIS_FOUND)
- else(OPENAL_FOUND)
- message(FATAL_ERROR "Sound enabled, but OpenAL not found!")
- endif(OPENAL_FOUND)
-endif(ENABLE_AUDIO)
+ find_package(Vorbis)
+ if(NOT OPENAL_FOUND)
+ message(STATUS "Sound enabled, but OpenAL not found!")
+ set(SOUND_PROBLEM 1)
+ MARK_AS_ADVANCED(CLEAR OPENAL_LIBRARY OPENAL_INCLUDE_DIR)
+ endif()
+ if(NOT VORBIS_FOUND)
+ message(STATUS "Sound enabled, but Vorbis libraries not found!")
+ set(SOUND_PROBLEM 1)
+ MARK_AS_ADVANCED(CLEAR OGG_INCLUDE_DIR VORBIS_INCLUDE_DIR OGG_LIBRARY VORBIS_LIBRARY VORBISFILE_LIBRARY)
+ endif()
+ if(OPENAL_FOUND AND VORBIS_FOUND)
+ set(USE_SOUND 1)
+ message(STATUS "Sound enabled")
+ endif()
+endif(ENABLE_SOUND)
+
+if(SOUND_PROBLEM)
+ message(FATAL_ERROR "Sound enabled, but cannot be used.\n"
+ "To continue, either fill in the required paths or disable sound.")
+endif()
+if(USE_SOUND)
+ set(sound_SRCS sound_openal.cpp)
+ set(SOUND_INCLUDE_DIRS
+ ${OPENAL_INCLUDE_DIR}
+ ${VORBIS_INCLUDE_DIR}
+ )
+ set(SOUND_LIBRARIES
+ ${OPENAL_LIBRARY}
+ ${VORBIS_LIBRARIES}
+ )
+endif()
if(NOT MSVC)
set(USE_GPROF 0 CACHE BOOL "Use -pg flag for g++")
@@ -191,7 +212,7 @@ endif()
# Client sources
set(minetest_SRCS
${common_SRCS}
- ${audio_SRCS}
+ ${sound_SRCS}
sky.cpp
clientmap.cpp
content_cso.cpp
@@ -235,7 +256,7 @@ include_directories(
${CMAKE_BUILD_TYPE}
${PNG_INCLUDE_DIR}
${GETTEXT_INCLUDE_DIR}
- ${AUDIO_INCLUDE_DIRS}
+ ${SOUND_INCLUDE_DIRS}
${JTHREAD_INCLUDE_DIR}
${SQLITE3_INCLUDE_DIR}
${LUA_INCLUDE_DIR}
@@ -255,7 +276,7 @@ if(BUILD_CLIENT)
${PNG_LIBRARIES}
${X11_LIBRARIES}
${GETTEXT_LIBRARY}
- ${AUDIO_LIBRARIES}
+ ${SOUND_LIBRARIES}
${JTHREAD_LIBRARY}
${SQLITE3_LIBRARY}
${LUA_LIBRARY}
diff --git a/src/cmake_config.h.in b/src/cmake_config.h.in
index 2205e14a2..054cca165 100644
--- a/src/cmake_config.h.in
+++ b/src/cmake_config.h.in
@@ -12,8 +12,8 @@
#define CMAKE_BUILD_TYPE "Debug"
#endif
#define CMAKE_USE_GETTEXT @USE_GETTEXT@
-#define CMAKE_USE_AUDIO @USE_AUDIO@
-#define CMAKE_BUILD_INFO "VER=@VERSION_STRING@ BUILD_TYPE="CMAKE_BUILD_TYPE" RUN_IN_PLACE=@RUN_IN_PLACE@ USE_GETTEXT=@USE_GETTEXT@ USE_AUDIO=@USE_AUDIO@ INSTALL_PREFIX=@CMAKE_INSTALL_PREFIX@"
+#define CMAKE_USE_SOUND @USE_SOUND@
+#define CMAKE_BUILD_INFO "VER=@VERSION_STRING@ BUILD_TYPE="CMAKE_BUILD_TYPE" RUN_IN_PLACE=@RUN_IN_PLACE@ USE_GETTEXT=@USE_GETTEXT@ USE_SOUND=@USE_SOUND@ INSTALL_PREFIX=@CMAKE_INSTALL_PREFIX@"
#endif
diff --git a/src/config.h b/src/config.h
index a4a1d351a..233d74717 100644
--- a/src/config.h
+++ b/src/config.h
@@ -10,7 +10,7 @@
#define VERSION_STRING "unknown"
#define BUILD_TYPE "unknown"
#define USE_GETTEXT 0
-#define USE_AUDIO 0
+#define USE_SOUND 0
#define BUILD_INFO "non-cmake"
#ifdef USE_CMAKE_CONFIG_H
@@ -23,8 +23,8 @@
#define BUILD_INFO CMAKE_BUILD_INFO
#undef USE_GETTEXT
#define USE_GETTEXT CMAKE_USE_GETTEXT
- #undef USE_AUDIO
- #define USE_AUDIO CMAKE_USE_AUDIO
+ #undef USE_SOUND
+ #define USE_SOUND CMAKE_USE_SOUND
#undef BUILD_INFO
#define BUILD_INFO CMAKE_BUILD_INFO
#endif