Вот моя структура каталогов проекта: < /p>
Код: Выделить всё
imgui_project
|____build
|____CMakeLists.txt
|____src
| |__CMakeLists.txt
| |__main.cpp
|____Vendors
|___CMakeLists.txt
|___Imgui
| |____CMakeLists.txt
|___sdl
|____CMakeLists.txt
< /code>
Содержимое в файлах:
shystrong> iimgui_project/cmakelists.txt
cmake_minimum_required(VERSION 3.22)
project(imgui_app)
add_subdirectory(vendors)
add_subdirectory(src)
Код: Выделить всё
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
add_executable(myapp main.cpp)
target_link_libraries(myapp PRIVATE SDL3 imgui)
Код: Выделить всё
{the entire content of example_sdl3_renderer3 main.cpp file from the imgui github repository.}
Код: Выделить всё
add_subdirectory(sdl)
add_subdirectory(imgui)
Код: Выделить всё
include(FetchContent)
FetchContent_Declare(
imgui
GIT_REPOSITORY https://github.com/ocornut/imgui.git
GIT_TAG docking
)
FetchContent_MakeAvailable(imgui)
add_library(imgui)
target_include_directories(
imgui
PUBLIC
${imgui_SOURCE_DIR}
${imgui_SOURCE_DIR}/backends
)
target_sources(
imgui
PUBLIC
${imgui_SOURCE_DIR}/imgui.cpp
${imgui_SOURCE_DIR}/imgui_draw.cpp
${imgui_SOURCE_DIR}/imgui_demo.cpp
${imgui_SOURCE_DIR}/imgui_tables.cpp
${imgui_SOURCE_DIR}/imgui_widgets.cpp
${imgui_SOURCE_DIR}/backends/imgui_impl_sdl3.cpp
${imgui_SOURCE_DIR}/backends/imgui_impl_sdlrenderer3.cpp
)
target_link_directories(imgui PUBLIC SDL3)
Код: Выделить всё
include(FetchContent)
FetchContent_Declare(
SDL3
GIT_REPOSITORY https://github.com/libsdl-org/SDL.git
GIT_TAG release-3.2.20
)
FetchContent_MakeAvailable(SDL3)
< /code>
Я строю проект в каталоге сборки, используя команду: cmake .. -g "Unix makefiles" < /code>
Когда я запускаю, Make < /code>, ошибка, которую я получаю: < /p>
.../imgui_project/build/_deps/imgui-src/backends/imgui_impl_sdl3.cpp:83:10: fatal error: 'SDL3/SDl.h' file not found
83 | #include
Итак, я не уверен, почему он не может найти файл sdl.h . Это единственная ошибка, которую я сейчас получаю.
Подробнее здесь: https://stackoverflow.com/questions/797 ... sdl-h-file