# This file is part of EPOCH.
# File: CMakeLists.txt
# Author: Florent Teichteil-Königsbuch
# Contact: florent.teichteil@onera.fr
#
#    EPOCH is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    EPOCH is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with EPOCH.  If not, see <http://www.gnu.org/licenses/>.

CMAKE_MINIMUM_REQUIRED (VERSION 2.8)

PROJECT (EPOCH)
ENABLE_LANGUAGE(C CXX Fortran)

SET (CMAKE_MODULE_PATH ${CMAKE_HOME_DIRECTORY}/config)

INCLUDE (CheckIncludeFiles)

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")

#####################
# FIND DEPENDENCIES #
#####################

FIND_PACKAGE (Boost 1.46.0 COMPONENTS program_options timer chrono filesystem system date_time timer unit_test_framework REQUIRED)
INCLUDE_DIRECTORIES (${Boost_INCLUDE_DIRS} ${SUITESPARSE_PATH})
LINK_DIRECTORIES (${Boost_LIBRARY_DIRS})
MESSAGE (STATUS "Found Boost version: " ${Boost_VERSION})

OPTION (BUILD_GUI "Build EPOCH's Graphical User Interface" OFF)
IF (BUILD_GUI)
	FIND_PACKAGE (wxWidgetsCustom COMPONENTS base core aui xml REQUIRED)
	SET (CMAKE_REQUIRED_INCLUDES_COPY ${CMAKE_REQUIRED_INCLUDES})
	LIST (APPEND CMAKE_REQUIRED_INCLUDES ${wxWidgets_INCLUDE_DIRS})
	CHECK_INCLUDE_FILES (wx/aui/tabdocmdi.h HAVE_TABDOCMDI_H)
	SET (CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_COPY})
	FIND_PACKAGE (PLplot REQUIRED)
	IF (NOT PLplot_wxwidgets_LIBRARY)
		MESSAGE (FATAL_ERROR "PLplot wxwidgets bindings required to build the GUI")
	ENDIF(NOT PLplot_wxwidgets_LIBRARY)
ENDIF (BUILD_GUI)

OPTION (BUILD_DOC "Build Doxygen documentation" OFF)
IF (BUILD_DOC)
	FIND_PACKAGE (Doxygen REQUIRED)
ENDIF (BUILD_DOC)

##################
# COMPILES FILES #
##################

ADD_SUBDIRECTORY (sdk)
ADD_SUBDIRECTORY (src)

#######################
# BUILD DOCUMENTATION #
#######################

IF (BUILD_DOC)
	ADD_SUBDIRECTORY (doc)
ENDIF (BUILD_DOC)
