reshapes build system to allow standalone C++ build as well as for PA

This commit is contained in:
Eyck Jentzsch 2023-05-12 09:44:08 +02:00
parent bd6a864bc5
commit 6b9d52ff80
4 changed files with 118 additions and 135 deletions

View File

@ -3,9 +3,10 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${C
project(TGFS-ISS VERSION 1.0.0 LANGUAGES CXX)
option(CODEGEN "enable generation of ISS code" ON)
set(CORE_NAME TGC_C CACHE STRING "The core to build the ISS for" )
set(WITH_LLVM FALSE CACHE BOOL "Build LLVM based backend")
if(CMAKE_PROJECT_NAME STREQUAL "TGFS-ISS")
option(USE_CWR_SYSTEMC "Build for PA SystemnC" OFF)
set(CORE_NAME TGC_C CACHE STRING "The core to build the ISS for" )
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@ -14,8 +15,6 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_INSTALL_RPATH "${ORIGIN}")
include(CheckCXXCompilerFlag)
include(GNUInstallDirs)
CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
if(COMPILER_SUPPORTS_MARCH_NATIVE)
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
@ -34,6 +33,7 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set(warnings "/W4 /WX /EHsc")
endif()
include(GNUInstallDirs)
include(ConanInline)
if(BUILD_SHARED_LIBS)
set(SHARED_FLAG "True")
@ -76,25 +76,17 @@ set(CONAN_PACKAGE_LIST
yaml-cpp/0.7.0
jsoncpp/1.9.5
)
set(CONAN_PACKAGE_OPTIONS fmt:header_only=True ${CONAN_BOOST_OPTIONS})
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
list(APPEND CONAN_PACKAGE_LIST tcc/0.9.27)
endif()
if(NOT USE_CWR_SYSTEMC AND NOT USE_NCSC_SYSTEMC AND NOT DEFINED ENV{SYSTEMC_HOME})
set(CONAN_PACKAGE_LIST ${CONAN_PACKAGE_LIST}
systemc/2.3.3
systemc-cci/1.0.0
)
set(CONAN_PACKAGE_OPTIONS ${CONAN_PACKAGE_OPTIONS}
systemc:shared=${SHARED_FLAG}
systemc-cci:shared=${SHARED_FLAG}
)
endif()
if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/dbt-rise-plugins)
list(APPEND CONAN_PACKAGE_OPTIONS lua:compile_as_cpp=False)
list(APPEND CONAN_PACKAGE_LIST lua/5.4.3)
endif()
conan_check()
conan_add_remote(NAME minres URL https://git.minres.com/api/packages/Tooling/conan)
# Boost on CentOS 7 quirks: the b2 of conan-center is build against a newer libstdc++ and therefore does not run
@ -116,6 +108,7 @@ conan_cmake_configure(REQUIRES ${CONAN_PACKAGE_LIST}
conan_cmake_autodetect(settings)
conan_install()
set(CONAN_CMAKE_SILENT_OUTPUT ON)
find_package(tcc QUIET)
find_package(elfio)
find_package(fmt)
@ -127,18 +120,8 @@ set(BOOST_ROOT ${CONAN_BOOST_ROOT})
find_package(Threads)
find_package(ZLIB)
include(clang-format)
set(ENABLE_CLANG_TIDY OFF CACHE BOOL "Add clang-tidy automatically to builds")
if (ENABLE_CLANG_TIDY)
find_program (CLANG_TIDY_EXE NAMES "clang-tidy" PATHS /usr/local/opt/llvm/bin )
if (CLANG_TIDY_EXE)
message(STATUS "clang-tidy found: ${CLANG_TIDY_EXE}")
set(CLANG_TIDY_CHECKS "-*,modernize-*")
set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_EXE};-checks=${CLANG_TIDY_CHECKS};-header-filter='${CMAKE_SOURCE_DIR}/*';-fix"
CACHE STRING "" FORCE)
else()
message(AUTHOR_WARNING "clang-tidy not found!")
set(CMAKE_CXX_CLANG_TIDY "" CACHE STRING "" FORCE) # delete it
if(USE_CWR_SYSTEMC)
include(SystemCPackage)
endif()
endif()

View File

@ -45,7 +45,7 @@ This ISS is based in DBT-RISE, a library to allow rapid ISS creation.
```
### Accellera SystemC build
### Standalone (C++) build
* start an out-of-source build:
@ -71,7 +71,7 @@ Assuming environment for Platform Architect is properly set up.
export CC=$COWAREHOME/SLS/linux/common/bin/gcc
export CXX=$COWAREHOME/SLS/linux/common/bin/g++
cmake -S . -B build/PA -DCMAKE_BUILD_TYPE=Debug -DUSE_CWR_SYSTEMC=ON \
-DBUILD_SHARED_LIBS=ON -DCODEGEN=OFF -DCMAKE_INSTALL_PREFIX=${TGFS_INSTALL_ROOT}
-DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=${TGFS_INSTALL_ROOT}
cmake --build build/PA --target install -j16
```

@ -1 +1 @@
Subproject commit afdf8fb97f7e8102ddc96129373a676cd0422bf0
Subproject commit 3bc4884a9d87a0a367ea462bdc455036cfa7e1ac

2
scc

@ -1 +1 @@
Subproject commit dfb06a90801b3a7e55b5d4a03d8f161a26063a1c
Subproject commit 20a555aab8c65cde95161862e6e06ce1a87abc3d