2017-10-26 11:41:35 +02:00
|
|
|
cmake_minimum_required(VERSION 3.3)
|
2017-10-04 15:58:28 +02:00
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_CURRENT_SOURCE_DIR}/sc-components/cmake)
|
|
|
|
|
2018-03-28 10:29:45 +02:00
|
|
|
include(GitFunctions)
|
2017-10-04 15:58:28 +02:00
|
|
|
get_branch_from_git()
|
2017-08-27 12:10:38 +02:00
|
|
|
|
|
|
|
### set the directory names of the submodules
|
2017-10-04 15:58:28 +02:00
|
|
|
set(GIT_SUBMODULES elfio libGIS sc-components dbt-core)
|
2017-08-27 12:10:38 +02:00
|
|
|
set(GIT_SUBMODULE_DIR_sc-components .)
|
|
|
|
set(GIT_SUBMODULE_DIR_dbt-core .)
|
|
|
|
### set each submodules's commit or tag that is to be checked out
|
|
|
|
### (leave empty if you want master)
|
|
|
|
#set(GIT_SUBMODULE_VERSION_sc-comp 3af6b9836589b082c19d9131c5d0b7afa8ddd7cd)
|
2017-10-04 15:58:28 +02:00
|
|
|
set(GIT_SUBMODULE_BRANCH_sc-components ${GIT_BRANCH})
|
|
|
|
set(GIT_SUBMODULE_BRANCH_dbt-core ${GIT_BRANCH})
|
2017-08-27 12:10:38 +02:00
|
|
|
|
|
|
|
include(GNUInstallDirs)
|
2017-10-04 23:15:04 +02:00
|
|
|
include(Submodules)
|
2017-10-26 11:41:35 +02:00
|
|
|
include(Conan)
|
2017-08-27 12:10:38 +02:00
|
|
|
|
|
|
|
#enable_testing()
|
|
|
|
|
2017-10-26 11:41:35 +02:00
|
|
|
set(CMAKE_CXX_STANDARD 14)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
|
2017-12-31 11:56:09 +01:00
|
|
|
include(CheckCXXCompilerFlag)
|
|
|
|
CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
|
2018-07-10 18:25:14 +02:00
|
|
|
if(COMPILER_SUPPORTS_MARCH_NATIVE)
|
|
|
|
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
|
2017-12-31 11:56:09 +01:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
|
2018-07-10 18:25:14 +02:00
|
|
|
elseif(NOT(${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo"))
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
|
|
|
|
endif()
|
2017-12-31 11:56:09 +01:00
|
|
|
endif()
|
|
|
|
|
2017-08-27 12:10:38 +02:00
|
|
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
|
|
|
set(warnings "-Wall -Wextra -Werror")
|
2018-05-15 20:10:13 +02:00
|
|
|
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
|
|
|
|
set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG")
|
2017-08-27 12:10:38 +02:00
|
|
|
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
|
|
|
set(warnings "/W4 /WX /EHsc")
|
|
|
|
endif()
|
|
|
|
|
2017-10-26 11:41:35 +02:00
|
|
|
setup_conan()
|
|
|
|
|
2017-10-04 15:58:28 +02:00
|
|
|
find_package(Threads)
|
|
|
|
find_package(Tcmalloc)
|
2017-08-27 12:10:38 +02:00
|
|
|
|
2018-03-28 10:29:45 +02:00
|
|
|
set(PROJECT_3PARTY_DIRS external)
|
2017-10-04 23:15:04 +02:00
|
|
|
include(clang-format)
|
2017-09-22 11:23:23 +02:00
|
|
|
|
2017-08-27 12:10:38 +02:00
|
|
|
add_subdirectory(external)
|
|
|
|
add_subdirectory(dbt-core)
|
|
|
|
add_subdirectory(sc-components)
|
2018-04-24 10:26:55 +02:00
|
|
|
add_subdirectory(softfloat)
|
|
|
|
GET_DIRECTORY_PROPERTY(SOFTFLOAT_INCLUDE_DIRS DIRECTORY softfloat DEFINITION SOFTFLOAT_INCLUDE_DIRS)
|
2017-08-27 12:10:38 +02:00
|
|
|
add_subdirectory(riscv)
|
2017-09-21 20:29:23 +02:00
|
|
|
add_subdirectory(riscv.sc)
|
2018-07-28 09:45:49 +02:00
|
|
|
add_subdirectory(platform)
|
2017-10-26 11:41:35 +02:00
|
|
|
|
2018-07-10 18:25:14 +02:00
|
|
|
message(STATUS "Build Type: ${CMAKE_BUILD_TYPE}")
|