@@ -265,7 +265,54 @@ namespace cudaq_internal::compiler {
265265}
266266```
267267
268- ## 5. Additional conventions
268+ ---
269+
270+ ## 5. Physical file layout
271+
272+ ### 5.1 Internal modules
273+
274+ Internal modules shall be laid out according to the following structure:
275+
276+ ``` text
277+ runtime
278+ ├── internal
279+ ├── compiler
280+ │ ├── CMakeLists.txt
281+ │ ├── *.cpp
282+ │ ├── include/cudaq_internal/compiler/*.h
283+ ├── device_code
284+ │ ├── CMakeLists.txt
285+ │ ├── *.cpp
286+ │ ├── include/cudaq_internal/device_code/*.h
287+ ```
288+
289+ Most noticeably, header files shall not be under a common include root.
290+ This is so that adding a dependency to a given module, using CMake ` target_link_libraries ` ,
291+ only gives visibility to the public headers of that module.
292+
293+ The concern for ` nvq++ ` users is different. The expectation is that ` nvq++ ` finds
294+ automatically all the required headers, even those from internal modules
295+ included transitively. We do not know ahead of time which headers will be used,
296+ and we do not expect users to provide this information, so we have to assume
297+ that all headers could be used.
298+
299+ CMake's ` INSTALL_INTERFACE ` and ` BUILD_INTERFACE ` will be leveraged to meet these
300+ requirements. They allow for a different header file layout for build and install
301+ environment.
302+
303+ Example:
304+
305+ ``` cmake
306+ target_include_directories(cudaq-mlir-runtime
307+ PUBLIC
308+ $<INSTALL_INTERFACE:include>
309+ $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/runtime/internal/compiler/include>
310+ PRIVATE .)
311+ ```
312+
313+ ---
314+
315+ ## 6. Additional conventions
269316
270317This documented primarily aims at defining conventions on APIs and modules.
271318Of particular relevance are the following rules from the LLVM coding standard
0 commit comments