From f108ad3763b2390261317373650ac100cbb0a3ea Mon Sep 17 00:00:00 2001 From: sonakrie Date: Sun, 30 Nov 2025 23:22:34 +0100 Subject: [PATCH] Uhm yes --- .gitignore | 2 +- CMakeLists.txt | 31 +++++++++++++++++++++++-------- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 527b85c..567609b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -Build/ +build/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 87999e5..101c0ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,18 +67,33 @@ target_link_libraries(core PUBLIC glad glm imgui imguizmo) # ==================== Executable ==================== add_executable(main src/main.cpp) -target_link_libraries(main PRIVATE core glfw OpenGL::GL) -# Optional: remove console window on Windows (uncomment if you want GUI-only app) -#if(WIN32) -# set_target_properties(main PROPERTIES WIN32_EXECUTABLE TRUE) -#endif() - -# Linux needs these extra libs +# Link order matters on Linux if(NOT WIN32) - target_link_libraries(main PRIVATE dl pthread X11) + find_package(X11 REQUIRED) + target_include_directories(main PRIVATE ${X11_INCLUDE_DIR}) + + target_link_libraries(main PRIVATE + core # your code + static libs + imgui # ImGui + imguizmo # ImGuizmo + glad # GLAD + glm # header-only, harmless + glfw # GLFW depends on X11 + OpenGL::GL + pthread + dl + ${X11_LIBRARIES} # Must come AFTER libraries that need X11 + Xrandr + Xi + Xinerama + Xcursor + ) +else() + target_link_libraries(main PRIVATE core glfw OpenGL::GL) endif() + # ==================== Copy Resources folder after build ==================== add_custom_command(TARGET main POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory