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

Propagate def files upwards in the correct order from extensions/modules #3744

Merged
merged 1 commit into from
Dec 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions backends/p4tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,13 @@ set(ENABLE_TESTING ON)
# Include sub projects.
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/common)


# Custom IR constructs for P4Tools.
set(IR_DEF_FILES ${IR_DEF_FILES} ${CMAKE_CURRENT_SOURCE_DIR}/common/testgen.def)

file(GLOB tools_modules RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/modules ${CMAKE_CURRENT_SOURCE_DIR}/modules/*)
foreach(ext ${tools_modules})
set (tools_dir ${CMAKE_CURRENT_SOURCE_DIR}/modules/${ext})
set(tools_dir ${CMAKE_CURRENT_SOURCE_DIR}/modules/${ext})
if(EXISTS ${tools_dir}/CMakeLists.txt AND IS_DIRECTORY ${tools_dir})
# Generate an option that makes it possible to disable this extension.
string(MAKE_C_IDENTIFIER ${ext} EXT_AS_IDENTIFIER)
Expand All @@ -102,5 +106,5 @@ foreach(ext ${tools_modules})
endif()
endforeach(ext)

# Custom IR constructs for P4Tools.
set(IR_DEF_FILES ${IR_DEF_FILES} ${CMAKE_CURRENT_SOURCE_DIR}/common/testgen.def PARENT_SCOPE)
# Propagate new def files upwards after all modules have been included.
set(IR_DEF_FILES ${IR_DEF_FILES} PARENT_SCOPE)
3 changes: 3 additions & 0 deletions backends/p4tools/modules/testgen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ foreach(ext ${testgen_targets})
endif()
endforeach(ext)

# Propagate def files set by target extensions upwards.
set(IR_DEF_FILES ${IR_DEF_FILES} PARENT_SCOPE)

# Convert the list of files into #includes
foreach(include_file ${include_files})
endforeach()
Expand Down