SystemC-Components-Test/CMakeLists.txt

86 lines
2.7 KiB
CMake
Raw Normal View History

2020-04-23 16:02:12 +02:00
cmake_minimum_required(VERSION 3.12)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_CURRENT_SOURCE_DIR}/sc-components/cmake)
2020-04-23 16:02:12 +02:00
project(SCC_Test)
set(ENABLE_SCV TRUE CACHE BOOL "Enable use of SCV")
2020-04-23 16:11:34 +02:00
2018-12-30 13:24:44 +01:00
set(ENABLE_SHARED TRUE CACHE BOOL "Build shared libraries")
2020-04-23 16:11:34 +02:00
2020-04-23 16:02:12 +02:00
set(NO_SUBMODULE_CHECK FALSE CACHE BOOL "Disable the submodule check")
2020-04-23 16:11:34 +02:00
include(GitFunctions)
get_branch_from_git()
2017-09-17 15:06:10 +02:00
### set the directory names of the submodules
set(GIT_SUBMODULES sc-components)
2017-09-17 15:06:10 +02:00
set(GIT_SUBMODULE_DIR_sc-components .)
### set each submodules's commit or tag that is to be checked out
### (leave empty if you want master)
2017-10-04 15:24:44 +02:00
#set(GIT_SUBMODULE_VERSION_sc-components 3af6b9836589b082c19d9131c5d0b7afa8ddd7cd)
set(GIT_SUBMODULE_BRANCH_sc-components ${GIT_BRANCH})
2017-09-17 15:06:10 +02:00
include(GNUInstallDirs)
2020-04-23 16:02:12 +02:00
if(NOT NO_SUBMODULE_CHECK)
include(Submodules)
endif()
include(Conan)
2018-12-30 13:24:44 +01:00
include(BuildType)
2017-09-17 15:06:10 +02:00
#enable_testing()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
2018-12-30 13:24:44 +01:00
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
2020-04-23 16:11:34 +02:00
if(COMPILER_SUPPORTS_MARCH_NATIVE)
2020-04-23 16:11:34 +02:00
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
elseif(NOT(${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo"))
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
endif()
endif()
2017-09-17 15:06:10 +02:00
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(warnings "-Wall -Wextra -Werror")
2018-12-30 13:24:44 +01:00
set(CMAKE_CXX_FLAG_RELEASE "-O3 -DNDEBUG")
set(CMAKE_C_FLAG_RELEASE "-O3 -DNDEBUG")
2017-09-17 15:06:10 +02:00
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set(warnings "/W4 /WX /EHsc")
endif()
setup_conan()
2017-09-18 07:30:54 +02:00
# This line finds the boost lib and headers.
set(Boost_NO_BOOST_CMAKE ON) # Don't do a find_package in config mode before searching for a regular boost install.
2018-09-14 19:28:36 +02:00
find_package(Boost COMPONENTS program_options filesystem system thread REQUIRED)
2017-09-18 07:30:54 +02:00
# set-up SystemC and SCV
2020-04-23 16:02:12 +02:00
find_package(OSCISystemC)
2020-04-23 16:11:34 +02:00
if(NOT SystemC_FOUND)
2017-09-18 07:30:54 +02:00
message( FATAL_ERROR "SystemC library not found." )
endif()
2017-09-17 15:06:10 +02:00
add_subdirectory(sc-components)
add_subdirectory(examples)
2020-04-23 16:02:12 +02:00
add_subdirectory(tests)
2017-09-18 07:30:54 +02:00
#
# SYSTEM PACKAGING (RPM, TGZ, ...)
# _____________________________________________________________________________
#include(CPackConfig)
#
# CMAKE PACKAGING (for other CMake projects to use this one easily)
# _____________________________________________________________________________
#include(PackageConfigurator)
#include(FeatureSummary)
#feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES PACKAGES_FOUND)