From 5c90a0113440556be79645ae47c9c3eb5ae46ab7 Mon Sep 17 00:00:00 2001 From: Trailcode Date: Sun, 6 Sep 2026 16:07:35 -0600 Subject: [PATCH 1/4] Fix cmake warnings. --- CMakeLists.txt | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7daae7f..d3219ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,6 +44,15 @@ endif() # Lua (for script console) - built for native and Emscripten (C sources compile with emcc) # Tarball has no CMake; we build the lib from sources include(FetchContent) +# Prefer extraction-time stamps for URL downloads (CMP0135 NEW). +if(POLICY CMP0135) + cmake_policy(SET CMP0135 NEW) +endif() +# Third-party FetchContent trees (pybind11) still declare cmake_minimum_required +# below 3.10; raise the effective policy floor so CMake 3.31+/4.x does not warn. +if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.31") + set(CMAKE_POLICY_VERSION_MINIMUM 3.10) +endif() if(EZYCAD_HAVE_PYTHON) set(PYBIND11_FINDPYTHON ON) FetchContent_Declare( @@ -57,7 +66,8 @@ FetchContent_Declare( lua URL https://www.lua.org/ftp/lua-5.4.6.tar.gz ) -FetchContent_Populate(lua) +# Lua has no top-level CMakeLists.txt; MakeAvailable only populates (no add_subdirectory). +FetchContent_MakeAvailable(lua) set(LUA_SRC_DIR ${lua_SOURCE_DIR}/lua-5.4.6/src) if(NOT EXISTS ${LUA_SRC_DIR}) set(LUA_SRC_DIR ${lua_SOURCE_DIR}/src) @@ -425,7 +435,7 @@ else() # For non-Emscripten builds, find and link required libraries find_package(OpenGL REQUIRED) - find_package(glfw3 REQUIRED) + find_package(GLFW3 REQUIRED) add_executable(${PROJECT_NAME} "src/main.cpp") @@ -730,7 +740,7 @@ if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Emscripten") FetchContent_Declare( googletest GIT_REPOSITORY https://github.com/google/googletest.git - GIT_TAG release-1.12.1 # Adjust version as needed + GIT_TAG v1.15.2 ) # For Windows: Prevent overriding the parent project's compiler/linker settings set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) From e8fc5cd2a676f01ab4d36600d5df4e813f277525 Mon Sep 17 00:00:00 2001 From: Trailcode Date: Sun, 6 Sep 2026 16:15:55 -0600 Subject: [PATCH 2/4] Standardize on vcpkg --- .gitignore | 2 + CHANGELOG.md | 1 + CMakeLists.txt | 117 ++++++++++++++++------------------ README.md | 16 ++--- agents/workflows/local-dev.md | 5 +- docs/building-occt.md | 21 ++++-- third_party/README.md | 2 +- 7 files changed, 84 insertions(+), 80 deletions(-) diff --git a/.gitignore b/.gitignore index 91a46fb..39b79ea 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,8 @@ /.vscode/settings.json # Legacy name; some toolchains write here. Primary vendored deps live in third_party/. /thirdParty +# vcpkg manifest install (when installed into the source tree) +/vcpkg_installed /.vs # AI/IDE local rule directories (Cursor, Claude, etc.). Shared repo-wide assistant notes live in agents/. /.cursor/ diff --git a/CHANGELOG.md b/CHANGELOG.md index 62add7e..fdde891 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- **Desktop deps**: MSVC GLFW/GLEW come from **vcpkg** (`vcpkg.json` + toolchain) instead of NuGet; local configure matches CI. - **Extrude Both sides**: Options **Both sides** defaults to on (session sticky; not a Settings key). ### Fixed diff --git a/CMakeLists.txt b/CMakeLists.txt index d3219ef..e42fdd6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,7 +97,7 @@ target_compile_features(lua PUBLIC c_std_99) set(BINARY_DIR ${${PROJECT_NAME}_BINARY_DIR}) # EzyCad branches on CMAKE_CXX_COMPILER_ID STREQUAL "Emscripten" (wasm link flags, -# TKOpenGles, no gtest/GLFW nuget). Override the Clang ID that emsdk forces. +# TKOpenGles, no gtest / no desktop GLFW+GLEW). Override the Clang ID that emsdk forces. if(EMSCRIPTEN_BUILD) message(" * C++ compiler: Emscripten") set(CMAKE_CXX_COMPILER_ID "Emscripten") @@ -105,19 +105,6 @@ else() message(" * C++ compiler: ${CMAKE_CXX_COMPILER_ID}") endif() -set(GLFW_VERSION "3.3.0.1") -set(GLEW_VERSION "2.1.0") - -if(MSVC_VERSION AND NOT CMAKE_TOOLCHAIN_FILE) - find_program(NUGET nuget) - if(NOT NUGET) - message(FATAL_ERROR "Cannot find nuget command line tool.\nInstall it with e.g. choco install nuget.commandline") - endif() - # Output must be under the build tree (CMAKE_BINARY_DIR), not the shell CWD, or clean out-of-source configures fail. - execute_process(COMMAND ${NUGET} install glfw -Version ${GLFW_VERSION} -OutputDirectory "${CMAKE_BINARY_DIR}/thirdParty") - execute_process(COMMAND ${NUGET} install unofficial-flayan-glew -Version ${GLEW_VERSION} -OutputDirectory "${CMAKE_BINARY_DIR}/thirdParty") -endif() - # imgui_demo.cpp omitted: large and unused here; add back if you need ImGui::ShowDemoWindow. file(GLOB imguiSrc "third_party/imgui/imgui_impl_glfw.cpp" @@ -428,15 +415,34 @@ else() list(APPEND OpenCASCADE_LIBS TKOpenGl) - set(GLEW_LOCATION ${BINARY_DIR}/thirdParty/unofficial-flayan-glew.${GLEW_VERSION}/build/native) - set(GLFW_ROOT_DIR ${BINARY_DIR}/thirdParty/glfw.${GLFW_VERSION}/build/native) + # Desktop GLFW/GLEW: vcpkg manifest (vcpkg.json). MSVC requires the vcpkg toolchain + # (same path as CI). Non-MSVC may use vcpkg CONFIG packages or system MODULE finds. + if(MSVC AND NOT DEFINED VCPKG_TARGET_TRIPLET) + message(FATAL_ERROR + "MSVC desktop builds require vcpkg (see vcpkg.json).\n" + " set VCPKG_ROOT to your vcpkg clone, then configure with:\n" + " -DCMAKE_TOOLCHAIN_FILE=%VCPKG_ROOT%/scripts/buildsystems/vcpkg.cmake\n" + "Manifest mode installs glfw3/glew on configure. See README and agents/workflows/local-dev.md.") + endif() set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules") - # For non-Emscripten builds, find and link required libraries find_package(OpenGL REQUIRED) - find_package(GLFW3 REQUIRED) - + find_package(glfw3 CONFIG QUIET) + if(glfw3_FOUND) + set(EZYCAD_GLFW_LIBS glfw) + else() + find_package(GLFW3 REQUIRED) + set(EZYCAD_GLFW_LIBS ${GLFW3_LIBRARY}) + endif() + find_package(GLEW CONFIG QUIET) + if(GLEW_FOUND) + set(EZYCAD_GLEW_LIBS GLEW::GLEW) + else() + find_package(GLEW REQUIRED) + set(EZYCAD_GLEW_LIBS ${GLEW_LIBRARY}) + endif() + add_executable(${PROJECT_NAME} "src/main.cpp") # Copy default settings and examples so native build finds res/ at runtime @@ -517,15 +523,12 @@ else() endif() target_link_libraries(${PROJECT_NAME} ${PROJECT_NAME}_lib) - if(MSVC_VERSION AND NOT CMAKE_TOOLCHAIN_FILE) - target_link_libraries(${PROJECT_NAME} ${BINARY_DIR}/thirdParty/unofficial-flayan-glew.${GLEW_VERSION}/build/native/lib/x64/dynamic/glew32.lib) - endif() - if(NOT MSVC) - target_link_libraries(${PROJECT_NAME} -Wl,--no-as-needed ${GLFW3_LIBRARY} -Wl,--as-needed) + if(NOT MSVC AND NOT glfw3_FOUND) + target_link_libraries(${PROJECT_NAME} -Wl,--no-as-needed ${EZYCAD_GLFW_LIBS} -Wl,--as-needed) else() - target_link_libraries(${PROJECT_NAME} ${GLFW3_LIBRARY}) + target_link_libraries(${PROJECT_NAME} ${EZYCAD_GLFW_LIBS}) endif() - + target_link_libraries(${PROJECT_NAME} ${EZYCAD_GLEW_LIBS}) target_link_libraries(${PROJECT_NAME} ${OpenCASCADE_LIBS}) if(EZYCAD_HAVE_PYTHON AND EZYCAD_PYTHON_LINK_MODE STREQUAL "imported_target" @@ -538,12 +541,12 @@ else() COMMENT "Copy Python DLL next to EzyCad.exe") endif() - if(MSVC_VERSION AND NOT CMAKE_TOOLCHAIN_FILE) - include_directories(${BINARY_DIR}/thirdParty/unofficial-flayan-glew.${GLEW_VERSION}/build/native/include) - endif() - if(GLFW3_INCLUDE_PATH) + if(NOT glfw3_FOUND AND GLFW3_INCLUDE_PATH) include_directories(${GLFW3_INCLUDE_PATH}) endif() + if(NOT GLEW_FOUND AND GLEW_INCLUDE_DIR) + include_directories(${GLEW_INCLUDE_DIR}) + endif() # MSVC-specific configuration if(MSVC_VERSION) @@ -570,32 +573,25 @@ else() ${OCCT_3RD_PARTY_DIR}/tbb-2021.13.0-x64/bin/tbb12.dll ${OCCT_3RD_PARTY_DIR}/jemalloc-vc14-64/bin/jemalloc.dll ) - if(MSVC_VERSION AND NOT CMAKE_TOOLCHAIN_FILE) - list(APPEND DLLS_COMMON - ${BINARY_DIR}/thirdParty/unofficial-flayan-glew.redist.${GLEW_VERSION}/build/native/bin/x64/dynamic/glew32.dll - ${BINARY_DIR}/thirdParty/glfw.${GLFW_VERSION}/build/native/bin/dynamic/v142/x64/glfw3.dll - ) + # Stage glfw/glew DLLs from the vcpkg install prefix next to EzyCad.exe. + set(_vcpkg_bin "") + if(DEFINED VCPKG_INSTALLED_DIR AND DEFINED VCPKG_TARGET_TRIPLET) + set(_vcpkg_bin "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin") endif() - - # When building with vcpkg toolchain (e.g. the GitHub CI), the nuget glew/glfw - # were never installed, so also stage the DLLs from the vcpkg manifest install - # (typically /vcpkg_installed/x64-windows/bin or under the build tree). - # This ensures the Release/ folder contains a runnable EzyCad.exe. - if(CMAKE_TOOLCHAIN_FILE) + if(NOT _vcpkg_bin OR NOT EXISTS "${_vcpkg_bin}/glfw3.dll") set(_vcpkg_bin "${CMAKE_SOURCE_DIR}/vcpkg_installed/x64-windows/bin") - if(NOT EXISTS "${_vcpkg_bin}/glfw3.dll") - set(_vcpkg_bin "${BINARY_DIR}/vcpkg_installed/x64-windows/bin") - endif() - if(NOT EXISTS "${_vcpkg_bin}/glfw3.dll") - # Fallback to common vcpkg classic location (if any packages landed there) - set(_vcpkg_bin "C:/vcpkg/installed/x64-windows/bin") - endif() - if(EXISTS "${_vcpkg_bin}/glfw3.dll") - list(APPEND DLLS_COMMON "${_vcpkg_bin}/glfw3.dll") - endif() - if(EXISTS "${_vcpkg_bin}/glew32.dll") - list(APPEND DLLS_COMMON "${_vcpkg_bin}/glew32.dll") - endif() + endif() + if(NOT EXISTS "${_vcpkg_bin}/glfw3.dll") + set(_vcpkg_bin "${BINARY_DIR}/vcpkg_installed/x64-windows/bin") + endif() + if(NOT EXISTS "${_vcpkg_bin}/glfw3.dll" AND DEFINED ENV{VCPKG_ROOT}) + set(_vcpkg_bin "$ENV{VCPKG_ROOT}/installed/x64-windows/bin") + endif() + if(EXISTS "${_vcpkg_bin}/glfw3.dll") + list(APPEND DLLS_COMMON "${_vcpkg_bin}/glfw3.dll") + endif() + if(EXISTS "${_vcpkg_bin}/glew32.dll") + list(APPEND DLLS_COMMON "${_vcpkg_bin}/glew32.dll") endif() foreach(lib ${OpenCASCADE_LIBS}) @@ -607,11 +603,7 @@ else() set(CONFIG_ASSETS ${CMAKE_SOURCE_DIR}/imgui.ini) - # Copy DLLs and assets to Release configurations. - # Only copy files that actually exist on disk. This prevents configure errors in - # the vcpkg-toolchain CI case (and prebuilt-OCCT path) where the nuget-populated - # thirdParty/glew/glfw redist paths are never created (the early nuget block is - # skipped when CMAKE_TOOLCHAIN_FILE is present). + # Copy DLLs and assets to Release configurations (skip paths that do not exist). foreach(file ${DLLS_RELEASE} ${DLLS_COMMON} ${FONT_ASSETS} ${CONFIG_ASSETS}) if(file AND EXISTS "${file}") file(COPY "${file}" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/Release") @@ -767,11 +759,12 @@ if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Emscripten") ${OPENGL_LIBRARIES} ${OPENGL_gl_LIBRARY} ) - if(NOT MSVC) - target_link_libraries(${PROJECT_NAME}_tests -Wl,--no-as-needed ${GLFW3_LIBRARY} -Wl,--as-needed) + if(NOT MSVC AND NOT glfw3_FOUND) + target_link_libraries(${PROJECT_NAME}_tests -Wl,--no-as-needed ${EZYCAD_GLFW_LIBS} -Wl,--as-needed) else() - target_link_libraries(${PROJECT_NAME}_tests ${GLFW3_LIBRARY}) + target_link_libraries(${PROJECT_NAME}_tests ${EZYCAD_GLFW_LIBS}) endif() + target_link_libraries(${PROJECT_NAME}_tests ${EZYCAD_GLEW_LIBS}) diff --git a/README.md b/README.md index 1257c33..ea5573a 100644 --- a/README.md +++ b/README.md @@ -62,20 +62,20 @@ Full guide: **[docs/building-occt.md](docs/building-occt.md)** (Windows prebuilt ### Steps to Build 1. Clone the repository. -2. Create a build directory, e.g., `C:\src\EzyCad\build`. -3. Configure the project in the build directory using CMake: +2. Install [vcpkg](https://vcpkg.io/) and set `VCPKG_ROOT` (GLFW and GLEW come from the repo `vcpkg.json` manifest; same path as CI). +3. Create a build directory, e.g., `C:\src\EzyCad\build`. +4. Configure the project in the build directory using CMake: - After extracting the V8.0.0 combined prebuilt zip under `C:\bin` (see [docs/building-occt.md](docs/building-occt.md)): - `cmake -S C:\src\EzyCad -B build -G "Visual Studio 18 2026" -A x64 -DOpenCASCADE_DIR=C:\bin\opencascade-8.0.0-vc14-64\cmake -DOCCT_3RD_PARTY_DIR=C:\bin\3rdparty-vc14-64` + `cmake -S C:\src\EzyCad -B build -G "Visual Studio 18 2026" -A x64 -DCMAKE_TOOLCHAIN_FILE=%VCPKG_ROOT%/scripts/buildsystems/vcpkg.cmake -DOpenCASCADE_DIR=C:\bin\opencascade-8.0.0-vc14-64\cmake -DOCCT_3RD_PARTY_DIR=C:\bin\3rdparty-vc14-64` - `OpenCASCADE_DIR` must be the folder that contains `OpenCASCADEConfig.cmake` (for the combined package that is `...\opencascade-8.0.0-vc14-64\cmake`). - `OCCT_3RD_PARTY_DIR` should point to the OCCT 3rd-party distribution (`...\3rdparty-vc14-64`). - Prefer CMake 4.3+ (PATH or VS 2026 bundled) so generator **Visual Studio 18 2026** is available. After deleting `build/`, re-run this configure step before building. - - CMake will use `nuget` to download additional dependencies (GLFW, GLEW). -4. Build the project (`cmake --build build --config Release`). +5. Build the project (`cmake --build build --config Release`). ### Notes for Windows Users -- Ensure `nuget` is installed for fetching dependencies like GLFW and GLEW. +- Desktop MSVC builds **require** the vcpkg toolchain (`CMAKE_TOOLCHAIN_FILE=.../vcpkg.cmake`). NuGet is not used. - Use Visual Studio 2026 as the IDE for debugging and building (generator `Visual Studio 18 2026`). Do not configure with `Visual Studio 17 2022` on a machine that only has VS 2026. -- If configure fails after wiping `build/`, confirm both OCCT paths exist on disk and that your CMake lists `Visual Studio 18 2026` in `cmake --help`. +- If configure fails after wiping `build/`, confirm both OCCT paths exist on disk, that `VCPKG_ROOT` is set, and that your CMake lists `Visual Studio 18 2026` in `cmake --help`. ### Notes for Emscripten Builds - Install Emscripten and activate its environment (`emsdk_env`). @@ -127,4 +127,4 @@ The **`third_party/`** folder holds other libraries **shipped inside the EzyCad **ImGuiColorTextEdit:** Prefer a full checkout under `third_party/ImGuiColorTextEdit/` (see `third_party/README.md`). If that folder is missing, CMake **FetchContent** downloads upstream at a **fixed commit** (`ca2f9f1462e3b60e56351bc466acda448c5ea50d`) because the upstream repo has **no release tags**. To upgrade the editor, bump that SHA in `CMakeLists.txt` and refresh any vendored copy. -**Windows note:** GLFW and GLEW for MSVC are **not** stored under `third_party/`; NuGet installs them into **`${CMAKE_BINARY_DIR}/thirdParty`** when you configure (see [Notes for Windows Users](#notes-for-windows-users)). +**Windows note:** GLFW and GLEW for MSVC come from **vcpkg** (`vcpkg.json` + `-DCMAKE_TOOLCHAIN_FILE=.../vcpkg.cmake`). They are not under `third_party/`. diff --git a/agents/workflows/local-dev.md b/agents/workflows/local-dev.md index 2f78d65..af6b28e 100644 --- a/agents/workflows/local-dev.md +++ b/agents/workflows/local-dev.md @@ -7,7 +7,7 @@ Short notes for day-to-day build, test, and quality checks. **Prerequisites** - CMake that supports generator **Visual Studio 18 2026** (VS 2026 bundled CMake 4.3+ is fine; older PATH CMake may lack this generator) - Visual Studio 2026 (C++ workload) — primary local toolchain -- nuget CLI (for GLFW/GLEW) +- [vcpkg](https://vcpkg.io/) with `VCPKG_ROOT` set (GLFW/GLEW via repo `vcpkg.json` manifest) - OCCT 8.0.0 prebuilts + 3rdparty-vc14-64 (strongly recommended — see [docs/building-occt.md](../../docs/building-occt.md)) **Typical configure** (run from repo root): @@ -16,11 +16,12 @@ Short notes for day-to-day build, test, and quality checks. # Prefer VS-bundled cmake if PATH cmake is too old for the VS 18 generator: # "C:\Program Files\Microsoft Visual Studio\18\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" cmake -S . -B build -G "Visual Studio 18 2026" -A x64 ` + -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" ` -DOpenCASCADE_DIR=C:\bin\opencascade-8.0.0-vc14-64\cmake ` -DOCCT_3RD_PARTY_DIR=C:\bin\3rdparty-vc14-64 ``` -Paths above match the V8.0.0 combined prebuilt extracted under `C:\bin` (see [docs/building-occt.md](../../docs/building-occt.md)). Adjust if your install lives elsewhere. +Paths above match the V8.0.0 combined prebuilt extracted under `C:\bin` (see [docs/building-occt.md](../../docs/building-occt.md)). Adjust if your install lives elsewhere. Manifest mode installs `glfw3` and `glew` from `vcpkg.json` on configure (first run may take a few minutes). Do **not** use `-G "Visual Studio 17 2022"` on a machine that only has VS 2026 installed — configure fails with a generator/instance mismatch. CI still uses VS 2022 (`windows-msvc.yml`). After wiping `build/`, re-run this configure step (do not open a stale `.sln` alone). diff --git a/docs/building-occt.md b/docs/building-occt.md index 0430147..f63db96 100644 --- a/docs/building-occt.md +++ b/docs/building-occt.md @@ -202,9 +202,15 @@ powershell -NoProfile -ExecutionPolicy Bypass -File C:\src\EzyCad\scripts\build- curl -L -o occt-combined.zip https://github.com/Open-Cascade-SAS/OCCT/releases/download/V8_0_0/occt-combined-release-no-pch.zip ``` -### vcpkg (alternative desktop path) +### vcpkg (GLFW / GLEW) -OCCT 8 supports vcpkg (`USE_VTK=ON` only if needed). EzyCad’s `CMakeLists.txt` is written for `find_package(OpenCASCADE)` + manual `OCCT_3RD_PARTY_DIR` DLL copies — vcpkg integration is **not** wired in-tree. +Desktop MSVC builds use the repo **`vcpkg.json`** manifest for **glfw3** and **glew** (same as CI). Pass the vcpkg toolchain when configuring: + +```text +-DCMAKE_TOOLCHAIN_FILE=%VCPKG_ROOT%/scripts/buildsystems/vcpkg.cmake +``` + +**Open CASCADE is not installed via vcpkg** for EzyCad. Keep using a prebuilt or self-built OCCT tree with `OpenCASCADE_DIR` and `OCCT_3RD_PARTY_DIR` (DLL staging). Upstream OCCT 8 has a vcpkg port (`USE_VTK=ON` only if needed); that path is separate from EzyCad’s current CMake wiring. --- @@ -225,10 +231,11 @@ OCCT 8 supports vcpkg (`USE_VTK=ON` only if needed). EzyCad’s `CMakeLists.txt` ## Quick reference: EzyCad CMake variables -| Variable | Platform | Purpose | -| -------------------- | --------------- | ------------------------------------------- | -| `OpenCASCADE_DIR` | All | Path to `OpenCASCADEConfig.cmake` directory | -| `OCCT_3RD_PARTY_DIR` | Windows desktop | Root of 3rdparty bundle for runtime DLLs | -| `CMAKE_BUILD_TYPE` | Native / wasm | `Release` recommended | +| Variable | Platform | Purpose | +| ---------------------- | --------------- | ------------------------------------------------- | +| `OpenCASCADE_DIR` | All | Path to `OpenCASCADEConfig.cmake` directory | +| `OCCT_3RD_PARTY_DIR` | Windows desktop | Root of 3rdparty bundle for runtime DLLs | +| `CMAKE_TOOLCHAIN_FILE` | Windows desktop | vcpkg toolchain (`.../vcpkg.cmake`) for glfw/glew | +| `CMAKE_BUILD_TYPE` | Native / wasm | `Release` recommended | EzyCad wasm also sets `TKOpenGles` in `OpenCASCADE_LIBS` when `CMAKE_CXX_COMPILER_ID` is `Emscripten`. diff --git a/third_party/README.md b/third_party/README.md index 14ec580..99e73be 100644 --- a/third_party/README.md +++ b/third_party/README.md @@ -2,7 +2,7 @@ Vendored sources and binaries for EzyCad live under **`third_party/`** (lowercase, underscore). CMake and scripts assume this layout. -The **`thirdParty/`** directory name (camel case) is **not** used by this project; it may appear in older docs or external tool defaults. Ignore or remove stray `thirdParty` trees to avoid confusion with Conan/NuGet outputs (see repo `.gitignore`). +The **`thirdParty/`** directory name (camel case) is **not** used by this project; it may appear in older docs or external tool defaults. Ignore or remove stray `thirdParty` trees to avoid confusion with legacy NuGet outputs (see repo `.gitignore`). GLFW/GLEW for desktop MSVC come from **vcpkg** (`vcpkg.json`), not from this folder. ## ImGuiColorTextEdit From e908335497232dbbb5e6fb7f7c868223a0778213 Mon Sep 17 00:00:00 2001 From: Trailcode Date: Sun, 6 Sep 2026 16:34:24 -0600 Subject: [PATCH 3/4] Fix --- CMakeLists.txt | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e42fdd6..6c93364 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -442,6 +442,14 @@ else() find_package(GLEW REQUIRED) set(EZYCAD_GLEW_LIBS ${GLEW_LIBRARY}) endif() + # imgui_impl_glfw / opengl3 compile inside EzyCad_lib; propagate includes via targets. + target_link_libraries(${PROJECT_NAME}_lib PUBLIC ${EZYCAD_GLFW_LIBS} ${EZYCAD_GLEW_LIBS}) + if(NOT glfw3_FOUND AND GLFW3_INCLUDE_PATH) + target_include_directories(${PROJECT_NAME}_lib PUBLIC ${GLFW3_INCLUDE_PATH}) + endif() + if(NOT GLEW_FOUND AND GLEW_INCLUDE_DIR) + target_include_directories(${PROJECT_NAME}_lib PUBLIC ${GLEW_INCLUDE_DIR}) + endif() add_executable(${PROJECT_NAME} "src/main.cpp") @@ -523,12 +531,6 @@ else() endif() target_link_libraries(${PROJECT_NAME} ${PROJECT_NAME}_lib) - if(NOT MSVC AND NOT glfw3_FOUND) - target_link_libraries(${PROJECT_NAME} -Wl,--no-as-needed ${EZYCAD_GLFW_LIBS} -Wl,--as-needed) - else() - target_link_libraries(${PROJECT_NAME} ${EZYCAD_GLFW_LIBS}) - endif() - target_link_libraries(${PROJECT_NAME} ${EZYCAD_GLEW_LIBS}) target_link_libraries(${PROJECT_NAME} ${OpenCASCADE_LIBS}) if(EZYCAD_HAVE_PYTHON AND EZYCAD_PYTHON_LINK_MODE STREQUAL "imported_target" @@ -541,13 +543,6 @@ else() COMMENT "Copy Python DLL next to EzyCad.exe") endif() - if(NOT glfw3_FOUND AND GLFW3_INCLUDE_PATH) - include_directories(${GLFW3_INCLUDE_PATH}) - endif() - if(NOT GLEW_FOUND AND GLEW_INCLUDE_DIR) - include_directories(${GLEW_INCLUDE_DIR}) - endif() - # MSVC-specific configuration if(MSVC_VERSION) message("Compiler is MSVC") @@ -759,12 +754,6 @@ if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Emscripten") ${OPENGL_LIBRARIES} ${OPENGL_gl_LIBRARY} ) - if(NOT MSVC AND NOT glfw3_FOUND) - target_link_libraries(${PROJECT_NAME}_tests -Wl,--no-as-needed ${EZYCAD_GLFW_LIBS} -Wl,--as-needed) - else() - target_link_libraries(${PROJECT_NAME}_tests ${EZYCAD_GLFW_LIBS}) - endif() - target_link_libraries(${PROJECT_NAME}_tests ${EZYCAD_GLEW_LIBS}) From 8f789ae9ae0ed671a0f2196bf90d95e5c941c2f9 Mon Sep 17 00:00:00 2001 From: Trailcode Date: Sun, 6 Sep 2026 16:52:14 -0600 Subject: [PATCH 4/4] Fix --- CMakeLists.txt | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c93364..ff5d49a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -568,25 +568,38 @@ else() ${OCCT_3RD_PARTY_DIR}/tbb-2021.13.0-x64/bin/tbb12.dll ${OCCT_3RD_PARTY_DIR}/jemalloc-vc14-64/bin/jemalloc.dll ) - # Stage glfw/glew DLLs from the vcpkg install prefix next to EzyCad.exe. - set(_vcpkg_bin "") + # Stage glfw/glew DLLs from vcpkg: release bin vs debug/bin (GLEW debug is glew32d.dll). + # Multi-config MSVC links the matching import libs; copy matching runtimes per output dir. + set(_vcpkg_root "") if(DEFINED VCPKG_INSTALLED_DIR AND DEFINED VCPKG_TARGET_TRIPLET) - set(_vcpkg_bin "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin") + set(_vcpkg_root "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}") endif() - if(NOT _vcpkg_bin OR NOT EXISTS "${_vcpkg_bin}/glfw3.dll") - set(_vcpkg_bin "${CMAKE_SOURCE_DIR}/vcpkg_installed/x64-windows/bin") + if(NOT _vcpkg_root OR NOT EXISTS "${_vcpkg_root}/bin/glfw3.dll") + set(_vcpkg_root "${CMAKE_SOURCE_DIR}/vcpkg_installed/x64-windows") endif() - if(NOT EXISTS "${_vcpkg_bin}/glfw3.dll") - set(_vcpkg_bin "${BINARY_DIR}/vcpkg_installed/x64-windows/bin") + if(NOT EXISTS "${_vcpkg_root}/bin/glfw3.dll") + set(_vcpkg_root "${BINARY_DIR}/vcpkg_installed/x64-windows") endif() - if(NOT EXISTS "${_vcpkg_bin}/glfw3.dll" AND DEFINED ENV{VCPKG_ROOT}) - set(_vcpkg_bin "$ENV{VCPKG_ROOT}/installed/x64-windows/bin") + if(NOT EXISTS "${_vcpkg_root}/bin/glfw3.dll" AND DEFINED ENV{VCPKG_ROOT}) + set(_vcpkg_root "$ENV{VCPKG_ROOT}/installed/x64-windows") endif() - if(EXISTS "${_vcpkg_bin}/glfw3.dll") - list(APPEND DLLS_COMMON "${_vcpkg_bin}/glfw3.dll") + set(_vcpkg_bin_rel "${_vcpkg_root}/bin") + set(_vcpkg_bin_dbg "${_vcpkg_root}/debug/bin") + if(EXISTS "${_vcpkg_bin_rel}/glfw3.dll") + list(APPEND DLLS_RELEASE "${_vcpkg_bin_rel}/glfw3.dll") endif() - if(EXISTS "${_vcpkg_bin}/glew32.dll") - list(APPEND DLLS_COMMON "${_vcpkg_bin}/glew32.dll") + if(EXISTS "${_vcpkg_bin_rel}/glew32.dll") + list(APPEND DLLS_RELEASE "${_vcpkg_bin_rel}/glew32.dll") + endif() + if(EXISTS "${_vcpkg_bin_dbg}/glfw3.dll") + list(APPEND DLLS_DEBUG "${_vcpkg_bin_dbg}/glfw3.dll") + elseif(EXISTS "${_vcpkg_bin_rel}/glfw3.dll") + list(APPEND DLLS_DEBUG "${_vcpkg_bin_rel}/glfw3.dll") + endif() + if(EXISTS "${_vcpkg_bin_dbg}/glew32d.dll") + list(APPEND DLLS_DEBUG "${_vcpkg_bin_dbg}/glew32d.dll") + elseif(EXISTS "${_vcpkg_bin_rel}/glew32.dll") + list(APPEND DLLS_DEBUG "${_vcpkg_bin_rel}/glew32.dll") endif() foreach(lib ${OpenCASCADE_LIBS})