From 85f498bc0749ba8479357d96994c9b46d36c5a52 Mon Sep 17 00:00:00 2001 From: Johannes Stoelp Date: Sat, 4 Nov 2023 20:38:54 +0100 Subject: cmake: rename systemc files and fix Makefile --- cmake/CMakeLists-sysc-external.txt | 40 -------------------------------------- cmake/CMakeLists-sysc-fetch.txt | 20 ------------------- cmake/SystemC-external.cmake | 40 ++++++++++++++++++++++++++++++++++++++ cmake/SystemC-fetch.cmake | 20 +++++++++++++++++++ 4 files changed, 60 insertions(+), 60 deletions(-) delete mode 100644 cmake/CMakeLists-sysc-external.txt delete mode 100644 cmake/CMakeLists-sysc-fetch.txt create mode 100644 cmake/SystemC-external.cmake create mode 100644 cmake/SystemC-fetch.cmake (limited to 'cmake') diff --git a/cmake/CMakeLists-sysc-external.txt b/cmake/CMakeLists-sysc-external.txt deleted file mode 100644 index 8346c34..0000000 --- a/cmake/CMakeLists-sysc-external.txt +++ /dev/null @@ -1,40 +0,0 @@ -# Integrate SYSTEMC as external project. -# -# External projects are not available during cmake configuration step, but only -# during the build step. Therefore we must maintain some targets manually, -# representing the parts of the external project we want to use (eg library). - -include(ExternalProject) - -set(SYSTEMC_HOME ${CMAKE_BINARY_DIR}/deps/systemc) - -ExternalProject_Add( - systemc_external - GIT_REPOSITORY https://github.com/accellera-official/systemc - GIT_TAG master - GIT_SHALLOW ON - GIT_PROGRESS ON - CMAKE_ARGS - # Fwd cmake outer cmake args. - -DCMAKE_INSTALL_PREFIX=${SYSTEMC_HOME} - -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} - -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} - # SystemC specific args. - -DBUILD_SHARED_LIBS=OFF - -DENABLE_ASSERTIONS=ON - INSTALL_BYPRODUCTS - ${CMAKE_BINARY_DIR}/deps/systemc/lib/libsystemc.a -) - -# Define pseudo target (import lib) for usage in cmake. -add_library(SystemC::systemc STATIC IMPORTED GLOBAL) -add_dependencies(SystemC::systemc systemc_external) - -# Create include dir such that we can set include dir property below. -file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/deps/systemc/include) - -# Set library properties. -set_target_properties(SystemC::systemc PROPERTIES - IMPORTED_LOCATION ${SYSTEMC_HOME}/lib/libsystemc.a - INTERFACE_INCLUDE_DIRECTORIES ${SYSTEMC_HOME}/include -) diff --git a/cmake/CMakeLists-sysc-fetch.txt b/cmake/CMakeLists-sysc-fetch.txt deleted file mode 100644 index 4afd154..0000000 --- a/cmake/CMakeLists-sysc-fetch.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Integrate SYSTEMC as source project. -# -# FetchContent makes the dependency available during cmake configuration step -# and acts similar to *add_subdirectory*, that means all targets of the -# sub-project are available in the main project. -# -# NOTE: Target name must be unique across the main project and all sub-project, -# names may clash :^) - -include(FetchContent) - -FetchContent_Declare( - systemc - GIT_REPOSITORY https://github.com/accellera-official/systemc - GIT_TAG master - EXCLUDE_FROM_ALL -) - -# This makes all targets from the sub-project available. -FetchContent_MakeAvailable(systemc) diff --git a/cmake/SystemC-external.cmake b/cmake/SystemC-external.cmake new file mode 100644 index 0000000..8346c34 --- /dev/null +++ b/cmake/SystemC-external.cmake @@ -0,0 +1,40 @@ +# Integrate SYSTEMC as external project. +# +# External projects are not available during cmake configuration step, but only +# during the build step. Therefore we must maintain some targets manually, +# representing the parts of the external project we want to use (eg library). + +include(ExternalProject) + +set(SYSTEMC_HOME ${CMAKE_BINARY_DIR}/deps/systemc) + +ExternalProject_Add( + systemc_external + GIT_REPOSITORY https://github.com/accellera-official/systemc + GIT_TAG master + GIT_SHALLOW ON + GIT_PROGRESS ON + CMAKE_ARGS + # Fwd cmake outer cmake args. + -DCMAKE_INSTALL_PREFIX=${SYSTEMC_HOME} + -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} + -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} + # SystemC specific args. + -DBUILD_SHARED_LIBS=OFF + -DENABLE_ASSERTIONS=ON + INSTALL_BYPRODUCTS + ${CMAKE_BINARY_DIR}/deps/systemc/lib/libsystemc.a +) + +# Define pseudo target (import lib) for usage in cmake. +add_library(SystemC::systemc STATIC IMPORTED GLOBAL) +add_dependencies(SystemC::systemc systemc_external) + +# Create include dir such that we can set include dir property below. +file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/deps/systemc/include) + +# Set library properties. +set_target_properties(SystemC::systemc PROPERTIES + IMPORTED_LOCATION ${SYSTEMC_HOME}/lib/libsystemc.a + INTERFACE_INCLUDE_DIRECTORIES ${SYSTEMC_HOME}/include +) diff --git a/cmake/SystemC-fetch.cmake b/cmake/SystemC-fetch.cmake new file mode 100644 index 0000000..4afd154 --- /dev/null +++ b/cmake/SystemC-fetch.cmake @@ -0,0 +1,20 @@ +# Integrate SYSTEMC as source project. +# +# FetchContent makes the dependency available during cmake configuration step +# and acts similar to *add_subdirectory*, that means all targets of the +# sub-project are available in the main project. +# +# NOTE: Target name must be unique across the main project and all sub-project, +# names may clash :^) + +include(FetchContent) + +FetchContent_Declare( + systemc + GIT_REPOSITORY https://github.com/accellera-official/systemc + GIT_TAG master + EXCLUDE_FROM_ALL +) + +# This makes all targets from the sub-project available. +FetchContent_MakeAvailable(systemc) -- cgit v1.2.3