Page MenuHomePhorge

CMakeLists.txt
No OneTemporary

Size
4 KB
Referenced Files
None
Subscribers
None

CMakeLists.txt

cmake_minimum_required(VERSION 2.8.8)
# Start project, set version here.
project("RoSA")
set(ROSA_VERSION_MAJOR 0)
set(ROSA_VERSION_MINOR 1)
set(ROSA_VERSION_PATCH 0)
# Add path for custom modules
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
)
# Package information
if( NOT PACKAGE_VERSION )
set(PACKAGE_VERSION "${ROSA_VERSION_MAJOR}.${ROSA_VERSION_MINOR}.${ROSA_VERSION_PATCH}")
endif()
set(PACKAGE_NAME "Research on Self-Awareness Framework")
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
set(PACKAGE_BUGREPORT "david.juhasz@tuwien.ac.at")
#TODO: cpack?
# Sanity check we are to make out-of-tree build
if( CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR )
message(FATAL_ERROR "In-source builds are not allowed.")
endif()
string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
# Set various paths
set(ROSA_MAIN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(ROSA_MAIN_INCLUDE_DIR ${ROSA_MAIN_SRC_DIR}/include)
set(ROSA_MAIN_BIN_DIR ${ROSA_MAIN_SRC_DIR}/bin)
set(ROSA_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
set(ROSA_RUNTIME_OUTPUT_INTDIR ${ROSA_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
set(ROSA_LIBRARY_OUTPUT_INTDIR ${ROSA_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib)
set(ROSA_TOOLS_BINARY_DIR ${ROSA_RUNTIME_OUTPUT_INTDIR})
set(ROSA_LIBRARY_DIR ${ROSA_LIBRARY_OUTPUT_INTDIR})
set(ROSA_INCLUDE_DIR ${ROSA_BINARY_DIR}/include)
# Set build options
option(ROSA_INCLUDE_TOOLS "Generate build targets for RoSA tools." ON)
option(ROSA_INCLUDE_EXAMPLES "Generate build target for RoSA examples." ON)
option(ROSA_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
if( NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" )
option(ROSA_ENABLE_ASSERTIONS "Enable assertions." OFF)
else()
option(ROSA_ENABLE_ASSERTIONS "Enable assertions." ON)
endif()
include(HandleROSAOptions)
# Configure the ROSA configuration header file.
if( ROSA_LOG_LEVEL )
set(ROSA_LOG_LEVEL_INT ${ROSA_LOG_LEVEL})
else()
set(ROSA_LOG_LEVEL_INT -1)
endif()
macro(to_int_value name)
if(${name})
set(${name}_INT 1)
else()
set(${name}_INT -1)
endif()
endmacro()
to_int_value(ROSA_ENABLE_ASSERTIONS)
configure_file(
${ROSA_MAIN_INCLUDE_DIR}/rosa/config/rosa_config.h.cmake
${ROSA_INCLUDE_DIR}/rosa/config/rosa_config.h
)
# They are not referenced. See set_output_directory().
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${ROSA_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${ROSA_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${ROSA_BINARY_DIR}/lib)
# Set include directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
include_directories(${ROSA_INCLUDE_DIR} ${ROSA_MAIN_INCLUDE_DIR})
# Set extra compiler options for Visual Studio
if ( MSVC )
add_definitions(-EHsc) # Use Exception Handling
endif()
# Set up YCM
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
message("Set compilation_database_folder in .ymc_extra_conf.py in the source directory if you want to use YMC.")
# Add parts of the project
include(AddROSATools)
add_subdirectory(lib)
if( ROSA_INCLUDE_TOOLS )
add_subdirectory(tools)
endif()
if( ROSA_INCLUDE_EXAMPLES )
add_subdirectory(examples)
endif()
#TODO: install?
# Print summary
set(LOG_LEVEL_STR "none")
if(ROSA_LOG_LEVEL)
if(${ROSA_LOG_LEVEL} EQUAL 0)
set(LOG_LEVEL_STR "ERROR")
elseif(${ROSA_LOG_LEVEL} EQUAL 1)
set(LOG_LEVEL_STR "WARNING")
elseif(${ROSA_LOG_LEVEL} EQUAL 2)
set(LOG_LEVEL_STR "INFO")
elseif(${ROSA_LOG_LEVEL} EQUAL 3)
set(LOG_LEVEL_STR "DEBUG")
elseif(${ROSA_LOG_LEVEL} EQUAL 4)
set(LOG_LEVEL_STR "TRACE")
else()
set(LOG_LEVEL_STR "invalid")
endif()
endif()
message(STATUS
"\n====================| Build Summary |===================="
"\n"
"\nRoSA version: ${PACKAGE_VERSION}"
"\n"
"\nBuild type: ${CMAKE_BUILD_TYPE}"
"\nAssertions: ${ROSA_ENABLE_ASSERTIONS}"
"\nLog level: ${LOG_LEVEL_STR}"
"\n"
"\nBuild tools: ${ROSA_INCLUDE_TOOLS}"
"\nBuild examples: ${ROSA_INCLUDE_EXAMPLES}"
"\n"
"\nCC: ${CMAKE_C_COMPILER}"
"\nCFLAGS: ${CMAKE_C_FLAGS}"
"\nCXX: ${CMAKE_CXX_COMPILER}"
"\nCXXFLAGS: ${CMAKE_CXX_FLAGS}"
"\nLIBRARIES: ${LD_FLAGS}"
"\n"
"\nSource directory: ${ROSA_MAIN_SRC_DIR}"
"\nBuild directory: ${ROSA_BINARY_DIR}"
"\nExecutable path: ${ROSA_TOOLS_BINARY_DIR}"
"\nLibrary path: ${ROSA_LIBRARY_DIR}"
"\nGenerator: ${CMAKE_GENERATOR}"
"\n"
"\n===========================================================\n")

File Metadata

Mime Type
text/plain
Expires
Sun, Apr 12, 11:40 AM (1 d, 11 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
307227
Default Alt Text
CMakeLists.txt (4 KB)

Event Timeline