PySysC-SC/CMakeLists.txt

72 lines
2.1 KiB
CMake
Raw Normal View History

2019-01-01 12:19:44 +01:00
cmake_minimum_required(VERSION 3.3)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_CURRENT_SOURCE_DIR}/sc-components/cmake)
2018-11-30 11:08:08 +01:00
2021-03-13 14:57:31 +01:00
project(pysysc-sc)
2019-01-01 12:19:44 +01:00
set(ENABLE_SCV TRUE CACHE BOOL "Enable use of SCV")
set(ENABLE_SHARED TRUE CACHE BOOL "Build shared libraries")
include(GNUInstallDirs)
2018-11-30 11:08:08 +01:00
include(Conan)
2019-01-01 12:19:44 +01:00
include(BuildType)
2018-11-30 11:08:08 +01:00
2019-01-01 12:19:44 +01:00
#enable_testing()
2018-11-30 11:08:08 +01:00
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
2019-01-01 12:19:44 +01:00
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
if(COMPILER_SUPPORTS_MARCH_NATIVE)
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()
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(warnings "-Wall -Wextra -Werror")
set(CMAKE_CXX_FLAG_RELEASE "-O3 -DNDEBUG")
set(CMAKE_C_FLAG_RELEASE "-O3 -DNDEBUG")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set(warnings "/W4 /WX /EHsc")
endif()
setup_conan()
# This line finds the boost lib and headers.
2021-03-13 14:57:31 +01:00
set(Boost_NO_BOOST_CMAKE ON) # Don't do a find_package in config mode before searching for a regular boost install.
find_package(Boost COMPONENTS program_options system thread REQUIRED)
2019-01-01 12:19:44 +01:00
# set-up SystemC and SCV
2020-10-08 17:45:57 +02:00
find_package(OSCISystemC)
2019-01-01 12:19:44 +01:00
if(SystemC_FOUND)
include_directories(${SystemC_INCLUDE_DIRS})
link_directories(${SystemC_LIBRARY_DIRS})
else()
message( FATAL_ERROR "SystemC library not found." )
endif()
if(CCI_FOUND)
include_directories(${CCI_INCLUDE_DIRS})
link_directories(${CCI_LIBRARY_DIRS})
2020-10-08 17:45:57 +02:00
#else()
#message( FATAL_ERROR "SystemC CCI library not found." )
2019-01-01 12:19:44 +01:00
endif()
include(sc-components/cmake/clang-format.cmake)
2018-11-30 11:08:08 +01:00
2019-01-01 12:19:44 +01:00
add_subdirectory(sc-components)
add_subdirectory(components)
add_subdirectory(top)
2018-11-30 11:08:08 +01:00
# CTest is a testing tool that can be used to test your project.
# enable_testing()
# add_test(NAME example
# WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin
# COMMAND example)