epezent / implot

Immediate Mode Plotting
MIT License
4.5k stars 495 forks source link

Question: undeclared identifiers and executable configuration. #535

Open felixmaldonadoos opened 7 months ago

felixmaldonadoos commented 7 months ago

Hello,

Im trying to implement implot to this repo (https://github.com/SaschaWillems/Vulkan/tree/master). All the examples build fine, including the imgui example which I am mainly interested in. I cloned implot to the external/ folder and updated the include paths in the main/root CmakeLists.txt (include_directories(external/implot)) and to the examples/CmakeLists.txt I added the following:

IF(${EXAMPLE_NAME} STREQUAL "implot")
  file(GLOB ADD_SOURCE 
  "../external/imgui/*.cpp" 
  "../external/implot/*.cpp" 
  "../external/implot/implot_internal.h")
  SET(SOURCE ${SOURCE} ${ADD_SOURCE})
ENDIF()

My system:

I added whole examples/CmakeLists.txt below.

examples/CMakeLists.txt:
function(buildExample EXAMPLE_NAME)
    SET(EXAMPLE_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/${EXAMPLE_NAME})
    message(STATUS "Generating project file for example in ${EXAMPLE_FOLDER}")
    file(GLOB SOURCE *.cpp ${BASE_HEADERS} ${EXAMPLE_FOLDER}/*.cpp)
    SET(MAIN_CPP ${EXAMPLE_FOLDER}/${EXAMPLE_NAME}.cpp)
    if(EXISTS ${EXAMPLE_FOLDER}/main.cpp)
        SET(MAIN_CPP ${EXAMPLE_FOLDER}/main.cpp)
    ENDIF()
    if(EXISTS ${EXAMPLE_FOLDER}/${EXAMPLE_NAME}.h)
        SET(MAIN_HEADER ${EXAMPLE_FOLDER}/${EXAMPLE_NAME}.h)
    ENDIF()
    IF(${EXAMPLE_NAME} STREQUAL "imgui")
        file(GLOB ADD_SOURCE "../external/imgui/*.cpp")
        SET(SOURCE ${SOURCE} ${ADD_SOURCE})
    ENDIF()

    IF(${EXAMPLE_NAME} STREQUAL "implot")
        file(GLOB ADD_SOURCE 
        "../external/imgui/*.cpp" 
        "../external/implot/*.cpp" 
        "../external/implot/implot_internal.h")
        SET(SOURCE ${SOURCE} ${ADD_SOURCE})
    ENDIF()

    IF(USE_WAYLAND_WSI)
        SET(SOURCE ${SOURCE} ${CMAKE_BINARY_DIR}/xdg-shell-client-protocol.h ${CMAKE_BINARY_DIR}/xdg-shell-protocol.c)
    ENDIF()

    set(SHADER_DIR_GLSL "../shaders/glsl/${EXAMPLE_NAME}")
    file(GLOB SHADERS_GLSL "${SHADER_DIR_GLSL}/*.vert" "${SHADER_DIR_GLSL}/*.frag" "${SHADER_DIR_GLSL}/*.comp" "${SHADER_DIR_GLSL}/*.geom" "${SHADER_DIR_GLSL}/*.tesc" "${SHADER_DIR_GLSL}/*.tese" "${SHADER_DIR_GLSL}/*.mesh" "${SHADER_DIR_GLSL}/*.task" "${SHADER_DIR_GLSL}/*.rgen" "${SHADER_DIR_GLSL}/*.rchit" "${SHADER_DIR_GLSL}/*.rmiss" "${SHADER_DIR_GLSL}/*.rcall" "${SHADER_DIR_GLSL}/*.rahit" "${SHADER_DIR_GLSL}/*.rint" "${SHADER_DIR_GLSL}/*.glsl")
    set(SHADER_DIR_HLSL "../shaders/hlsl/${EXAMPLE_NAME}")
    file(GLOB SHADERS_HLSL "${SHADER_DIR_HLSL}/*.vert" "${SHADER_DIR_HLSL}/*.frag" "${SHADER_DIR_HLSL}/*.comp" "${SHADER_DIR_HLSL}/*.geom" "${SHADER_DIR_HLSL}/*.tesc" "${SHADER_DIR_HLSL}/*.tese" "${SHADER_DIR_HLSL}/*.mesh" "${SHADER_DIR_HLSL}/*.task" "${SHADER_DIR_HLSL}/*.rgen" "${SHADER_DIR_HLSL}/*.rchit" "${SHADER_DIR_HLSL}/*.rmiss" "${SHADER_DIR_HLSL}/*.rcall" "${SHADER_DIR_HLSL}/*.rahit" "${SHADER_DIR_HLSL}/*.rint")
    source_group("Shaders\\GLSL" FILES ${SHADERS_GLSL})
    source_group("Shaders\\HLSL" FILES ${SHADERS_HLSL})
    file(GLOB README_FILES "${EXAMPLE_FOLDER}/*.md")
    if(WIN32)
        add_executable(${EXAMPLE_NAME} WIN32 ${MAIN_CPP} ${SOURCE} ${MAIN_HEADER} ${SHADERS_GLSL} ${SHADERS_HLSL} ${README_FILES})
        target_link_libraries(${EXAMPLE_NAME} base ${Vulkan_LIBRARY} ${WINLIBS})
    else(WIN32)
        add_executable(${EXAMPLE_NAME} ${MAIN_CPP} ${SOURCE} ${MAIN_HEADER} ${SHADERS_GLSL} ${SHADERS_HLSL} ${README_FILES})
        target_link_libraries(${EXAMPLE_NAME} base )
    endif(WIN32)

    file(MAKE_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
    set_target_properties(${EXAMPLE_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
    if(${EXAMPLE_NAME} STREQUAL "texture3d")
        if(APPLE)
            if(NOT OpenMP_omp_LIBRARY AND EXISTS /opt/local/lib/libomp/libomp.dylib)
                set(OpenMP_omp_LIBRARY /opt/local/lib/libomp/libomp.dylib)
            endif()
            if(CMAKE_C_COMPILER_ID MATCHES "Clang\$")
                set(OpenMP_C_FLAGS "-Xclang -fopenmp")
                set(OpenMP_C_LIB_NAMES "omp")
                if(NOT OpenMP_C_INCLUDE_DIR AND EXISTS /opt/local/include/libomp)
                    set(OpenMP_C_INCLUDE_DIR /opt/local/include/libomp)
                endif()
            endif()
            if(CMAKE_CXX_COMPILER_ID MATCHES "Clang\$")
                set(OpenMP_CXX_FLAGS "-Xclang -fopenmp")
                set(OpenMP_CXX_LIB_NAMES "omp")
                if(NOT OpenMP_CXX_INCLUDE_DIR AND EXISTS /opt/local/include/libomp)
                    set(OpenMP_CXX_INCLUDE_DIR /opt/local/include/libomp)
                endif()
            endif()
        endif()
        find_package(OpenMP)
        if(OpenMP_CXX_FOUND)
            link_directories(${OpenMP_CXX_LIBRARY_DIRS})
        endif()
    endif()

    if(RESOURCE_INSTALL_DIR)
        install(TARGETS ${EXAMPLE_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
    endif()
endfunction(buildExample)

function(buildExamples)
    foreach(EXAMPLE ${EXAMPLES})
        buildExample(${EXAMPLE})
    endforeach(EXAMPLE)
endfunction(buildExamples)

set(EXAMPLES
    imgui
    multiview
    implot
)

buildExamples()

Tree

.
├── BUILD.md
├── CMakeLists.txt
├── CREDITS.md
├── LICENSE.md
├── README.md
├── android
│   ├── build.gradle
│   ├── common
│   │   └── res
│   ├── examples
│   │   ├── _template
│   │   ├── base
│   │   ├── bloom
│   │   ├── computecloth
│   │   ├── computecullandlod
│   │   ├── computeheadless
│   │   ├── computenbody
│   │   ├── computeparticles
│   │   ├── computeraytracing
│   │   ├── computeshader
│   │   ├── conservativeraster
│   │   ├── debugmarker
│   │   ├── deferred
│   │   ├── deferredmultisampling
│   │   ├── deferredshadows
│   │   ├── descriptorindexing
│   │   ├── descriptorsets
│   │   ├── displacement
│   │   ├── distancefieldfonts
│   │   ├── dynamicuniformbuffer
│   │   ├── gears
│   │   ├── geometryshader
│   │   ├── gltfloading
│   │   ├── gltfscenerendering
│   │   ├── gltfskinning
│   │   ├── gradle
│   │   ├── hdr
│   │   ├── imgui
│   │   ├── indirectdraw
│   │   ├── inlineuniformblocks
│   │   ├── inputattachments
│   │   ├── instancing
│   │   ├── multisampling
│   │   ├── multithreading
│   │   ├── multiview
│   │   ├── negativeviewportheight
│   │   ├── occlusionquery
│   │   ├── offscreen
│   │   ├── oit
│   │   ├── parallaxmapping
│   │   ├── particlesystem
│   │   ├── pbrbasic
│   │   ├── pbribl
│   │   ├── pbrtexture
│   │   ├── pipelines
│   │   ├── pipelinestatistics
│   │   ├── pushconstants
│   │   ├── pushdescriptors
│   │   ├── radialblur
│   │   ├── rayquery
│   │   ├── raytracingbasic
│   │   ├── raytracingreflections
│   │   ├── raytracingshadows
│   │   ├── renderheadless
│   │   ├── screenshot
│   │   ├── shadowmapping
│   │   ├── shadowmappingcascade
│   │   ├── shadowmappingomni
│   │   ├── specializationconstants
│   │   ├── sphericalenvmapping
│   │   ├── ssao
│   │   ├── stencilbuffer
│   │   ├── subpasses
│   │   ├── terraintessellation
│   │   ├── tessellation
│   │   ├── textoverlay
│   │   ├── texture
│   │   ├── texture3d
│   │   ├── texturearray
│   │   ├── texturecubemap
│   │   ├── texturecubemaparray
│   │   ├── texturemipmapgen
│   │   ├── triangle
│   │   ├── variablerateshading
│   │   ├── vertexattributes
│   │   ├── viewportarray
│   │   └── vulkanscene
│   ├── gradle
│   │   └── wrapper
│   ├── gradle.properties
│   ├── gradlew
│   ├── gradlew.bat
│   └── settings.gradle
├── assets
│   ├── README.md
│   ├── Roboto-Medium-license.txt
│   ├── Roboto-Medium.ttf
│   ├── font.fnt
│   ├── models
│   │   ├── CesiumMan
│   │   ├── FlightHelmet
│   │   ├── armor
│   │   ├── cerberus
│   │   ├── chinesedragon.gltf
│   │   ├── color_teapot_spheres.gltf
│   │   ├── cube.gltf
│   │   ├── deer.gltf
│   │   ├── deferred_box.gltf
│   │   ├── deferred_floor.gltf
│   │   ├── displacement_plane.gltf
│   │   ├── fireplace.gltf
│   │   ├── glowsphere.gltf
│   │   ├── gltf
│   │   ├── lavaplanet.gltf
│   │   ├── oaktree.gltf
│   │   ├── plane.gltf
│   │   ├── plane_circle.gltf
│   │   ├── plane_z.gltf
│   │   ├── plants.gltf
│   │   ├── reflection_scene.gltf
│   │   ├── retroufo.glb
│   │   ├── retroufo.gltf
│   │   ├── retroufo_glow.glb
│   │   ├── retroufo_glow.gltf
│   │   ├── retroufo_license.txt
│   │   ├── retroufo_red_lowpoly.gltf
│   │   ├── rock01.gltf
│   │   ├── samplebuilding.gltf
│   │   ├── samplebuilding_glass.gltf
│   │   ├── sampleroom.gltf
│   │   ├── samplescene.gltf
│   │   ├── shadowscene_fire.gltf
│   │   ├── sibenik.gltf
│   │   ├── sphere.gltf
│   │   ├── sponza
│   │   ├── suzanne.gltf
│   │   ├── suzanne_lods.gltf
│   │   ├── teapot.gltf
│   │   ├── terrain_gridlines.gltf
│   │   ├── torusknot.gltf
│   │   ├── treasure_glow.gltf
│   │   ├── treasure_smooth.gltf
│   │   ├── tunnel_cylinder.gltf
│   │   ├── venus.gltf
│   │   ├── voyager.gltf
│   │   ├── vulkanscene_license.txt
│   │   ├── vulkanscene_shadow.gltf
│   │   ├── vulkanscenebackground.gltf
│   │   ├── vulkanscenelogos.gltf
│   │   └── vulkanscenemodels.gltf
│   └── textures
│       ├── colored_glass_rgba.ktx
│       ├── crate01_color_height_rgba.ktx
│       ├── crate02_color_height_rgba.ktx
│       ├── cubemap_array.ktx
│       ├── cubemap_space.ktx
│       ├── cubemap_vulkan.ktx
│       ├── cubemap_yokohama_rgba.ktx
│       ├── fireplace_colormap_rgba.ktx
│       ├── fireplace_normalmap_rgba.ktx
│       ├── font_bitmap_rgba.ktx
│       ├── font_sdf_rgba.ktx
│       ├── gratefloor_rgba.ktx
│       ├── gridlines.ktx
│       ├── ground_dry_rgba.ktx
│       ├── hdr
│       ├── lavaplanet_rgba.ktx
│       ├── matcap_array_rgba.ktx
│       ├── metalplate01_rgba.ktx
│       ├── metalplate_nomips_rgba.ktx
│       ├── particle01_rgba.ktx
│       ├── particle_fire.ktx
│       ├── particle_gradient_rgba.ktx
│       ├── particle_smoke.ktx
│       ├── rocks_color_rgba.ktx
│       ├── rocks_normal_height_rgba.ktx
│       ├── skysphere_rgba.ktx
│       ├── stonefloor01_color_rgba.ktx
│       ├── stonefloor01_normal_rgba.ktx
│       ├── stonefloor02_color_rgba.ktx
│       ├── stonefloor02_normal_rgba.ktx
│       ├── stonefloor03_color_height_rgba.ktx
│       ├── terrain_heightmap_r16.ktx
│       ├── terrain_texturearray_rgba.ktx
│       ├── texture_orientation_ccw_rgba.ktx
│       ├── texture_orientation_cw_rgba.ktx
│       ├── texturearray_plants_rgba.ktx
│       ├── texturearray_rgba.ktx
│       ├── texturearray_rocks_rgba.ktx
│       ├── vulkan_11_rgba.ktx
│       └── vulkan_cloth_rgba.ktx
├── base
│   ├── CMakeLists.txt
│   ├── CommandLineParser.hpp
│   ├── VulkanAndroid.cpp
│   ├── VulkanAndroid.h
│   ├── VulkanBuffer.cpp
│   ├── VulkanBuffer.h
│   ├── VulkanDebug.cpp
│   ├── VulkanDebug.h
│   ├── VulkanDevice.cpp
│   ├── VulkanDevice.h
│   ├── VulkanFrameBuffer.hpp
│   ├── VulkanInitializers.hpp
│   ├── VulkanRaytracingSample.cpp
│   ├── VulkanRaytracingSample.h
│   ├── VulkanSwapChain.cpp
│   ├── VulkanSwapChain.h
│   ├── VulkanTexture.cpp
│   ├── VulkanTexture.h
│   ├── VulkanTools.cpp
│   ├── VulkanTools.h
│   ├── VulkanUIOverlay.cpp
│   ├── VulkanUIOverlay.h
│   ├── VulkanglTFModel.cpp
│   ├── VulkanglTFModel.h
│   ├── benchmark.hpp
│   ├── camera.hpp
│   ├── frustum.hpp
│   ├── keycodes.hpp
│   ├── threadpool.hpp
│   ├── vulkanexamplebase.cpp
│   └── vulkanexamplebase.h
├── bin
├── cmake
│   ├── FindDirectFB.cmake
│   ├── FindWayland.cmake
│   └── FindXCB.cmake
├── examples
│   ├── CMakeLists.txt
│   ├── imgui
│   │   └── main.cpp
│   ├── implot
│   │   └── main.cpp
│   └── multiview
│       └── multiview.cpp
├── external
│   ├── glm
│   │   ├── CMakeLists.txt
│   │   ├── cmake
│   │   ├── doc
│   │   ├── glm
│   │   ├── manual.md
│   │   ├── readme.md
│   │   ├── test
│   │   └── util
│   ├── imgui
│   │   ├── LICENSE.txt
│   │   ├── imconfig.h
│   │   ├── imgui.cpp
│   │   ├── imgui.h
│   │   ├── imgui_demo.cpp
│   │   ├── imgui_draw.cpp
│   │   ├── imgui_internal.h
│   │   ├── imgui_widgets.cpp
│   │   ├── imstb_rectpack.h
│   │   ├── imstb_textedit.h
│   │   └── imstb_truetype.h
│   ├── implot
│   │   ├── LICENSE
│   │   ├── README.md
│   │   ├── TODO.md
│   │   ├── implot.cpp
│   │   ├── implot.h
│   │   ├── implot_demo.cpp
│   │   ├── implot_internal.h
│   │   └── implot_items.cpp