git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@2710 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
quemy 2012-07-16 09:38:48 +00:00
commit e3a610506b
1731 changed files with 105122 additions and 63920 deletions

View file

@ -0,0 +1,94 @@
######################################################################################
### 0) Detect the configuration
######################################################################################
# Inspired by Boost and SFML CMake files
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(MACOSX 1)
# detect OS X version. (use '/usr/bin/sw_vers -productVersion' to extract V from '10.V.x'.)
execute_process (COMMAND /usr/bin/sw_vers -productVersion OUTPUT_VARIABLE MACOSX_VERSION_RAW)
string(REGEX REPLACE "10\\.([0-9]).*" "\\1" MACOSX_VERSION "${MACOSX_VERSION_RAW}")
if(${MACOSX_VERSION} LESS 5)
message(FATAL_ERROR "Unsupported version of OS X : ${MACOSX_VERSION_RAW}")
return()
endif()
endif()
# Determine architecture
include(CheckTypeSize)
check_type_size(void* SIZEOF_VOID_PTR)
if("${SIZEOF_VOID_PTR}" STREQUAL "4")
set(ARCH x86)
set(LIB lib32)
elseif("${SIZEOF_VOID_PTR}" STREQUAL "8")
set(ARCH x64)
set(LIB lib64)
else()
message(FATAL_ERROR "Unsupported architecture")
return()
endif()
######################################################################################
### 0) Define general CXX flags for DEBUG and RELEASE
######################################################################################
add_definitions(-DDEPRECATED_MESSAGES)
set(CMAKE_CXX_FLAGS_DEBUG "-Wunknown-pragmas -O0 -g -Wall -Wextra -ansi -pedantic -fopenmp -std=c++0x" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_RELEASE "-Wunknown-pragmas -O3 -fopenmp -std=c++0x" CACHE STRING "" FORCE)
######################################################################################
### 1) Define installation type
######################################################################################
if(INSTALL_TYPE STREQUAL full)
set(ENABLE_CMAKE_EXAMPLE "true" CACHE PATH "ParadisEO examples")
set(ENABLE_CMAKE_TESTING "true" CACHE PATH "ParadisEO tests")
elseif(INSTALL_TYPE STREQUAL min)
set(ENABLE_CMAKE_EXAMPLE "false" CACHE PATH "ParadisEO examples")
set(ENABLE_CMAKE_TESTING "false" CACHE PATH "ParadisEO tests")
endif()
######################################################################################
### 2) Define profiling flags
######################################################################################
if(PROFILING)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -pg --coverage" CACHE STRING "" FORCE)
set(ENABLE_CMAKE_TESTING "true" CACHE STRING "" FORCE)
endif(PROFILING)
######################################################################################
### 3) Testing part
######################################################################################
if(ENABLE_CMAKE_TESTING)
enable_testing()
include(CTest REQUIRED)
set(DEBUG "true" CACHE STRING "" FORCE)
endif(ENABLE_CMAKE_TESTING)
######################################################################################
### 4) Set DEBUG or RELEASE build type depending testing and profiling
######################################################################################
if(NOT DEFINED DEBUG)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
else( NOT DEFINED DEBUG OR DEFINED PREFIX )
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "" FORCE)
endif(NOT DEFINED DEBUG)
######################################################################################
### 5) Build examples ?
######################################################################################
set(ENABLE_CMAKE_EXAMPLE "true" CACHE PATH "ParadisEO examples")
######################################################################################
### 6) Determine prefix for installation
######################################################################################
if(UNIX)
set(INSTALL_SUB_DIR /paradiseo)
endif()

View file

@ -0,0 +1,38 @@
######################################################################################
### add_lesson(module target files)
### Macro to add a lesson to a specific module.
### Currently module must be "mo" or "moeo".
### The target name will be prefixed by module name.
### Paramaters files must have the same name as cpp file. No need to have a .param
### file. CMake will check if such a file exists.
######################################################################################
macro(add_lesson module target files)
foreach(i ${files})
if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${i}.param)
add_executable(${i} ${i}.cpp)
else(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${i}.param)
if(${CMAKE_VERBOSE_MAKEFILE})
message(STATUS "Copying ${i}.param")
endif(${CMAKE_VERBOSE_MAKEFILE})
execute_process(
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_CURRENT_SOURCE_DIR}/${i}.param
${CMAKE_CURRENT_BINARY_DIR}/${i}.param)
add_executable(${i}
${i}.cpp
${CMAKE_CURRENT_BINARY_DIR}/${i}.param)
endif(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${i}.param)
if(${module} MATCHES mo)
target_link_libraries(${i} eoutils ga eo)
elseif(${module} MATCHES moeo)
target_link_libraries(${i} moeo flowshop eo eoutils)
endif()
install(TARGETS ${i} RUNTIME DESTINATION share${INSTALL_SUB_DIR}/${module}/tutorial/${target} COMPONENT examples)
endforeach(i)
# Custom target
add_custom_target(${module}${target} DEPENDS
${files}
${files}.param)
endmacro()

View file

@ -0,0 +1,92 @@
######################################################################################
### 0) Set up components
######################################################################################
set(CPACK_COMPONENTS_ALL
libraries
headers
tests
examples
doc
)
set(CPACK_ALL_INSTALL_TYPES Minimal Full)
######################################################################################
### 1) Describing components
######################################################################################
set(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "Libraries")
set(CPACK_COMPONENT_LIBRARIES_DESCRIPTION "ParadisEO Libraries : EO, MO, MOEO")
set(CPACK_COMPONENT_LIBRARIES_INSTALL_TYPES Minimal Full)
set(CPACK_COMPONENT_LIBRARIES_REQUIRED)
set(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "Headers")
set(CPACK_COMPONENT_HEADERS_DESCRIPTION "C++ headers for using ParadisEO")
set(CPACK_COMPONENT_HEADERS_DEPENDS libraries)
set(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Minimal Full)
set(CPACK_COMPONENT_LIBRARIES_REQUIRED)
set(CPACK_COMPONENT_TESTS_DISPLAY_NAME "Tests")
set(CPACK_COMPONENT_TESTS_DESCRIPTION "Tests")
set(CPACK_COMPONENT_TESTS_DEPENDS libraries)
set(CPACK_COMPONENT_TESTS_INSTALL_TYPES Full)
set(CPACK_COMPONENT_EXAMPLES_DISPLAY_NAME "Examples")
set(CPACK_COMPONENT_EXAMPLES_DESCRIPTION "Examples and lessons")
set(CPACK_COMPONENT_EXAMPLES_DEPENDS libraries)
set(CPACK_COMPONENT_EXAMPLES_INSTALL_TYPES Full)
set(CPACK_COMPONENT_DOC_DISPLAY_NAME "Documentation")
set(CPACK_COMPONENT_DOC_DESCRIPTION "ParadisEO documentation")
set(CPACK_COMPONENT_DOC_INSTALL_TYPES Full)
######################################################################################
### 2) Set up general information about packaging
######################################################################################
# For more details: http://www.cmake.org/Wiki/CMake:Component_Install_With_CPack
#cpack package information
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README")
set(CPACK_PACKAGE_DESCRIPTION "ParadisEO is a white-box object-oriented framework dedicated to the flexible design of metaheuristics. This template-based, ANSI-C++ compliant computation library is portable across both Windows system and sequential platforms (Unix, Linux, Mac OS X, etc.). ParadisEO is distributed under the CeCill license and can be used under several environments.")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A Software Framework for Metaheuristics")
set(CPACK_PACKAGE_VENDOR "Inria")
set(CPACK_PACKAGE_CONTACT "paradiseo-help@lists.gforge.inria.fr")
set(CPACK_PACKAGE_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
set(CPACK_STRIP_FILES ${PACKAGE_NAME})
set(CPACK_SOURCE_STRIP_FILES "bin/${PROJECT_NAME}")
set(CPACK_PACKAGE_EXECUTABLES "${PROJECT_NAME}" "${PROJECT_NAME}")
set(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME} ${VERSION_MAJOR}.${VERSION_MINOR}")
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}-${ARCH}")
if(UNIX)
if(APPLE)
# Generators for Mac OS X
set(CPACK_BINARY_PACKAGEMARKER "ON")
set(CPACK_BINARY_TGZ "OFF")
set(CPACK_BINARY_STGZ "OFF")
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/mac.rtf")
else()
# Generators for Unix-like
set(CPACK_GENERATOR "DEB;RPM")
endif()
else(UNIX)
# Generator for Windows
set(CPACK_GENERATOR "NSIS")
endif()
######################################################################################
### 3) And finally, include cpack, this is the last thing to do.
######################################################################################
include(CPack)

View file

@ -0,0 +1,45 @@
######################################################################################
### Mrproper will delete all files and folders in build directory
######################################################################################
if(UNIX)
add_custom_target(mrproper COMMAND cd ${CMAKE_BINARY_DIR} && rm -rf *)
endif(UNIX)
######################################################################################
### Doc-all enable to build all documentations in one target
######################################################################################
if(DOXYGEN_FOUND AND DOXYGEN_EXECUTABLE)
add_custom_target(doc
COMMAND make doc-eo
COMMAND make doc-mo
COMMAND make doc-moeo
)
endif(DOXYGEN_FOUND AND DOXYGEN_EXECUTABLE)
######################################################################################
### Perform covering test if lcov is found
######################################################################################
if(PROFILING)
find_program(LCOV
NAMES lcov
PATHS
"/usr/local/bin /usr/bin [HKEY_LOCAL_MACHINE\\SOFTWARE\\Rational Software\\Purify\\Setup;InstallFolder] [HKEY_CURRENT_USER\\Software]"
DOC "Path to the memory checking command, used for memory error detection.")
if(LCOV)
add_custom_target(coverage
COMMAND make
COMMAND ctest
COMMAND lcov -d . -c -o output.info
COMMAND lcov -r output.info */tutorial* -o output.info
COMMAND lcov -r output.info /usr* -o output.info
COMMAND lcov -r output.info */test* -o output.info
COMMAND genhtml output.info -o coverage/ --highlight --legend
)
else(LCOV)
message(STATUS "Could NOT find Lcov")
endif(LCOV)
endif(PROFILING)

View file

@ -0,0 +1,87 @@
# File: FindParadiseo.cmake
# Version: 0.0.1
#
# The following variables are filled out:
# - PARADISEO_INCLUDE_DIRS
# - PARADISEO_LIBRARY_DIRS
# - PARADISEO_LIBRARIES
# - PARADISEO_FOUND
#
# Here are the components:
# - PyEO
# - es
# - ga
# - cma
#
# You can use FIND_PACKAGE( EO COMPONENTS ... ) to enable one or several components.
#
# Default enabled components
set(PARADISEO_LIBRARIES_TO_FIND eo eoutils cma es flowshop ga moeo)
# Use FIND_PACKAGE( Paradiseo COMPONENTS ... ) to enable modules
if(PARADISEO_FIND_COMPONENTS)
foreach(component ${PARADISEO_FIND_COMPONENTS})
string(TOUPPER ${component} _COMPONENT)
set(PARADISEO_USE_${_COMPONENT} 1)
endforeach(component)
endif(PARADISEO_FIND_COMPONENTS)
# Path
set(PARADISEO_PATHS
${PARADISEO_ROOT}
$ENV{PARADISEO_ROOT}
/usr/local/
/usr/
/sw # Fink
/opt/local/ # DarwinPorts
/opt/csw/ # Blastwave
/opt/
HKEY_CURRENT_USER\Software
HKEY_LOCAL_MACHINE\Software
)
# Set lib path
if(NOT PARADISEO_INCLUDE_DIRS)
find_path(
PARADISEO_INCLUDE_DIRS
PATH_SUFFIXES include
PATHS ${PARADISEO_PATHS}
)
endif(NOT PARADISEO_INCLUDE_DIRS)
# Set include path
if(NOT PARADISEO_LIBRARY_DIRS)
find_path(
PARADISEO_LIBRARY_DIRS
PATH_SUFFIXES lib
PATHS ${PARADISEO_PATHS}
)
endif(NOT PARADISEO_LIBRARY_DIRS)
if(NOT PARADISEO_LIBRARIES)
set(PARADISEO_LIBRARIES)
foreach(component ${PARADISEO_LIBRARIES_TO_FIND})
find_library(
PARADISEO_${component}_LIBRARY
NAMES ${component}
PATH_SUFFIXES lib64 lib
PATHS ${PARADISEO_PATHS}
)
if(PARADISEO_${component}_LIBRARY)
set(PARADISEO_LIBRARIES ${PARADISEO_LIBRARIES} ${PARADISEO_${component}_LIBRARY})
else(PARADISEO_${component}_LIBRARY)
message(FATAL_ERROR "${component} component not found.")
endif(PARADISEO_${component}_LIBRARY)
endforeach(component)
endif(NOT PARADISEO_LIBRARIES)
if(PARADISEO_INCLUDE_DIRS AND PARADISEO_LIBRARY_DIRS AND PARADISEO_LIBRARIES)
set(PARADISEO_FOUND 1)
mark_as_advanced(PARADISEO_FOUND)
mark_as_advanced(PARADISEO_INCLUDE_DIRS)
mark_as_advanced(PARADISEO_LIBRARY_DIRS)
mark_as_advanced(PARADISEO_LIBRARIES)
endif(PARADISEO_INCLUDE_DIRS AND PARADISEO_LIBRARY_DIRS AND PARADISEO_LIBRARIES)