Find libepoxy without pkg-config (MSVC + vcpkg); Windows build notes
This commit is contained in:
@@ -23,9 +23,24 @@ include(FetchContent)
|
|||||||
# --- Dependencies -----------------------------------------------------------
|
# --- Dependencies -----------------------------------------------------------
|
||||||
# System packages are preferred; anything missing is fetched.
|
# System packages are preferred; anything missing is fetched.
|
||||||
find_package(OpenGL REQUIRED)
|
find_package(OpenGL REQUIRED)
|
||||||
find_package(PkgConfig REQUIRED)
|
# libepoxy: pkg-config where available (Linux, MSYS2), else a plain header/library search
|
||||||
|
# (MSVC + vcpkg ships no pkg-config by default).
|
||||||
if(NOT TARGET PkgConfig::EPOXY)
|
if(NOT TARGET PkgConfig::EPOXY)
|
||||||
pkg_check_modules(EPOXY REQUIRED IMPORTED_TARGET epoxy)
|
find_package(PkgConfig QUIET)
|
||||||
|
if(PkgConfig_FOUND)
|
||||||
|
pkg_check_modules(EPOXY QUIET IMPORTED_TARGET epoxy)
|
||||||
|
endif()
|
||||||
|
if(NOT TARGET PkgConfig::EPOXY)
|
||||||
|
find_path(EPOXY_INCLUDE_DIR epoxy/gl.h)
|
||||||
|
find_library(EPOXY_LIBRARY NAMES epoxy libepoxy epoxy-0)
|
||||||
|
if(NOT EPOXY_INCLUDE_DIR OR NOT EPOXY_LIBRARY)
|
||||||
|
message(FATAL_ERROR "libepoxy not found (install it, e.g. pacman -S libepoxy, "
|
||||||
|
"pacman -S mingw-w64-ucrt-x86_64-libepoxy or vcpkg install libepoxy)")
|
||||||
|
endif()
|
||||||
|
add_library(PkgConfig::EPOXY UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(PkgConfig::EPOXY PROPERTIES IMPORTED_LOCATION "${EPOXY_LIBRARY}"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${EPOXY_INCLUDE_DIR}")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT TARGET glfw)
|
if(NOT TARGET glfw)
|
||||||
|
|||||||
@@ -56,6 +56,12 @@ ninja -C build
|
|||||||
./build/hd2d_demo
|
./build/hd2d_demo
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Windows: in the MSYS2 **UCRT64** shell,
|
||||||
|
`pacman -S --needed mingw-w64-ucrt-x86_64-{gcc,cmake,ninja,pkgconf,glfw,glm,libepoxy}` and the
|
||||||
|
same `cmake` / `ninja` commands. With Visual Studio, `vcpkg install glfw3 glm libepoxy` and pass
|
||||||
|
`-DCMAKE_TOOLCHAIN_FILE=<vcpkg>/scripts/buildsystems/vcpkg.cmake`. libepoxy is found through
|
||||||
|
pkg-config when present, else by a plain header/library search.
|
||||||
|
|
||||||
The asset path is baked in at configure time (`HD2D_ASSET_DIR`), so the demo can
|
The asset path is baked in at configure time (`HD2D_ASSET_DIR`), so the demo can
|
||||||
be run from any working directory.
|
be run from any working directory.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user