Explorar o código

making it build on macos with modern clang

Bernardo Magri hai 1 mes
pai
achega
92b1ed1c86

+ 30 - 13
CMakeLists.txt

@@ -14,12 +14,6 @@ if(NOT CMAKE_BUILD_TYPE)
     set(CMAKE_BUILD_TYPE Release)
 endif()
 
-# Compiler warnings
-if(MSVC)
-    add_compile_options(/W4 /WX)
-else()
-    add_compile_options(-Wall -Wextra -Wpedantic -Werror)
-endif()
 
 # Dependencies
 include(FetchContent)
@@ -43,13 +37,20 @@ FetchContent_Declare(
 )
 FetchContent_MakeAvailable(sol2)
 
-# spdlog
-FetchContent_Declare(
-    spdlog
-    GIT_REPOSITORY https://github.com/gabime/spdlog.git
-    GIT_TAG v1.12.0
-)
-FetchContent_MakeAvailable(spdlog)
+# spdlog - try system package first (from Nix), fallback to FetchContent
+find_package(spdlog)
+
+if(NOT spdlog_FOUND)
+    message(STATUS "System spdlog not found. Fetching via Git...")
+    FetchContent_Declare(
+        spdlog
+        GIT_REPOSITORY https://github.com/gabime/spdlog.git
+        GIT_TAG v1.14.1
+    )
+    FetchContent_MakeAvailable(spdlog)
+else()
+    message(STATUS "Found system spdlog: ${spdlog_VERSION}")
+endif()
 
 # Try to find system GoogleTest first (Nix-shell provided)
 find_package(GTest)
@@ -105,6 +106,7 @@ target_link_libraries(lumacs_core PUBLIC
     ${CURSES_LIBRARIES}
 )
 
+
 # Main Executable (Single binary)
 add_executable(lumacs
     src/main.cpp
@@ -124,6 +126,21 @@ target_include_directories(lumacs PRIVATE
     ${CURSES_INCLUDE_DIR}
 )
 
+
+# Helper variable for your flags
+if(MSVC)
+    set(LUMACS_WARNINGS /W4 /WX)
+else()
+    set(LUMACS_WARNINGS -Wall -Wextra -Wpedantic -Werror)
+endif()
+
+# Apply ONLY to your core library
+target_compile_options(lumacs_core PRIVATE ${LUMACS_WARNINGS})
+
+# Apply ONLY to your executable
+target_compile_options(lumacs PRIVATE ${LUMACS_WARNINGS})
+
+
 # Configure GTK if available
 if(GTKMM_FOUND)
     message(STATUS "GTKMM 4.0 found - Building with GUI support")

+ 1 - 1
include/lumacs/command_system.hpp

@@ -57,7 +57,7 @@ public:
 
 private:
     ICommandTarget& target_; // Declared first
-    MinibufferManager& minibuffer_manager_; // Declared second
+    [[maybe_unused]] MinibufferManager& minibuffer_manager_; // Declared second, will be used when interactive methods are implemented
     std::vector<std::string> args_; // Declared third
 };
 

+ 1 - 1
include/lumacs/completion_system.hpp

@@ -38,7 +38,7 @@ public:
     std::vector<CompletionCandidate> get_candidates_for_mode(MinibufferMode mode, const std::string& input_text);
 
 private:
-    EditorCore& core_;
+    [[maybe_unused]] EditorCore& core_; // Reserved for future use
     std::unordered_map<MinibufferMode, std::unique_ptr<ICompletionSource>> sources_;
 };
 

+ 1 - 1
include/lumacs/minibuffer_manager.hpp

@@ -76,7 +76,7 @@ public:
 
 private:
     EditorCore& core_;
-    LuaApi& lua_api_;
+    [[maybe_unused]] LuaApi& lua_api_; // Reserved for future Lua integration
     CompletionSystem& completion_system_;
 
     MinibufferMode current_mode_ = MinibufferMode::None;

+ 1 - 1
include/lumacs/plugin_manager.hpp

@@ -45,7 +45,7 @@ public:
     std::vector<std::string> get_loaded_plugins() const;
 
 private:
-    EditorCore& core_;
+    [[maybe_unused]] EditorCore& core_; // Reserved for future plugin integration
     LuaApi& lua_api_;
 
     std::unordered_map<std::string, std::filesystem::path> discovered_plugins_;

+ 6 - 1
shell.nix

@@ -16,6 +16,11 @@ pkgs.mkShell {
     ncurses
     pkg-config # For locating libraries
     gtkmm4     # GTK4 C++ bindings
+    fribidi    # Required by pango/GTK
+    libthai    # Required by pango/GTK
+    libdatrie  # Required by libthai
+    expat      # Required by fontconfig
+    xorg.libXdmcp  # Required by xcb
 
     # Development tools
     clang-tools  # clangd, clang-format, clang-tidy
@@ -26,8 +31,8 @@ pkgs.mkShell {
 
     gtest
     sol2
-    libsysprof-capture
     pcre2
+    spdlog
   ];
 
   shellHook = ''

+ 2 - 2
src/completion_system.cpp

@@ -98,7 +98,7 @@ public:
     }
 
 private:
-    EditorCore& core_;
+    [[maybe_unused]] EditorCore& core_; // Reserved for future filesystem operations
 };
 
 /// @brief Completion source for theme names.
@@ -118,7 +118,7 @@ public:
     }
 
 private:
-    EditorCore& core_;
+    [[maybe_unused]] EditorCore& core_; // Reserved for future filesystem operations
 };
 
 

+ 1 - 1
src/main.cpp

@@ -101,4 +101,4 @@ int main(int argc, char* argv[]) {
     }
 
     return 0;
-}
+}