From 67435271dcbc94446ab8333c96cd71277594b417 Mon Sep 17 00:00:00 2001 From: Henner Zeller Date: Thu, 8 Sep 2022 11:21:19 -0700 Subject: [PATCH 1/3] Streamline target include directories. Don't add includes that automatically are added by the subdirectory anyway. --- CMakeLists.txt | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0889065d34..a465cc7441 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -261,7 +261,9 @@ if (SURELOG_WITH_PYTHON) ) endif() -include_directories(${PROJECT_SOURCE_DIR}/include ${GENDIR}/include ${GENDIR}/src) +include_directories(${PROJECT_SOURCE_DIR}/include + ${GENDIR}/include + ${GENDIR}/src) # Put source code here, files that are generated at build time in # surelog_generated_SRC @@ -401,11 +403,7 @@ endforeach() add_library(surelog STATIC ${surelog_SRC} ${surelog_generated_SRC}) set_target_properties(surelog PROPERTIES PUBLIC_HEADER include/Surelog/surelog.h) -target_include_directories(surelog PRIVATE - third_party/antlr4/runtime/Cpp/runtime/src - third_party/flatbuffers/include - third_party/googletest/googletest/include - third_party/googletest/googlemock/include) + target_include_directories(surelog PUBLIC $) if (SURELOG_WITH_PYTHON) target_include_directories(surelog PUBLIC ${Python3_INCLUDE_DIRS}) # Keep this at the end @@ -454,6 +452,7 @@ target_link_libraries(surelog PUBLIC antlr4_static) if(SURELOG_USE_HOST_FLATBUFFERS) target_link_libraries(surelog PRIVATE PkgConfig::FLATBUFFERS) + target_include_directories(surelog PUBLIC ${FLATBUFFERS_INCLUDE_DIRS}) else() target_link_libraries(surelog PUBLIC flatbuffers) add_dependencies(surelog flatc) @@ -523,9 +522,6 @@ function(register_gtests) # Build binary, link all relevant libs and extract tests add_executable(${test_bin} EXCLUDE_FROM_ALL ${gtest_cc_file}) - target_include_directories(${test_bin} PRIVATE - ${PROJECT_SOURCE_DIR}/third_party/antlr4/runtime/Cpp/runtime/src - ${PROJECT_SOURCE_DIR}/third_party/flatbuffers/include) # For simplicity, we link the test with libsurelog, but there is of # course a lot unnecessary churn if headers are modified. # Often it is sufficient to just have a few depeendencies. @@ -642,8 +638,13 @@ install( EXPORT Surelog ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/surelog PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Surelog) +target_include_directories(surelog PRIVATE + third_party/antlr4/runtime/Cpp/runtime/src) if(NOT SURELOG_USE_HOST_FLATBUFFERS) + # TODO: should we even install these from third_party ? If it is + # always a static library, then it is an implementation detail + # of surelog. install( TARGETS flatbuffers EXPORT Surelog From 873e24127b34b52b4c9fd4a2ab63e2707318c05d Mon Sep 17 00:00:00 2001 From: Henner Zeller Date: Thu, 8 Sep 2022 11:23:55 -0700 Subject: [PATCH 2/3] Add more convenience tool dependencies for developers. Signed-off-by: Henner Zeller --- shell.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/shell.nix b/shell.nix index bd320da6be..7e734f64bf 100644 --- a/shell.nix +++ b/shell.nix @@ -27,8 +27,14 @@ pkgs.mkShell { time zlib + # Libraries for USE_HOST_* use + flatbuffers + capnproto + # Ease development ccache + ninja + clang-tools ]; shellHook = '' From 8bc4b694af049275c159bb7211f132a0305685e7 Mon Sep 17 00:00:00 2001 From: Henner Zeller Date: Thu, 8 Sep 2022 12:06:50 -0700 Subject: [PATCH 3/3] Fix test for empty string. Should always be str.empty() instead of str == "". Signed-off-by: Henner Zeller --- src/DesignCompile/UhdmWriter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DesignCompile/UhdmWriter.cpp b/src/DesignCompile/UhdmWriter.cpp index f76d55a461..9d714dd94c 100644 --- a/src/DesignCompile/UhdmWriter.cpp +++ b/src/DesignCompile/UhdmWriter.cpp @@ -2250,7 +2250,7 @@ void UhdmWriter::lateTypedefBinding(UHDM::Serializer& s, DesignComponent* mod, } } - if ((name == "") && (found == false)) { + if ((name.empty()) && (found == false)) { // Port .op({\op[1] ,\op[0] }) if (operation* op = any_cast(var)) { const typespec* baseTypespec = nullptr;