2021-12-22 09:59:59 -07:00
|
|
|
cmake_minimum_required(VERSION 3.8)
|
2018-11-28 14:42:00 -07:00
|
|
|
|
2019-02-14 00:00:29 -07:00
|
|
|
option(LEGACY_OPENGL_LIBS "Use legacy OpenGL libraries instead of glvnd library (Default: off)" OFF)
|
2018-12-30 13:14:41 -07:00
|
|
|
|
2022-04-03 11:00:41 -06:00
|
|
|
# Plain and keyword target_link_libraries() signatures cannot be mixed
|
|
|
|
if (POLICY CMP0023)
|
|
|
|
cmake_policy(SET CMP0023 NEW)
|
|
|
|
endif()
|
|
|
|
|
2020-04-21 08:32:21 -06:00
|
|
|
# Honor link flags in try_compile()
|
|
|
|
if (POLICY CMP0056)
|
|
|
|
cmake_policy(SET CMP0056 NEW)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# only use the additional link flags when linking executables if the
|
|
|
|
# ENABLE_EXPORTS target property is set to True
|
|
|
|
if(POLICY CMP0065)
|
|
|
|
cmake_policy(SET CMP0065 NEW)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Honor language standard (CMAKE_CXX_STANDARD) in try_compile()
|
|
|
|
if(POLICY CMP0067)
|
|
|
|
cmake_policy(SET CMP0067 NEW)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Ignore generated source files in AUTOMOC and AUTOUIC
|
2020-03-02 08:56:46 -07:00
|
|
|
if(POLICY CMP0071)
|
2019-02-14 00:09:17 -07:00
|
|
|
cmake_policy(SET CMP0071 OLD)
|
|
|
|
endif()
|
|
|
|
|
2020-04-21 08:32:21 -06:00
|
|
|
# Prefer GLVND or "legacy" OpenGL library (libOpenGL.so vs libGL.so)
|
2020-03-02 08:56:46 -07:00
|
|
|
if(POLICY CMP0072)
|
|
|
|
if(LEGACY_OPENGL_LIBS)
|
2018-12-30 13:14:41 -07:00
|
|
|
cmake_policy(SET CMP0072 OLD)
|
|
|
|
else()
|
|
|
|
cmake_policy(SET CMP0072 NEW)
|
|
|
|
endif()
|
2018-11-28 14:42:00 -07:00
|
|
|
endif()
|
|
|
|
|
2020-04-08 05:04:14 -06:00
|
|
|
# Remove leading and trailing whitespace from libraries linked
|
|
|
|
if(POLICY CMP0004)
|
2021-10-20 08:42:20 -06:00
|
|
|
cmake_policy(SET CMP0004 NEW)
|
2020-04-08 05:04:14 -06:00
|
|
|
endif()
|
|
|
|
|
2020-05-05 02:48:23 -06:00
|
|
|
project(celestia VERSION 1.7.0 LANGUAGES C CXX)
|
2019-08-02 22:42:24 -06:00
|
|
|
set(DISPLAY_NAME "Celestia")
|
2018-11-28 14:42:00 -07:00
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
2019-02-14 00:00:29 -07:00
|
|
|
option(ENABLE_CELX "Enable celx scripting, requires Lua library? (Default: on)" ON)
|
|
|
|
option(ENABLE_SPICE "Use spice library? (Default: off)" OFF)
|
|
|
|
option(ENABLE_NLS "Enable interface translation? (Default: on)" ON)
|
2021-04-16 15:21:26 -06:00
|
|
|
option(ENABLE_GLUT "Build simple Glut frontend? (Default: off)" OFF)
|
2019-02-14 00:00:29 -07:00
|
|
|
option(ENABLE_GTK "Build GTK2 frontend (Unix only)? (Default: off)" OFF)
|
|
|
|
option(ENABLE_QT "Build Qt frontend? (Default: on)" ON)
|
2020-04-08 05:04:14 -06:00
|
|
|
option(ENABLE_SDL "Build SDL frontend? (Default: off)" OFF)
|
2019-02-14 00:00:29 -07:00
|
|
|
option(ENABLE_WIN "Build Windows native frontend? (Default: on)" ON)
|
2018-12-24 13:14:22 -07:00
|
|
|
option(ENABLE_FFMPEG "Support video capture using FFMPEG (Default: off)" OFF)
|
2019-05-05 06:12:43 -06:00
|
|
|
option(ENABLE_TOOLS "Build different tools? (Default: off)" OFF)
|
2019-03-11 12:42:31 -06:00
|
|
|
option(NATIVE_OSX_APP "Support native OSX paths read data from (Default: off)" OFF)
|
2019-05-17 07:52:32 -06:00
|
|
|
option(FAST_MATH "Build with unsafe fast-math compiller option (Default: off)" OFF)
|
2020-02-15 08:02:57 -07:00
|
|
|
option(ENABLE_TESTS "Enable unit tests? (Default: off)" OFF)
|
2020-05-12 09:51:25 -06:00
|
|
|
option(ENABLE_GLES "Build for OpenGL ES 2.0 instead of OpenGL 2.1 (Default: off)" OFF)
|
2021-04-16 15:21:26 -06:00
|
|
|
option(USE_GTKGLEXT "Use libgtkglext1 for GTK2 frontend (Default: on)" ON)
|
2021-12-05 07:38:31 -07:00
|
|
|
option(USE_QT6 "Use Qt6 in Qt frontend (Default: off)" OFF)
|
2021-04-17 03:11:59 -06:00
|
|
|
option(USE_GTK3 "Use Gtk3 in GTK2 frontend (Default: off)" OFF)
|
2020-05-12 09:51:25 -06:00
|
|
|
|
|
|
|
if(ENABLE_GLES)
|
|
|
|
add_definitions(-DGL_ES)
|
2021-04-16 15:21:26 -06:00
|
|
|
# Disable USE_GTKGLEXT if using OpenGL ES
|
|
|
|
set(USE_GTKGLEXT OFF)
|
2020-05-12 09:51:25 -06:00
|
|
|
endif()
|
2018-11-28 14:42:00 -07:00
|
|
|
|
2021-04-17 03:11:59 -06:00
|
|
|
if(USE_GTK3)
|
|
|
|
# Disable USE_GTKGLEXT if using Gtk+3
|
|
|
|
set(USE_GTKGLEXT OFF)
|
|
|
|
endif()
|
|
|
|
|
2018-11-28 14:42:00 -07:00
|
|
|
if(NOT CMAKE_BUILD_TYPE)
|
|
|
|
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type." FORCE)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|
|
|
|
2021-05-09 00:12:26 -06:00
|
|
|
if(UNIX AND (NOT CYGWIN))
|
2018-11-28 14:42:00 -07:00
|
|
|
set(_UNIX true)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# _USE_MATH_DEFINES enables use of math constants like M_PI,
|
|
|
|
# which are by default disabled in standard C++ mode (like std=c++11 instead of std=gnu11)
|
|
|
|
add_definitions(-D_USE_MATH_DEFINES)
|
|
|
|
|
|
|
|
# Let CMake handle setting C++11 (since 3.1)
|
2021-10-20 08:44:39 -06:00
|
|
|
if(NOT CMAKE_CXX_STANDARD)
|
2021-12-22 09:59:59 -07:00
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
2021-10-20 08:44:39 -06:00
|
|
|
endif()
|
2018-11-28 14:42:00 -07:00
|
|
|
set(CMAKE_C_STANDARD 11)
|
|
|
|
|
2019-01-10 10:55:18 -07:00
|
|
|
# Use our cmake files
|
|
|
|
list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
|
|
|
|
2020-03-02 08:56:46 -07:00
|
|
|
if((NOT WIN32) AND (NOT NATIVE_OSX_APP))
|
|
|
|
include(GNUInstallDirs)
|
|
|
|
include(rpath)
|
|
|
|
endif()
|
2018-11-28 14:42:00 -07:00
|
|
|
include(CheckIncludeFiles)
|
2019-08-15 13:21:22 -06:00
|
|
|
include(CheckIncludeFileCXX)
|
2020-03-02 08:56:46 -07:00
|
|
|
include(FastMath)
|
2018-11-28 14:42:00 -07:00
|
|
|
|
2020-03-02 08:56:46 -07:00
|
|
|
#
|
|
|
|
# Compile options
|
|
|
|
#
|
|
|
|
if(MSVC)
|
2021-12-28 09:38:36 -07:00
|
|
|
# CMake 3.14 and below set warning flags by default, remove them to prevent conflicts
|
|
|
|
string(REGEX REPLACE "/W[3|4]" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
|
|
|
string(REGEX REPLACE "/W[3|4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
|
|
|
|
2020-03-02 08:56:46 -07:00
|
|
|
# Disabled warnings
|
|
|
|
# C4244, C4267, C4503: implicit type conversion to a smaller type
|
|
|
|
# C4786: long names in templates
|
|
|
|
# C4800: forcing value to bool
|
2021-03-03 15:07:43 -07:00
|
|
|
# C4455: reserved literals (no undescore at the beginning)
|
|
|
|
# C5030: not recognized attribute
|
2021-05-25 10:07:36 -06:00
|
|
|
# C5105: macro expansion producing 'defined' has undefined behavior
|
2020-03-02 08:56:46 -07:00
|
|
|
# Additional options
|
|
|
|
# bigobj: generate more object sections than allowed by default
|
2020-06-21 10:49:46 -06:00
|
|
|
# Promoted to errors
|
|
|
|
# C4316: object allocated on the heap may not be aligned 16
|
2021-05-25 10:07:36 -06:00
|
|
|
add_compile_options("/wd4244" "/wd4267" "/wd4503" "/wd4800" "/wd4455" "/wd5030" "/wd5105" "/bigobj" "/we4316")
|
2021-03-11 22:33:02 -07:00
|
|
|
|
|
|
|
if(MSVC_VERSION GREATER_EQUAL 1914)
|
|
|
|
# /Zc:__cplusplus: correctly set __cplusplus macro value
|
|
|
|
add_compile_options("/Zc:__cplusplus")
|
|
|
|
endif()
|
2020-03-02 08:56:46 -07:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT WIN32)
|
|
|
|
# Qt requires -fPIC, so build all code with it
|
|
|
|
# It's always set on windows
|
|
|
|
add_compile_options(-fPIC)
|
|
|
|
endif()
|
|
|
|
|
2021-03-02 12:41:34 -07:00
|
|
|
if(MINGW)
|
|
|
|
# MinGW has a bug which causes too many false-positive warnings
|
|
|
|
# for 'operator!='
|
|
|
|
add_compile_options(-Wno-attributes)
|
|
|
|
endif()
|
|
|
|
|
2020-03-02 08:56:46 -07:00
|
|
|
EnableFastMath(${FAST_MATH})
|
|
|
|
|
2018-11-28 14:42:00 -07:00
|
|
|
#
|
|
|
|
# NLS (Gettext) support
|
|
|
|
#
|
|
|
|
if(ENABLE_NLS)
|
|
|
|
find_package(Gettext)
|
|
|
|
if(NOT GETTEXT_FOUND)
|
|
|
|
message(WARNING "Gettext is not found, traslations won't be created.")
|
|
|
|
endif()
|
2019-01-10 10:55:18 -07:00
|
|
|
include(FixGettext)
|
|
|
|
|
|
|
|
find_package(Intl REQUIRED)
|
|
|
|
include_directories(${Intl_INCLUDE_DIRS})
|
|
|
|
link_libraries(${Intl_LIBRARIES})
|
2020-02-13 09:21:42 -07:00
|
|
|
add_definitions(-DENABLE_NLS)
|
2020-03-02 08:56:46 -07:00
|
|
|
else()
|
|
|
|
message(STATUS "NLS is disabled. Not looking for gettext and libintl.")
|
2018-11-28 14:42:00 -07:00
|
|
|
endif()
|
|
|
|
|
2019-01-19 05:49:06 -07:00
|
|
|
if(ENABLE_SPICE)
|
2021-06-21 23:16:10 -06:00
|
|
|
find_package(CSPICE)
|
2019-01-27 04:58:57 -07:00
|
|
|
if(NOT CSPICE_FOUND)
|
|
|
|
message(STATUS "Using cspice submodule")
|
|
|
|
add_subdirectory("${CMAKE_SOURCE_DIR}/thirdparty/Spice")
|
2021-12-28 10:40:25 -07:00
|
|
|
get_target_property(SPICE_INCLUDE_DIR spice INCLUDE_DIRECTORIES)
|
2019-08-12 12:49:33 -06:00
|
|
|
include_directories(${SPICE_INCLUDE_DIR})
|
|
|
|
message(STATUS "Spice include directories: ${SPICE_INCLUDE_DIR}")
|
2021-12-28 10:40:25 -07:00
|
|
|
add_library(CSPICE::CSPICE ALIAS spice)
|
2019-11-01 15:47:43 -06:00
|
|
|
else()
|
|
|
|
include_directories(${CSPICE_INCLUDE_DIR})
|
2019-01-27 04:58:57 -07:00
|
|
|
endif()
|
2019-06-04 03:52:14 -06:00
|
|
|
add_definitions(-DUSE_SPICE)
|
2020-03-02 08:56:46 -07:00
|
|
|
else()
|
|
|
|
message(STATUS "NAIF SPICE is disabled. Not looking for cspice library.")
|
2019-01-19 05:49:06 -07:00
|
|
|
endif()
|
|
|
|
|
2018-12-24 13:14:22 -07:00
|
|
|
if(ENABLE_FFMPEG)
|
|
|
|
include(FindFFMPEG)
|
|
|
|
find_package(FFMPEG REQUIRED COMPONENTS avcodec avutil avformat swscale)
|
2021-06-21 23:14:19 -06:00
|
|
|
include_directories(${FFMPEG_INCLUDE_DIRS})
|
2018-12-24 13:14:22 -07:00
|
|
|
add_definitions(-DUSE_FFMPEG)
|
2018-11-28 14:42:00 -07:00
|
|
|
endif()
|
|
|
|
|
2021-10-09 21:01:21 -06:00
|
|
|
if(ENABLE_LIBAVIF)
|
|
|
|
find_package(Libavif REQUIRED)
|
|
|
|
link_libraries(libavif::libavif)
|
|
|
|
include_directories(${LIBAVIF_INCLUDE_DIR})
|
|
|
|
add_definitions(-DUSE_LIBAVIF)
|
|
|
|
endif()
|
|
|
|
|
2018-12-24 13:14:22 -07:00
|
|
|
if(_UNIX)
|
|
|
|
find_package(PkgConfig)
|
2018-11-28 14:42:00 -07:00
|
|
|
endif()
|
|
|
|
|
2020-03-02 08:56:46 -07:00
|
|
|
if(WIN32)
|
2019-01-10 10:55:18 -07:00
|
|
|
link_libraries("vfw32" "comctl32" "winmm")
|
|
|
|
endif()
|
|
|
|
|
2020-05-12 09:51:25 -06:00
|
|
|
if(NOT ENABLE_GLES)
|
|
|
|
find_package(OpenGL REQUIRED)
|
|
|
|
include_directories(${OPENGL_INCLUDE_DIRS})
|
|
|
|
link_libraries(${OPENGL_LIBRARIES})
|
|
|
|
endif()
|
2018-11-28 14:42:00 -07:00
|
|
|
|
2020-05-05 02:42:08 -06:00
|
|
|
find_package(Libepoxy REQUIRED)
|
|
|
|
link_libraries(libepoxy::libepoxy)
|
|
|
|
include_directories(${LIBEPOXY_INCLUDE_DIR})
|
2018-11-28 14:42:00 -07:00
|
|
|
|
2021-01-04 02:08:32 -07:00
|
|
|
find_package(Eigen3 3.3 REQUIRED NO_MODULE) # -DEigen3_DIR=...
|
|
|
|
message(STATUS "Found Eigen3 ${EIGEN3_VERSION_STRING}")
|
|
|
|
link_libraries(Eigen3::Eigen)
|
2018-11-28 14:42:00 -07:00
|
|
|
|
2021-11-20 05:01:57 -07:00
|
|
|
find_package(fmt 6.1.0 CONFIG QUIET)
|
|
|
|
if(NOT fmt_FOUND)
|
|
|
|
message(STATUS "Using fmt submodule")
|
|
|
|
add_subdirectory("${CMAKE_SOURCE_DIR}/thirdparty/fmt")
|
|
|
|
endif()
|
2021-01-04 02:08:32 -07:00
|
|
|
link_libraries(fmt::fmt)
|
2018-11-28 14:42:00 -07:00
|
|
|
|
2019-05-20 12:00:47 -06:00
|
|
|
find_package(PNG REQUIRED)
|
|
|
|
add_definitions(${PNG_DEFINITIONS})
|
|
|
|
link_libraries(PNG::PNG)
|
2018-11-28 14:42:00 -07:00
|
|
|
|
2019-05-20 12:00:47 -06:00
|
|
|
find_package(JPEG REQUIRED) # -DJPEG_LIBRARY=...
|
|
|
|
include_directories(${JPEG_INCLUDE_DIRS})
|
|
|
|
link_libraries(${JPEG_LIBRARIES})
|
2018-11-28 14:42:00 -07:00
|
|
|
|
|
|
|
if(ENABLE_CELX)
|
|
|
|
add_definitions(-DCELX)
|
|
|
|
|
2019-05-26 14:44:49 -06:00
|
|
|
find_package(LuaJIT)
|
|
|
|
if(NOT LUAJIT_FOUND)
|
|
|
|
find_package(Lua REQUIRED)
|
2018-11-28 14:42:00 -07:00
|
|
|
endif()
|
2019-05-26 14:44:49 -06:00
|
|
|
include_directories(${LUA_INCLUDE_DIR})
|
|
|
|
link_libraries(${LUA_LIBRARIES})
|
2020-03-02 08:56:46 -07:00
|
|
|
else()
|
|
|
|
message(STATUS "CELX is disabled. Not looking for LUA libraries.")
|
2018-11-28 14:42:00 -07:00
|
|
|
endif()
|
|
|
|
|
2020-06-24 07:23:11 -06:00
|
|
|
find_package(Freetype REQUIRED)
|
|
|
|
link_libraries(Freetype::Freetype)
|
2019-06-03 11:57:15 -06:00
|
|
|
|
2022-02-17 14:01:11 -07:00
|
|
|
find_package(meshoptimizer CONFIG QUIET)
|
|
|
|
if(meshoptimizer_FOUND)
|
|
|
|
message(STATUS "Found meshoptimizer library")
|
|
|
|
set(HAVE_MESHOPTIMIZER 1)
|
|
|
|
else()
|
|
|
|
message(STATUS "meshoptimizer library is missing")
|
|
|
|
endif()
|
|
|
|
|
2018-11-28 14:42:00 -07:00
|
|
|
#[[
|
|
|
|
get_cmake_property(_variableNames VARIABLES)
|
|
|
|
list (SORT _variableNames)
|
|
|
|
foreach (_variableName ${_variableNames})
|
|
|
|
message(STATUS "${_variableName}=${${_variableName}}")
|
|
|
|
endforeach()
|
|
|
|
]]#
|
|
|
|
|
2020-03-02 08:56:46 -07:00
|
|
|
# macOS Bundling
|
2019-08-02 22:42:24 -06:00
|
|
|
if(NATIVE_OSX_APP)
|
|
|
|
message(STATUS "Generating Info.plist for macOS Bundle")
|
|
|
|
configure_file(${CMAKE_SOURCE_DIR}/Info.plist.in ${CMAKE_BINARY_DIR}/Info.plist @ONLY)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NATIVE_OSX_APP)
|
|
|
|
set(CMAKE_INSTALL_PREFIX "${PROJECT_BINARY_DIR}/${PROJECT_NAME}.app/Contents")
|
|
|
|
set(CMAKE_INSTALL_FULL_LOCALEDIR "${CMAKE_INSTALL_PREFIX}/Resources/locale")
|
2019-08-03 01:01:47 -06:00
|
|
|
set(CMAKE_INSTALL_BINDIR "MacOS")
|
2019-08-02 22:42:24 -06:00
|
|
|
set(DATADIR "${CMAKE_INSTALL_PREFIX}/Resources")
|
|
|
|
set(FULL_DATADIR "${CMAKE_INSTALL_PREFIX}/Resources")
|
2020-03-02 08:56:46 -07:00
|
|
|
elseif(WIN32)
|
|
|
|
set(CMAKE_INSTALL_BINDIR ".")
|
|
|
|
set(CMAKE_INSTALL_DATAROOTDIR ".")
|
|
|
|
set(CMAKE_INSTALL_DATADIR ".")
|
|
|
|
set(CMAKE_INSTALL_FULL_LOCALEDIR "locale")
|
|
|
|
set(DATADIR "${CMAKE_INSTALL_DATADIR}")
|
|
|
|
set(FULL_DATADIR ".")
|
2019-08-02 22:42:24 -06:00
|
|
|
else()
|
|
|
|
set(DATADIR "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}")
|
|
|
|
set(FULL_DATADIR "${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME}")
|
|
|
|
endif()
|
2018-11-28 14:42:00 -07:00
|
|
|
|
2020-03-02 08:56:46 -07:00
|
|
|
if(NOT GIT_COMMIT)
|
2019-01-10 10:55:18 -07:00
|
|
|
find_program(GIT_FOUND git)
|
2020-03-02 08:56:46 -07:00
|
|
|
if(GIT_FOUND)
|
|
|
|
execute_process(
|
|
|
|
COMMAND git log --pretty=format:%h -1
|
|
|
|
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
|
|
|
OUTPUT_VARIABLE GIT_COMMIT
|
|
|
|
)
|
|
|
|
if("${GIT_COMMIT}" STREQUAL "")
|
2019-02-14 00:01:30 -07:00
|
|
|
set(GIT_COMMIT "unknown")
|
|
|
|
endif()
|
2019-01-10 10:55:18 -07:00
|
|
|
else()
|
|
|
|
set(GIT_COMMIT "unknown")
|
|
|
|
endif()
|
|
|
|
endif()
|
2018-11-28 14:42:00 -07:00
|
|
|
|
2020-03-02 08:56:46 -07:00
|
|
|
#
|
|
|
|
# Compile definitions
|
|
|
|
#
|
2018-11-28 14:42:00 -07:00
|
|
|
add_definitions(
|
2020-03-02 08:56:46 -07:00
|
|
|
-DVERSION="${PROJECT_VERSION}"
|
2018-11-28 14:42:00 -07:00
|
|
|
-DPACKAGE="celestia"
|
2020-03-02 08:56:46 -07:00
|
|
|
-DGIT_COMMIT="${GIT_COMMIT}"
|
2018-11-28 14:42:00 -07:00
|
|
|
)
|
|
|
|
|
2019-08-02 23:30:04 -06:00
|
|
|
if(NOT NATIVE_OSX_APP)
|
|
|
|
add_definitions(
|
|
|
|
-DLOCALEDIR="${CMAKE_INSTALL_FULL_LOCALEDIR}"
|
|
|
|
-DCONFIG_DATA_DIR="${FULL_DATADIR}"
|
|
|
|
-DHIP_DATA_DIR="${FULL_DATADIR}"
|
2020-03-02 08:56:46 -07:00
|
|
|
-DSPLASH_DIR="${FULL_DATADIR}/splash"
|
2019-08-02 23:30:04 -06:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2019-05-21 15:06:48 -06:00
|
|
|
if(WIN32)
|
|
|
|
add_definitions(
|
|
|
|
-D_CRT_SECURE_NO_WARNINGS
|
|
|
|
-D_SCL_SECURE_NO_WARNINGS
|
|
|
|
-DNOMINMAX
|
|
|
|
-DWIN32_LEAN_AND_MEAN
|
|
|
|
-DWINVER=0x0601
|
|
|
|
-D_WIN32_WINNT=0x0601
|
|
|
|
)
|
2020-03-02 08:56:46 -07:00
|
|
|
# Fix the issue: https://github.com/CelestiaProject/Celestia/issues/364
|
|
|
|
add_definitions(-D_ENABLE_EXTENDED_ALIGNED_STORAGE)
|
2019-05-21 15:06:48 -06:00
|
|
|
endif()
|
|
|
|
|
2019-02-07 14:05:08 -07:00
|
|
|
if(APPLE)
|
2020-03-02 08:56:46 -07:00
|
|
|
if(NATIVE_OSX_APP)
|
2019-03-11 12:42:31 -06:00
|
|
|
add_definitions(-DNATIVE_OSX_APP)
|
|
|
|
endif()
|
2019-08-27 14:23:21 -06:00
|
|
|
add_definitions(-DGL_SILENCE_DEPRECATION)
|
2019-02-07 14:05:08 -07:00
|
|
|
endif()
|
|
|
|
|
2018-11-28 14:42:00 -07:00
|
|
|
string(TOLOWER "${CMAKE_BUILD_TYPE}" build_type_lc)
|
2019-08-20 01:16:27 -06:00
|
|
|
if("${build_type_lc}" STREQUAL "debug")
|
|
|
|
add_definitions(-D_DEBUG -DDEBUG)
|
|
|
|
else()
|
2018-11-28 14:42:00 -07:00
|
|
|
add_definitions(-DNO_DEBUG -DEIGEN_NO_DEBUG)
|
2021-03-02 11:19:49 -07:00
|
|
|
if(NOT MSVC)
|
2021-12-28 13:24:35 -07:00
|
|
|
add_compile_options(
|
|
|
|
$<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>
|
|
|
|
$<$<COMPILE_LANGUAGE:CXX>:-fno-exceptions>
|
|
|
|
)
|
2021-03-02 11:19:49 -07:00
|
|
|
endif()
|
2018-11-28 14:42:00 -07:00
|
|
|
endif()
|
|
|
|
|
2020-03-02 08:56:46 -07:00
|
|
|
# Turning all debug on dramatically decreases performance
|
2019-05-01 06:28:15 -06:00
|
|
|
if(OCTREE_DEBUG)
|
|
|
|
add_definitions(-DOCTREE_DEBUG)
|
|
|
|
endif()
|
|
|
|
|
2018-11-28 14:42:00 -07:00
|
|
|
include_directories("${CMAKE_SOURCE_DIR}/src" ${CMAKE_BINARY_DIR})
|
|
|
|
|
|
|
|
# configure a header file to pass some of the CMake settings
|
|
|
|
# to the source code
|
2019-11-21 23:32:13 -07:00
|
|
|
include(CheckSymbolExists)
|
|
|
|
check_symbol_exists(wordexp wordexp.h HAVE_WORDEXP)
|
2018-11-28 14:42:00 -07:00
|
|
|
check_include_files(byteswap.h HAVE_BYTESWAP_H)
|
|
|
|
|
2021-12-22 10:57:32 -07:00
|
|
|
find_package(Filesystem REQUIRED COMPONENTS Final Experimental)
|
|
|
|
if(CXX_FILESYSTEM_IS_EXPERIMENTAL)
|
|
|
|
message(WARNING "C++ lacks header <filesystem>, using <experimental/filesystem> instead.")
|
2021-10-20 08:44:02 -06:00
|
|
|
else()
|
2021-12-22 10:57:32 -07:00
|
|
|
set(HAVE_STD_FILESYSTEM ON)
|
2019-08-15 13:21:22 -06:00
|
|
|
endif()
|
2021-12-22 10:57:32 -07:00
|
|
|
link_libraries(std::filesystem)
|
2019-08-15 13:21:22 -06:00
|
|
|
|
2021-12-15 13:22:53 -07:00
|
|
|
try_compile(HAVE_CHARCONV ${CMAKE_BINARY_DIR} "${CMAKE_SOURCE_DIR}/checks/cxxccint.cpp")
|
|
|
|
if(HAVE_CHARCONV)
|
|
|
|
try_compile(HAVE_FLOAT_CHARCONV ${CMAKE_BINARY_DIR} "${CMAKE_SOURCE_DIR}/checks/cxxccfloat.cpp")
|
|
|
|
if(NOT HAVE_FLOAT_CHARCONV)
|
|
|
|
message(WARNING "C++ charconv lacks floating point support!\nWill use own implementation.")
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
message(WARNING "C++ charconv is unusable!\nWill use own implementation.")
|
|
|
|
endif()
|
|
|
|
|
2021-11-06 04:45:30 -06:00
|
|
|
include(TestBigEndian)
|
|
|
|
test_big_endian(WORDS_BIGENDIAN)
|
|
|
|
|
2020-03-02 08:56:46 -07:00
|
|
|
configure_file("config.h.in" "config.h")
|
|
|
|
|
2018-11-28 14:42:00 -07:00
|
|
|
set(BASE_DATA_SOURCES
|
|
|
|
demo.cel
|
|
|
|
guide.cel
|
|
|
|
start.cel
|
|
|
|
celestia.cfg
|
|
|
|
controls.txt
|
|
|
|
)
|
2018-11-30 10:54:25 -07:00
|
|
|
install(FILES ${BASE_DATA_SOURCES} DESTINATION ${DATADIR})
|
2018-11-30 13:25:09 -07:00
|
|
|
install(FILES "splash.png" DESTINATION "${DATADIR}/splash")
|
2018-11-28 14:42:00 -07:00
|
|
|
|
2019-08-02 22:42:24 -06:00
|
|
|
if(NATIVE_OSX_APP)
|
|
|
|
install(FILES ${CMAKE_BINARY_DIR}/Info.plist DESTINATION .)
|
|
|
|
endif()
|
|
|
|
|
2018-11-28 14:42:00 -07:00
|
|
|
add_subdirectory(src)
|
|
|
|
add_subdirectory(po)
|
|
|
|
add_subdirectory(fonts)
|
2018-11-30 13:25:09 -07:00
|
|
|
add_subdirectory(images)
|
2018-11-28 14:42:00 -07:00
|
|
|
add_subdirectory(locale)
|
|
|
|
add_subdirectory(scripts)
|
2019-06-23 14:35:00 -06:00
|
|
|
add_subdirectory(shaders)
|
2020-02-15 08:02:57 -07:00
|
|
|
|
|
|
|
if(ENABLE_TESTS)
|
|
|
|
enable_testing()
|
|
|
|
add_subdirectory(test)
|
|
|
|
endif()
|