Skip to content

How to generate module map for compilation database? #1979

Answered by dmpolukhin
Genomorf asked this question in Q&A
Discussion options

You must be logged in to vote

@Genomorf we use Python script that extracts all #include directives from the file, resolves them to real files using include paths from CDB, makes them relative to the directory where you will generate modulemap file like this:

module some_name_not_important {
  header "relative_file_path1"
  header "relative_file_path2"
  ...
  export *
}

Instead of implementing include resolver in a script you can add compiler option -H and run only preprocessor on the file and it will print include graph, files on the first level of the graph is what you need. After that you will need to inject the module and other options see full list on the last backup slide.

Unfortunately, other urgent things get…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Genomorf
Comment options

@dmpolukhin
Comment options

Answer selected by Genomorf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants