2018-03-28 10:29:45 +02:00
|
|
|
cmake_minimum_required(VERSION 3.3)
|
2017-08-27 12:10:38 +02:00
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/../cmake) # main (top) cmake dir
|
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) # project specific cmake dir
|
|
|
|
|
|
|
|
# CMake useful variables
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
|
|
|
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
|
|
|
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
|
|
|
|
|
|
|
|
# Set the name of your project here
|
|
|
|
project("riscv")
|
|
|
|
|
|
|
|
# Set the version number of your project here (format is MAJOR.MINOR.PATCHLEVEL - e.g. 1.0.0)
|
|
|
|
set(VERSION_MAJOR "0")
|
|
|
|
set(VERSION_MINOR "0")
|
|
|
|
set(VERSION_PATCH "1")
|
|
|
|
set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
|
|
|
|
|
|
|
|
include(Common)
|
|
|
|
|
|
|
|
## Git (and its revision)
|
|
|
|
find_package(Git QUIET) # if we don't find git or FindGit.cmake is not on the system we ignore it.
|
|
|
|
## The Git module will trigger a reconfiguration for each pull that will bring a new revision on the local repository
|
|
|
|
set (VCS_REVISION "-1")
|
|
|
|
if(GIT_FOUND)
|
|
|
|
include(GetGitRevisionDescription)
|
|
|
|
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
|
|
|
|
message(STATUS "GIT branch ${GIT_REFSPEC}")
|
|
|
|
message(STATUS "GIT revision ${GIT_SHA1}")
|
|
|
|
set (VCS_REVISION ${GIT_SHA1})
|
|
|
|
endif()
|
|
|
|
|
2018-04-06 02:45:11 +02:00
|
|
|
conan_basic_setup()
|
|
|
|
|
2017-08-27 12:10:38 +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.
|
|
|
|
find_package(Boost COMPONENTS program_options system thread REQUIRED)
|
|
|
|
|
|
|
|
find_package(LLVM REQUIRED CONFIG)
|
|
|
|
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
|
|
|
|
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
|
|
|
|
llvm_map_components_to_libnames(llvm_libs support core mcjit x86codegen x86asmparser)
|
|
|
|
|
|
|
|
# This sets the include directory for the reference project. This is the -I flag in gcc.
|
|
|
|
include_directories(
|
|
|
|
${PROJECT_SOURCE_DIR}/incl
|
2018-04-24 10:26:55 +02:00
|
|
|
${SOFTFLOAT_INCLUDE_DIRS}
|
2017-08-27 12:10:38 +02:00
|
|
|
${LLVM_INCLUDE_DIRS}
|
|
|
|
)
|
|
|
|
add_dependent_subproject(dbt-core)
|
|
|
|
add_dependent_subproject(sc-components)
|
|
|
|
include_directories(
|
|
|
|
${PROJECT_SOURCE_DIR}/incl
|
|
|
|
${PROJECT_SOURCE_DIR}/../external/elfio
|
|
|
|
${PROJECT_SOURCE_DIR}/../external/libGIS
|
|
|
|
${Boost_INCLUDE_DIRS}
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
# Mac needed variables (adapt for your needs - http://www.cmake.org/Wiki/CMake_RPATH_handling#Mac_OS_X_and_the_RPATH)
|
|
|
|
set(CMAKE_MACOSX_RPATH ON)
|
|
|
|
set(CMAKE_SKIP_BUILD_RPATH FALSE)
|
|
|
|
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
|
|
|
|
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
|
|
|
|
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
|
|
|
|
|
|
|
add_subdirectory(src)
|
|
|
|
|
|
|
|
#
|
|
|
|
# SYSTEM PACKAGING (RPM, TGZ, ...)
|
|
|
|
# _____________________________________________________________________________
|
|
|
|
|
|
|
|
#include(CPackConfig)
|
|
|
|
|
|
|
|
#
|
|
|
|
# CMAKE PACKAGING (for other CMake projects to use this one easily)
|
|
|
|
# _____________________________________________________________________________
|
|
|
|
|
|
|
|
#include(PackageConfigurator)
|