added CMake config files

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@447 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
legrand 2007-06-28 13:02:40 +00:00
commit 6051d114de
3 changed files with 169 additions and 0 deletions

View file

@ -0,0 +1,115 @@
######################################################################################
### 0) If you want to set your variables in mo-conf.cmake and avoid the cmd line
######################################################################################
INCLUDE(mo-conf.cmake OPTIONAL)
######################################################################################
######################################################################################
### 1) Main project config
######################################################################################
IF(NOT DEFINED ${PROJECT_NAME} OR ${PROJECT_NAME} STREQUAL "Project")
SET(PROJECT_NAME "ParadisEO-MO")
ENDIF(NOT DEFINED ${PROJECT_NAME} OR ${PROJECT_NAME} STREQUAL "Project")
# set the project name
PROJECT(${PROJECT_NAME})
# check cmake version compatibility
CMAKE_MINIMUM_REQUIRED(VERSION 2.4 FATAL_ERROR)
# regular expression checking
INCLUDE_REGULAR_EXPRESSION("^.*$" "^$")
# set a language for the entire project.
ENABLE_LANGUAGE(CXX)
ENABLE_LANGUAGE(C)
#####################################################################################
#####################################################################################
### 2) Include required modules
#####################################################################################
INCLUDE(CMakeBackwardCompatibilityCXX)
INCLUDE(FindDoxygen)
INCLUDE(FindGnuplot)
# check for some functions
INCLUDE(CheckLibraryExists)
######################################################################################
######################################################################################
### 3) SET main paths (can be defined in mo-conf.cmake)
######################################################################################
IF(NOT DEFINED MO_DIR)
SET(MO_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH "ParadisEO-MO main directory")
ENDIF(NOT DEFINED MO_DIR)
# Need main EO directory path
IF(NOT DEFINED EO_DIR OR NOT EO_DIR)
SET(EO_DIR ${EOdir} CACHE PATH "ParadisEO-EO main directory" FORCE) # given on the command line
ELSE(NOT DEFINED EO_DIR OR NOT EO_DIR)
MESSAGE(STATUS "EOdir already defined in as ${EO_DIR}")
ENDIF(NOT DEFINED EO_DIR OR NOT EO_DIR)
# Set the main paths
IF(NOT DEFINED EO_SRC_DIR)
SET(EO_SRC_DIR "${EO_DIR}/src")
ENDIF(NOT DEFINED EO_SRC_DIR)
IF(NOT DEFINED MO_SRC_DIR)
SET(MO_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
ENDIF(NOT DEFINED MO_SRC_DIR)
IF(NOT DEFINED MO_DOC_DIR)
SET(MO_DOC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/doc)
ENDIF(NOT DEFINED MO_DOC_DIR)
######################################################################################
######################################################################################
### 4) Paths checking
######################################################################################
IF(EXISTS ${EO_DIR})
MESSAGE (STATUS "Using ParadisEO-EO path: ${EO_DIR}")
ELSE(EXISTS ${EO_DIR})
MESSAGE (FATAL_ERROR "Could not find the ParadisEO-EO path: ${EO_DIR}. You should use : cmake . -DEOdir=<your path to paradiseo-eo>")
ENDIF(EXISTS ${EO_DIR})
# Is it an absolute path ?
IF(WIN32)
SET (ABSOLUTE_PATH_REGEX "^[A-Z]:|^[a-z]:")
ELSE(WIN32)
SET (ABSOLUTE_PATH_REGEX "^/")
ENDIF(WIN32)
IF(NOT ${EO_DIR} MATCHES "${ABSOLUTE_PATH_REGEX}")
MESSAGE (FATAL_ERROR "${EO_DIR} MUST BE an absolute path")
ENDIF(NOT ${EO_DIR} MATCHES "${ABSOLUTE_PATH_REGEX}")
IF(WIN32)
SET(EO_LIB_DIR "${EO_DIR}\\win\\lib\\")
ELSE(WIN32)
SET(EO_LIB_DIR "${EO_DIR}/src")
ENDIF(WIN32)
######################################################################################
######################################################################################
### 5) Where must cmake go now ?
######################################################################################
SUBDIRS(doc tutorial)
######################################################################################

View file

@ -0,0 +1,38 @@
### ParadisEO-MO Doc generation using Doxygen ###
# Find the Doxygen package - will set all the variables required to use Doxygen
FIND_PACKAGE(Doxygen)
IF (DOXYGEN_FOUND)
SET(MO_DOC_COMMENT "ParadisEO-MO framework documentation")
SET(DOXYGEN_INPUT "mo.doxyfile")
SET(DOXYGEN_OUTPUT "ParadisEO-MO documentation")
ADD_CUSTOM_COMMAND(
OUTPUT ${DOXYGEN_OUTPUT}
COMMAND ${CMAKE_COMMAND} -E echo_append "Building documentation from ${MO_DOC_DIR} ..."
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_INPUT}
COMMAND ${CMAKE_COMMAND} -E echo "Done."
WORKING_DIRECTORY ${MO_DOC_DIR}
COMMENT ${MO_DOC_COMMENT}
DEPENDS ${DOXYGEN_INPUT}
)
# The main target launched with "make doc"
ADD_CUSTOM_TARGET(doc DEPENDS ${DOXYGEN_OUTPUT})
# A forced additionnal target that generate the documentation in the current directory
ADD_CUSTOM_TARGET(doc_forced
COMMAND ${CMAKE_COMMAND} -E echo_append "Building documentation from current directory ..."
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_INPUT}
COMMAND ${CMAKE_COMMAND} -E echo " Done."
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
ELSE (DOXYGEN_FOUND)
MESSAGE(STATUS "Unable to generate the document, Doxygen package not found")
ENDIF (DOXYGEN_FOUND)

View file

@ -0,0 +1,16 @@
######################################################################################
### 2) Definitions (required for tsp target)
######################################################################################
SET(TSP_EXAMPLE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/examples/tsp CACHE PATH "TSP example directory")
######################################################################################
######################################################################################
### 2) Where must cmake go now ?
######################################################################################
SUBDIRS(examples Lesson1 Lesson2 Lesson3)
######################################################################################