Generic RISC-V ISS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
2.0 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. cmake_minimum_required(VERSION 3.3)
  2. set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_CURRENT_SOURCE_DIR}/sc-components/cmake)
  3. include(GitFunctions)
  4. get_branch_from_git()
  5. ### set the directory names of the submodules
  6. set(GIT_SUBMODULES elfio libGIS sc-components dbt-core)
  7. set(GIT_SUBMODULE_DIR_sc-components .)
  8. set(GIT_SUBMODULE_DIR_dbt-core .)
  9. ### set each submodules's commit or tag that is to be checked out
  10. ### (leave empty if you want master)
  11. #set(GIT_SUBMODULE_VERSION_sc-comp 3af6b9836589b082c19d9131c5d0b7afa8ddd7cd)
  12. set(GIT_SUBMODULE_BRANCH_sc-components ${GIT_BRANCH})
  13. set(GIT_SUBMODULE_BRANCH_dbt-core ${GIT_BRANCH})
  14. include(GNUInstallDirs)
  15. include(Submodules)
  16. include(Conan)
  17. #enable_testing()
  18. set(CMAKE_CXX_STANDARD 14)
  19. set(CMAKE_CXX_STANDARD_REQUIRED ON)
  20. set(CMAKE_CXX_EXTENSIONS OFF)
  21. include(CheckCXXCompilerFlag)
  22. CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
  23. if(NOT(${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo") AND COMPILER_SUPPORTS_MARCH_NATIVE)
  24. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
  25. endif()
  26. if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
  27. set(warnings "-Wall -Wextra -Werror")
  28. set(CMAKE_CXX_FLAG_RELEASE "-O3 -DNDEBUG -D_GLIBCXX_USE_CXX11_ABI=0")
  29. set(CMAKE_C_FLAG_RELEASE "-O3 -DNDEBUG")
  30. set(CMAKE_CXX_FLAG_DEBUG "-Og -D_GLIBCXX_USE_CXX11_ABI=0")
  31. set(CMAKE_C_FLAG_DEBUG "-Og")
  32. elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
  33. set(warnings "/W4 /WX /EHsc")
  34. endif()
  35. setup_conan()
  36. find_package(Threads)
  37. find_package(Tcmalloc)
  38. set(PROJECT_3PARTY_DIRS external)
  39. include(clang-format)
  40. add_subdirectory(external)
  41. add_subdirectory(dbt-core)
  42. add_subdirectory(sc-components)
  43. add_subdirectory(softfloat)
  44. GET_DIRECTORY_PROPERTY(SOFTFLOAT_INCLUDE_DIRS DIRECTORY softfloat DEFINITION SOFTFLOAT_INCLUDE_DIRS)
  45. add_subdirectory(riscv)
  46. add_subdirectory(riscv.sc)
  47. message(STATUS "Build Type: ${CMAKE_BUILD_TYPE}")