Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F27036183
CMakeLists.txt
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Authored By
Unknown
Size
6 KB
Referenced Files
None
Subscribers
None
CMakeLists.txt
View Options
cmake_minimum_required(VERSION 3.3.0)
# Start project, set version here.
project("RoSA")
# NOTE: Adjust the variables version and release in docs/conf.py according to
# version changes here.
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_EXEC_BINARY_DIR ${ROSA_BINARY_DIR}/bin)
set(ROSA_LIBRARY_DIR ${ROSA_BINARY_DIR}/lib)
set(ROSA_INCLUDE_DIR ${ROSA_BINARY_DIR}/include)
set(ROSA_MAIN_MODULE_DIR ${ROSA_MAIN_SRC_DIR}/modules)
# Add some generic helpers.
include(AddCMakeTools)
# Set build options
option(ROSA_INCLUDE_TOOLS "Generate build targets for RoSA tools." ON)
option(ROSA_INCLUDE_EXAMPLES "Generate build targets for RoSA examples." ON)
option(ROSA_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
# Assertions are always enabled for Debug builds, this option is respected only
# for non-Debug builds.
option(ROSA_ENABLE_ASSERTIONS "Enable assertions for non-Debug builds." OFF)
option(ROSA_ENABLE_CLANG_TIDY "Run clang-tidy checks when building RoSA." OFF)
option(ROSA_INCLUDE_CLANG_FORMAT "Generate build target for formatting RoSA sources with clang-format." OFF)
option(ROSA_INCLUDE_DOCS "Generate build targets for RoSA documentation." ON)
option(ROSA_BUILD_DOCS "Build RoSA documentation." OFF)
option(ROSA_ENABLE_DOXYGEN "Use doxygen to generate RoSA API documentation." OFF)
option(ROSA_ENABLE_SPHINX "Use Sphinx to generate RoSA documentation." OFF)
set(ROSA_LOG_LEVEL "" CACHE STRING "Level of logging to be used.")
set(ROSA_INCLUDE_APPS "" CACHE STRING "Generate build targets for the defined RoSA applications.")
# All options referred to from HandleROSAOptions have to be specified
# BEFORE this include, otherwise options will not be correctly set on
# first cmake run
include(config-ix)
include(HandleROSAOptions)
# Configure the ROSA configuration header file.
if( NOT ROSA_LOG_LEVEL STREQUAL "")
if( ${ROSA_LOG_LEVEL} EQUAL 5 )
set(ROSA_LOG_LEVEL_INT -1)
else()
set(ROSA_LOG_LEVEL_INT ${ROSA_LOG_LEVEL})
endif()
else()
set(ROSA_LOG_LEVEL_INT -1)
endif()
configure_file(
${ROSA_MAIN_INCLUDE_DIR}/rosa/config/rosa_config.h.cmake
${ROSA_INCLUDE_DIR}/rosa/config/rosa_config.h
)
# Handling modules
configure_file(
${ROSA_MAIN_MODULE_DIR}/cxxopts/include/cxxopts.hpp
${ROSA_INCLUDE_DIR}/cxxopts/cxxopts.hpp
COPYONLY
)
# They are not referenced. See set_output_directory().
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${ROSA_EXEC_BINARY_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${ROSA_LIBRARY_DIR})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${ROSA_LIBRARY_DIR})
# Set include directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
include_directories(${ROSA_INCLUDE_DIR} ${ROSA_MAIN_INCLUDE_DIR})
# 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)
add_subdirectory(apps)
add_subdirectory(modules)
if( ROSA_INCLUDE_TOOLS )
add_subdirectory(tools)
endif()
if( ROSA_INCLUDE_EXAMPLES )
add_subdirectory(examples)
endif()
if( ROSA_INCLUDE_DOCS )
add_subdirectory(docs)
endif()
#TODO: install?
# Print summary
set(ROSA_ENABLE_ASSERTIONS_STR "OFF")
if( ROSA_ENABLE_ASSERTIONS_INT EQUAL 1 )
set(ROSA_ENABLE_ASSERTIONS_STR "ON")
endif()
set(LOG_LEVEL_STR "disabled")
if( NOT ROSA_LOG_LEVEL STREQUAL "" )
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")
elseif( ${ROSA_LOG_LEVEL} EQUAL 5 )
set(LOG_LEVEL_STR "disabled")
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_STR}"
"\nClang-tidy: ${ROSA_ENABLE_CLANG_TIDY}"
"\nClang-format: ${ROSA_INCLUDE_CLANG_FORMAT}"
"\nLog level: ${LOG_LEVEL_STR}"
"\n"
"\nBuild apps: ${ROSA_INCLUDE_APPS}"
"\nBuild tools: ${ROSA_INCLUDE_TOOLS}"
"\nBuild examples: ${ROSA_INCLUDE_EXAMPLES}"
"\nInclude docs: ${ROSA_INCLUDE_DOCS}"
"\nBuild docs: ${ROSA_BUILD_DOCS}"
"\n -enable doxygen: ${ROSA_ENABLE_DOXYGEN}"
"\n -enable Sphinx: ${ROSA_ENABLE_SPHINX}"
"\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_EXEC_BINARY_DIR}"
"\nLibrary path: ${ROSA_LIBRARY_DIR}"
"\nGenerator: ${CMAKE_GENERATOR}"
"\n"
"\n===========================================================\n")
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Oct 27, 7:39 PM (1 d, 11 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
407462
Default Alt Text
CMakeLists.txt (6 KB)
Attached To
Mode
R20 SoC_Rosa_repo
Attached
Detach File
Event Timeline