secondvoice/CMakeLists_noui_fixed.txt
StillHammer 7dec7a6eed fix: Résolution complète du problème OpenGL/ImGui avec threading
PROBLÈME RÉSOLU: Les shaders ImGui compilent maintenant avec succès!

Changements majeurs:
- Remplacé vcpkg ImGui par FetchContent (compilation from source)
- Créé wrapper GLAD pour ImGui (imgui_opengl3_glad.cpp)
- Ajout de makeContextCurrent() pour gérer le contexte OpenGL multi-thread
- Release du contexte dans initialize(), puis rendu current dans uiThread()

Root Cause Analysis:
1. Rendering s'exécute dans uiThread() (thread séparé)
2. Contexte OpenGL créé dans thread principal n'était pas accessible
3. glCreateShader retournait 0 avec GL_INVALID_OPERATION (erreur 1282)
4. Solution: Transfer du contexte OpenGL du thread principal vers uiThread

Debugging profond:
- Ajout de logs debug dans ImGui pour tracer glCreateShader
- Découvert que handle=0 indiquait échec de création (pas compilation)
- Identifié erreur WGL \"ressource en cours d'utilisation\" = contexte locked

Fichiers modifiés:
- vcpkg.json: Supprimé imgui
- CMakeLists.txt: FetchContent pour ImGui + imgui_backends library
- src/imgui_opengl3_glad.cpp: Nouveau wrapper GLAD
- src/ui/TranslationUI.{h,cpp}: Ajout makeContextCurrent()
- src/core/Pipeline.cpp: Appel makeContextCurrent() dans uiThread()
- build/.../imgui_impl_opengl3.cpp: Debug logs (temporaire)

Résultat: UI fonctionne! NVIDIA RTX 4060 GPU, OpenGL 3.3.0, shaders compilent

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-21 16:37:47 +08:00

63 lines
1.6 KiB
Plaintext

cmake_minimum_required(VERSION 3.20)
project(SecondVoice_NoUI VERSION 0.1.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Find packages (NO IMGUI, NO GLFW, NO OPENGL)
find_package(portaudio CONFIG REQUIRED)
find_package(httplib CONFIG REQUIRED)
find_package(nlohmann_json CONFIG REQUIRED)
# Source files (NO UI)
set(SOURCES
src/main_no_ui_test.cpp
src/audio/AudioCapture.cpp
src/audio/AudioBuffer.cpp
src/utils/Config.cpp
)
# Executable
add_executable(${PROJECT_NAME} ${SOURCES})
# Include directories
target_include_directories(${PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src
)
# Link libraries (NO IMGUI) - use static linking for MinGW
if(MINGW)
target_link_libraries(${PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/vcpkg_installed/x64-mingw-static/lib/libportaudio.a
httplib::httplib
nlohmann_json::nlohmann_json
# Windows system libraries for portaudio
winmm
setupapi
)
else()
target_link_libraries(${PROJECT_NAME} PRIVATE
portaudio
httplib::httplib
nlohmann_json::nlohmann_json
)
endif()
# Compiler options
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
target_compile_options(${PROJECT_NAME} PRIVATE
-Wall
-Wextra
-Wpedantic
)
if(MINGW)
target_link_options(${PROJECT_NAME} PRIVATE -mconsole)
endif()
endif()
# Copy config files to build directory
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.json
${CMAKE_CURRENT_BINARY_DIR}/config.json COPYONLY)