### Define Source and Header Files for imgui Source: https://github.com/lectem/worldstone/blob/master/source/tools/RendererApp/imgui/CMakeLists.txt Sets the source and header files for the imgui implementation. This is a prerequisite for creating the library. ```cmake set(SRC_LIST imgui_bgfx.cpp) set(HDR_LIST imgui_bgfx.h ) ``` -------------------------------- ### Create Static Library for imgui Implementation Source: https://github.com/lectem/worldstone/blob/master/source/tools/RendererApp/imgui/CMakeLists.txt Adds a static library target named 'ws_imgui_impl' using the defined source and header files. This library encapsulates the imgui integration logic. ```cmake add_library(ws_imgui_impl ${SRC_LIST} ${HDR_LIST}) ``` -------------------------------- ### Link Dependencies for imgui Library Source: https://github.com/lectem/worldstone/blob/master/source/tools/RendererApp/imgui/CMakeLists.txt Links the 'ws_imgui_impl' library with 'external::bgfx' and 'imgui::imgui'. This makes bgfx and imgui functionalities available to the imgui implementation. ```cmake target_link_libraries(ws_imgui_impl PUBLIC external::bgfx imgui::imgui ) ``` -------------------------------- ### Create ALIAS Target for bgfx::imgui Source: https://github.com/lectem/worldstone/blob/master/source/tools/RendererApp/imgui/CMakeLists.txt Creates an ALIAS target 'bgfx::imgui' that points to 'ws_imgui_impl'. This provides a convenient and namespaced way to refer to the imgui implementation library. ```cmake add_library(bgfx::imgui ALIAS ws_imgui_impl) ``` -------------------------------- ### Enable Link-Time Optimization (LTO) Source: https://github.com/lectem/worldstone/blob/master/source/tools/RendererApp/imgui/CMakeLists.txt Enables Link-Time Optimization for the 'ws_imgui_impl' target in optimized builds. LTO can improve performance by optimizing across translation units. ```cmake target_enable_lto(ws_imgui_impl optimized) ``` -------------------------------- ### RendererApp Link Libraries Source: https://github.com/lectem/worldstone/blob/master/source/tools/RendererApp/CMakeLists.txt Specifies the libraries to be linked with the RendererApp target. This includes custom libraries (WS::system, WS::decoders), SDL2, bgfx, and imgui. ```cmake target_link_libraries(RendererApp PUBLIC WS::system WS::decoders SDL2::SDL2 external::bgfx bgfx::imgui ) ``` -------------------------------- ### Add CMake Test Source: https://github.com/lectem/worldstone/blob/master/source/system/tests/CMakeLists.txt Adds a CMake test named 'WS.systemtest' that executes the 'ws_systemtest' executable with specified parameters and a working directory derived from the executable's properties. ```cmake add_test( NAME WS.systemtest COMMAND ws_systemtest ${TEST_RUNNER_PARAMS} WORKING_DIRECTORY $ # Would need to copy files if we install the tests ? ) ``` -------------------------------- ### Set Target Properties and Subdirectory Source: https://github.com/lectem/worldstone/blob/master/source/tools/CMakeLists.txt Assigns both DC6extract and MPQextract targets to the 'tools' project folder in Visual Studio and includes the RendererApp subdirectory. ```cmake set_target_properties(DC6extract MPQextract PROPERTIES FOLDER ${PROJECT_NAME}) add_subdirectory(RendererApp) set_directory_properties(PROPERTIES VS_STARTUP_PROJECT DC6extract) ``` -------------------------------- ### Configure Compiler Warnings Source: https://github.com/lectem/worldstone/blob/master/source/tools/RendererApp/imgui/CMakeLists.txt Configures compiler warnings for the 'ws_imgui_impl' target. It enables all warnings, treats them as errors, and disables a specific warning category named 'Annoying'. ```cmake target_set_warnings(ws_imgui_impl ENABLE ALL AS_ERROR ALL DISABLE Annoying ) ``` -------------------------------- ### Source and Header File Lists Source: https://github.com/lectem/worldstone/blob/master/source/tools/RendererApp/CMakeLists.txt Defines lists for source files (SRC_LIST) and header files (HDR_LIST) used by the RendererApp. These lists are used when adding the executable target. ```cmake set(SRC_LIST main.cpp BaseApp.cpp RendererApp.cpp bgfxUtils.cpp DrawSprite.cpp SearchableListWidget.cpp FileBrowser.cpp ) ``` ```cmake set(HDR_LIST main.h BaseApp.h RendererApp.h Inputs.h bgfxUtils.h DrawSprite.h SearchableListWidget.h FileBrowser.h ) ``` -------------------------------- ### Enable Link-Time Optimization (LTO) Source: https://github.com/lectem/worldstone/blob/master/source/tools/RendererApp/CMakeLists.txt Enables Link-Time Optimization for the RendererApp target in optimized builds. LTO can improve performance by performing optimizations across translation units. ```cmake target_enable_lto(RendererApp optimized) ``` -------------------------------- ### Define Executable and Link Libraries Source: https://github.com/lectem/worldstone/blob/master/source/system/tests/CMakeLists.txt Defines the system test executable and links it against external libraries and the project's system library. Configures the debugger's working directory for the executable. ```cmake add_executable(ws_systemtest main.cpp FileStreamTests.cpp BitStreamTests.cpp SystemUtilsTests.cpp ) target_link_libraries(ws_systemtest external::doctest WS::system) set_target_properties(ws_systemtest PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/workingDirectory ) ``` -------------------------------- ### RendererApp Executable Target Source: https://github.com/lectem/worldstone/blob/master/source/tools/RendererApp/CMakeLists.txt Defines the RendererApp executable target, including Windows-specific settings (WIN32) and listing all source, header, and shader files required for the build. ```cmake add_executable(RendererApp WIN32 ${SRC_LIST} ${HDR_LIST} ${SHADERS_LIST} ) ``` -------------------------------- ### Shader File List Source: https://github.com/lectem/worldstone/blob/master/source/tools/RendererApp/CMakeLists.txt Defines a list of shader files (SHADERS_LIST) to be compiled and included in the build. This list specifies the paths to the shader source files. ```cmake set(SHADERS_LIST shaders/vs_sprite.sc shaders/fs_sprite.sc ) ``` -------------------------------- ### Define Executable for Decoder Tests Source: https://github.com/lectem/worldstone/blob/master/source/decoders/tests/CMakeLists.txt Defines the executable for the decoder tests, listing its source files. ```cmake add_executable(ws_decoderstests decoderstests.cpp ImageViewTests.cpp PaletteTests.cpp ) ``` -------------------------------- ### Multi-line Doxygen Comments Source: https://github.com/lectem/worldstone/blob/master/CONTRIBUTING.md Use C-style block comments for multi-line Doxygen documentation, including brief descriptions, parameter explanations, and longer detailed explanations. ```cpp /**This is a brief comment. * @param a This is a param description * * A longer description of this item. */ void foo(int a); ``` -------------------------------- ### Define MPQextract Executable Target Source: https://github.com/lectem/worldstone/blob/master/source/tools/CMakeLists.txt Defines the MPQextract executable, links the system library, enables Link-Time Optimization (LTO), and configures compiler warnings. ```cmake add_executable(MPQextract MPQextract.cpp) target_link_libraries(MPQextract PUBLIC WS::system ) target_enable_lto(MPQextract optimized) target_set_warnings(MPQextract ENABLE ALL AS_ERROR ALL DISABLE Annoying ) ``` -------------------------------- ### Set Compiler Warnings Source: https://github.com/lectem/worldstone/blob/master/source/tools/RendererApp/CMakeLists.txt Configures compiler warnings for the RendererApp target. It enables all warnings, treats all warnings as errors, and disables a specific warning named 'Annoying'. ```cmake target_set_warnings(RendererApp ENABLE ALL AS_ERROR ALL DISABLE Annoying ) ``` -------------------------------- ### Shader Compilation Loop Source: https://github.com/lectem/worldstone/blob/master/source/tools/RendererApp/CMakeLists.txt Iterates through the SHADERS_LIST, determines the shader type (VERTEX or FRAGMENT), and calls the add_shader command to compile each shader. It specifies output directory, platforms, and GLSL version. ```cmake foreach(SHADER ${SHADERS_LIST}) if(${SHADER} MATCHES "vs_.*") set(SHADER_TYPE VERTEX) elseif(${SHADER} MATCHES "fs_.*") set(SHADER_TYPE FRAGMENT) else() message(FATAL_ERROR "Unsupported shader name") endif() add_shader(${SHADER} ${SHADER_TYPE} OUTPUT ${ShaderBinariesDir} PLATFORMS ${SHADER_PLATFORMS} GLSL_VERSION 130 ) endforeach() ``` -------------------------------- ### Shader Platform Configuration Source: https://github.com/lectem/worldstone/blob/master/source/tools/RendererApp/CMakeLists.txt Sets the SHADER_PLATFORMS variable based on the operating system (MSVC, APPLE, or others). This determines which shader languages will be compiled. ```cmake if( MSVC ) set( SHADER_PLATFORMS dx11 glsl) elseif( APPLE ) set( SHADER_PLATFORMS glsl ) else() set( SHADER_PLATFORMS glsl ) endif() ``` -------------------------------- ### SDL2 Dependency Check Source: https://github.com/lectem/worldstone/blob/master/source/tools/RendererApp/CMakeLists.txt Finds the SDL2 package and checks if the target is available. If not, it issues a warning and returns. Otherwise, it reports the found location. ```cmake find_package(SDL2) if(NOT TARGET SDL2::SDL2) message(WARNING "SDL2 not found, not building RendererApp. If you already installed SDL2, please set SDL2DIR or CMAKE_PREFIX_PATH to your SDL2 installation.") return() else() message(STATUS "Found SDL2 at ${SDL2_LIBRARY_DIR}, building RendererApp.") endif() ``` -------------------------------- ### Conditional Build Check Source: https://github.com/lectem/worldstone/blob/master/source/tools/RendererApp/CMakeLists.txt Checks if BGFX is available and returns if not. This ensures the application only builds when necessary dependencies are met. ```cmake if(NOT WS_WITH_BGFX) return() endif() ``` -------------------------------- ### Link Libraries for Decoder Tests Source: https://github.com/lectem/worldstone/blob/master/source/decoders/tests/CMakeLists.txt Links the necessary external and internal libraries to the decoder tests executable. ```cmake target_link_libraries(ws_decoderstests external::doctest WS::decoders) ``` -------------------------------- ### Copy Debug DLLs Source: https://github.com/lectem/worldstone/blob/master/source/tools/RendererApp/CMakeLists.txt Retrieves the location of the SDL2 library and copies necessary DLLs for debugging. This ensures that the application can run correctly in a debug environment by having its dependencies available. ```cmake get_target_property(SDL2_location SDL2::SDL2 LOCATION) get_filename_component(SDL2_directory ${SDL2_location} DIRECTORY) copy_dlls_for_debug(RendererApp "" "${SDL2_directory}") ``` -------------------------------- ### RendererApp Target Properties Source: https://github.com/lectem/worldstone/blob/master/source/tools/RendererApp/CMakeLists.txt Sets target-specific properties for RendererApp, such as the debugger working directory and the folder in the build system. This helps in organizing and running the application. ```cmake set_target_properties(RendererApp PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY ${RendererAppWorkDir} FOLDER ${PROJECT_NAME} ) ``` -------------------------------- ### Doxygen Test Aliases - Test Implementation Documentation Source: https://github.com/lectem/worldstone/blob/master/CONTRIBUTING.md Document test implementations using `@testimpl{TestedObject,TestShortName}` or `@testimpl{TestShortName}`. The `TestedObject` parameter links to the object being tested, while `TestShortName` identifies the specific test case. ```cpp ///@testimpl{FileStream,RO_filestream} TEST_CASE("Read-only filestream"); ///@testimpl{FileStream,WO_filestream} TEST_CASE("Write-only filestream"); ``` -------------------------------- ### Define DC6extract Executable Target Source: https://github.com/lectem/worldstone/blob/master/source/tools/CMakeLists.txt Defines the DC6extract executable, links necessary libraries (decoders and system), enables Link-Time Optimization (LTO), and configures compiler warnings. ```cmake project(tools) add_executable(DC6extract DC6extract.cpp) target_link_libraries(DC6extract PUBLIC WS::decoders WS::system ) target_enable_lto(DC6extract optimized) target_set_warnings(DC6extract ENABLE ALL AS_ERROR ALL DISABLE Annoying ) ``` -------------------------------- ### Link External Libraries with CMake Source: https://github.com/lectem/worldstone/blob/master/CONTRIBUTING.md When adding or using external libraries in CMake, always use the `external::` alias if the library does not already provide one. This ensures consistent library referencing. ```cmake target_link_libraries(hello_world PRIVATE external::fmt # Not provided, add the external:: prefix Qt5::Core # No need to add external, already in its own namespace ) ``` -------------------------------- ### Set Debugger Working Directory Source: https://github.com/lectem/worldstone/blob/master/source/decoders/tests/CMakeLists.txt Configures the working directory for the debugger when running the decoder tests executable. ```cmake set_target_properties(ws_decoderstests PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/workingDirectory ) ``` -------------------------------- ### Doxygen Test Aliases - Class Documentation Source: https://github.com/lectem/worldstone/blob/master/CONTRIBUTING.md Document classes intended for testing using the `@test{Module,TestShortName}` command. This command registers the class with specific test modules and short names for documentation generation. ```cpp /**A class representing a file stream * @test{System,RO_filestream} * @test{System,WO_filestream} */ class FileStream; ``` -------------------------------- ### Single-line Doxygen Comments Source: https://github.com/lectem/worldstone/blob/master/CONTRIBUTING.md Use C++-style single-line comments for brief Doxygen documentation of functions or members. For class members, use inline comments to describe their purpose. ```cpp /// A function that does nothing void bar(){} struct IntegerStruct { int value; ///< The value of the integer }; ``` -------------------------------- ### Add Decoder Tests to CTest Source: https://github.com/lectem/worldstone/blob/master/source/decoders/tests/CMakeLists.txt Adds the decoder tests as a CTest to be run by the testing framework. It specifies the test name, the command to execute, and the working directory. ```cmake add_test( NAME WS.decoders COMMAND ws_decoderstests ${TEST_RUNNER_PARAMS} WORKING_DIRECTORY $# Would need to copy files if we install the tests ? ) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.