+ packaging + cmake files

This commit is contained in:
Caner Candan 2010-07-05 19:42:34 +02:00
commit 2b9402d3f5
3 changed files with 190 additions and 30 deletions

77
CMakeLists.txt Normal file
View file

@ -0,0 +1,77 @@
######################################################################################
### 1) Set the application properties
######################################################################################
# Checks cmake version compatibility
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(DO)
SET(PROJECT_VERSION_MAJOR 1)
SET(PROJECT_VERSION_MINOR 0)
SET(PROJECT_VERSION_PATCH 0)
SET(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
######################################################################################
######################################################################################
### 2) Include the install configuration file where are defined the main variables
######################################################################################
INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/install.cmake)
######################################################################################
#####################################################################################
### 3) Include required modules & utilities
#####################################################################################
INCLUDE(CMakeBackwardCompatibilityCXX)
#INCLUDE(FindDoxygen)
INCLUDE(CheckLibraryExists)
#INCLUDE(Dart OPTIONAL)
FIND_PACKAGE(Doxygen)
FIND_PACKAGE(MPI REQUIRED)
FIND_PACKAGE(Gnuplot REQUIRED)
# Set a special flag if the environment is windows (should do the same in a config.g file)
IF (WIN32)
ADD_DEFINITIONS(-D_WINDOWS=1)
ENDIF (WIN32)
######################################################################################
#####################################################################################
### 4) Manage the build type
#####################################################################################
INCLUDE(${CMAKE_SOURCE_DIR}/BuildConfig.cmake)
######################################################################################
######################################################################################
### 5) Now where we go ???
######################################################################################
# warning: you have to compile libraries before bopo sources because of dependencies.
ADD_SUBDIRECTORY(lib)
ADD_SUBDIRECTORY(doc)
ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(test)
ADD_SUBDIRECTORY(application)
######################################################################################
######################################################################################
### 6) Include packaging
######################################################################################
INCLUDE(Packaging.cmake)
######################################################################################

74
Packaging.cmake Normal file
View file

@ -0,0 +1,74 @@
######################################################################################
### 1) Check dependencies
######################################################################################
IF (NOT DEFINED PROJECT_NAME OR
NOT DEFINED PROJECT_VERSION_MAJOR OR
NOT DEFINED PROJECT_VERSION_MINOR OR
NOT DEFINED PROJECT_VERSION_PATCH OR
NOT DEFINED PROJECT_VERSION)
MESSAGE(FATAL_ERROR "Be sure you have defined PROJECT_NAME and PROJECT_VERSION*.")
ENDIF()
######################################################################################
######################################################################################
### 2) Set up components
######################################################################################
SET(CPACK_COMPONENTS_ALL libraries)
SET(CPACK_ALL_INSTALL_TYPES Full)
SET(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "Distribution Objects")
SET(CPACK_COMPONENT_LIBRARIES_DESCRIPTION "Distribution Objects library")
SET(CPACK_COMPONENT_LIBRARIES_GROUP "Devel")
SET(CPACK_COMPONENT_LIBRARIES_INSTALL_TYPES Full)
######################################################################################
######################################################################################
### 3) 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_PACKAGE_DESCRIPTION "Distribution Objects")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Distribution Objects")
SET(CPACK_PACKAGE_VENDOR "Thales")
SET(CPACK_PACKAGE_CONTACT "caner.candan@thalesgroup.com")
SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
SET(CPACK_STRIP_FILES ${PROJECT_NAME})
SET(CPACK_SOURCE_STRIP_FILES "bin/${PROJECT_NAME}")
SET(CPACK_PACKAGE_EXECUTABLES "${PROJECT_NAME}" "${PROJECT_NAME}")
SET(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
SET(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
SET(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME} ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
######################################################################################
######################################################################################
### 4) Set up debian packaging information
######################################################################################
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libstdc++6, libgcc1, libc6, libxml2, libmpich2-1.2")
SET(CPACK_DEBIAN_PACKAGE_SECTION "devel")
SET(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
######################################################################################
######################################################################################
### 5) And finally, include cpack, this is the last thing to do.
######################################################################################
INCLUDE(CPack)
######################################################################################

View file

@ -1,35 +1,44 @@
######################################################################################
### 1) Include useful packages
######################################################################################
FIND_PACKAGE(Boost 1.33.0 REQUIRED)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
######################################################################################
SET(RESOURCES
cma_sa.param
plot.py
######################################################################################
### 2) Include the sources
######################################################################################
INCLUDE_DIRECTORIES(
${PARADISEO_EO_SRC_DIR}/src
${PARADISEO_MO_SRC_DIR}/src
${PARADISEO_MOEO_SRC_DIR}/src
${PARADISEO_PEO_SRC_DIR}/src
${CMAKE_SOURCE_DIR}/src
${CMAKE_SOURCE_DIR}/lib/eometah
${CMAKE_SOURCE_DIR}/lib/nk-landscapes
${Boost_INCLUDE_DIRS}
)
FOREACH(file ${RESOURCES})
EXECUTE_PROCESS(
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_CURRENT_SOURCE_DIR}/${file}
${CMAKE_CURRENT_BINARY_DIR}/${file}
)
ENDFOREACH(file)
######################################################################################
ADD_EXECUTABLE(cma_sa main.cpp)
TARGET_LINK_LIBRARIES(cma_sa
${Boost_LIBRARIES}
BOPO
eoutils
pthread
moeo
eo
peo
rmc_mpi
eometah
nklandscapes
BOPO
#${MPICH2_LIBRARIES}
${LIBXML2_LIBRARIES}
${MPI_LIBRARIES}
)
######################################################################################
### 3) Define your target(s)
######################################################################################
SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
FILE(GLOB SOURCES *.cpp)
ADD_LIBRARY(${PROJECT_NAME} STATIC ${SOURCES})
# INSTALL(
# TARGETS ${LIBRARY_OUTPUT_PATH}/lib${PROJECT_NAME}.a
# DESTINATION lib
# COMPONENT libraries
# )
######################################################################################