Skip to content
Snippets Groups Projects
Commit b05d6869 authored by Bienchen's avatar Bienchen
Browse files

Added configurational header, fixed some glitches in the CMake setup

parent b698f491
No related branches found
No related tags found
No related merge requests found
......@@ -6,11 +6,11 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake_support)
project(PROMOD3 CXX C)
include(PROMOD)
include(PROMOD3)
set(PROMOD3_VERSION_MAJOR 0)
set(PROMOD3_VERSION_MINOR 0)
set(PROMOD_VERSION_STRING ${PROMOD3_VERSION_MAJOR}.${PROMOD3_VERSION_MINOR})
set(PROMOD3_VERSION_STRING ${PROMOD3_VERSION_MAJOR}.${PROMOD3_VERSION_MINOR})
if (CMAKE_COMPILER_IS_GNUCXX)
exec_program(gcc ARGS --version OUTPUT_VARIABLE CMAKE_C_COMPILER_VERSION)
......@@ -57,12 +57,13 @@ endif()
include_directories(${Boost_INCLUDE_DIRS}
${OST_INCLUDE_DIR})
set(FILES_TO_BE_REMOVED ${CMAKE_SOURCE_DIR}/stage)
set(FILES_TO_BE_REMOVED ${PROJECT_BINARY_DIR}/stage)
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES
"${FILES_TO_BE_REMOVED}")
## sub dirs to be recognised by CMake
## e.g. add_subdirectory(src), subdirs have thier own CMakeLists.txt
add_subdirectory(config)
add_subdirectory(meld)
## report setup
......
......
......@@ -171,7 +171,7 @@ macro(module)
# deal with arguments
#-----------------------------------------------------------------------------
set(_ARGS "NAME;SOURCES;HEADERS;DEPENDS_ON;LINK;HEADER_OUTPUT_DIR;PREFIX")
set(_ARG_PREFIX promod)
set(_ARG_PREFIX promod3)
parse_argument_list(_ARG "${_ARGS}" "NO_STATIC" ${ARGN})
if (NOT _ARG_NAME)
message(FATAL_ERROR
......@@ -224,10 +224,10 @@ macro(module)
get_target_property(_DEFS ${_LIB_NAME} COMPILE_DEFINITIONS)
add_dependencies(${_LIB_NAME} create_stage)
set_target_properties(${_LIB_NAME} PROPERTIES
COMPILE_DEFINITIONS PROMOD_MODULE_${_UPPER_LIB_NAME})
COMPILE_DEFINITIONS PROMOD3_MODULE_${_UPPER_LIB_NAME})
set_target_properties(${_LIB_NAME} PROPERTIES
VERSION ${PROMOD_VERSION_STRING}
SOVERSION ${PROMOD_VERSION_MAJOR}.${PROMOD_VERSION_MINOR})
VERSION ${PROMOD3_VERSION_STRING}
SOVERSION ${PROMOD3_VERSION_MAJOR}.${PROMOD3_VERSION_MINOR})
set_target_properties(${_LIB_NAME} PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${LIB_STAGE_PATH}
ARCHIVE_OUTPUT_DIRECTORY ${LIB_STAGE_PATH}
......@@ -315,7 +315,7 @@ macro(executable)
if (ENABLE_STATIC AND _ARG_STATIC)
target_link_libraries(${_ARG_NAME} ${STATIC_LIBRARIES})
if (UNIX AND NOT APPLE)
if (PROMOD_GCC_45)
if (PROMOD3_GCC_45)
set_target_properties(${_ARG_NAME}
PROPERTIES LINK_SEARCH_END_STATIC TRUE
LINK_FLAGS "-static-libgcc -static-libstdc++ -static -pthread")
......@@ -504,7 +504,7 @@ macro(pymod)
#-----------------------------------------------------------------------------
# deal with arguments
#-----------------------------------------------------------------------------
set(_ARG_PREFIX promod)
set(_ARG_PREFIX promod3)
parse_argument_list(_ARG
"NAME;CPP;PY;LINK;OUTPUT_DIR;UI;PREFIX" "" ${ARGN})
if (NOT _ARG_NAME)
......@@ -615,12 +615,12 @@ add_custom_target(check)
add_custom_target(check_xml)
#-------------------------------------------------------------------------------
# promod_unittest
# promod3_unittest
#
# define a unit test
#-------------------------------------------------------------------------------
macro(promod_unittest)
set(_ARG_PREFIX promod)
macro(promod3_unittest)
set(_ARG_PREFIX promod3)
parse_argument_list(_ARG
"MODULE;PREFIX;SOURCES;LINK" "" ${ARGN})
set(_SOURCES ${_ARG_SOURCES})
......@@ -649,12 +649,12 @@ macro(promod_unittest)
target_link_libraries(${_test_name} ${BOOST_UNIT_TEST_LIBRARIES}
"${_ARG_PREFIX}_${_ARG_MODULE}")
add_custom_target("${_test_name}_run"
COMMAND PROMOD_ROOT=${STAGE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/${_test_name} || echo
COMMAND PROMOD3_ROOT=${STAGE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/${_test_name} || echo
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "running checks for module ${_ARG_MODULE}"
DEPENDS ${_test_name})
add_custom_target("${_test_name}_run_xml"
COMMAND PROMOD_ROOT=${STAGE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/${_test_name} --log_format=xml --log_level=all > ${_test_name}_log.xml || echo
COMMAND PROMOD3_ROOT=${STAGE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/${_test_name} --log_format=xml --log_level=all > ${_test_name}_log.xml || echo
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "running checks for module ${_ARG_MODULE}"
DEPENDS ${_test_name})
......@@ -686,8 +686,8 @@ macro(promod_unittest)
sh -c "${PY_TESTS_CMD} ${CMAKE_CURRENT_SOURCE_DIR}/${py_test} xml || echo"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "running checks ${py_test}" VERBATIM)
add_dependencies("${py_test}_run_xml" promod_scripts "_${_ARG_PREFIX}_${_ARG_MODULE}")
add_dependencies("${py_test}_run" promod_scripts "_${_ARG_PREFIX}_${_ARG_MODULE}")
add_dependencies("${py_test}_run_xml" promod3_scripts "_${_ARG_PREFIX}_${_ARG_MODULE}")
add_dependencies("${py_test}_run" promod3_scripts "_${_ARG_PREFIX}_${_ARG_MODULE}")
add_dependencies(check "${py_test}_run")
add_dependencies(check_xml "${py_test}_run_xml")
......@@ -703,7 +703,7 @@ endmacro()
#-------------------------------------------------------------------------------
# make sure the previously detected Python interpreter has the given module
#-------------------------------------------------------------------------------
macro(promod_find_python_module MODULE)
macro(promod3_find_python_module MODULE)
if (NOT PYTHON_MODULE_${MODULE})
message(STATUS "Searching for python module ${MODULE} for ${PYTHON_BINARY}")
execute_process(COMMAND ${PYTHON_BINARY} -c "import ${MODULE}"
......@@ -724,7 +724,7 @@ endmacro()
# it makes sure that boost python is linked against the same version of python
# that we are linking against.
#-------------------------------------------------------------------------------
macro(promod_match_boost_python_version)
macro(promod3_match_boost_python_version)
include(CheckCXXSourceRuns)
# this variable may either be a simple library path or list that contains
# different libraries for different build-options. For example:
......
......
add_subdirectory(src)
set(PROMOD3_CONFIG_HEADERS
config.hh
)
set(CONFIG_HH_FILE "${CMAKE_CURRENT_BINARY_DIR}/config.hh")
configure_file(config.hh.in ${CONFIG_HH_FILE})
add_custom_target(config_headers ALL)
copy_if_different("${CMAKE_CURRENT_BINARY_DIR}" "${HEADER_STAGE_PATH}/promod3"
"${PROMOD3_CONFIG_HEADERS}" "config_headers" config_headers)
install(FILES ${PROMOD3_CONFIG_HEADERS} DESTINATION "include/promod3/")
#ifndef PROMOD3_CONFIG_HH
#define PROMOD3_CONFIG_HH
/*
DO NOT EDIT the '.hh' file, it is processed from a template '.hh.in' by CMake.
*/
/* fetch version from top level CMakeLists.txt */
#define PROMOD3_VERSION_MAJOR @PROMOD3_VERSION_MAJOR@
#define PROMOD3_VERSION_MINOR @PROMOD3_VERSION_MINOR@
#define PROMOD3_VERSION_STRING "@PROMOD3_VERSION_STRING@"
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment