update the build system: only basic build works
This commit is contained in:
parent
b0107e44da
commit
8a81bd2191
32 changed files with 244 additions and 377 deletions
|
|
@ -1,51 +1,5 @@
|
|||
############################################################################
|
||||
##########
|
||||
### 1) If you want to set your own variables in install.cmake and avoid the cmd line
|
||||
######################################################################################
|
||||
|
||||
INCLUDE(install.cmake OPTIONAL)
|
||||
|
||||
######################################################################################
|
||||
|
||||
######################################################################################
|
||||
### 2) Project properties
|
||||
######################################################################################
|
||||
|
||||
# Checks cmake version compatibility
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
||||
|
||||
PROJECT(EDO)
|
||||
|
||||
SET(PROJECT_VERSION_MAJOR 0)
|
||||
SET(PROJECT_VERSION_MINOR 1)
|
||||
SET(PROJECT_VERSION_PATCH 0)
|
||||
SET(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 3) Include useful features
|
||||
######################################################################################
|
||||
|
||||
# include useful features for cmake
|
||||
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/cmake/modules)
|
||||
|
||||
|
||||
INCLUDE(FindDoxygen)
|
||||
INCLUDE(FindPkgConfig)
|
||||
|
||||
IF( WITH_BOOST AND WITH_EIGEN )
|
||||
MESSAGE( "ERROR: You have to choose between Boost:ublas and Eigen, you cannot compile with both libraries" )
|
||||
SET(IS_FATAL 1)
|
||||
ELSEIF( NOT WITH_BOOST AND NOT WITH_EIGEN )
|
||||
#MESSAGE( "WARNING: Boost:ublas and Eigen are both deactivated, some features may lack." )
|
||||
# FIXME ideally, we would have a minimal implementation with STL vectors…
|
||||
MESSAGE( "FIXME: Boost:ublas and Eigen are both deactivated, too much features will lack, you should choose one." )
|
||||
SET(IS_FATAL 1)
|
||||
ENDIF()
|
||||
|
||||
IF(WITH_BOOST)
|
||||
IF(EDO_USE_LIB STREQUAL "UBlas")
|
||||
FIND_PACKAGE(Boost 1.33.0)
|
||||
IF( Boost_FOUND )
|
||||
INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIRS} )
|
||||
|
|
@ -54,7 +8,7 @@ IF(WITH_BOOST)
|
|||
MESSAGE( "ERROR: You asked for Boost:ublas but it has nost been found." )
|
||||
SET(IS_FATAL 1)
|
||||
ENDIF()
|
||||
ELSEIF( WITH_EIGEN )
|
||||
ELSEIF( EDO_USE_LIB STREQUAL "Eigen3" )
|
||||
# FIXME FindEigen3.cmake does not work
|
||||
#find_package(Eigen3)
|
||||
#include_directories(EIGEN3_INCLUDE_DIR)
|
||||
|
|
@ -65,100 +19,33 @@ ELSEIF( WITH_EIGEN )
|
|||
INCLUDE_DIRECTORIES( ${EIGEN3_INCLUDE_DIR} )
|
||||
ADD_DEFINITIONS( -DWITH_EIGEN )
|
||||
ELSE()
|
||||
MESSAGE( "ERROR: You asked for Eigen but it has nost been found." )
|
||||
MESSAGE( "ERROR: You asked for Eigen3 but it has nost been found." )
|
||||
SET(IS_FATAL 1)
|
||||
ENDIF()
|
||||
|
||||
ELSE()
|
||||
# FIXME ideally, we would have a minimal implementation with STL vectors…
|
||||
MESSAGE( "You must set EDO_USE_LIB to either 'UBlas' or 'Eigen3'." )
|
||||
SET(IS_FATAL 1)
|
||||
ENDIF()
|
||||
|
||||
FIND_PACKAGE(EO)
|
||||
|
||||
INCLUDE_DIRECTORIES(
|
||||
${EO_INCLUDE_DIRS}
|
||||
${MO_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
LINK_DIRECTORIES(
|
||||
${EO_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 4) Include header files path
|
||||
### Include subdirectories
|
||||
######################################################################################
|
||||
|
||||
INCLUDE_DIRECTORIES(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
add_subdirectory(doc)
|
||||
add_subdirectory(src)
|
||||
|
||||
######################################################################################
|
||||
if(ENABLE_CMAKE_TESTING)
|
||||
add_subdirectory(test)
|
||||
endif(ENABLE_CMAKE_TESTING)
|
||||
|
||||
if(ENABLE_CMAKE_EXAMPLE)
|
||||
if(${CMAKE_VERBOSE_MAKEFILE})
|
||||
message("EDO examples:")
|
||||
endif(${CMAKE_VERBOSE_MAKEFILE})
|
||||
add_subdirectory(tutorial)
|
||||
add_subdirectory(application)
|
||||
endif(ENABLE_CMAKE_EXAMPLE)
|
||||
|
||||
######################################################################################
|
||||
### 5) Set compiler definitions
|
||||
######################################################################################
|
||||
|
||||
IF(UNIX)
|
||||
# enable warnings
|
||||
ADD_DEFINITIONS( -Wall -W -Wextra )
|
||||
# ADD_DEFINITIONS( -Weffc++)
|
||||
# ADD_DEFINITIONS( -g3 )
|
||||
ENDIF()
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 6) Prepare some variables for CMAKE usage
|
||||
######################################################################################
|
||||
|
||||
# Empty source files, because we want to build a library
|
||||
SET(SAMPLE_SRCS)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 7) Now where we go ?
|
||||
######################################################################################
|
||||
|
||||
ADD_SUBDIRECTORY(src)
|
||||
ADD_SUBDIRECTORY(application)
|
||||
ADD_SUBDIRECTORY(test)
|
||||
ADD_SUBDIRECTORY(doc)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 8) Create executable, link libraries and prepare target
|
||||
######################################################################################
|
||||
|
||||
SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
|
||||
|
||||
LINK_DIRECTORIES(${LIBRARY_OUTPUT_PATH})
|
||||
|
||||
ADD_LIBRARY(edo STATIC ${SAMPLE_SRCS})
|
||||
INSTALL(TARGETS edo ARCHIVE DESTINATION lib COMPONENT libraries)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 9) Install pkg-config config file for EO
|
||||
######################################################################################
|
||||
|
||||
INSTALL(FILES edo.pc DESTINATION lib/pkgconfig COMPONENT headers)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 10) Include packaging
|
||||
######################################################################################
|
||||
|
||||
INCLUDE(Packaging.cmake)
|
||||
|
||||
######################################################################################
|
||||
|
|
|
|||
|
|
@ -1,35 +1,40 @@
|
|||
#######################################################################################
|
||||
### Doc generation using Doxygen
|
||||
#######################################################################################
|
||||
######################################################################################
|
||||
### 0) Documentation
|
||||
######################################################################################
|
||||
|
||||
IF (DOXYGEN_FOUND)
|
||||
SET(DOC_DIR ${CMAKE_BINARY_DIR}/doc CACHE PATH "documentation directory")
|
||||
SET(DOC_CONFIG_FILE "doxyfile" CACHE PATH "documentation configuration file")
|
||||
|
||||
# define the doc target
|
||||
IF (DOXYGEN_EXECUTABLE)
|
||||
ADD_CUSTOM_TARGET(doc
|
||||
COMMAND ${DOXYGEN_EXECUTABLE} ${DOC_CONFIG_FILE}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
ENDIF (DOXYGEN_EXECUTABLE)
|
||||
|
||||
# configure doxyfile file
|
||||
CONFIGURE_FILE(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/${DOC_CONFIG_FILE}.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${DOC_CONFIG_FILE}"
|
||||
if(DOXYGEN_FOUND)
|
||||
# Directory where the generation will be launched
|
||||
set(EDO_DOC_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "Documentation directory" FORCE)
|
||||
# Name of the doxygene configuration file
|
||||
set(EDO_DOC_CONFIG_FILE "edo.doxyfile" CACHE INTERNAL "Documentation configuration file")
|
||||
if(DOXYGEN_EXECUTABLE)
|
||||
# Creating the custom target
|
||||
if(UNIX AND NOT ${CMAKE_VERBOSE_MAKEFILE})
|
||||
add_custom_target(doc-edo
|
||||
COMMAND ${DOXYGEN_EXECUTABLE} ${EDO_DOC_CONFIG_FILE} 2> /dev/null > /dev/null
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
else(UNIX AND NOT ${CMAKE_VERBOSE_MAKEFILE})
|
||||
add_custom_target(doc-edo
|
||||
COMMAND ${DOXYGEN_EXECUTABLE} ${EDO_DOC_CONFIG_FILE}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
endif(UNIX AND NOT ${CMAKE_VERBOSE_MAKEFILE})
|
||||
endif(DOXYGEN_EXECUTABLE)
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${EDO_DOC_CONFIG_FILE}.cmake"
|
||||
"${EDO_DOC_DIR}/${EDO_DOC_CONFIG_FILE}")
|
||||
install(
|
||||
DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
DESTINATION local/share${INSTALL_SUB_DIR}/edo COMPONENT doc
|
||||
PATTERN "CMakeFiles" EXCLUDE
|
||||
PATTERN "cmake_install.cmake" EXCLUDE
|
||||
PATTERN "CTestTestfile.cmake" EXCLUDE
|
||||
PATTERN "Makefile" EXCLUDE
|
||||
PATTERN "edo.cfg" EXCLUDE
|
||||
PATTERN "edo.doxytag" EXCLUDE
|
||||
)
|
||||
else(DOXYGEN_FOUND)
|
||||
message(STATUS "Unable to generate the documentation, Doxygen package not found")
|
||||
endif(DOXYGEN_FOUND)
|
||||
|
||||
INSTALL(
|
||||
DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
DESTINATION share/edo COMPONENT libraries
|
||||
PATTERN "CMakeFiles" EXCLUDE
|
||||
PATTERN "cmake_install.cmake" EXCLUDE
|
||||
PATTERN "Makefile" EXCLUDE
|
||||
PATTERN "doxyfile" EXCLUDE
|
||||
)
|
||||
ELSE (DOXYGEN_FOUND)
|
||||
MESSAGE(STATUS "Unable to generate the documentation, Doxygen package not found")
|
||||
ENDIF (DOXYGEN_FOUND)
|
||||
|
||||
#######################################################################################
|
||||
|
|
|
|||
|
|
@ -2,14 +2,30 @@
|
|||
### 1) Set all needed source files for the project
|
||||
######################################################################################
|
||||
|
||||
FILE(GLOB HDRS *.h edo)
|
||||
INSTALL(FILES ${HDRS} DESTINATION include/edo COMPONENT headers)
|
||||
include_directories(${EO_SRC_DIR})
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
FILE(GLOB SOURCES *.cpp)
|
||||
set(EDO_LIB_OUTPUT_PATH ${EDO_BINARY_DIR}/lib)
|
||||
set(LIBRARY_OUTPUT_PATH ${EDO_LIB_OUTPUT_PATH})
|
||||
|
||||
SET(SAMPLE_SRCS ${SOURCES} PARENT_SCOPE)
|
||||
|
||||
######################################################################################
|
||||
### 3) Look for headers
|
||||
######################################################################################
|
||||
|
||||
file(GLOB HDRS edo)
|
||||
install(FILES ${HDRS} DESTINATION local/include${INSTALL_SUB_DIR}/edo COMPONENT headers)
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 4) Install directories
|
||||
######################################################################################
|
||||
|
||||
install(DIRECTORY utils
|
||||
DESTINATION local/include${INSTALL_SUB_DIR}/moeo
|
||||
COMPONENT headers
|
||||
FILES_MATCHING PATTERN "*.h"
|
||||
)
|
||||
|
||||
|
||||
######################################################################################
|
||||
|
|
|
|||
|
|
@ -1,14 +1,21 @@
|
|||
######################################################################################
|
||||
### 1) Set all needed source files for the project
|
||||
### 1) Include the sources
|
||||
######################################################################################
|
||||
|
||||
FILE(GLOB SOURCES *.cpp)
|
||||
|
||||
SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
|
||||
ADD_LIBRARY(edoutils ${SOURCES})
|
||||
INSTALL(TARGETS edoutils ARCHIVE DESTINATION lib COMPONENT libraries)
|
||||
|
||||
FILE(GLOB HDRS *.h utils)
|
||||
INSTALL(FILES ${HDRS} DESTINATION include/edo/utils COMPONENT headers)
|
||||
include_directories(${EO_SRC_DIR}/src)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
######################################################################################
|
||||
### 2) Define the target
|
||||
######################################################################################
|
||||
|
||||
set(EDOUTILS_LIB_OUTPUT_PATH ${EO_BIN_DIR}/lib)
|
||||
set(LIBRARY_OUTPUT_PATH ${EDOUTILS_LIB_OUTPUT_PATH})
|
||||
|
||||
file(GLOB SOURCES *.cpp)
|
||||
add_library(edoutils ${SOURCES})
|
||||
install(TARGETS edoutils ARCHIVE DESTINATION local/${LIB} COMPONENT libraries)
|
||||
|
||||
set(EDOUTILS_VERSION ${GLOBAL_VERSION})
|
||||
set_target_properties(edoutils PROPERTIES VERSION "${EDOUTILS_VERSION}")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue