diff --git a/CMakeLists.txt b/CMakeLists.txt index 4389b88..2cdc3b4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,6 +98,11 @@ else() message("liblldb not found. Building juCi++ without debugging support") endif() +if(CMAKE_SYSTEM_NAME MATCHES .*BSD|DragonFly) + add_definitions(-DJUCI_USE_UCTAGS) # See https://svnweb.freebsd.org/ports?view=revision&revision=452957 + add_definitions(-DJUCI_USE_GREP_EXCLUDE) # --exclude-dir is not an argument in bsd grep +endif() + # For both src and tests targets include_directories( ${Boost_INCLUDE_DIRS} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 222a7aa..3868f55 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -65,7 +65,6 @@ if(APPLE) target_link_libraries(juci "-framework Foundation -framework AppKit") endif() - install(TARGETS juci RUNTIME DESTINATION bin) if(${CMAKE_SYSTEM_NAME} MATCHES Linux|.*BSD|DragonFly) install(FILES "${CMAKE_SOURCE_DIR}/share/juci.desktop" diff --git a/src/files.h b/src/files.h index 1d7eb7c..dba4935 100644 --- a/src/files.h +++ b/src/files.h @@ -191,8 +191,15 @@ const std::string default_config_file = R"RAW({ "default_build_management_system_comment": "Select which build management system to use when creating a new C or C++ project, for instance \"cmake\" or \"meson\"", "default_build_management_system": "cmake", "save_on_compile_or_run": true, - "clear_terminal_on_compile": true, - "ctags_command": "ctags", + "clear_terminal_on_compile": true,)RAW" +#ifdef JUCI_USE_UCTAGS + R"RAW( + "ctags_command": "uctags",)RAW" +#else + R"RAW( + "ctags_command": "ctags",)RAW" +#endif + R"RAW( "grep_command": "grep", "python_command": "PYTHONUNBUFFERED=1 python", "markdown_command": "grip -b" diff --git a/src/grep.cc b/src/grep.cc index 44dd983..ff67ba1 100644 --- a/src/grep.cc +++ b/src/grep.cc @@ -6,11 +6,20 @@ Grep::Grep(const boost::filesystem::path &path, const std::string &pattern, bool case_sensitive, bool extended_regex) { auto build = Project::Build::create(path); +#ifdef JUCI_USE_GREP_EXCLUDE + std::string exclude = "--exclude=node_modules/*"; +#else std::string exclude = "--exclude-dir=node_modules"; +#endif if(!build->project_path.empty()) { project_path = build->project_path; +#ifdef JUCI_USE_GREP_EXCLUDE + exclude += " --exclude=" + filesystem::escape_argument(filesystem::get_relative_path(build->get_default_path(), build->project_path).string()) + "/*"; + exclude += " --exclude=" + filesystem::escape_argument(filesystem::get_relative_path(build->get_debug_path(), build->project_path).string()) + "/*"; +#else exclude += " --exclude-dir=" + filesystem::escape_argument(filesystem::get_relative_path(build->get_default_path(), build->project_path).string()); exclude += " --exclude-dir=" + filesystem::escape_argument(filesystem::get_relative_path(build->get_debug_path(), build->project_path).string()); +#endif } else project_path = path; diff --git a/tests/ctags_grep_test.cc b/tests/ctags_grep_test.cc index cf2a2df..0b6e76e 100644 --- a/tests/ctags_grep_test.cc +++ b/tests/ctags_grep_test.cc @@ -14,7 +14,11 @@ class Test { int main() { auto app = Gtk::Application::create(); +#ifdef JUCI_USE_UCTAGS + Config::get().project.ctags_command = "uctags"; +#else Config::get().project.ctags_command = "ctags"; +#endif Config::get().project.grep_command = "grep"; Config::get().project.debug_build_path = "build";