]> git.jsancho.org Git - lugaru.git/blobdiff - CMakeLists.txt
Dialogs: Fix long lines overflowing the box
[lugaru.git] / CMakeLists.txt
index d1e62951cc47f74ad3398e9d2acdda68418b724f..ac908f06e863fa15900fceb596bdde5ca3cfca1b 100644 (file)
@@ -1,6 +1,6 @@
 project(lugaru)
 
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION 3.0)
 cmake_policy(SET CMP0004 OLD)
 
 include(FindPkgConfig)
@@ -16,14 +16,63 @@ if(UNIX AND NOT APPLE)
 endif()
 
 
+### Version
+
+# Version for the current (stable) or next (development) release
+set(LUGARU_VERSION_MAJOR 1)
+set(LUGARU_VERSION_MINOR 2)
+set(LUGARU_VERSION_PATCH 0)
+
+# MAJOR.MINOR, or MAJOR.MINOR.PATCH if PATCH != 0
+set(LUGARU_VERSION_NUMBER "${LUGARU_VERSION_MAJOR}.${LUGARU_VERSION_MINOR}")
+if(LUGARU_VERSION_PATCH)
+    set(LUGARU_VERSION_NUMBER "${LUGARU_VERSION_NUMBER}.${LUGARU_VERSION_PATCH}")
+endif()
+
+# Set to "" for stable (tagged) builds, "-dev" for dev builds
+set(LUGARU_VERSION_SUFFIX "-dev")  # development
+#set(LUGARU_VERSION_SUFFIX "")  # stable
+
+# Set to 7-char git commit hash if available, otherwise "".
+# On stable (tagged) builds, this is ignored.
+set(LUGARU_VERSION_HASH "")
+if(LUGARU_VERSION_SUFFIX STREQUAL "-dev" AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
+    find_package(Git)
+    if(GIT_FOUND)
+        execute_process(
+            COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
+            WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
+            OUTPUT_VARIABLE "LUGARU_VERSION_HASH"
+            ERROR_QUIET
+            OUTPUT_STRIP_TRAILING_WHITESPACE)
+        message(STATUS "Git commit hash: ${LUGARU_VERSION_HASH}")
+    endif()
+endif()
+
+set(LUGARU_VERSION_RELEASE "" CACHE STRING "Optional release string, e.g. for distro packages release number")
+
+# Final string built from the above constants, following the scheme:
+# MAJOR.MINOR[.PATCH][-dev] [(git HASH)] [[RELEASE]]
+set(LUGARU_VERSION_STRING "${LUGARU_VERSION_NUMBER}${LUGARU_VERSION_SUFFIX}")
+if(NOT LUGARU_VERSION_HASH STREQUAL "")
+    set(LUGARU_VERSION_STRING "${LUGARU_VERSION_STRING} (git ${LUGARU_VERSION_HASH})")
+endif()
+if(NOT LUGARU_VERSION_RELEASE STREQUAL "")
+    set(LUGARU_VERSION_STRING "${LUGARU_VERSION_STRING} [${LUGARU_VERSION_RELEASE}]")
+endif()
+
+message(STATUS "Version string: ${LUGARU_VERSION_STRING}")
+configure_file(${SRCDIR}/Version.hpp.in ${SRCDIR}/Version.hpp ESCAPE_QUOTES @ONLY)
+
+
 ### CMake config
 
 if(NOT CMAKE_BUILD_TYPE)
     set(CMAKE_BUILD_TYPE RelWithDebInfo)
 endif(NOT CMAKE_BUILD_TYPE)
-message("CMake build type: ${CMAKE_BUILD_TYPE}")
+message(STATUS "CMake build type: ${CMAKE_BUILD_TYPE}")
 
-set(CMAKE_CXX_FLAGS "-Wall -Wno-parentheses -pedantic --std=c++11 ${CMAKE_CXX_FLAGS}")
+set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-parentheses -pedantic --std=gnu++11 ${CMAKE_CXX_FLAGS}")
 
 if(APPLE)
     set(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Build architectures for OSX")
@@ -54,6 +103,7 @@ set(LUGARU_SRCS
     ${SRCDIR}/Environment/Lights.cpp
     ${SRCDIR}/Environment/Skybox.cpp
     ${SRCDIR}/Environment/Terrain.cpp
+    ${SRCDIR}/Graphic/Decal.cpp
     ${SRCDIR}/Graphic/Models.cpp
     ${SRCDIR}/Graphic/Sprite.cpp
     ${SRCDIR}/Graphic/Stereo.cpp
@@ -64,9 +114,9 @@ set(LUGARU_SRCS
     ${SRCDIR}/Level/Dialog.cpp
     ${SRCDIR}/Level/Hotspot.cpp
     ${SRCDIR}/Math/Frustum.cpp
-    ${SRCDIR}/Math/Quaternions.cpp
+    ${SRCDIR}/Math/XYZ.cpp
     ${SRCDIR}/Menu/Menu.cpp
-    ${SRCDIR}/Objects/Objects.cpp
+    ${SRCDIR}/Objects/Object.cpp
     ${SRCDIR}/Objects/Person.cpp
     ${SRCDIR}/Objects/Weapons.cpp
     ${SRCDIR}/User/Account.cpp
@@ -82,6 +132,7 @@ set(LUGARU_SRCS
     ${SRCDIR}/GameInitDispose.cpp
     ${SRCDIR}/GameTick.cpp
     ${SRCDIR}/Globals.cpp
+    ${SRCDIR}/Tutorial.cpp
 
 )
 
@@ -96,6 +147,7 @@ set(LUGARU_H
     ${SRCDIR}/Environment/Lights.hpp
     ${SRCDIR}/Environment/Skybox.hpp
     ${SRCDIR}/Environment/Terrain.hpp
+    ${SRCDIR}/Graphic/Decal.hpp
     ${SRCDIR}/Graphic/gamegl.hpp
     ${SRCDIR}/Graphic/Models.hpp
     ${SRCDIR}/Graphic/Sprite.hpp
@@ -106,11 +158,10 @@ set(LUGARU_H
     ${SRCDIR}/Level/Dialog.hpp
     ${SRCDIR}/Level/Hotspot.hpp
     ${SRCDIR}/Math/Frustum.hpp
-    ${SRCDIR}/Math/PhysicsMath.hpp
-    ${SRCDIR}/Math/Quaternions.hpp
+    ${SRCDIR}/Math/XYZ.hpp
     ${SRCDIR}/Math/Random.hpp
     ${SRCDIR}/Menu/Menu.hpp
-    ${SRCDIR}/Objects/Objects.hpp
+    ${SRCDIR}/Objects/Object.hpp
     ${SRCDIR}/Objects/Person.hpp
     ${SRCDIR}/Objects/Weapons.hpp
     ${SRCDIR}/Thirdparty/optionparser.h
@@ -122,6 +173,7 @@ set(LUGARU_H
     ${SRCDIR}/Utils/Input.hpp
     ${SRCDIR}/Utils/private.h
     ${SRCDIR}/Game.hpp
+    ${SRCDIR}/Tutorial.hpp
 
 )
 
@@ -173,7 +225,13 @@ else(WIN32)
     find_package(OpenAL REQUIRED)
 endif(WIN32)
 
-find_package(sdl2 REQUIRED)
+# macOS has problems with using pkgconfig to find SDL2
+if(APPLE)
+    find_package(sdl2 REQUIRED)
+else(APPLE)
+    pkg_check_modules(SDL2 sdl2 REQUIRED)
+endif(APPLE)
+
 find_package(PNG REQUIRED)
 find_package(JPEG REQUIRED)
 find_package(ZLIB REQUIRED)
@@ -230,7 +288,7 @@ endif(LINUX)
 if(APPLE)
     set(LUGARU_APP_ROOT ${CMAKE_INSTALL_PREFIX}/Lugaru.app)
     set(LUGARU_BINDIR ${LUGARU_APP_ROOT}/Contents/MacOS)
-    set(LUGARU_RESDIR ${LUGARU_APP_ROOT}/Resources)
+    set(LUGARU_RESDIR ${LUGARU_APP_ROOT}/Contents/Resources)
 endif(APPLE)
 
 # Actual installation instructions
@@ -291,7 +349,10 @@ endif(APPLE)
 install(FILES ${CMAKE_SOURCE_DIR}/AUTHORS
               ${CMAKE_SOURCE_DIR}/CONTENT-LICENSE.txt
               ${CMAKE_SOURCE_DIR}/COPYING.txt
-              ${CMAKE_SOURCE_DIR}/DEVTOOLS.txt
               ${CMAKE_SOURCE_DIR}/README.md
               ${CMAKE_SOURCE_DIR}/RELEASE-NOTES.md
+              ${CMAKE_SOURCE_DIR}/Docs/DEVTOOLS.txt
+              ${CMAKE_SOURCE_DIR}/Docs/README.Empire.txt
+              ${CMAKE_SOURCE_DIR}/Docs/README.SevenTasks.txt
+              ${CMAKE_SOURCE_DIR}/Docs/README.Temple.txt
         DESTINATION ${LUGARU_DOCDIR})