Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STB not found #69

Open
meerfrau opened this issue Apr 20, 2023 · 4 comments
Open

STB not found #69

meerfrau opened this issue Apr 20, 2023 · 4 comments

Comments

@meerfrau
Copy link

I've installed stb 20210910, but it is not found by raytracinginvulkan's CMake:

  Could not find a package configuration file provided by "Stb" with any of
  the following names:

    StbConfig.cmake
    stb-config.cmake
@GPSnoopy
Copy link
Owner

The CMake files assume you've called one of the vcpkg_* script before. It's designed to use its own dependencies rather than any system-wide package/files.

@meerfrau
Copy link
Author

And what if I would like to package it for my distribution (and thus use the system libs)?

@GPSnoopy
Copy link
Owner

GPSnoopy commented Apr 20, 2023

Then it gets a bit iffy. Exact CMake code will be dependent on the versions of CMake and the libraries you have; also not all libraries might be supported/have an existing find_package script.

The relevant code is here:

find_package(Boost REQUIRED COMPONENTS exception program_options)
find_package(freetype CONFIG REQUIRED)
find_package(glfw3 REQUIRED)
find_package(glm CONFIG REQUIRED)
find_package(imgui CONFIG REQUIRED)
find_package(Stb REQUIRED)
find_package(tinyobjloader CONFIG REQUIRED)
find_package(Vulkan REQUIRED)

and here:

target_include_directories(${exe_name} PRIVATE . ${Boost_INCLUDE_DIRS} ${glfw3_INCLUDE_DIRS} ${glm_INCLUDE_DIRS} ${STB_INCLUDE_DIRS} ${Vulkan_INCLUDE_DIRS})
target_link_directories(${exe_name} PRIVATE ${Vulkan_LIBRARY})
target_link_libraries(${exe_name} PRIVATE ${Boost_LIBRARIES} freetype glfw glm::glm imgui::imgui tinyobjloader::tinyobjloader ${Vulkan_LIBRARIES} ${extra_libs})

@disini
Copy link

disini commented Jan 18, 2024

Here is a same issue on version 2023.12.26 when I compile the code in CLion IDE, ubuntu 22.04, and the error log is:

CMake Error at CMakeLists.txt:62 (find_package):
  By not providing "FindStb.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Stb", but
  CMake did not find one.

  Could not find a package configuration file provided by "Stb" with any of
  the following names:

    StbConfig.cmake
    stb-config.cmake

  Add the installation prefix of "Stb" to CMAKE_PREFIX_PATH or set "Stb_DIR"
  to a directory containing one of the above files.  If "Stb" provides a
  separate development package or SDK, be sure it has been installed.


-- Configuring incomplete, errors occurred!

[Failed to reload]

and I added the following line in CMakeLists.txt ,

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/build/vcpkg.linux/packages/stb_x64-linux/share/stb")

then it worked!

All things go perfectly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants