Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove automake flow #311

Open
aut0 opened this issue Mar 6, 2024 · 1 comment
Open

Remove automake flow #311

aut0 opened this issue Mar 6, 2024 · 1 comment
Assignees

Comments

@aut0
Copy link
Collaborator

aut0 commented Mar 6, 2024

Hi,

I think we should remove the automake flow.
Nobody wants to maintain it and cmake works well on all platforms anyways.

BR,
Lukas

@markfoodyburton
Copy link
Contributor

markfoodyburton commented Mar 21, 2024

The issue I have with cmake is that I think we should support two essentially different ways of working
1/ I want to build CCI, the examples, etc, using the 'upstream' SystemC
2/ I want to use CCI in a different environment where either
a) I've used 'typical' CMAKE processes to already pull in SystemC or
b) I'm using a 'legacy' flow using environment variables etc.

I would strongly recommend that if we're using CMAKE - internally to Accellera - we should use CMP to handle package management, this would give us the following 'boilerplate':

project(....)

include(FetchContent)

FetchContent_Declare(
  cpm-cmake
  GIT_REPOSITORY ${GITHUB}cpm-cmake/CPM.cmake.git
  GIT_SHALLOW True
  GIT_TAG v0.31.1
)
FetchContent_MakeAvailable(cpm-cmake)
include(${cpm-cmake_SOURCE_DIR}/cmake/CPM.cmake)
cpmaddpackage("${GITHUB}TheLartians/[email protected]")

# check if caller has already setup SystemC based on e.g. SYSTEMC_HOME
if(DEFINED ENV{SYSTEMC_HOME} OR DEFINED SYSTEMC_HOME)
  include(${PROJECT_SOURCE_DIR}/cmake/FindSystemC.cmake)
else ()
  cpmaddpackage(
    NAME SystemCLanguage
    GIT_REPOSITORY  ${GITHUB}accellera-official/systemc.git
    GIT_SHALLOW True
    GIT_TAG main....v3.0....
  )
endif()


...

packageproject(
   NAME "${PROJECT_NAME}"
   VERSION ${PROJECT_VERSION}
   NAMESPACE SomeNameSpace
   BINARY_DIR ${PROJECT_BINARY_DIR}
   INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include
   INCLUDE_DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
   VERSION_HEADER "${VERSION_HEADER_LOCATION}"
   COMPATIBILITY SameMajorVersion
)

As you can see, the boilerplate is really small, and the only thing you need to add are the specifics to the project in hand (in our case CCI). Indeed, this allows RapidJSON to be included (though I am in favour of forking that into CCI).

Using a combination of CMP and PackageProject means the CMakeLists.txt is kept short, but also, the PakcageProject means that the project is packaged in a very convenient way for others to use it.

We could 'replicate' all of this, but I dont see the point, it just gives us more to maintain.

In this 'boilerplate' I'm checking for SYSTEMC_HOME and that then relies on a FindSystemC.cmake. The 'downside' of this is that each and every SystemC components (CCI, SCP, or any 'user') would need to have a FindSystemC.cmake if they want to support the 'legacy' approach. I personally dont like that. Perhaps we could provide a single 'source' for that.

My suggestion would be - possibly - that we create a CMP recipe and 'publish' it to the CPM/examples
https://github.com/cpm-cmake/CPM.cmake/blob/master/examples/...

Actually there is a simpler approach, IF the cmake for systemc itself is sufficiently well setup (which it currently is probably not), then

if(DEFINED ENV{SYSTEMC_HOME} 
  cpmaddpackage(
    NAME SystemCLanguage
    SOURCE_DIR ENV{SYSTEMC_HOME}
    ....
  )
else ()
  cpmaddpackage(
    NAME SystemCLanguage
    GIT_REPOSITORY  ${GITHUB}accellera-official/systemc.git
    GIT_SHALLOW True
    GIT_TAG master
  )

Should work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants