CMakeLists.txt 6.87 KB
cmake_minimum_required(VERSION 2.6)

PROJECT(AMDA-Kernel)

SET(CPACK_PACKAGE_VERSION_MAJOR "3")
SET(CPACK_PACKAGE_VERSION_MINOR "6")
SET(CPACK_PACKAGE_VERSION_PATCH "0")

set(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/build/${CMAKE_BUILD_TYPE}/bin/)
set(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/build/${CMAKE_BUILD_TYPE}/lib/)
set(PLUGIN_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/build/${CMAKE_BUILD_TYPE}/plugin/)

set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${OPTION_SUP} -std=c++0x -fPIC -Wall -Wextra -ggdb -DLINUX -Dlinux -D_REENTRANT -malign-double -pthread")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}  ${OPTION_SUP} -fPIC -Wall -ggdb -DLINUX  -fPIC -Dlinux -D_REENTRANT -malign-double -pthread")

set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++0x -Wall -Wextra -fPIC -DLINUX -Dlinux -D_REENTRANT -malign-double -pthread -O3 -DNDEBUG")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_DEBUG}  ${OPTION_SUP} -fPIC -Wall -DLINUX -Dlinux -D_REENTRANT -malign-double -pthread")

set(Boost_USE_MULTITHREADED ON)

# Check some environment variables
if (EXISTS "$ENV{AMDA_COTS_DIR}")
    message("AMDA_COTS_DIR exists")
    set(AMDA_COTS_DIR "$ENV{AMDA_COTS_DIR}")
    set(USERLOCAL_ROOT "$ENV{AMDA_COTS_DIR}/local")
    set(AMDA_TOOLS_DIR "$ENV{AMDA_COTS_DIR}/tools")
    set(GCC_ROOT "$ENV{GCC_ROOT}")
    set(BOOST_ROOT "$ENV{BOOST_ROOT}")
    set(SONAR_ROOT "$ENV{AMDA_COTS_DIR}/tools/sonar")
    set(FITNESSE_ROOT "$ENV{AMDA_COTS_DIR}/tools/FitNesse")
else()
    message(FATAL_ERROR "AMDA_COTS_DIR NOT exists")
endif()

message("USERLOCAL_ROOT (AMDA COTS install directory) is defined as ${USERLOCAL_ROOT}")
message("GCC_ROOT (gcc install directory) is defined as ${GCC_ROOT}")
message("BOOST_ROOT (Boost install directory) is defined as ${BOOST_ROOT}")

if(NOT DEFINED ENV{DDSERVER_HOST_NAME})
    message(FATAL_ERROR "Missing DDSERVER_HOST_NAME definition")
endif()

set(DDSERVER_HOST_NAME "$ENV{DDSERVER_HOST_NAME}")

if(NOT DEFINED ENV{DDSERVER_PORT})
    message(FATAL_ERROR "Missing DDSERVER_PORT definition")
endif()

set(DDSERVER_PORT "$ENV{DDSERVER_PORT}")


#Find all packages
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/")

find_package( Boost 1.51 REQUIRED COMPONENTS program_options regex system filesystem thread iostreams)
find_package(Threads REQUIRED)
find_package( Boost COMPONENTS thread system REQUIRED)
find_package(cURL REQUIRED)
find_package(Archive REQUIRED)
find_package(Log4Cxx REQUIRED)
find_package(LibXML2 REQUIRED)
find_package(PLplot REQUIRED)
find_package(CDF REQUIRED)
find_package(NetCDF REQUIRED)
find_package(DDClientCpp REQUIRED)
find_package(Geopack REQUIRED)
find_package(CSlim)

get_filename_component(DDCLIENTLIB_DIR ${DDCLIENTLIBRARIES} PATH)

# Apply configuration
configure_file (
 "${CMAKE_SOURCE_DIR}/src/Common/AMDA-Kernel_Config.hh.in"
 "${CMAKE_SOURCE_DIR}/src/Common/AMDA-Kernel_Config.hh"
)

configure_file (
    "${CMAKE_SOURCE_DIR}/config/app/templates/spiceKernelConfig.xml.in"
    "${CMAKE_SOURCE_DIR}/config/app/spiceKernelConfig.xml"
)

foreach(environment debug release generate-paraminfo)
    configure_file (
        "${CMAKE_SOURCE_DIR}/config/app/templates/app.properties.${environment}.in"
        "${CMAKE_SOURCE_DIR}/app-${environment}/app.properties"
    )
    configure_file (
        "${CMAKE_SOURCE_DIR}/config/app/templates/DD.res.in"
        "${CMAKE_SOURCE_DIR}/app-${environment}/DD.res"
    )
    configure_file(
        "${CMAKE_SOURCE_DIR}/config/app/amda.properties"
        "${CMAKE_SOURCE_DIR}/app-${environment}/amda.properties"
        COPYONLY
    )
endforeach()

configure_file (
    "${CMAKE_SOURCE_DIR}/script/templates/amda-kernel-env.in"
    "${CMAKE_SOURCE_DIR}/script/amda-kernel-env"
    @ONLY
)

# Build AMDA Kernel
MESSAGE( STATUS "Build AMDA-Kernel Project" )

add_subdirectory(src/TimeUtil)
add_subdirectory(src/Common)
add_subdirectory(src/helpers)
add_subdirectory(src/Info)
add_subdirectory(src/Parameters)
add_subdirectory(src/XMLConfigurator)
add_subdirectory(src/XMLParameterConfigurator)
add_subdirectory(src/Plugins)
add_subdirectory(src/Main)
add_subdirectory(src/XMLRequest)
add_subdirectory(src/SpiceKernel)
add_subdirectory(src/amdaXMLRequestorTool)
add_subdirectory(src/amdaParameterGenerator)
add_subdirectory(src/amdaParameterInfo)
add_subdirectory(src/PostProcessing)
add_subdirectory(src/ParamOutputImpl/Download)
add_subdirectory(src/ParamOutputImpl/IntervalTrue)
add_subdirectory(src/ParamOutputImpl/DataMining)
add_subdirectory(src/ParamOutputImpl/Plot)
add_subdirectory(src/ParamOutputImpl/Statistic)
add_subdirectory(src/TimeTableCatalog)
add_subdirectory(src/TTOperations)
add_subdirectory(src/TTConversion)
add_subdirectory(src/ParamGetImpl/DDServerInterface)
add_subdirectory(src/ParamGetImpl/LocalFileInterface)
add_subdirectory(src/InternLib)
add_subdirectory(src/ExternLib/Deriv)
add_subdirectory(src/ExternLib/Magnitude)
add_subdirectory(src/ExternLib/Morschhauser)
add_subdirectory(src/ExternLib/Ram_Presure)
add_subdirectory(src/ExternLib/TimeShifted)
add_subdirectory(src/ExternLib/GetClbInfo)
add_subdirectory(src/ExternLib/GetClbInfoByIndex)
add_subdirectory(src/ExternLib/GetMavenStaticEnergy)
add_subdirectory(src/ExternLib/GetJunoJediEnergy)
add_subdirectory(src/ExternLib/EnergyBounds)
add_subdirectory(src/ExternLib/Boxcar)
add_subdirectory(src/ExternLib/SlidingAverage)
add_subdirectory(src/ExternLib/Merge)
add_subdirectory(src/ExternLib/els_calculate)
add_subdirectory(src/ExternLib/mexvex_els_decode)
add_subdirectory(src/ExternLib/mexvex_els_calculate)
add_subdirectory(src/ExternLib/mexvex_els_calculate_sum)
add_subdirectory(src/ExternLib/PlotCurves)
add_subdirectory(src/ExternLib/StatisticProcesses)
add_subdirectory(src/ExternLib/FramesTransformation)
add_subdirectory(src/ExternLib/sum_into_table_range)
add_subdirectory(src/ExternLib/EISCATDataFilter)
add_subdirectory(src/ExternLib/Tsyganenko96)
add_subdirectory(src/ExternLib/StatisticFunctions)
add_subdirectory(src/ExternLib/Fix)
add_subdirectory(src/ExternLib/Ceil)
add_subdirectory(src/ExternLib/Floor)
add_subdirectory(src/ExternLib/Sign)

IF ( CSLIM_FOUND )
    add_subdirectory(test/DD_Client/CSlimFixtures)
    add_subdirectory(test/CSlimTestServer)
ENDIF ()
    
IF(CMAKE_COMPILER_IS_GNUCC)
  SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fmessage-length=0")
ENDIF(CMAKE_COMPILER_IS_GNUCC)
IF(CMAKE_COMPILER_IS_GNUCXX)
  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmessage-length=0")
ENDIF(CMAKE_COMPILER_IS_GNUCXX)

SET(CMAKE_VERBOSE_MAKEFILE ON)

SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "AMDA-Kernel")
SET(CPACK_GENERATOR "STGZ;TGZ")
SET(CPACK_SOURCE_GENERATOR "TGZ")
SET(CPACK_PACKAGE_VENDOR "AKKA IS")
#SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/ReadMe.txt")
#SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}")
#SET(CPACK_STRIP_FILES "bin/MyExecutable")
#SET(CPACK_SOURCE_STRIP_FILES "")
SET(CPACK_PACKAGE_EXECUTABLES "roof" "FTP client")
INCLUDE(CPack)