### Copy and Execute Guest Setup Scripts Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imnodes/vcpkg/scripts/azure-pipelines/osx/README.md Copies necessary setup scripts (setup-guest.sh, setup-box.sh) and the Xcode installer (clt.dmg) to the VM, then executes the guest setup script. Ensure paths are correct. ```sh scp ./setup-guest.sh vcpkg@MACHINE:/Users/vcpkg/Downloads scp ./setup-box.sh vcpkg@MACHINE:/Users/vcpkg/Downloads scp path/to/console/tools.dmg vcpkg@MACHINE:/Users/vcpkg/Downloads/clt.dmg ssh vcpkg@MACHINE cd /Users/vcpkg/Downloads chmod +x ./setup-guest.sh ./setup-guest.sh exit ``` -------------------------------- ### Build Example with Visual Studio CLI (64-bit) Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imgui/examples/example_sdl2_opengl2/README.md Use this command to build the example on Windows with Visual Studio's command-line interface for a 64-bit executable. Ensure SDL2_DIR is set to your SDL2 installation path. ```batch cl /Zi /MD /I.. /I..\.. /I%SDL2_DIR%\include main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_opengl2.cpp ..\..\imgui*.cpp /FeDebug/example_sdl2_opengl2.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x64 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console ``` -------------------------------- ### Hello SDL2 Example Source: https://github.com/allendang/cimgui-go/blob/main/thirdparty/SDL/docs/README-visualc.md A basic SDL2 program to verify the setup. It initializes SDL video, creates a window and renderer, and then cleans up resources. ```c #include "SDL.h" int main( int argc, char* argv[] ) { const int WIDTH = 640; const int HEIGHT = 480; SDL_Window* window = NULL; SDL_Renderer* renderer = NULL; SDL_Init(SDL_INIT_VIDEO); window = SDL_CreateWindow("SDL2 Test", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, WIDTH, HEIGHT, SDL_WINDOW_SHOWN); renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC); SDL_DestroyRenderer(renderer); SDL_DestroyWindow(window); SDL_Quit(); return 0; } ``` -------------------------------- ### Build Example with MSVC (Windows 64-bit) Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imgui/examples/example_sdl2_opengl3/README.md Compile the example for Windows 64-bit using MSVC. Ensure SDL2_DIR is set to your SDL2 installation path. ```batch set SDL2_DIR=path_to_your_sdl2_folder cl /Zi /MD /utf-8 /I.. /I..\.. /I%SDL2_DIR%\include main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_opengl3.cpp ..\..\imgui*.cpp /FeDebug/example_sdl2_opengl3.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x64 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console ``` -------------------------------- ### Copy and Execute VM Setup Scripts Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imnodes/vcpkg/scripts/azure-pipelines/osx/README.md Copies necessary setup scripts and the Xcode command-line tools installer to the VM, then executes the guest setup script. The box setup script is also removed after execution. ```sh scp ./setup-guest.sh vcpkg@MACHINE:/Users/vcpkg scp ./setup-box.sh vcpkg@MACHINE:/Users/vcpkg scp path/to/console/tools.dmg vcpkg@MACHINE:/Users/vcpkg/clt.dmg ssh vcpkg@MACHINE chmod +x setup-guest.sh ./setup-guest.sh rm setup-guest.sh rm setup-box.sh ``` -------------------------------- ### Build Example with Visual Studio CLI (32-bit) Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imgui/examples/example_sdl2_opengl2/README.md Use this command to build the example on Windows with Visual Studio's command-line interface for a 32-bit executable. Ensure SDL2_DIR is set to your SDL2 installation path. ```batch set SDL2_DIR=path_to_your_sdl2_folder cl /Zi /MD /I.. /I..\.. /I%SDL2_DIR%\include main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_opengl2.cpp ..\..\imgui*.cpp /FeDebug/example_sdl2_opengl2.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console ``` -------------------------------- ### Build Example with GCC/Clang (Linux/Unix) Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imgui/examples/example_sdl2_opengl3/README.md Compile the example on Linux or similar Unix systems using C++. This command uses sdl2-config to get necessary flags. ```bash c++ `sdl2-config --cflags` -I .. -I ../.. -I ../../backends \ main.cpp ../../backends/imgui_impl_sdl2.cpp ../../backends/imgui_impl_opengl3.cpp ../../imgui*.cpp \ `sdl2-config --libs` -lGL -ldl ``` -------------------------------- ### Build Example with Emscripten Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imgui/examples/example_sdl2_opengl3/README.md Build the example for the web using Emscripten. Requires Emscripten SDK to be installed and configured. ```bash make -f Makefile.emscripten ``` -------------------------------- ### Build Example with MSVC (Windows 32-bit) Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imgui/examples/example_sdl2_opengl3/README.md Compile the example for Windows 32-bit using MSVC. Ensure SDL2_DIR is set to your SDL2 installation path. ```batch set SDL2_DIR=path_to_your_sdl2_folder cl /Zi /MD /utf-8 /I.. /I..\.. /I%SDL2_DIR%\include main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_opengl3.cpp ..\..\imgui*.cpp /FeDebug/example_sdl2_opengl3.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console ``` -------------------------------- ### Bootstrap vcpkg Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imnodes/vcpkg/README.md Clone the vcpkg repository and run the bootstrap script to install vcpkg. This is the initial setup step. ```cmd > git clone https://github.com/microsoft/vcpkg > .\vcpkg\bootstrap-vcpkg.bat ``` -------------------------------- ### Build Example with Visual Studio CLI (Windows 64-bit) Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imgui/examples/example_sdl3_opengl3/README.md Compile the example using the Visual Studio compiler (cl.exe) on Windows for a 64-bit target. Ensure SDL3_DIR is set to your SDL3 installation path. ```batch cl /Zi /MD /utf-8 /I.. /I..\.. /I%SDL3_DIR%\include main.cpp ..\..\backends\imgui_impl_sdl3.cpp ..\..\backends\imgui_impl_opengl3.cpp ..\..\imgui*.cpp /FeDebug/example_sdl3_opengl3.exe /FoDebug/ /link /libpath:%SDL3_DIR%\lib\x64 SDL3.lib SDL2mainopengl32.lib /subsystem:console ``` -------------------------------- ### Build Example with Visual Studio CLI (Windows 32-bit) Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imgui/examples/example_sdl3_opengl3/README.md Compile the example using the Visual Studio compiler (cl.exe) on Windows for a 32-bit target. Ensure SDL3_DIR is set to your SDL3 installation path. ```batch set SDL3_DIR=path_to_your_sdl3_folder cl /Zi /MD /utf-8 /I.. /I..\.. /I%SDL3_DIR%\include main.cpp ..\..\backends\imgui_impl_sdl3.cpp ..\..\backends\imgui_impl_opengl3.cpp ..\..\imgui*.cpp /FeDebug/example_sdl3_opengl3.exe /FoDebug/ /link /libpath:%SDL3_DIR%\lib\x86 SDL3.lib opengl32.lib /subsystem:console ``` -------------------------------- ### Basic CMake Project Setup Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imnodes/vcpkg/ports/nonius/CMakeLists.txt Initializes a CMake project and sets the policy version. This is a standard starting point for CMake projects. ```cmake cmake_minimum_required(VERSION 3.9) cmake_policy(VERSION ${CMAKE_VERSION}) # use default policies of current cmake version project(nonius) ``` -------------------------------- ### Build and Run ImPlot Example with CMake Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/implot/example/README.md Use these commands to build the ImPlot example with CMake and then run the executable. Ensure you have CMake installed and the project is in your current directory. ```bash cmake -B build && cmake --build build && build/example ``` -------------------------------- ### Build Example on Mac OS X Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imgui/examples/example_sdl2_opengl2/README.md Build the example on Mac OS X after installing SDL2 via Homebrew. This command uses sdl2-config for flags and links against the OpenGL framework. ```bash brew install sdl2 c++ `sdl2-config --cflags` -I .. -I ../.. -I ../../backends main.cpp ../../backends/imgui_impl_sdl2.cpp ../../backends/imgui_impl_opengl2.cpp ../../imgui*.cpp `sdl2-config --libs` -framework OpenGl ``` -------------------------------- ### Basic CMake Project Setup Source: https://github.com/allendang/cimgui-go/blob/main/thirdparty/SDL/cmake/test/CMakeLists.txt Initializes the CMake build system and defines the project name and language. This is a standard starting point for CMake projects. ```cmake cmake_minimum_required(VERSION 3.12) project(sdl_test LANGUAGES C) ``` -------------------------------- ### Build ImGui Allegro5 Example with cl.exe (Windows) Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imgui/examples/example_allegro5/README.md Build the ImGui Allegro5 example on Windows using the Visual Studio command-line compiler. Set the ALLEGRODIR environment variable to your Allegro5 installation path. This command also defines `IMGUI_USER_CONFIG` for 32-bit indices. ```batch set ALLEGRODIR=path_to_your_allegro5_folder cl /Zi /MD /utf-8 /I %ALLEGRODIR%\include /DIMGUI_USER_CONFIG=\"examples/example_allegro5/imconfig_allegro5.h\" /I .. /I ..\.. /I ..\..\backends main.cpp ..\..\backends\imgui_impl_allegro5.cpp ..\..\imgui*.cpp /link /LIBPATH:%ALLEGRODIR%\lib allegro-5.0.10-monolith-md.lib user32.lib ``` -------------------------------- ### Configure HIDAPI Build Options Source: https://github.com/allendang/cimgui-go/blob/main/thirdparty/SDL/src/hidapi/README.txt Example of configuring HIDAPI build with specific options. '--enable-testgui' builds the Test GUI, and '--prefix' specifies installation directories. ```bash ./configure --enable-testgui --prefix=/usr ``` -------------------------------- ### Basic wxWidgets Application Setup Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imnodes/vcpkg/ports/wxwidgets/example/CMakeLists.txt Configures a basic wxWidgets application executable. Ensure wxWidgets is installed and findable by CMake. ```cmake cmake_minimum_required(VERSION 3.7) project(wxwidgets-example) add_executable(main WIN32 popup.cpp) find_package(wxWidgets REQUIRED) target_compile_definitions(main PRIVATE ${wxWidgets_DEFINITIONS} "$<$:${wxWidgets_DEFINITIONS_DEBUG}>") target_include_directories(main PRIVATE ${wxWidgets_INCLUDE_DIRS}) target_link_libraries(main PRIVATE ${wxWidgets_LIBRARIES}) ``` -------------------------------- ### Build for Emscripten Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imgui/examples/example_glfw_wgpu/CMakeLists.txt Steps for building the example for Emscripten, including installing the SDK, Ninja, configuring CMake with emcmake, and running the build. Optional flags for Dawn are also noted. ```bash Install Emscripten SDK following the instructions: https://emscripten.org/docs/getting_started/downloads.html Install Ninja build system emcmake cmake -G Ninja -B build (optional) -DIMGUI_EMSCRIPTEN_WEBGPU_FLAG="--use-port=path/to/emdawnwebgpu_package/emdawnwebgpu.port.py", see ReadMe.md cmake --build build emrun build/index.html ``` -------------------------------- ### Install Allegro5 with vcpkg (Windows) Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imgui/examples/example_allegro5/README.md Install Allegro5 using vcpkg for Windows. This command installs the library for both 32-bit and 64-bit triplets and integrates it with Visual Studio. ```bash git clone https://github.com/Microsoft/vcpkg cd vcpkg bootstrap-vcpkg.bat vcpkg install allegro5 --triplet=x86-windows ; for win32 vcpkg install allegro5 --triplet=x64-windows ; for win64 vcpkg integrate install ; register include / libs in Visual Studio ``` -------------------------------- ### GLFW Dependency Setup Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imgui/examples/example_glfw_vulkan/CMakeLists.txt Configures the GLFW subdirectory and its build options. Sets the GLFW directory and disables examples, tests, docs, and installation. ```cmake # GLFW if(NOT GLFW_DIR) set(GLFW_DIR ../../../glfw) # Set this to point to an up-to-date GLFW repo endif() option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" OFF) option(GLFW_BUILD_TESTS "Build the GLFW test programs" OFF) option(GLFW_BUILD_DOCS "Build the GLFW documentation" OFF) option(GLFW_INSTALL "Generate installation target" OFF) option(GLFW_DOCUMENT_INTERNALS "Include internals in documentation" OFF) add_subdirectory(${GLFW_DIR} binary_dir EXCLUDE_FROM_ALL) include_directories(${GLFW_DIR}/include) ``` -------------------------------- ### Hello Example Build Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imnodes/CMakeLists.txt Configures the 'hello' executable example. Links against the 'imnodes' library, SDL2, and OpenGL. ```cmake add_executable(hello ${CMAKE_CURRENT_SOURCE_DIR}/imnodes.cpp ${CMAKE_CURRENT_SOURCE_DIR}/example/main.cpp ${CMAKE_CURRENT_SOURCE_DIR}/example/hello.cpp) target_link_libraries(hello imnodes SDL2::SDL2) if (APPLE) target_link_libraries(hello "-framework OpenGL") elseif(MSVC) target_link_libraries(hello "opengl32") else() target_link_libraries(hello X11 Xext GL) endif() ``` -------------------------------- ### Build Desktop with WGPU-Native Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imgui/examples/example_sdl2_wgpu/README.md Builds the example for desktop using WGPU-Native. Download WGPU-Native binaries and specify the path. ```bash unzip the downloaded file in `your_preferred_folder` cmake -B build -DIMGUI_WGPU_DIR=your_preferred_folder cmake --build build ``` -------------------------------- ### Build for Desktop with WGPU-Native Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imgui/examples/example_glfw_wgpu/README.md Build the example for desktop using the WGPU-Native backend. Download the pre-compiled WGPU-Native binary modules for your system and specify their location. ```bash download WGPU-Native autogenerated binary modules for your platform/compiler from: https://github.com/gfx-rs/wgpu-native/releases unzip the downloaded file in `your_preferred_folder` cmake -B build -DIMGUI_WGPU_DIR=your_preferred_folder cmake --build build ``` -------------------------------- ### Install ImGuizmo with vcpkg Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/ImGuizmo/README.md This command installs ImGuizmo using the vcpkg package manager. Refer to the vcpkg example for more detailed integration instructions. ```bash vcpkg install imguizmo ``` -------------------------------- ### Build for Desktop (WebGPU-Native) with WGPU Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imgui/examples/example_sdl3_wgpu/README.md Build the example for desktop using WGPU-Native. Download the pre-compiled binary modules for your platform and specify the directory. ```bash download WGPU-Native autogenerated binary modules for your platform/compiler from: https://github.com/gfx-rs/wgpu-native/releases unzip the downloaded file in `your_preferred_folder` cmake -B build -DIMGUI_WGPU_DIR=your_preferred_folder ("full path" or "relative" starting from current directory) cmake --build build ``` -------------------------------- ### Build with WGPU-Native Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imgui/examples/example_glfw_wgpu/CMakeLists.txt Steps to download WGPU-Native binaries, configure CMake with the WGPU-Native directory, and build the example. The binary output location is provided. ```bash download WGPU-Native autogenerated binary modules for your platform/compiler from: https://github.com/gfx-rs/wgpu-native/releases unzip the downloaded file in your_preferred_folder cmake -B build -DIMGUI_WGPU_DIR=your_preferred_folder ("full path" or "relative" starting from current directory) cmake --build build ``` -------------------------------- ### Build Example with GCC/Clang (macOS) Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imgui/examples/example_sdl3_opengl3/README.md Compile the example using g++ or clang on macOS. It requires sdl3 to be installed via Homebrew and uses sdl3-config for flags, linking against OpenGL and CoreFoundation frameworks. ```bash brew install sdl3 c++ `sdl3-config --cflags` -I .. -I ../.. -I ../../backends \ main.cpp ../../backends/imgui_impl_sdl3.cpp ../../backends/imgui_impl_opengl3.cpp ../../imgui*.cpp \ `sdl3-config --libs` -framework OpenGl -framework CoreFoundation ``` -------------------------------- ### Build Example on Linux/Unix Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imgui/examples/example_sdl2_opengl2/README.md Compile the example on Linux or similar Unix-like systems using g++. This command utilizes sdl2-config for flags and libraries, and links against OpenGL. ```bash c++ `sdl2-config --cflags` -I .. -I ../.. -I ../../backends main.cpp ../../backends/imgui_impl_sdl2.cpp ../../backends/imgui_impl_opengl2.cpp ../../imgui*.cpp `sdl2-config --libs` -lGL ``` -------------------------------- ### Example .parameters File Source: https://github.com/allendang/cimgui-go/blob/main/thirdparty/SDL/visualtest/README.txt Defines command-line options for the SUT, specifying their type, possible values, and default settings. Use hash characters for comments. ```plaintext --blend, enum, [add mod], false, [] --fullscreen, boolean, [], false, [] ``` -------------------------------- ### Deploying Guest Script and Running Agent (ARM64) Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imnodes/vcpkg/scripts/azure-pipelines/osx/README.md Copy the guest deploy script to the VM, make it executable, and run it with a PAT. Then, relaunch the VM in ephemeral mode and connect to run the agent. ```sh scp ./register-guest.sh vcpkg@MACHINE:/Users/vcpkg ssh vcpkg@MACHINE chmod +x register-guest.sh ./register-guest.sh rm register-guest.sh exit ``` ```sh ~/macosvm --ephemeral ./vm.json ``` ```sh ssh -i ~/Parallels/*/id_guest -o StrictHostKeychecking=no vcpkg@vcpkgs-Virtual-Machine.local ~/myagent/run.sh ``` -------------------------------- ### ImGui Window with Menu and Widgets Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imgui/docs/README.md Shows how to create a window with a menu bar, menu items, color editing, plotting, and a scrolling text region. This example illustrates more advanced window and widget usage, including handling menu actions and displaying dynamic data. ```cpp // Create a window called "My First Tool", with a menu bar. ImGui::Begin("My First Tool", &my_tool_active, ImGuiWindowFlags_MenuBar); if (ImGui::BeginMenuBar()) { if (ImGui::BeginMenu("File")) { if (ImGui::MenuItem("Open..", "Ctrl+O")) { /* Do stuff */ } if (ImGui::MenuItem("Save", "Ctrl+S")) { /* Do stuff */ } if (ImGui::MenuItem("Close", "Ctrl+W")) { my_tool_active = false; } ImGui::EndMenu(); } ImGui::EndMenuBar(); } // Edit a color stored in 4 floats ImGui::ColorEdit4("Color", my_color); // Generate samples and plot them float samples[100]; for (int n = 0; n < 100; n++) samples[n] = sinf(n * 0.2f + ImGui::GetTime() * 1.5f); ImGui::PlotLines("Samples", samples, 100); // Display contents in a scrolling region ImGui::TextColored(ImVec4(1,1,0,1), "Important Stuff"); ImGui::BeginChild("Scrolling"); for (int n = 0; n < 50; n++) ImGui::Text("%04d: Some text", n); ImGui::EndChild(); ImGui::End(); ``` -------------------------------- ### Build ImGui Allegro5 Example with g++ (Ubuntu/macOS) Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imgui/examples/example_allegro5/README.md Compile the ImGui Allegro5 example using g++. Ensure Allegro is installed. This command defines `IMGUI_USER_CONFIG` to use the Allegro5 specific configuration for 32-bit indices. ```bash g++ -DIMGUI_USER_CONFIG=\"examples/example_allegro5/imconfig_allegro5.h\" -I .. -I ../.. -I ../../backends main.cpp ../../backends/imgui_impl_allegro5.cpp ../../imgui*.cpp -lallegro -lallegro_main -lallegro_primitives -o allegro5_example ``` -------------------------------- ### Install macosvm on ARM64 Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imnodes/vcpkg/scripts/azure-pipelines/osx/README.md Download and extract the macosvm utility for ARM64 macOS systems. This is a one-time setup step. ```sh curl -L -o macosvm-0.2-1-arm64-darwin21.tar.gz https://github.com/s-u/macosvm/releases/download/0.2-1/macosvm-0.2-1-arm64-darwin21.tar.gz tar xvf macosvm-0.2-1-arm64-darwin21.tar.gz rm macosvm-0.2-1-arm64-darwin21.tar.gz ``` -------------------------------- ### Configure ImGui Example Includes and Definitions Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imgui/examples/example_sdl2_wgpu/CMakeLists.txt Sets include directories for ImGui, its backends, and SDL2. Also defines IMGUI_EXAMPLE_SDL2_WGPU for the executable. ```cmake target_include_directories(${IMGUI_EXECUTABLE} PUBLIC ${IMGUI_DIR} ${IMGUI_DIR}/backends ${SDL2_INCLUDE_DIRS} ) target_compile_definitions(${IMGUI_EXECUTABLE} PUBLIC "IMGUI_EXAMPLE_SDL2_WGPU") ``` -------------------------------- ### Build for Desktop with Google Dawn Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imgui/examples/example_glfw_wgpu/README.md Use this command to build the example for desktop platforms using Google Dawn as the WebGPU backend. Ensure you have cloned the Dawn repository. ```bash git clone https://github.com/google/dawn dawn cmake -B build -DIMGUI_DAWN_DIR=dawn cmake --build build ``` -------------------------------- ### CMake Project Setup Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/ImGuiColorTextEdit/vendor1/regex/test/cmake_install_test/CMakeLists.txt Defines the minimum CMake version, project name, and languages. This is a standard starting point for CMake projects. ```cmake cmake_minimum_required(VERSION 3.5...3.16) project(cmake_install_test LANGUAGES CXX) ``` -------------------------------- ### Build imnodes Examples with CMake Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imnodes/README.md Instructions for building the imnodes examples using CMake and vcpkg. Ensure submodules are initialized before running the CMake configuration. ```bash git submodule update --init cmake -B build-release/ -S . -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake cmake --build build-release -- -j ``` -------------------------------- ### Run Example with emrun Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imgui/examples/example_glfw_wgpu/README.md Use the emrun command to serve the HTML file and open it in a specified browser. This command automatically spawns a temporary local webserver. ```bash emrun web/example_glfw_wgpu.html --browser firefox ``` -------------------------------- ### Get Dynamic Libraries for SDL Source: https://github.com/allendang/cimgui-go/blob/main/thirdparty/SDL/docs/README-macos.md Use this command to retrieve the necessary flags for dynamically linking against SDL. This is the default behavior and requires SDL to be installed on the target machine. ```bash sdl-config --libs ``` -------------------------------- ### Project Setup and Library Definition Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imnodes/vcpkg/ports/nlohmann-fifo-map/CMakeLists.txt Defines the CMake version, project name, and sets up variables for installation paths and build directories. It then defines an INTERFACE library and an ALIAS target. ```cmake cmake_minimum_required(VERSION 3.1) project(nlohmann-fifo-map LANGUAGES CXX) include(GNUInstallDirs) set(NLOHMANN_FIFO_MAP_TARGET_NAME ${PROJECT_NAME}) set(NLOHMANN_FIFO_MAP_INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}/nlohmann") set(NLOHMANN_FIFO_MAP_CONFIG_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/nlohmann-fifo-map") set(NLOHMANN_FIFO_MAP_CONFIG_EXPORT_NAME "${PROJECT_NAME}-config") set(NLOHMANN_FIFO_MAP_INCLUDE_BUILD_DIR "${CMAKE_SOURCE_DIR}/src/") add_library(${NLOHMANN_FIFO_MAP_TARGET_NAME} INTERFACE) add_library(${PROJECT_NAME}::${NLOHMANN_FIFO_MAP_TARGET_NAME} ALIAS ${NLOHMANN_FIFO_MAP_TARGET_NAME}) ``` -------------------------------- ### Basic CMake Project Setup Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imnodes/vcpkg/ports/metrohash/CMakeLists.txt Initializes the CMake project, sets the C++ standard, and defines the library target. ```cmake cmake_minimum_required(VERSION 3.5) project(metrohash LANGUAGES CXX) set(CMAKE_CXX_STANDARD 11) ``` -------------------------------- ### Build using CMake Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imgui/examples/example_glfw_wgpu/README.md This is the universal command to build the example after CMake configuration, regardless of the chosen backend or generator. ```bash cmake --build where_to_build_dir ``` -------------------------------- ### CMake Project Setup for ImGuizmo Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/ImGuizmo/vcpkg-example/CMakeLists.txt Configures the CMake project, finds ImGui and ImGuizmo packages, and sets up an executable. Ensure ImGui and ImGuizmo are installed via vcpkg or another package manager. ```cmake cmake_minimum_required(VERSION 3.16) project(vcpkg-example) add_definitions(-DSTB_IMAGE_IMPLEMENTATION) find_path(STB_INCLUDE_DIRS "stb.h") find_package(imgui CONFIG REQUIRED) find_package(imguizmo CONFIG REQUIRED) add_executable(example-app) target_sources(example-app PRIVATE main.cpp) target_compile_options(example-app PRIVATE "/std:c++17") target_include_directories(example-app PRIVATE ${STB_INCLUDE_DIRS} ) target_link_libraries(example-app PRIVATE imgui::imgui imguizmo::imguizmo ) ``` -------------------------------- ### Example: Triangle rendering with GLFW and OpenGL Source: https://github.com/allendang/cimgui-go/blob/main/thirdparty/glfw/docs/quick.md A complete example demonstrating initialization, window creation, event polling, and rendering a triangle using GLFW and OpenGL. ```c #include #include #include static void error_callback(int error, const char* description) { fprintf(stderr, "Error: %s\n", description); } static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) { if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) glfwSetWindowShouldClose(window, GLFW_TRUE); } int main(void) { GLFWwindow* window; int width, height; glfwSetErrorCallback(error_callback); if (!glfwInit()) return -1; glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); window = glfwCreateWindow(640, 480, "Simple example", NULL, NULL); if (!window) { glfwTerminate(); return -1; } glfwSetKeyCallback(window, key_callback); glfwMakeContextCurrent(window); gladLoadGLLoader((GLADloadproc)glfwGetProcAddress); glfwSwapInterval(1); while (!glfwWindowShouldClose(window)) { width = glfwGetWindowWidth(window); height = glfwGetWindowHeight(window); glViewport(0, 0, width, height); glClear(GL_COLOR_BUFFER_BIT); glBegin(GL_TRIANGLES); glColor3f(1.f, 0.f, 0.f); glVertex3f(-0.6f, -0.4f, 0.f); glColor3f(0.f, 1.f, 0.f); glVertex3f( 0.6f, -0.4f, 0.f); glColor3f(0.f, 0.f, 1.f); glVertex3f( 0.f, 0.4f, 0.f); glEnd(); glfwSwapBuffers(window); glfwPollEvents(); } glfwDestroyWindow(window); glfwTerminate(); return 0; } ``` -------------------------------- ### Get Static Libraries for SDL Source: https://github.com/allendang/cimgui-go/blob/main/thirdparty/SDL/docs/README-macos.md Use this command to retrieve the necessary flags for statically linking against SDL. This is crucial for ensuring your application runs on other machines without requiring a separate SDL installation. ```bash sdl-config --static-libs ``` -------------------------------- ### Deploying Guest Script and Running Agent (AMD64) Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imnodes/vcpkg/scripts/azure-pipelines/osx/README.md Copy the guest deploy script to the VM, make it executable, and run it with a PAT. Then, connect to the VM via SSH and run the agent. ```sh scp ./register-guest.sh vcpkg@MACHINE:/Users/vcpkg ssh vcpkg@MACHINE chmod +x /Users/vcpkg/register-guest.sh /Users/vcpkg/register-guest.sh ``` ```sh ssh -i ~/Parallels/*/id_guest -o StrictHostKeychecking=no vcpkg@`prlctl list --full | sed -nr 's/^.*running *([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}).*/\1/p'` ~/myagent/run.sh ``` -------------------------------- ### Install SDL2 Library Source: https://github.com/allendang/cimgui-go/blob/main/thirdparty/SDL/CMakeLists.txt Installs the SDL2 library file to the specified installation directory. This command ensures the library is available system-wide after installation. ```cmake install(FILES ${SDL2_BINARY_DIR}/libSDL2${SOPOSTFIX}${SOEXT} DESTINATION "${CMAKE_INSTALL_LIBDIR}") ``` -------------------------------- ### Build Example with GCC/Clang (Linux/Unix) Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imgui/examples/example_sdl3_opengl3/README.md Compile the example using g++ or clang on Linux and similar Unix-like systems. It uses sdl3-config to fetch compiler and linker flags. ```bash c++ `sdl3-config --cflags` -I .. -I ../.. -I ../../backends \ main.cpp ../../backends/imgui_impl_sdl3.cpp ../../backends/imgui_impl_opengl3.cpp ../../imgui*.cpp \ `sdl3-config --libs` -lGL -ldl ``` -------------------------------- ### Basic CMake Project Setup Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imnodes/vcpkg/ports/fastfeat/CMakeLists.txt Initializes a CMake project and sets the minimum required version. This is standard for all CMake projects. ```cmake cmake_minimum_required(VERSION 3.8) project(fastfeat) ``` -------------------------------- ### Install vcpkg Packages Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imnodes/vcpkg/README.md Install libraries for your project using the vcpkg install command. Replace '[packages to install]' with the desired package names. ```sh $ ./vcpkg/vcpkg install [packages to install] ``` -------------------------------- ### Basic LV2 Library Setup Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imnodes/vcpkg/ports/lv2/CMakeLists.txt Defines the minimum CMake version and project name, then creates an INTERFACE library for LV2. ```cmake cmake_minimum_required(VERSION 3.17) project(lv2 NONE) add_library(lv2 INTERFACE) ``` -------------------------------- ### Install Winpty Libraries and Binaries Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imnodes/vcpkg/ports/winpty/CMakeLists.txt Installs Winpty targets based on the build type. Static builds install libraries, while others install DLLs and import libraries. Also installs agent and debugserver executables. ```cmake if("${BUILD_TYPE}" STREQUAL "STATIC") install(TARGETS winpty DESTINATION ${WINPTY_INSTALL_LIB_DIR}) else() install(FILES ${CMAKE_CURRENT_BINARY_DIR}/winpty.dll DESTINATION ${WINPTY_INSTALL_BIN_DIR}) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/winpty.lib DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) endif() install(TARGETS winpty-agent DESTINATION ${WINPTY_INSTALL_BIN_DIR}) install(TARGETS winpty-debugserver DESTINATION ${WINPTY_INSTALL_BIN_DIR}) ``` -------------------------------- ### Build Example with GCC/Clang (macOS) Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imgui/examples/example_sdl2_opengl3/README.md Compile the example on macOS using C++. This command uses sdl2-config and links against OpenGL and CoreFoundation frameworks. ```bash brew install sdl2 c++ `sdl2-config --cflags` -I .. -I ../.. -I ../../backends \ main.cpp ../../backends/imgui_impl_sdl2.cpp ../../backends/imgui_impl_opengl3.cpp ../../imgui*.cpp \ `sdl2-config --libs` -framework OpenGl -framework CoreFoundation ``` -------------------------------- ### Install SDL Test Executables and Resources Source: https://github.com/allendang/cimgui-go/blob/main/thirdparty/SDL/test/CMakeLists.txt Installs SDL test executables, PDB files (on MSVC), and resource files to the specified installation directory. This ensures that tests can be run after the SDL library is installed. Handles platform-specific installation for RISC OS. ```cmake if(SDL_INSTALL_TESTS) if(RISCOS) install( FILES ${SDL_TEST_EXECUTABLES_AIF} DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/installed-tests/SDL2 ) else() install( TARGETS ${SDL_TEST_EXECUTABLES} DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/installed-tests/SDL2 ) endif() if(MSVC) foreach(test ${SDL_TEST_EXECUTABLES}) SDL_install_pdb(${test} "${CMAKE_INSTALL_LIBEXECDIR}/installed-tests/SDL2") endforeach() endif() install( FILES ${RESOURCE_FILES} DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/installed-tests/SDL2 ) endif() ``` -------------------------------- ### Prepare Sysroot for Chroot Source: https://github.com/allendang/cimgui-go/blob/main/thirdparty/SDL/docs/README-raspberrypi.md Copies QEMU static binary and mounts necessary host directories into the sysroot for chrooting. ```bash sudo apt-get install qemu binfmt-support qemu-user-static sudo cp /usr/bin/qemu-arm-static $SYSROOT/usr/bin sudo mount --bind /dev $SYSROOT/dev sudo mount --bind /proc $SYSROOT/proc sudo mount --bind /sys $SYSROOT/sys ``` -------------------------------- ### Build and Install Mesa for DirectFB Source: https://github.com/allendang/cimgui-go/blob/main/thirdparty/SDL/docs/README-directfb.md Compile and install Mesa with DirectFB support, specifying an installation directory. ```shell make linux-directfb make echo Installing - please enter sudo pw. sudo make install INSTALL_DIR=/usr/local/dfb_GL cd src/mesa/drivers/directfb make sudo make install INSTALL_DIR=/usr/local/dfb_GL ``` -------------------------------- ### Configure WebGPU Backend for Native Builds Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imgui/examples/example_sdl3_wgpu/CMakeLists.txt Sets up the WebGPU backend (Dawn, WGPU, or WGVK) for native builds based on directory variables. Links necessary libraries and includes headers. ```cmake if(NOT EMSCRIPTEN) # WegGPU-Native settings if(IMGUI_DAWN_DIR) target_compile_definitions(${IMGUI_EXECUTABLE} PUBLIC "IMGUI_IMPL_WEBGPU_BACKEND_DAWN") if(NOT Dawn_FOUND) target_link_libraries(${IMGUI_EXECUTABLE} INTERFACE webgpu_cpp) endif() endif() if(IMGUI_WGPU_DIR) target_compile_definitions(${IMGUI_EXECUTABLE} PUBLIC "IMGUI_IMPL_WEBGPU_BACKEND_WGPU") target_include_directories(${IMGUI_EXECUTABLE} PUBLIC ${IMGUI_WGPU_DIR}/include) endif() if(IMGUI_WGVK_DIR) target_sources(${IMGUI_EXECUTABLE} PRIVATE ${IMGUI_WGVK_DIR}/src/wgvk.c) target_compile_definitions(${IMGUI_EXECUTABLE} PUBLIC "IMGUI_IMPL_WEBGPU_BACKEND_WGVK") target_include_directories(${IMGUI_EXECUTABLE} PUBLIC ${IMGUI_WGVK_DIR}/include) if (MSVC) target_compile_options(${IMGUI_EXECUTABLE} PUBLIC /std:clatest /experimental:c11atomics) endif() endif() target_link_libraries(${IMGUI_EXECUTABLE} PUBLIC ${LIBRARIES} SDL3::SDL3) else() # Emscripten settings set(CMAKE_EXECUTABLE_SUFFIX ".html") target_compile_options(${IMGUI_EXECUTABLE} PUBLIC "${IMGUI_EMSCRIPTEN_WEBGPU_FLAG}") target_compile_definitions(${IMGUI_EXECUTABLE} PUBLIC "IMGUI_IMPL_WEBGPU_BACKEND_DAWN") message(STATUS "Using ${IMGUI_EMSCRIPTEN_WEBGPU_FLAG} WebGPU implementation") target_compile_options(${IMGUI_EXECUTABLE} PUBLIC "-sUSE_SDL=3") target_link_options(${IMGUI_EXECUTABLE} PRIVATE "${IMGUI_EMSCRIPTEN_WEBGPU_FLAG}" "-sUSE_SDL=3" "-sWASM=1" "-sASYNCIFY=1" "-sALLOW_MEMORY_GROWTH=1" "-sNO_EXIT_RUNTIME=0" "-sASSERTIONS=1" "-sDISABLE_EXCEPTION_CATCHING=1" # "-sNO_FILESYSTEM=1" "--shell-file=${CMAKE_CURRENT_LIST_DIR}/../libs/emscripten/shell_minimal.html" ) set_target_properties(${IMGUI_EXECUTABLE} PROPERTIES OUTPUT_NAME "index") endif() ``` -------------------------------- ### Install Import Library Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imnodes/vcpkg/ports/node-api-headers/CMakeLists.txt Installs the generated 'node.lib' file to the 'lib' destination within the installation directory. ```cmake install(FILES ${CMAKE_BINARY_DIR}/node.lib DESTINATION lib) ``` -------------------------------- ### Installation Rules Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imnodes/vcpkg/ports/nlohmann-fifo-map/CMakeLists.txt Specifies how to install the library's header files and CMake configuration files. This includes installing the source directory to the include path and exporting targets for package management. ```cmake install( DIRECTORY ${NLOHMANN_FIFO_MAP_INCLUDE_BUILD_DIR} DESTINATION ${NLOHMANN_FIFO_MAP_INCLUDE_INSTALL_DIR} ) install( TARGETS ${NLOHMANN_FIFO_MAP_TARGET_NAME} EXPORT ${NLOHMANN_FIFO_MAP_CONFIG_EXPORT_NAME} INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) install( EXPORT ${NLOHMANN_FIFO_MAP_CONFIG_EXPORT_NAME} DESTINATION ${NLOHMANN_FIFO_MAP_CONFIG_INSTALL_DIR} NAMESPACE ${PROJECT_NAME}:: ) ``` -------------------------------- ### Install Header Files Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imnodes/vcpkg/ports/libaiff/CMakeLists.txt Conditionally installs the public header files for the libaiff library if the installation of headers is not disabled. ```cmake if(NOT DISABLE_INSTALL_HEADERS) install(FILES libaiff/libaiff.h libaiff/config.h libaiff/endian.h DESTINATION include/libaiff) endif() ``` -------------------------------- ### Install EasyExif Library and Headers Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imnodes/vcpkg/ports/easyexif/CMakeLists.txt Installs the EasyExif static library, its headers, and archives to standard installation directories. ```cmake install(TARGETS easyexif PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ) ``` -------------------------------- ### Conditional Header Installation Source: https://github.com/allendang/cimgui-go/blob/main/cwrappers/imnodes/vcpkg/ports/nonius/CMakeLists.txt Installs the 'include' directory of the Nonius project if 'DISABLE_INSTALL_HEADERS' is not set. This ensures headers are available after installation. ```cmake if(NOT DISABLE_INSTALL_HEADERS) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION include ) endif() ```