CMakeLists.txt 7.65 KB
cmake_minimum_required(VERSION 2.6)

if (DEFINED ENV{TREPS_INSTALL_DIR})
    message("TREPS_INSTALL_DIR is defined")
else()
    message( FATAL_ERROR "TREPS_INSTALL_DIR is NOT defined" )
endif()

SET(TREPS_KERNEL_VALIDATION false)
if (DEFINED ENV{TREPS_VALIDATION})
  if ("$ENV{TREPS_VALIDATION}" STREQUAL 1)
    message("Use TREPS Kernel Validation !")
    SET(TREPS_KERNEL_VALIDATION true)
  endif()
endif()

SET(TREPS_VERSION_MAJOR "1")
SET(TREPS_VERSION_MINOR "8")
SET(TREPS_VERSION_PATCH "0")

SET(TREPS_SONAR_PORT    "8090")
SET(TREPS_MYSQL_PORT    "3306")
SET(TREPS_FITNESSE_PORT "8081")

SET(TREPS_3DVIEW_BASEDIR "http://3dview.cdpp.eu")
SET(TREPS_3DVIEW_WSDL "${TREPS_3DVIEW_BASEDIR}/CdppServices?wsdl")

SET(TREPS_INSTALL_DIR       "$ENV{TREPS_INSTALL_DIR}")

SET(TREPS_COTS_INSTALL_DIR        "${TREPS_INSTALL_DIR}/bin/COTS")
SET(TREPS_GSOAP_INSTALL_DIR       "${TREPS_COTS_INSTALL_DIR}/gsoap")
SET(TREPS_LOG4CXX_INSTALL_DIR     "${TREPS_COTS_INSTALL_DIR}/log4cxx")
SET(TREPS_CPPUNIT_INSTALL_DIR     "${TREPS_COTS_INSTALL_DIR}/cppunit")
SET(TREPS_FILE_INSTALL_DIR        "${TREPS_COTS_INSTALL_DIR}/file")
SET(TREPS_NETCDF_INSTALL_DIR      "${TREPS_COTS_INSTALL_DIR}/netcdf")
SET(TREPS_CDF_INSTALL_DIR         "${TREPS_COTS_INSTALL_DIR}/cdf")
SET(TREPS_FITNESSE_INSTALL_DIR    "${TREPS_COTS_INSTALL_DIR}/fitnesse")
SET(TREPS_SONAR_INSTALL_DIR       "${TREPS_COTS_INSTALL_DIR}/sonar")
SET(TREPS_SONARRUNNER_INSTALL_DIR "${TREPS_COTS_INSTALL_DIR}/sonar-runner")
SET(TREPS_CPPCHECK_INSTALL_DIR    "${TREPS_COTS_INSTALL_DIR}/cppcheck")

SET(TREPS_KERNEL_SRC    "${CMAKE_SOURCE_DIR}")
SET(TREPS_CMAKE_MODULES "${CMAKE_SOURCE_DIR}/cmake/modules/")

project(TREPS-KERNEL)

execute_process(
 COMMAND ${TREPS_KERNEL_SRC}/scripts/generate3DViewSOAPClient.sh ${TREPS_GSOAP_INSTALL_DIR} ${TREPS_3DVIEW_WSDL} RESULT_VARIABLE ret_var
)
if (NOT "${ret_var}" STREQUAL 0)
    message( FATAL_ERROR "Unable to generate code for 3DView SOAP client!")
endif()

configure_file (
 "src/Common/TREPS_kernel_config.h.in"
 "src/Common/TREPS_kernel_config.h"
 @ONLY
)

configure_file (
 "scripts/framesUpdateList.sh.in"
 "scripts/framesUpdateList.sh"
)

configure_file (
 "test/Fitnesse/CSlimServer/CMakeLists.txt.in"
 "test/Fitnesse/CSlimServer/CMakeLists.txt"
 @ONLY
)

configure_file (
 "test/Fitnesse/FitNesseRoot/SuiteTests/content.txt.in"
 "test/Fitnesse/FitNesseRoot/SuiteTests/content.txt"
 @ONLY
)

configure_file (
 "test/Fitnesse/scripts/fitnesse_start_server.sh.in"
 "test/Fitnesse/scripts/fitnesse_start_server.sh"
 @ONLY
)

configure_file (
 "test/Fitnesse/scripts/fitnesse_run_suite.sh.in"
 "test/Fitnesse/scripts/fitnesse_run_suite.sh"
 @ONLY
)

configure_file (
 "test/Fitnesse/requests/request_newop_votable.xml.in"
 "test/Fitnesse/requests/request_newop_votable.xml"
 @ONLY
)

configure_file (
 "test/Fitnesse/requests/request_newop_ascii_1.xml.in"
 "test/Fitnesse/requests/request_newop_ascii_1.xml"
 @ONLY
)

configure_file (
 "test/Fitnesse/requests/request_newop_ascii_2.xml.in"
 "test/Fitnesse/requests/request_newop_ascii_2.xml"
 @ONLY
)

configure_file (
 "test/Fitnesse/requests/request_newop_ascii_nan.xml.in"
 "test/Fitnesse/requests/request_newop_ascii_nan.xml"
 @ONLY
)

configure_file (
 "test/Fitnesse/requests/request_newop_cdf.xml.in"
 "test/Fitnesse/requests/request_newop_cdf.xml"
 @ONLY
)

configure_file (
 "test/Fitnesse/requests/request_newop_netcdf.xml.in"
 "test/Fitnesse/requests/request_newop_netcdf.xml"
 @ONLY
)

configure_file (
 "test/Sonar/scripts/sonar_start_server.sh.in"
 "test/Sonar/scripts/sonar_start_server.sh"
 @ONLY
)

configure_file (
 "test/Sonar/scripts/sonar_stop_server.sh.in"
 "test/Sonar/scripts/sonar_stop_server.sh"
 @ONLY
)

configure_file (
 "test/Sonar/scripts/sonar_create_report.sh.in"
 "test/Sonar/scripts/sonar_create_report.sh"
 @ONLY
)

configure_file (
 "test/Sonar/conf/sonar-runner.properties.in"
 "test/Sonar/conf/sonar-runner.properties"
 @ONLY
)

configure_file (
 "test/Sonar/conf/sonar.properties.in"
 "test/Sonar/conf/sonar.properties"
 @ONLY
)

configure_file (
 "test/Sonar/conf/sonar-project.properties.in"
 "test/Sonar/conf/sonar-project.properties"
 @ONLY
)

set(EXECUTABLE_OUTPUT_PATH bin/${CMAKE_BUILD_TYPE})

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${TREPS_CMAKE_MODULES})

set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -fPIC -ggdb -DLINUX -Dlinux -D_REENTRANT -malign-double -O0")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}  -Wall -fPIC -DLINUX -Dlinux -D_REENTRANT -malign-double -O3 -DNDEBUG")


find_package(LibXML2 REQUIRED)

include_directories(
	${TREPS_LOG4CXX_INSTALL_DIR}/include
	${TREPS_CPPUNIT_INSTALL_DIR}/include
	${TREPS_FILE_INSTALL_DIR}/include
	${LIBXML2_INCLUDE_DIR}
	${TREPS_GSOAP_INSTALL_DIR}/include
	${TREPS_NETCDF_INSTALL_DIR}/include
	${TREPS_CDF_INSTALL_DIR}/include
)

link_directories(
	${TREPS_LOG4CXX_INSTALL_DIR}/lib
	${TREPS_CPPUNIT_INSTALL_DIR}/lib
	${TREPS_FILE_INSTALL_DIR}/lib
	${LIBXML2_LIBRARIES}
	${TREPS_GSOAP_INSTALL_DIR}/lib
	${TREPS_NETCDF_INSTALL_DIR}/lib
	${TREPS_CDF_INSTALL_DIR}/lib
)

file(
	GLOB_RECURSE
	source_files
	src/*
     	CDPP3DViewSOAPClient/*
)

add_executable(
	treps_kernel
	${source_files}
)

target_link_libraries(
	treps_kernel
	log4cxx
	cppunit
	xml2
	magic
	gsoap++
	netcdf
	cdf
)

install(TARGETS treps_kernel DESTINATION ${TREPS_INSTALL_DIR}/bin/kernel/)
install(DIRECTORY config DESTINATION ${TREPS_INSTALL_DIR}/bin/kernel/
	DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_WRITE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
install(DIRECTORY xsd DESTINATION ${TREPS_INSTALL_DIR}/bin/kernel/
	DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_WRITE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
install(DIRECTORY data DESTINATION ${TREPS_INSTALL_DIR}/bin/kernel/
	DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_WRITE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
install(PROGRAMS scripts/framesUpdateList.sh DESTINATION ${TREPS_INSTALL_DIR}/bin/kernel/scripts)
if (TREPS_KERNEL_VALIDATION)
    install(DIRECTORY test/Fitnesse/FitNesseRoot DESTINATION ${TREPS_INSTALL_DIR}/test/Fitnesse/
		DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_WRITE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
		FILE_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_WRITE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
    install(PROGRAMS test/Fitnesse/scripts/fitnesse_start_server.sh DESTINATION ${TREPS_INSTALL_DIR}/test/Fitnesse/scripts)
    install(PROGRAMS test/Fitnesse/scripts/fitnesse_run_suite.sh DESTINATION ${TREPS_INSTALL_DIR}/test/Fitnesse/scripts)
    install(DIRECTORY test/Fitnesse/requests DESTINATION ${TREPS_INSTALL_DIR}/test/Fitnesse/
	DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_WRITE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
    install(PROGRAMS test/Sonar/scripts/sonar_start_server.sh DESTINATION ${TREPS_INSTALL_DIR}/test/Sonar/scripts)
    install(PROGRAMS test/Sonar/scripts/sonar_stop_server.sh DESTINATION ${TREPS_INSTALL_DIR}/test/Sonar/scripts)
    install(PROGRAMS test/Sonar/scripts/sonar_create_report.sh DESTINATION ${TREPS_INSTALL_DIR}/test/Sonar/scripts)
    install(DIRECTORY test/Sonar/mysql DESTINATION ${TREPS_INSTALL_DIR}/test/Sonar/
	DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_WRITE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
    install(FILES test/Sonar/conf/sonar-runner.properties DESTINATION ${TREPS_SONARRUNNER_INSTALL_DIR}/conf/)
    install(FILES test/Sonar/conf/sonar.properties DESTINATION ${TREPS_SONAR_INSTALL_DIR}/conf/)
endif()