Commit 4e91d48e authored by Jeremy Whiting's avatar Jeremy Whiting
Browse files

Add cmake modules to kstars repo.

Fix CMakeLists.txt files so kstars will build.
parent 5a0a53e5
......@@ -5,11 +5,15 @@ include(KDE4Defaults)
include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES} ${QT4_INCLUDES})
set(CMAKE_MODULE_PATH ${kstars_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
# some configure checks needed for kstars
include(CheckIncludeFiles)
macro_optional_find_package(Eigen2 2.0.3)
macro_log_feature(EIGEN2_FOUND "Eigen2" "A generic C++ template library for dense and sparse matrices" "http://eigen.tuxfamily.org" FALSE "2.0.3" "Required to build Step and KStars.")
if( EIGEN2_FOUND )
macro_optional_find_package(CFitsio)
macro_bool_to_01(CFITSIO_FOUND HAVE_CFITSIO_H)
macro_log_feature(CFITSIO_FOUND "libcfitsio0" "A library for reading and writing data files in FITS (Flexible Image Transport System) data format" "http://indi.sf.net" FALSE "3.09" "Gives KStars support for FITS images.")
......@@ -38,3 +42,5 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config-kstars.h.cmake ${CMAKE_CURRENT
add_subdirectory( doc )
add_subdirectory( kstars )
endif( EIGEN2_FOUND )
# - Try to find CFITSIO
# Once done this will define
#
# CFITSIO_FOUND - system has CFITSIO
# CFITSIO_INCLUDE_DIR - the CFITSIO include directory
# CFITSIO_LIBRARIES - Link these to use CFITSIO
# Copyright (c) 2006, Jasem Mutlaq <mutlaqja@ikarustech.com>
# Based on FindLibfacile by Carsten Niehaus, <cniehaus@gmx.de>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES)
# in cache already
set(CFITSIO_FOUND TRUE)
message(STATUS "Found CFITSIO: ${CFITSIO_LIBRARIES}")
else (CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES)
if (NOT WIN32)
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
pkg_check_modules(PC_CFITSIO cfitsio)
endif (PKG_CONFIG_FOUND)
endif (NOT WIN32)
find_path(CFITSIO_INCLUDE_DIR fitsio.h
${PC_CFITSIO_INCLUDE_DIRS}
${_obIncDir}
${GNUWIN32_DIR}/include
)
find_library(CFITSIO_LIBRARIES NAMES cfitsio libcfitsio
PATHS
${PC_CFITSIO_LIBRARY_DIRS}
${_obLinkDir}
${GNUWIN32_DIR}/lib
)
if(CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES)
set(CFITSIO_FOUND TRUE)
else (CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES)
set(CFITSIO_FOUND FALSE)
endif(CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES)
if (CFITSIO_FOUND)
if (NOT CFitsio_FIND_QUIETLY)
message(STATUS "Found CFITSIO: ${CFITSIO_LIBRARIES}")
endif (NOT CFitsio_FIND_QUIETLY)
else (CFITSIO_FOUND)
if (CFitsio_FIND_REQUIRED)
message(FATAL_ERROR "CFITSIO not found. Please install libcfitsio0-devel and try again. http://indi.sf.net")
endif (CFitsio_FIND_REQUIRED)
endif (CFITSIO_FOUND)
mark_as_advanced(CFITSIO_INCLUDE_DIR CFITSIO_LIBRARIES)
endif (CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES)
# - Try to find Eigen2 lib
# Once done this will define
#
# EIGEN2_FOUND - system has eigen lib with correct version
# EIGEN2_INCLUDE_DIR - the eigen include directory
# EIGEN2_VERSION - eigen version
# Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>
# Copyright (c) 2008, 2009 Gael Guennebaud, <g.gael@free.fr>
# Redistribution and use is allowed according to the terms of the BSD license.
if(NOT EIGEN2_MIN_VERSION)
if(NOT Eigen2_FIND_VERSION_MAJOR)
set(Eigen2_FIND_VERSION_MAJOR 2)
endif(NOT Eigen2_FIND_VERSION_MAJOR)
if(NOT Eigen2_FIND_VERSION_MINOR)
set(Eigen2_FIND_VERSION_MINOR 0)
endif(NOT Eigen2_FIND_VERSION_MINOR)
if(NOT Eigen2_FIND_VERSION_PATCH)
set(Eigen2_FIND_VERSION_PATCH 0)
endif(NOT Eigen2_FIND_VERSION_PATCH)
set(EIGEN2_MIN_VERSION "${Eigen2_FIND_VERSION_MAJOR}.${Eigen2_FIND_VERSION_MINOR}.${Eigen2_FIND_VERSION_PATCH}")
endif(NOT EIGEN2_MIN_VERSION)
macro(_eigen2_check_version)
file(READ "${EIGEN2_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen2_version_header LIMIT 5000 OFFSET 1000)
string(REGEX MATCH "define *EIGEN_WORLD_VERSION ([0-9]*)" _eigen2_world_version_match "${_eigen2_version_header}")
set(EIGEN2_WORLD_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define *EIGEN_MAJOR_VERSION ([0-9]*)" _eigen2_major_version_match "${_eigen2_version_header}")
set(EIGEN2_MAJOR_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define *EIGEN_MINOR_VERSION ([0-9]*)" _eigen2_minor_version_match "${_eigen2_version_header}")
set(EIGEN2_MINOR_VERSION "${CMAKE_MATCH_1}")
set(EIGEN2_VERSION ${EIGEN2_WORLD_VERSION}.${EIGEN2_MAJOR_VERSION}.${EIGEN2_MINOR_VERSION})
if(${EIGEN2_VERSION} VERSION_LESS ${EIGEN2_MIN_VERSION})
set(EIGEN2_VERSION_OK FALSE)
else(${EIGEN2_VERSION} VERSION_LESS ${EIGEN2_MIN_VERSION})
set(EIGEN2_VERSION_OK TRUE)
endif(${EIGEN2_VERSION} VERSION_LESS ${EIGEN2_MIN_VERSION})
if(NOT EIGEN2_VERSION_OK)
message(STATUS "Eigen2 version ${EIGEN2_VERSION} found in ${EIGEN2_INCLUDE_DIR}, "
"but at least version ${EIGEN2_MIN_VERSION} is required")
endif(NOT EIGEN2_VERSION_OK)
endmacro(_eigen2_check_version)
if (EIGEN2_INCLUDE_DIR)
# in cache already
_eigen2_check_version()
set(EIGEN2_FOUND ${EIGEN2_VERSION_OK})
else (EIGEN2_INCLUDE_DIR)
find_path(EIGEN2_INCLUDE_DIR NAMES Eigen/Core
PATHS
${INCLUDE_INSTALL_DIR}
${KDE4_INCLUDE_DIR}
PATH_SUFFIXES eigen2
)
if(EIGEN2_INCLUDE_DIR)
_eigen2_check_version()
endif(EIGEN2_INCLUDE_DIR)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Eigen2 DEFAULT_MSG EIGEN2_INCLUDE_DIR EIGEN2_VERSION_OK)
mark_as_advanced(EIGEN2_INCLUDE_DIR)
endif(EIGEN2_INCLUDE_DIR)
# - Try to find INDI
# Once done this will define
#
# INDI_FOUND - system has INDI
# INDI_INCLUDE_DIR - the INDI include directory
# INDI_LIBRARIES - Link these to use INDI
# Copyright (c) 2006, Jasem Mutlaq <mutlaqja@ikarustech.com>
# Based on FindLibfacile by Carsten Niehaus, <cniehaus@gmx.de>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (INDI_INCLUDE_DIR AND INDI_LIBRARIES AND INDI_DRIVER_LIBRARIES)
# in cache already
set(INDI_FOUND TRUE)
message(STATUS "Found INDI: ${INDI_LIBRARIES}")
else (INDI_INCLUDE_DIR AND INDI_LIBRARIES AND INDI_DRIVER_LIBRARIES)
find_path(INDI_INCLUDE_DIR indidevapi.h
PATH_SUFFIXES libindi
${_obIncDir}
${GNUWIN32_DIR}/include
)
find_library(INDI_DRIVER_LIBRARIES NAMES indidriver
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
)
find_library(INDI_LIBRARIES NAMES indi
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
)
if(INDI_INCLUDE_DIR AND INDI_LIBRARIES AND INDI_DRIVER_LIBRARIES)
set(INDI_FOUND TRUE)
else (INDI_INCLUDE_DIR AND INDI_LIBRARIES AND INDI_DRIVER_LIBRARIES)
set(INDI_FOUND FALSE)
endif(INDI_INCLUDE_DIR AND INDI_LIBRARIES AND INDI_DRIVER_LIBRARIES)
# Find pkg-config
FIND_PROGRAM(PKGCONFIG_EXECUTABLE NAMES pkg-config PATHS /usr/bin/ /usr/local/bin )
# query pkg-config asking for a libindi >= 0.6.2
EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS --atleast-version=0.6.2 libindi RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _pkgconfigDevNull )
if(_return_VALUE STREQUAL "0")
set(INDI_FOUND TRUE)
else(_return_VALUE STREQUAL "0")
set(INDI_FOUND FALSE)
message(STATUS "Could NOT find libindi. pkg-config indicates that libindi >= 0.6.2 is not installed.")
endif(_return_VALUE STREQUAL "0")
# Find INDI Server
FIND_PROGRAM(INDISERVER NAMES indiserver PATHS /usr/bin/ /usr/local/bin )
if (INDISERVER-NOTFOUND)
set(INDI_FOUND FALSE)
endif(INDISERVER-NOTFOUND)
if (INDI_FOUND)
if (NOT INDI_FIND_QUIETLY)
message(STATUS "Found INDI: ${INDI_LIBRARIES}, ${INDI_DRIVER_LIBRARIES}")
endif (NOT INDI_FIND_QUIETLY)
else (INDI_FOUND)
if (INDI_FIND_REQUIRED)
message(FATAL_ERROR "libindi and indiserver not found. Please install libindi and try again. http://www.indilib.org")
endif (INDI_FIND_REQUIRED)
endif (INDI_FOUND)
mark_as_advanced(INDI_INCLUDE_DIR INDI_LIBRARIES INDI_DRIVER_LIBRARIES)
endif (INDI_INCLUDE_DIR AND INDI_LIBRARIES AND INDI_DRIVER_LIBRARIES)
# - Try to find XPlanet
# Once done this will define
#
# XPLANET_FOUND - system has XPlanet
# XPLANET_EXECUTABLE - the XPlanet executable
#
# Copyright (c) 2008, Jerome SONRIER, <jsid@emor3j.fr.eu.org>
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
# THIS FILE NEEDS IMPROVEMENTS
#
# if ( XPLANET_EXECUTABLE )
# # in cache already
# set(XPLANET_FOUND TRUE)
# message(STATUS "Found XPlanet (in cache): ${XPLANET_EXECUTABLE}")
# else ( XPLANET_EXECUTABLE )
set(XPLANET_EXECUTABLE XPLANET_EXECUTABLE-NOTFOUND)
find_program(XPLANET_EXECUTABLE NAMES xplanet)
if ( XPLANET_EXECUTABLE )
set(XPLANET_FOUND TRUE)
else ( XPLANET_EXECUTABLE )
set(XPLANET_FOUND FALSE)
message(STATUS "xplanet not found.")
endif( XPLANET_EXECUTABLE )
if ( XPLANET_FOUND )
if ( NOT XPLANET_FIND_QUIETLY )
message(STATUS "Found Xplanet: ${XPLANET_EXECUTABLE}")
endif ( NOT XPLANET_FIND_QUIETLY )
else ( XPLANET_FOUND )
if ( XPLANET_FIND_REQUIRED )
message(FATAL_ERROR "xplanet is required.")
endif ( XPLANET_FIND_REQUIRED )
endif ( XPLANET_FOUND )
mark_as_advanced ( XPLANET_FOUND )
# endif( XPLANET_EXECUTABLE )
......@@ -69,10 +69,10 @@ endif( OPENGL_FOUND )
include_directories(
${CMAKE_SOURCE_DIR}/kstars/kstars/tools
${CMAKE_SOURCE_DIR}/kstars/kstars/skyobjects
${CMAKE_SOURCE_DIR}/kstars/kstars/skycomponents
${CMAKE_SOURCE_DIR}/kstars/kstars/satlib
${kstars_SOURCE_DIR}/kstars/tools
${kstars_SOURCE_DIR}/kstars/skyobjects
${kstars_SOURCE_DIR}/kstars/skycomponents
${kstars_SOURCE_DIR}/kstars/satlib
# ${CMAKE_SOURCE_DIR}/kstars/kstars/htmesh
# ${CMAKE_SOURCE_DIR}/libkdeedu/extdate
${ZLIB_INCLUDE_DIR}
......
......@@ -5,19 +5,19 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config-htmesh.h.cmake ${CMAKE_CURRENT
### HTMesh library
set(HTMesh_LIB_SRCS
${CMAKE_SOURCE_DIR}/kstars/kstars/htmesh/HtmRange.cpp
${CMAKE_SOURCE_DIR}/kstars/kstars/htmesh/HtmRangeIterator.cpp
${CMAKE_SOURCE_DIR}/kstars/kstars/htmesh/RangeConvex.cpp
${CMAKE_SOURCE_DIR}/kstars/kstars/htmesh/SkipList.cpp
${CMAKE_SOURCE_DIR}/kstars/kstars/htmesh/SkipListElement.cpp
${CMAKE_SOURCE_DIR}/kstars/kstars/htmesh/SpatialConstraint.cpp
${CMAKE_SOURCE_DIR}/kstars/kstars/htmesh/SpatialEdge.cpp
${CMAKE_SOURCE_DIR}/kstars/kstars/htmesh/SpatialException.cpp
${CMAKE_SOURCE_DIR}/kstars/kstars/htmesh/SpatialIndex.cpp
${CMAKE_SOURCE_DIR}/kstars/kstars/htmesh/SpatialVector.cpp
${CMAKE_SOURCE_DIR}/kstars/kstars/htmesh/HTMesh.cpp
${CMAKE_SOURCE_DIR}/kstars/kstars/htmesh/MeshBuffer.cpp
${CMAKE_SOURCE_DIR}/kstars/kstars/htmesh/MeshIterator.cpp
${kstars_SOURCE_DIR}/kstars/htmesh/HtmRange.cpp
${kstars_SOURCE_DIR}/kstars/htmesh/HtmRangeIterator.cpp
${kstars_SOURCE_DIR}/kstars/htmesh/RangeConvex.cpp
${kstars_SOURCE_DIR}/kstars/htmesh/SkipList.cpp
${kstars_SOURCE_DIR}/kstars/htmesh/SkipListElement.cpp
${kstars_SOURCE_DIR}/kstars/htmesh/SpatialConstraint.cpp
${kstars_SOURCE_DIR}/kstars/htmesh/SpatialEdge.cpp
${kstars_SOURCE_DIR}/kstars/htmesh/SpatialException.cpp
${kstars_SOURCE_DIR}/kstars/htmesh/SpatialIndex.cpp
${kstars_SOURCE_DIR}/kstars/htmesh/SpatialVector.cpp
${kstars_SOURCE_DIR}/kstars/htmesh/HTMesh.cpp
${kstars_SOURCE_DIR}/kstars/htmesh/MeshBuffer.cpp
${kstars_SOURCE_DIR}/kstars/htmesh/MeshIterator.cpp
)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}")
......
## SatLib Library ###
set(SatLib_LIB_SRCS
${CMAKE_SOURCE_DIR}/kstars/kstars/satlib/SatLib.c
${kstars_SOURCE_DIR}/kstars/satlib/SatLib.c
)
add_definitions(-DUSE_KDEWIN32_LIB -DBUILD_DLL)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment