Initial cmake implementation

pull/147/head
Hleb Valoshka 2018-11-29 00:42:00 +03:00
parent 354354bda3
commit 549a646c67
38 changed files with 5298 additions and 0 deletions

250
CMakeLists.txt 100644
View File

@ -0,0 +1,250 @@
cmake_minimum_required(VERSION 3.1.0)
if(POLICY CMP0072)
cmake_policy(SET CMP0072 NEW)
endif()
project(celestia)
set(VERSION "1.7.0")
#
#
#
set(ENABLE_CELX ON CACHE BOOL "Enable celx scripting, requires Lua library? (Default: on)")
set(ENABLE_SPICE OFF CACHE BOOL "Use spice library? (Default: off)")
set(ENABLE_NLS ON CACHE BOOL "Enable interface translation? (Default: on)")
set(ENABLE_GLUT ON CACHE BOOL "Build simple Glut frontend? (Default: on)")
set(ENABLE_GTK OFF CACHE BOOL "Build GTK2 frontend (Unix only)? (Default: off)")
set(ENABLE_QT ON CACHE BOOL "Build Qt frontend? (Default: on)")
set(ENABLE_WIN ON CACHE BOOL "Build Windows native frontend? (Default: on)")
set(ENABLE_THEORA ON CACHE BOOL "Support video capture to OGG Theora? (Default: on)")
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type." FORCE)
endif()
#string(REPLACE " -fpermissive" "" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
#string(REPLACE "-O3" "-O2" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
add_compile_options(-fPIC)
#temporary
add_compile_options(-g)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(APPLE true)
endif()
if(UNIX AND (NOT APPLE) AND (NOT CYGWIN))
set(_UNIX true)
endif()
# Theora supported on Unix-like systems only, but not on OSX
if(NOT _UNIX)
set(ENABLE_THEORA OFF CACHE)
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)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_C_STANDARD 11)
include(GNUInstallDirs)
include(CheckIncludeFiles)
include(cmake/rpath.cmake)
include(cmake/cotire.cmake)
#
# 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()
include(cmake/FixGettext.cmake)
endif()
if(_UNIX)
find_package(PkgConfig)
endif()
if(ENABLE_THEORA)
pkg_search_module(THEORA theora REQUIRED)
include_directories(${THEORA_INCLUDE_DIRS})
link_libraries(${THEORA_LIBRARIES})
add_definitions(-DTHEORA)
endif()
find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIRS})
link_libraries(${OPENGL_LIBRARIES})
find_package(GLEW)
if(GLEW_FOUND)
#link_libraries(GLEW::GLEW)
include_directories(${GLEW_INCLUDE_DIRS})
link_libraries(${GLEW_LIBRARIES})
find_package(OpenGL)
elseif(_UNIX)
pkg_search_module(GLEW glew)
if(GLEW_FOUND)
include_directories(${GLEW_INCLUDE_DIRS})
link_libraries(${GLEW_LIBRARIES})
else()
message("Using bundled glew")
include_directories("${CMAKE_SOURCE_DIR}/thirdparty/glew/include")
add_definitions(-DGLEW_STATIC)
endif()
else()
include_directories("${CMAKE_SOURCE_DIR}/thirdparty/glew/include")
add_definitions(-DGLEW_STATIC)
endif()
find_package(Eigen3 3.3 NO_MODULE) # -DEigen3_DIR=...
if(TARGET Eigen3::Eigen)
message("Found Eigen3 ${EIGEN3_VERSION_STRING}")
link_libraries(Eigen3::Eigen)
elseif(_UNIX)
pkg_search_module(EIGEN eigen3)
if(EIGEN_FOUND)
include_directories(${EIGEN_INCLUDE_DIRS})
else()
message("Using bundled Eigen")
include_directories("${CMAKE_SOURCE_DIR}/thirdparty/Eigen")
endif()
else()
include_directories("${CMAKE_SOURCE_DIR}/thirdparty/Eigen")
endif()
find_package(fmt 4.0.0 CONFIG QUIET)
if(fmt_FOUND)
link_libraries(fmt::fmt)
else()
message("Using bundled libfmt")
include_directories("${CMAKE_SOURCE_DIR}/thirdparty/fmt/include")
endif()
find_package(PNG)
if(PNG_FOUND)
add_definitions(${PNG_DEFINITIONS})
include_directories(${PNG_INCLUDE_DIRS})
link_libraries(${PNG_LIBRARIES})
elseif(_UNIX)
pkg_search_module(PNG libpng REQUIRED)
include_directories(${PNG_INCLUDE_DIRS})
link_libraries(${PNG_LIBRARIES})
else()
message(FATAL_ERROR "libpng was not found")
endif()
find_package(JPEG) # -DJPEG_LIBRARY=...
if(JPEG_FOUND)
include_directories(${JPEG_INCLUDE_DIRS})
link_libraries(${JPEG_LIBRARIES})
elseif(_UNIX)
pkg_search_module(JPEG libjpeg REQUIRED)
include_directories(${JPEG_INCLUDE_DIRS})
link_libraries(${JPEG_LIBRARIES})
else()
message(FATAL_ERROR "libjpeg was not found")
endif()
if(ENABLE_CELX)
add_definitions(-DCELX)
find_package(Lua)
if(LUA_FOUND)
add_definitions(-DLUA_VER=0x0${LUA_VERSION_MAJOR}0${LUA_VERSION_MINOR}00)
include_directories(${LUA_INCLUDE_DIR})
link_libraries(${LUA_LIBRARIES})
else()
if(_UNIX)
pkg_search_module(LUA luajit lua5.3 lua5.2 lua5.1 REQUIRED)
include_directories(${LUA_INCLUDE_DIRS})
link_libraries(${LUA_LIBRARIES})
if(LUA_VERSION VERSION_EQUAL "5.3" OR LUA_VERSION VERSION_GREATER "5.3")
add_definitions(-DLUA_VER=0x050300)
elseif(LUA_VERSION VERSION_EQUAL "5.2" OR LUA_VERSION VERSION_GREATER "5.2")
add_definitions(-DLUA_VER=0x050200)
elseif(LUA_VERSION VERSION_EQUAL "5.1" OR LUA_VERSION VERSION_GREATER "5.1")
add_definitions(-DLUA_VER=0x050100)
else() # luajit
add_definitions(-DLUA_VER=0x050100)
endif()
elseif(WIN32 OR APPLE)
add_definitions(-DLUA_VER=0x050100)
endif()
endif()
endif()
#[[
get_cmake_property(_variableNames VARIABLES)
list (SORT _variableNames)
foreach (_variableName ${_variableNames})
message(STATUS "${_variableName}=${${_variableName}}")
endforeach()
]]#
if(ENABLE_SPICE)
add_definitions(-DUSE_SPICE)
endif()
set(DATADIR "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}")
set(FULL_DATADIR "${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME}")
execute_process(
COMMAND git log --pretty=format:"%h" -1
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_COMMIT
)
add_definitions(
-DVERSION="${VERSION}"
-DLOCALEDIR="${CMAKE_INSTALL_FULL_LOCALEDIR}"
-DPACKAGE="celestia"
-DCONFIG_DATA_DIR="${FULL_DATADIR}"
-DHIP_DATA_DIR="${FULL_DATADIR}"
-DSPLASH_DIR="${FULL_DATADIR}/splash"
-DGIT_COMMIT=${GIT_COMMIT}
)
string(TOLOWER "${CMAKE_BUILD_TYPE}" build_type_lc)
if(NOT "${build_type_lc}" STREQUAL "debug")
add_definitions(-DNO_DEBUG -DEIGEN_NO_DEBUG)
endif()
include_directories("${CMAKE_SOURCE_DIR}/src" ${CMAKE_BINARY_DIR})
# configure a header file to pass some of the CMake settings
# to the source code
configure_file("config.h.in" "config.h")
check_include_files(byteswap.h HAVE_BYTESWAP_H)
set(BASE_DATA_SOURCES
demo.cel
guide.cel
start.cel
celestia.cfg
controls.txt
)
install(FILES ${BASE_CEL_SOURCES} DESTINATION ${DATADIR})
add_subdirectory(src)
add_subdirectory(po)
add_subdirectory(po2)
add_subdirectory(data)
add_subdirectory(extras)
add_subdirectory(extras-standard)
add_subdirectory(fonts)
add_subdirectory(locale)
add_subdirectory(models)
add_subdirectory(scripts)
add_subdirectory(textures)

View File

@ -0,0 +1,45 @@
macro(GETTEXT_CREATE_TRANSLATIONS2 _potFile _firstPoFileArg)
# make it a real variable, so we can modify it here
set(_firstPoFile "${_firstPoFileArg}")
set(_gmoFiles)
get_filename_component(_potName ${_potFile} NAME)
string(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _potBasename ${_potName})
get_filename_component(_absPotFile ${_potFile} ABSOLUTE)
set(_addToAll)
if(${_firstPoFile} STREQUAL "ALL")
set(_addToAll "ALL")
set(_firstPoFile)
endif()
foreach (_currentPoFile ${_firstPoFile} ${ARGN})
get_filename_component(_absFile ${_currentPoFile} ABSOLUTE)
get_filename_component(_abs_PATH ${_absFile} PATH)
get_filename_component(_lang ${_absFile} NAME_WE)
set(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo)
set(_poFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.po)
add_custom_command(
OUTPUT ${_gmoFile}
COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --output-file=${_poFile} --lang=${_lang} --sort-output ${_absFile} ${_absPotFile}
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_poFile}
DEPENDS ${_absPotFile} ${_absFile}
)
install(FILES ${_gmoFile} DESTINATION share/locale/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo)
set(_gmoFiles ${_gmoFiles} ${_gmoFile})
endforeach ()
if(NOT TARGET translations)
add_custom_target(translations)
endif()
_GETTEXT_GET_UNIQUE_TARGET_NAME(translations uniqueTargetName)
add_custom_target(${uniqueTargetName} ${_addToAll} DEPENDS ${_gmoFiles})
add_dependencies(translations ${uniqueTargetName})
endmacro()

4190
cmake/cotire.cmake 100644

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,5 @@
# the RPATH to be used when installing, but only if it's not a system directory
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES ${CMAKE_INSTALL_FULL_LIBDIR} isSystemDir)
if("${isSystemDir}" STREQUAL "-1")
set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR})
endif()

1
config.h.in 100644
View File

@ -0,0 +1 @@
#cmakedefine HAVE_BYTESWAP_H

View File

@ -0,0 +1,45 @@
if(ENABLE_HIPPARCOS)
add_custom_command(OUTPUT stars.dat COMMAND buildstardb -q DEPENDS buildstardb)
add_custom_target(hipparcos_data ALL DEPENDS stars.dat)
endif()
set(DATA_SOURCES
asterisms.dat
boundaries.dat
hdxindex.dat
saoxindex.dat
starnames.dat
stars.dat
extrasolar.ssc
solarsys.ssc
charm2.stc
extrasolar.stc
nearstars.stc
revised.stc
spectbins.stc
visualbins.stc
stars.txt
asteroids.ssc
comets.ssc
earth_locs.ssc
eros_locs.ssc
gaspra_locs.ssc
ida_locs.ssc
itokawa_locs.ssc
jupitermoons_locs.ssc
mars_locs.ssc
marsmoons_locs.ssc
merc_locs.ssc
minormoons.ssc
moon_locs.ssc
neptunemoons_locs.ssc
numberedmoons.ssc
outersys.ssc
ring_locs.ssc
saturnmoons_locs.ssc
uranusmoons_locs.ssc
venus_locs.ssc
world-capitals.ssc
)
install(FILES ${DATA_SOURCES} DESTINATION "${DATADIR}/data")

View File

@ -0,0 +1,5 @@
add_subdirectory(cassini)
add_subdirectory(galileo)
add_subdirectory(hubble)
add_subdirectory(iss)
add_subdirectory(mir)

View File

@ -0,0 +1,11 @@
set(CASSINI_SOURCES
data/cassini-cruise.xyzv
data/cassini-solstice.xyzv
data/huygens.xyzv
data/cassini-orbit.xyzv
cassini.ssc
models/cassini.3ds
models/huygens.3ds
)
install(FILES ${CASSINI_SOURCES} DESTINATION "${DATADIR}/extras-standard/cassini")

View File

@ -0,0 +1,8 @@
set(GALILEO_SOURCES
galileo.ssc
data/galileo-orbit.xyzv
data/galileo-cruise.xyzv
models/galileo.3ds
)
install(FILES ${GALILEO_SOURCES} DESTINATION "${DATADIR}/extras-standard/galileo")

View File

@ -0,0 +1,6 @@
set(HUBBLE_SOURCES
hubble.ssc
models/hubble.cmod
)
install(FILES ${HUBBLE_SOURCES} DESTINATION "${DATADIR}/extras-standard/hubble")

View File

@ -0,0 +1,42 @@
set(ISS_SOURCES
iss.ssc
textures/medres/issmod.jpg
textures/medres/issbso2.jpg
textures/medres/isspanel.jpg
textures/medres/issb2.jpg
textures/medres/issku2.jpg
textures/medres/isscup.jpg
textures/medres/isszmod.jpg
textures/medres/metalcon.jpg
textures/medres/issesa.jpg
textures/medres/issp2.jpg
textures/medres/issusa.jpg
textures/medres/iss_dcs.jpg
textures/medres/issins.jpg
textures/medres/issbso.jpg
textures/medres/d_ring.jpg
textures/medres/questcov.jpg
textures/medres/issbs.jpg
textures/medres/issb.jpg
textures/medres/iss_un.jpg
textures/medres/isscover.jpg
textures/medres/iss_dc.jpg
textures/medres/issrad.jpg
textures/medres/isssolar.jpg
textures/medres/issb4.jpg
textures/medres/graple.jpg
textures/medres/issred.jpg
textures/medres/isshand.jpg
textures/medres/issku1.jpg
textures/medres/isscov2.jpg
textures/medres/issmb.jpg
textures/medres/nasda.jpg
textures/medres/issdish.jpg
textures/medres/issb3.jpg
textures/medres/issdot.jpg
textures/medres/issku.jpg
textures/medres/issusaf.jpg
models/iss.cmod
)
install(FILES ${ISS_SOURCES} DESTINATION "${DATADIR}/extras-standard/iss")

View File

@ -0,0 +1,6 @@
set(MIR_SOURCES
models/mir.3ds
mir.ssc
)
install(FILES ${EXTRA_MIR_SOURCES} DESTINATION "${DATADIR}/extras-standard/mir")

View File

@ -0,0 +1,8 @@
set(EXTRA_SOURCES
apollo.ssc
shroxclassic.ssc
shroxmars.ssc
skylab.ssc
)
install(FILES ${EXTRA_SOURCES} DESTINATION "${DATADIR}/extras")

View File

@ -0,0 +1,3 @@
file(GLOB FONTS_SOURCES *.txf)
install(FILES ${FONTS_SOURCES} DESTINATION "${DATADIR}/fonts")

View File

@ -0,0 +1,3 @@
file(GLOB LOCALE_SOURCES "controls_*.txt" "*.cel")
install(FILES ${LOCALE_SOURCES} DESTINATION "${DATADIR}")

View File

@ -0,0 +1,3 @@
file(GLOB MODELS_SOURCES "*.3ds" "*.cmod" "*.cms" "*.png")
install(FILES ${MODELS_SOURCES} DESTINATION "${DATADIR}/models")

View File

@ -0,0 +1,6 @@
if((NOT ENABLE_NLS) OR (NOT GETTEXT_FOUND))
return()
endif()
file(GLOB PO_FILES "*.po")
gettext_create_translations2("celestia.pot" ALL ${PO_FILES})

View File

@ -0,0 +1,6 @@
if((NOT ENABLE_NLS) OR (NOT GETTEXT_FOUND))
return()
endif()
file(GLOB PO_FILES "*.po")
gettext_create_translations2("celestia_constellations.pot" ALL ${PO_FILES})

View File

@ -0,0 +1,3 @@
file(GLOB SCRIPTS_SOURCES "*.cel" "*.celx")
install(FILES ${SCRIPTS_SOURCES} DESTINATION "${DATADIR}/scripts")

17
src/CMakeLists.txt 100644
View File

@ -0,0 +1,17 @@
set(CELESTIA_LIBS
cel3ds
celengine
celephem
celestia
celmath
celmodel
celtxf
celutil
)
foreach(lib ${CELESTIA_LIBS} tools)
add_subdirectory(${lib})
endforeach()
add_executable(buildstardb buildstardb.cpp)
cotire(buildstardb)

View File

@ -0,0 +1,19 @@
set(CEL3DS_SOURCES
3dschunk.h
3dsmodel.cpp
3dsmodel.h
3dsread.cpp
3dsread.h
)
add_library(cel3ds STATIC ${CEL3DS_SOURCES})
cotire(cel3ds)
#[[
add_library(cel3ds SHARED ${CEL3DS_SOURCES})
set_target_properties(cel3ds PROPERTIES
VERSION ${VERSION}
SOVERSION ${VERSION}
)
]]#
#install(TARGETS cel3ds LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(TARGETS cel3ds ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})

View File

@ -0,0 +1,164 @@
set(CELENGINE_SOURCES
asterism.cpp
asterism.h
astro.cpp
astro.h
atmosphere.h
axisarrow.cpp
axisarrow.h
body.cpp
body.h
boundaries.cpp
boundaries.h
catalogxref.cpp
catalogxref.h
celestia.h
cmdparser.cpp
cmdparser.h
command.cpp
command.h
console.cpp
console.h
constellation.cpp
constellation.h
curveplot.cpp
curveplot.h
dds.cpp
deepskyobj.cpp
deepskyobj.h
dispmap.cpp
dispmap.h
dsodb.cpp
dsodb.h
dsoname.cpp
dsoname.h
dsooctree.cpp
dsooctree.h
execenv.h
execution.cpp
execution.h
frame.cpp
frame.h
frametree.cpp
frametree.h
galaxy.cpp
galaxy.h
geometry.h
glcontext.cpp
glcontext.h
globular.cpp
globular.h
glshader.cpp
glshader.h
image.cpp
image.h
lightenv.h
location.cpp
location.h
lodspheremesh.cpp
lodspheremesh.h
marker.cpp
marker.h
meshmanager.cpp
meshmanager.h
modelgeometry.cpp
modelgeometry.h
multitexture.cpp
multitexture.h
name.h
nebula.cpp
nebula.h
observer.cpp
observer.h
octree.h
opencluster.cpp
opencluster.h
overlay.cpp
overlay.h
parseobject.cpp
parseobject.h
parser.cpp
parser.h
# particlesystem.cpp
# particlesystemfile.cpp
# particlesystemfile.h
# particlesystem.h
planetgrid.cpp
planetgrid.h
referencemark.h
rendcontext.cpp
rendcontext.h
render.cpp
renderglsl.cpp
renderglsl.h
render.h
renderinfo.h
rotationmanager.cpp
rotationmanager.h
selection.cpp
selection.h
shadermanager.cpp
shadermanager.h
simulation.cpp
simulation.h
skygrid.cpp
skygrid.h
solarsys.cpp
solarsys.h
spheremesh.cpp
spheremesh.h
starbrowser.cpp
starbrowser.h
starcolors.cpp
starcolors.h
star.cpp
star.h
stardb.cpp
stardb.h
starname.cpp
starname.h
staroctree.cpp
staroctree.h
stellarclass.cpp
stellarclass.h
surface.h
texmanager.cpp
texmanager.h
texture.cpp
texture.h
timeline.cpp
timeline.h
timelinephase.cpp
timelinephase.h
tokenizer.cpp
tokenizer.h
trajmanager.cpp
trajmanager.h
univcoord.cpp
univcoord.h
universe.cpp
universe.h
vecgl.h
virtualtex.cpp
virtualtex.h
visibleregion.cpp
visibleregion.h
)
if(APPLE)
list(APPEND CELENGINE_SOURCES CGBuffer.h)
endif()
add_library(celengine STATIC ${CELENGINE_SOURCES})
cotire(celengine)
#[[
add_library(celengine SHARED ${CELENGINE_SOURCES})
set_target_properties(celengine PROPERTIES
VERSION ${VERSION}
SOVERSION ${VERSION}
)
]]#
add_dependencies(celengine cel3ds celmath celmodel)
target_link_libraries(celengine cel3ds celmath celmodel)
#install(TARGETS celengine LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(TARGETS celengine ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})

View File

@ -0,0 +1,57 @@
set(CELEPHEM_SOURCES
customorbit.cpp
customorbit.h
customrotation.cpp
customrotation.h
jpleph.cpp
jpleph.h
nutation.cpp
nutation.h
orbit.cpp
orbit.h
precession.cpp
precession.h
rotation.cpp
rotation.h
samporbit.cpp
samporbit.h
samporient.cpp
samporient.h
vsop87.cpp
vsop87.h
)
if(ENABLE_SPICE)
list(APPEND CELEPHEM_SOURCES
spiceinterface.cpp
spiceinterface.h
spiceorbit.cpp
spiceorbit.h
spicerotation.cpp
spicerotation.h
)
endif()
if(ENABLE_CELX)
list(APPEND CELEPHEM_SOURCES
scriptobject.cpp
scriptobject.h
scriptorbit.cpp
scriptorbit.h
scriptrotation.cpp
scriptrotation.h
)
endif()
add_library(celephem STATIC ${CELEPHEM_SOURCES})
cotire(celephem)
#[[
add_library(celephem SHARED ${CELEPHEM_SOURCES})
set_target_properties(celephem PROPERTIES
VERSION ${VERSION}
SOVERSION ${VERSION}
)
]]#
#install(TARGETS celephem LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(TARGETS celephem ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})

View File

@ -0,0 +1,100 @@
set(CELESTIA_SOURCES
celestiacore.cpp
celestiacore.h
configfile.cpp
configfile.h
destination.cpp
destination.h
eclipsefinder.cpp
eclipsefinder.h
favorites.cpp
favorites.h
imagecapture.cpp
imagecapture.h
moviecapture.h
scriptmenu.cpp
scriptmenu.h
url.cpp
url.h
)
set(CELX_SOURCES
celx_celestia.cpp
celx_celestia.h
celx.cpp
celx_frame.cpp
celx_frame.h
celx_gl.cpp
celx_gl.h
celx.h
celx_internal.h
celx_misc.cpp
celx_misc.h
celx_object.cpp
celx_object.h
celx_observer.cpp
celx_observer.h
celx_phase.cpp
celx_phase.h
celx_position.cpp
celx_position.h
celx_rotation.cpp
celx_rotation.h
celx_vector.cpp
celx_vector.h
)
if(ENABLE_CELX)
list(APPEND CELESTIA_SOURCES ${CELX_SOURCES})
endif()
if(WIN32)
list(APPEND CELESTIA_SOURCES
avicapture.cpp
avicapture.h
)
elseif(_UNIX AND ENABLE_THEORA)
list(APPEND CELESTIA_SOURCES
oggtheoracapture.cpp
oggtheoracapture.h
)
endif()
if(NOT fmt_FOUND)
list(APPEND CELESTIA_SOURCES
${CMAKE_SOURCE_DIR}/thirdparty/fmt/src/format.cc
${CMAKE_SOURCE_DIR}/thirdparty/fmt/src/posix.cc
)
endif()
add_library(celestia STATIC ${CELESTIA_SOURCES})
#[[
add_library(celestia SHARED ${CELESTIA_SOURCES})
set_target_properties(celestia PROPERTIES
VERSION ${VERSION}
SOVERSION ${VERSION}
)
]]#
add_dependencies(celestia celengine celephem)
cotire(celestia)
target_link_libraries(celestia celengine celephem)
#install(TARGETS celestia LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
# celestia-glut binary
if(ENABLE_GLUT)
find_package(GLUT)
if(NOT GLUT_FOUND)
message(WARNING "GLUT library isn't found, not building GLUT fronend.")
else()
set(GLUT_SOURCES glutmain.cpp)
add_executable(celestia-glut ${GLUT_SOURCES})
cotire(celestia-glut)
target_include_directories(celestia-glut PRIVATE ${GLUT_INCLUDE_DIR})
target_link_libraries(celestia-glut ${CELESTIA_LIBS} ${GLUT_LIBRARIES})
install(TARGETS celestia-glut RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
endif()
add_subdirectory(gtk)
add_subdirectory(qt)
add_subdirectory(win32)

View File

@ -0,0 +1,49 @@
if(NOT _UNIX OR NOT ENABLE_GTK)
message("Either not Unix or Gtk frontend is disabled.")
return()
endif()
set(GTK_SOURCES
actions.cpp
common.cpp
dialog-eclipse.cpp
dialog-goto.cpp
dialog-options.cpp
dialog-solar.cpp
dialog-star.cpp
dialog-time.cpp
dialog-tour.cpp
glwidget.cpp
main.cpp
menu-context.cpp
settings-file.cpp
splash.cpp
)
set(GTK_HEADERS
actions.h
common.h
dialog-eclipse.h
dialog-goto.h
dialog-options.h
dialog-solar.h
dialog-star.h
dialog-time.h
dialog-tour.h
glwidget.h
menu-context.h
settings-file.h
splash.h
ui.h
)
pkg_check_modules(GTK2 gtk+-2.0 REQUIRED)
pkg_check_modules(GTK2GLEXT gtkglext-1.0 REQUIRED)
add_executable(celestia-gtk ${GTK_SOURCES})
cotire(celestia-gtk)
target_include_directories(celestia-gtk PRIVATE ${GTK2_INCLUDE_DIRS} ${GTK2GLEXT_INCLUDE_DIRS})
target_link_libraries(celestia-gtk ${CELESTIA_LIBS} ${GTK2_LIBRARIES} ${GTK2GLEXT_LIBRARIES})
install(TARGETS celestia-gtk RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
add_subdirectory(data)

View File

@ -0,0 +1,5 @@
set(GTK_DATA_FILES
celestiaui.xml
)
install(FILES ${GTK_DATA_FILES} DESTINATION "${DATADIR}")

View File

@ -0,0 +1,60 @@
if(NOT ENABLE_QT)
message("Qt frontend is disabled.")
return()
endif()
set(QT_LIBS Widgets OpenGL)
find_package(Qt5 COMPONENTS ${QT_LIBS} CONFIG REQUIRED)
set(QT_SOURCES
qtappwin.cpp
qtbookmark.cpp
qtcelestialbrowser.cpp
qtcelestiaactions.cpp
qtcolorswatchwidget.cpp
qtdeepskybrowser.cpp
qteventfinder.cpp
qtglwidget.cpp
qtgotoobjectdialog.cpp
qtinfopanel.cpp
qtmain.cpp
qtpreferencesdialog.cpp
qtselectionpopup.cpp
qtsettimedialog.cpp
qtsolarsystembrowser.cpp
qttimetoolbar.cpp
xbel.cpp
)
set(QT_HEADERS
qtappwin.h
qtbookmark.h
qtcelestialbrowser.h
qtcelestiaactions.h
qtcolorswatchwidget.h
qtdeepskybrowser.h
qteventfinder.h
qtgettext.h
qtgotoobjectdialog.h
qtglwidget.h
qtinfopanel.h
qtpreferencesdialog.h
qtselectionpopup.h
qtsettimedialog.h
qtsolarsystembrowser.h
qttimetoolbar.h
xbel.h
)
# Instruct CMake to run moc automatically when needed
set(CMAKE_AUTOMOC ON)
# Create code from a list of Qt designer ui files
set(CMAKE_AUTOUIC ON)
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
qt5_add_resources(RC_SRC "icons.qrc")
add_executable(celestia-qt WIN32 ${QT_SOURCES} ${RC_SRC})
cotire(celestia-qt)
qt5_use_modules(celestia-qt ${QT_LIBS})
target_link_libraries(celestia-qt ${CELESTIA_LIBS})
install(TARGETS celestia-qt RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

View File

@ -0,0 +1,44 @@
if(NOT WIN32 OR NOT ENABLE_WIN)
message("Either not Windows or Windows frontend is disabled.")
return()
endif()
set(WIN32_SOURCES
iob_func_shim.cpp
ODMenu.cpp
wglext.cpp
winbookmarks.cpp
windatepicker.cpp
wineclipses.cpp
wingotodlg.cpp
winhyperlinks.cpp
winlocations.cpp
winmain.cpp
winsplash.cpp
winssbrowser.cpp
winstarbrowser.cpp
wintime.cpp
wintourguide.cpp
winviewoptsdlg.cpp
)
set(WIN32_HEADERS
ODMenu.h
wglext.h
winbookmarks.h
wineclipses.h
wingotodlg.h
winhyperlinks.h
winlocations.h
winsplash.h
winssbrowser.h
winstarbrowser.h
wintime.h
wintourguide.h
winviewoptsdlg.h
)
add_executable(celestia-win WIN32 ${WIN32_SOURCES})
cotire(celestia-win)
target_link_libraries(celestia-win ${CELESTIA_LIBS})
install(TARGETS celestia-win RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

View File

@ -0,0 +1,26 @@
set(CELMATH_SOURCES
distance.h
ellipsoid.h
frustum.cpp
frustum.h
geomutil.h
intersect.h
mathlib.h
perlin.cpp
perlin.h
ray.h
solve.h
sphere.h
)
add_library(celmath STATIC ${CELMATH_SOURCES})
cotire(celmath)
#[[
add_library(celmath SHARED ${CELMATH_SOURCES})
set_target_properties(celmath PROPERTIES
VERSION ${VERSION}
SOVERSION ${VERSION}
)
]]#
#install(TARGETS celmath LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(TARGETS celmath ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})

View File

@ -0,0 +1,22 @@
set(CELMODEL_SOURCES
material.cpp
material.h
mesh.cpp
mesh.h
model.cpp
modelfile.cpp
modelfile.h
model.h
)
add_library(celmodel STATIC ${CELMODEL_SOURCES})
cotire(celmodel)
#[[
add_library(celmodel SHARED ${CELMODEL_SOURCES})
set_target_properties(celmodel PROPERTIES
VERSION ${VERSION}
SOVERSION ${VERSION}
)
]]#
#install(TARGETS celmodel LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(TARGETS celmodel ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})

View File

@ -0,0 +1,16 @@
set(CELTFX_SOURCES
texturefont.cpp
texturefont.h
)
add_library(celtxf STATIC ${CELTFX_SOURCES})
cotire(celtxf)
#[[
add_library(celtxf SHARED ${CELTFX_SOURCES})
set_target_properties(celtxf PROPERTIES
VERSION ${VERSION}
SOVERSION ${VERSION}
)
]]#
#install(TARGETS celtxf LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(TARGETS celtxf ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})

View File

@ -0,0 +1,50 @@
set(CELUTIL_SOURCES
bigfix.cpp
bigfix.h
bytes.h
color.cpp
color.h
debug.cpp
debug.h
directory.cpp
directory.h
filetype.cpp
filetype.h
formatnum.cpp
formatnum.h
#memorypool.cpp
#memorypool.h
reshandle.h
resmanager.h
timer.cpp
timer.h
utf8.cpp
utf8.h
util.cpp
util.h
watcher.h
)
if (WIN32)
list(APPEND CELUTIL_SOURCES
windirectory.cpp
winutil.cpp
winutil.h
)
else()
list(APPEND CELUTIL_SOURCES
unixdirectory.cpp
)
endif()
add_library(celutil STATIC ${CELUTIL_SOURCES})
cotire(celutil)
#[[
add_library(celutil SHARED ${CELUTIL_SOURCES})
set_target_properties(celutil PROPERTIES
VERSION ${VERSION}
SOVERSION ${VERSION}
)
]]#
#install(TARGETS celutil LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(TARGETS celutil ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})

View File

@ -0,0 +1 @@
add_subdirectory(stardb)

View File

@ -0,0 +1,6 @@
# not building celdat2txt as in references external function
foreach(tool makestardb makexindex startextdump)
add_executable(${tool} WIN32 "${tool}.cpp")
target_link_libraries(${tool} ${CELESTIA_LIBS})
install(TARGETS ${tool} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endforeach()

View File

@ -0,0 +1,7 @@
file(GLOB TEXTURES_SOURCES "*.jpg" "*.png")
install(FILES ${TEXTURES_SOURCES} DESTINATION "${DATADIR}/textures")
add_subdirectory(hires)
add_subdirectory(medres)
add_subdirectory(lores)

View File

@ -0,0 +1,3 @@
file(GLOB HIRES_SOURCES "*.jpg" "*.png" "*.dds")
install(FILES ${HIRES_SOURCES} DESTINATION "${DATADIR}/textures/hires")

View File

@ -0,0 +1,3 @@
file(GLOB LORES_SOURCES "*.jpg" "*.png" "*.dds")
install(FILES ${LORES_SOURCES} DESTINATION "${DATADIR}/textures/lores")

View File

@ -0,0 +1,3 @@
file(GLOB MEDRES_SOURCES "*.jpg" "*.png" "*.dds")
install(FILES ${MEDRES_SOURCES} DESTINATION "${DATADIR}/textures/medres")