]> git.jsancho.org Git - lugaru.git/blobdiff - CMakeLists.txt
CMake: Fix SDL2 detection for macOS
[lugaru.git] / CMakeLists.txt
index ddcbd7004c5c6c3f88ea2c4ac47df3c8778d395b..0feb4b9cc98130dc2986e9b1596457988d1a2e2b 100644 (file)
@@ -1,15 +1,15 @@
 project(lugaru)
 
 project(lugaru)
 
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION 3.0)
 cmake_policy(SET CMP0004 OLD)
 
 include(FindPkgConfig)
 include(GNUInstallDirs)
 
 cmake_policy(SET CMP0004 OLD)
 
 include(FindPkgConfig)
 include(GNUInstallDirs)
 
-set(SRCDIR "${CMAKE_CURRENT_SOURCE_DIR}/Source")
 
 
+### Helpers
 
 
-### Helper
+set(SRCDIR "${CMAKE_CURRENT_SOURCE_DIR}/Source")
 
 if(UNIX AND NOT APPLE)
     set(LINUX TRUE)
 
 if(UNIX AND NOT APPLE)
     set(LINUX TRUE)
@@ -18,13 +18,18 @@ endif()
 
 ### CMake config
 
 
 ### CMake config
 
+if(NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE RelWithDebInfo)
+endif(NOT CMAKE_BUILD_TYPE)
+message("CMake build type: ${CMAKE_BUILD_TYPE}")
+
 set(CMAKE_CXX_FLAGS "-Wall -Wno-parentheses -pedantic --std=c++11 ${CMAKE_CXX_FLAGS}")
 
 if(APPLE)
     set(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Build architectures for OSX")
 set(CMAKE_CXX_FLAGS "-Wall -Wno-parentheses -pedantic --std=c++11 ${CMAKE_CXX_FLAGS}")
 
 if(APPLE)
     set(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Build architectures for OSX")
-    set(CMAKE_OSX_DEPLOYMENT_TARGET "10.10" CACHE STRING
+    set(CMAKE_OSX_DEPLOYMENT_TARGET "10.11" CACHE STRING
         "Minimum OS X version to target for deployment (at runtime); newer APIs weak linked. Set to empty string for default value")
         "Minimum OS X version to target for deployment (at runtime); newer APIs weak linked. Set to empty string for default value")
-    set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.10.sdk" CACHE PATH
+    set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.11.sdk" CACHE PATH
         "The product will be built against the headers and libraries located inside the indicated SDK.")
 endif(APPLE)
 
         "The product will be built against the headers and libraries located inside the indicated SDK.")
 endif(APPLE)
 
@@ -32,7 +37,7 @@ if(LINUX)
     option(SYSTEM_INSTALL "Enable system-wide installation, with hardcoded data directory defined with CMAKE_INSTALL_DATADIR" OFF)
 endif(LINUX)
 
     option(SYSTEM_INSTALL "Enable system-wide installation, with hardcoded data directory defined with CMAKE_INSTALL_DATADIR" OFF)
 endif(LINUX)
 
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMake/Modules/")
 
 
 ### Sources
 
 
 ### Sources
@@ -40,74 +45,84 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
 set(LUGARU_SRCS
     ${SRCDIR}/main.cpp
     ${SRCDIR}/Animation/Animation.cpp
 set(LUGARU_SRCS
     ${SRCDIR}/main.cpp
     ${SRCDIR}/Animation/Animation.cpp
+    ${SRCDIR}/Animation/Joint.cpp
+    ${SRCDIR}/Animation/Muscle.cpp
     ${SRCDIR}/Animation/Skeleton.cpp
     ${SRCDIR}/Animation/Skeleton.cpp
-    ${SRCDIR}/Frustum.cpp
-    ${SRCDIR}/Account.cpp
-    ${SRCDIR}/ConsoleCmds.cpp
-    ${SRCDIR}/Dialog.cpp
+    ${SRCDIR}/Audio/openal_wrapper.cpp
+    ${SRCDIR}/Audio/Sounds.cpp
+    ${SRCDIR}/Devtools/ConsoleCmds.cpp
+    ${SRCDIR}/Environment/Lights.cpp
+    ${SRCDIR}/Environment/Skybox.cpp
+    ${SRCDIR}/Environment/Terrain.cpp
+    ${SRCDIR}/Graphic/Models.cpp
+    ${SRCDIR}/Graphic/Sprite.cpp
+    ${SRCDIR}/Graphic/Stereo.cpp
+    ${SRCDIR}/Graphic/Text.cpp
+    ${SRCDIR}/Graphic/Texture.cpp
+    ${SRCDIR}/Level/Awards.cpp
+    ${SRCDIR}/Level/Campaign.cpp
+    ${SRCDIR}/Level/Dialog.cpp
+    ${SRCDIR}/Level/Hotspot.cpp
+    ${SRCDIR}/Math/Frustum.cpp
+    ${SRCDIR}/Math/Quaternions.cpp
+    ${SRCDIR}/Menu/Menu.cpp
+    ${SRCDIR}/Objects/Objects.cpp
+    ${SRCDIR}/Objects/Person.cpp
+    ${SRCDIR}/Objects/Weapons.cpp
+    ${SRCDIR}/User/Account.cpp
+    ${SRCDIR}/User/Settings.cpp
+    ${SRCDIR}/Utils/Folders.cpp
+    ${SRCDIR}/Utils/ImageIO.cpp
+    ${SRCDIR}/Utils/Input.cpp
+    ${SRCDIR}/Utils/pack.c
+    ${SRCDIR}/Utils/private.c
+    ${SRCDIR}/Utils/unpack.c
     ${SRCDIR}/Game.cpp
     ${SRCDIR}/GameDraw.cpp
     ${SRCDIR}/GameInitDispose.cpp
     ${SRCDIR}/GameTick.cpp
     ${SRCDIR}/Globals.cpp
     ${SRCDIR}/Game.cpp
     ${SRCDIR}/GameDraw.cpp
     ${SRCDIR}/GameInitDispose.cpp
     ${SRCDIR}/GameTick.cpp
     ${SRCDIR}/Globals.cpp
-    ${SRCDIR}/Lights.cpp
-    ${SRCDIR}/Menu.cpp
-    ${SRCDIR}/Models.cpp
-    ${SRCDIR}/Objects.cpp
-    ${SRCDIR}/pack.c
-    ${SRCDIR}/Person.cpp
-    ${SRCDIR}/private.c
-    ${SRCDIR}/Quaternions.cpp
-    ${SRCDIR}/Skybox.cpp
-    ${SRCDIR}/Sprite.cpp
-    ${SRCDIR}/Terrain.cpp
-    ${SRCDIR}/Texture.cpp
-    ${SRCDIR}/Text.cpp
-    ${SRCDIR}/ImageIO.cpp
-    ${SRCDIR}/unpack.c
-    ${SRCDIR}/Weapons.cpp
-    ${SRCDIR}/openal_wrapper.cpp
-    ${SRCDIR}/Input.cpp
-    ${SRCDIR}/Settings.cpp
-    ${SRCDIR}/Stereo.cpp
-    ${SRCDIR}/Sounds.cpp
-    ${SRCDIR}/Awards.cpp
-    ${SRCDIR}/Utils/Folders.cpp
+
 )
 
 set(LUGARU_H
 )
 
 set(LUGARU_H
-    ${SRCDIR}/Animation/Animation.h
-    ${SRCDIR}/Animation/Skeleton.h
-    ${SRCDIR}/Frustum.h
-    ${SRCDIR}/Account.h
-    ${SRCDIR}/ConsoleCmds.h
-    ${SRCDIR}/Dialog.h
-    ${SRCDIR}/Game.h
-    ${SRCDIR}/Lights.h
-    ${SRCDIR}/Menu.h
-    ${SRCDIR}/Models.h
-    ${SRCDIR}/Objects.h
-    ${SRCDIR}/Person.h
-    ${SRCDIR}/PhysicsMath.h
-    ${SRCDIR}/Quaternions.h
-    ${SRCDIR}/Random.h
-    ${SRCDIR}/Skybox.h
-    ${SRCDIR}/Sprite.h
-    ${SRCDIR}/ImageIO.h
-    ${SRCDIR}/Terrain.h
-    ${SRCDIR}/Texture.h
-    ${SRCDIR}/Text.h
-    ${SRCDIR}/Weapons.h
-    ${SRCDIR}/Input.h
-    ${SRCDIR}/binio.h
-    ${SRCDIR}/openal_wrapper.h
-    ${SRCDIR}/optionparser.h
-    ${SRCDIR}/gamegl.h
-    ${SRCDIR}/private.h
-    ${SRCDIR}/Settings.h
-    ${SRCDIR}/Stereo.h
-    ${SRCDIR}/Sounds.h
-    ${SRCDIR}/Utils/Folders.h
+    ${SRCDIR}/Animation/Animation.hpp
+    ${SRCDIR}/Animation/Joint.hpp
+    ${SRCDIR}/Animation/Muscle.hpp
+    ${SRCDIR}/Animation/Skeleton.hpp
+    ${SRCDIR}/Audio/openal_wrapper.hpp
+    ${SRCDIR}/Audio/Sounds.hpp
+    ${SRCDIR}/Devtools/ConsoleCmds.hpp
+    ${SRCDIR}/Environment/Lights.hpp
+    ${SRCDIR}/Environment/Skybox.hpp
+    ${SRCDIR}/Environment/Terrain.hpp
+    ${SRCDIR}/Graphic/gamegl.hpp
+    ${SRCDIR}/Graphic/Models.hpp
+    ${SRCDIR}/Graphic/Sprite.hpp
+    ${SRCDIR}/Graphic/Stereo.hpp
+    ${SRCDIR}/Graphic/Text.hpp
+    ${SRCDIR}/Graphic/Texture.hpp
+    ${SRCDIR}/Level/Campaign.hpp
+    ${SRCDIR}/Level/Dialog.hpp
+    ${SRCDIR}/Level/Hotspot.hpp
+    ${SRCDIR}/Math/Frustum.hpp
+    ${SRCDIR}/Math/PhysicsMath.hpp
+    ${SRCDIR}/Math/Quaternions.hpp
+    ${SRCDIR}/Math/Random.hpp
+    ${SRCDIR}/Menu/Menu.hpp
+    ${SRCDIR}/Objects/Objects.hpp
+    ${SRCDIR}/Objects/Person.hpp
+    ${SRCDIR}/Objects/Weapons.hpp
+    ${SRCDIR}/Thirdparty/optionparser.h
+    ${SRCDIR}/User/Account.hpp
+    ${SRCDIR}/User/Settings.hpp
+    ${SRCDIR}/Utils/binio.h
+    ${SRCDIR}/Utils/Folders.hpp
+    ${SRCDIR}/Utils/ImageIO.hpp
+    ${SRCDIR}/Utils/Input.hpp
+    ${SRCDIR}/Utils/private.h
+    ${SRCDIR}/Game.hpp
+
 )
 
 if(UNIX)
 )
 
 if(UNIX)
@@ -117,7 +132,7 @@ if(UNIX)
     )
     set(LUGARU_H
         ${LUGARU_H}
     )
     set(LUGARU_H
         ${LUGARU_H}
-        ${SRCDIR}/MacCompatibility.h
+        ${SRCDIR}/MacCompatibility.hpp
     )
 endif(UNIX)
 
     )
 endif(UNIX)
 
@@ -137,8 +152,8 @@ if(WIN32)
 
     set(LUGARU_H
         ${LUGARU_H}
 
     set(LUGARU_H
         ${LUGARU_H}
-        ${SRCDIR}/WinDefs.h
-        ${SRCDIR}/win-res/resource.h)
+        ${SRCDIR}/WinDefs.hpp
+        ${SRCDIR}/win-res/resource.hpp)
 endif(WIN32)
 
 if(APPLE)
 endif(WIN32)
 
 if(APPLE)
@@ -158,7 +173,13 @@ else(WIN32)
     find_package(OpenAL REQUIRED)
 endif(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)
 find_package(PNG REQUIRED)
 find_package(JPEG REQUIRED)
 find_package(ZLIB REQUIRED)
@@ -222,6 +243,7 @@ endif(APPLE)
 
 if(WIN32)
     install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/lugaru.exe DESTINATION ${CMAKE_INSTALL_PREFIX})
 
 if(WIN32)
     install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/lugaru.exe DESTINATION ${CMAKE_INSTALL_PREFIX})
+    install(DIRECTORY ${CMAKE_SOURCE_DIR}/Data DESTINATION ${CMAKE_INSTALL_PREFIX})
     if(MINGW)
         # Based off Mageia/Fedora MinGW toolchain, might not work on other distros or Windows
         set(LIBGCC_S libgcc_s_sjlj-1.dll)
     if(MINGW)
         # Based off Mageia/Fedora MinGW toolchain, might not work on other distros or Windows
         set(LIBGCC_S libgcc_s_sjlj-1.dll)
@@ -257,7 +279,7 @@ if(LINUX)
         install(FILES ${CMAKE_SOURCE_DIR}/Dist/lugaru.png DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/128x128/apps)
         install(FILES ${CMAKE_SOURCE_DIR}/Dist/lugaru.6 DESTINATION ${CMAKE_INSTALL_MANDIR}/man6)
     else(SYSTEM_INSTALL)
         install(FILES ${CMAKE_SOURCE_DIR}/Dist/lugaru.png DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/128x128/apps)
         install(FILES ${CMAKE_SOURCE_DIR}/Dist/lugaru.6 DESTINATION ${CMAKE_INSTALL_MANDIR}/man6)
     else(SYSTEM_INSTALL)
-        message(WARNING "You are installing Lugaru without having enabled the SYSTEM_INSTALL option. It will default to looking for the data in the 'Data' directory next to the binary.")
+        message("You are building Lugaru without having enabled the SYSTEM_INSTALL option. It will default to looking for the data in the 'Data' directory next to the binary.")
         install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/lugaru DESTINATION ${CMAKE_INSTALL_PREFIX})
         install(DIRECTORY ${CMAKE_SOURCE_DIR}/Data DESTINATION ${CMAKE_INSTALL_PREFIX})
     endif(SYSTEM_INSTALL)
         install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/lugaru DESTINATION ${CMAKE_INSTALL_PREFIX})
         install(DIRECTORY ${CMAKE_SOURCE_DIR}/Data DESTINATION ${CMAKE_INSTALL_PREFIX})
     endif(SYSTEM_INSTALL)
@@ -266,7 +288,7 @@ endif(LINUX)
 if(APPLE)
     install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/lugaru DESTINATION ${LUGARU_BINDIR})
     install(DIRECTORY ${CMAKE_SOURCE_DIR}/Data DESTINATION ${LUGARU_APP_ROOT})
 if(APPLE)
     install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/lugaru DESTINATION ${LUGARU_BINDIR})
     install(DIRECTORY ${CMAKE_SOURCE_DIR}/Data DESTINATION ${LUGARU_APP_ROOT})
-    install(FILES ${CMAKE_SOURCE_DIR}/Dist/OSX/lugaru.icns DESTINATION ${LUGARU_RESDIR})
+    install(FILES ${CMAKE_SOURCE_DIR}/Dist/OSX/Lugaru.icns DESTINATION ${LUGARU_RESDIR})
     install(FILES ${CMAKE_SOURCE_DIR}/Dist/OSX/Info.plist DESTINATION ${LUGARU_APP_ROOT}/Contents)
 endif(APPLE)
 
     install(FILES ${CMAKE_SOURCE_DIR}/Dist/OSX/Info.plist DESTINATION ${LUGARU_APP_ROOT}/Contents)
 endif(APPLE)
 
@@ -275,6 +297,10 @@ endif(APPLE)
 install(FILES ${CMAKE_SOURCE_DIR}/AUTHORS
               ${CMAKE_SOURCE_DIR}/CONTENT-LICENSE.txt
               ${CMAKE_SOURCE_DIR}/COPYING.txt
 install(FILES ${CMAKE_SOURCE_DIR}/AUTHORS
               ${CMAKE_SOURCE_DIR}/CONTENT-LICENSE.txt
               ${CMAKE_SOURCE_DIR}/COPYING.txt
-              ${CMAKE_SOURCE_DIR}/DEBUG-OPTIONS.txt
               ${CMAKE_SOURCE_DIR}/README.md
               ${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})
         DESTINATION ${LUGARU_DOCDIR})