### Configure Packaging and Installation Source: https://github.com/thephrozenkeep/d2moo/blob/master/CMakeLists.txt Includes system libraries, installs targets, and configures CPack for creating distributable packages. Installs executables, libraries, documentation, and README. ```cmake if(${D2MOO_INSTALL}) include(InstallRequiredSystemLibraries) # Tell CMake that the `install` target needs to install required system libraries (eg: Windows SDK) include(GNUInstallDirs) install(TARGETS D2.DetoursLauncher D2.Detours) set(D2MOO_TARGETS_TO_INSTALL D2Common D2Game D2Debugger) install(TARGETS ${D2MOO_TARGETS_TO_INSTALL} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}/patch ) foreach(TARGET_TO_INSTALL IN LISTS D2MOO_TARGETS_TO_INSTALL) install(FILES "$<$ ,SHARED_LIBRARY>:$>" DESTINATION ${CMAKE_INSTALL_BINDIR}/patch OPTIONAL ) endforeach() install(FILES README.md TYPE DOC) install(DIRECTORY doc/ TYPE DOC) set(CPACK_RESOURCE_FILE_README ${CMAKE_CURRENT_LIST_DIR}/README.md) include(CPack) endif() ``` -------------------------------- ### Install Project with CMake Source: https://github.com/thephrozenkeep/d2moo/blob/master/README.md This command installs the project after building the Release configuration using the 'DefaultGenerator' preset. This step is optional. ```shell cmake --build --preset DefaultGenerator --config Release --target install ``` -------------------------------- ### Build Project Without CMake Presets Source: https://github.com/thephrozenkeep/d2moo/blob/master/doc/AdvancedBuildAndRun.md Configure, build, and install the project manually using CMake commands if presets are not desired. Specify your build directory and installation folder. ```sh cmake -A Win32 -B YOU_BUILD_DIR cmake --build YOU_BUILD_DIR --config Release cmake --install YOU_BUILD_DIR --config Release --prefix YOUR_INSTALL_FOLDER ``` -------------------------------- ### Enable D2MOO Debugger Source: https://github.com/thephrozenkeep/d2moo/blob/master/doc/Debugging.md Start the game with the `-debug` argument or set the environment variable `D2_DEBUGGER=1` to enable the visual debugger. ```bash D2.DetoursLauncher -- -debug ``` ```bash export D2_DEBUGGER=1 ``` -------------------------------- ### Build Project with CMake Presets Source: https://github.com/thephrozenkeep/d2moo/blob/master/doc/AdvancedBuildAndRun.md Use these commands to configure, build, and install the project using CMake presets. Ensure you are in the correct environment if using the 'ninja' preset. ```sh cmake --preset DefaultGenerator cmake --build --preset DefaultGenerator --config Release cmake --build --preset DefaultGenerator --target install ``` -------------------------------- ### Include Standard CMake Modules Source: https://github.com/thephrozenkeep/d2moo/blob/master/CMakeLists.txt Includes various standard and custom CMake modules to manage options, installation directories, testing, and project-specific helpers. ```cmake include(CMakeDependentOption) include(GNUInstallDirs) include(CTest) include(cmake/D2MOO.TargetsHelpers.cmake) include(cmake/D2MOO.ModHelpers.cmake) include(cmake/D2MOO.D2SE.cmake) ``` -------------------------------- ### Basic CMake Project Setup Source: https://github.com/thephrozenkeep/d2moo/blob/master/CMakeLists.txt Sets the minimum required CMake version and defines the project name, languages, and version. It also includes a check to prevent in-source builds. ```cmake cmake_minimum_required(VERSION 3.15...3.29) if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR) message(FATAL_ERROR "Do not build in-source. Please remove CMakeCache.txt and the CMakeFiles/ directory. Then build out-of-source.") endif() project("D2MOO" LANGUAGES C CXX VERSION 0.1.0) ``` -------------------------------- ### D2MOO Project Options Configuration Source: https://github.com/thephrozenkeep/d2moo/blob/master/CMakeLists.txt Configures project-specific options such as the ordinals version, embedded patches, shared library building, installation, and test enablement. ```cmake set(D2MOO_ORDINALS_VERSION "1.10f" CACHE STRING "Name of the version to be used for ordinals and patches") option(ENABLE_D2DETOURS_EMBEDDED_PATCHES "Build the DLL with builtin patching using D2.Detours" ON) if(D2MOO_IS_ROOT_PROJECT) # Let parent project decide wether to use its own patches or not set(D2DETOURS_EMBEDDED_PATCHES_DIR "${EMBEDDED_PATCHES_DIR_PREFIX}D2.Detours.patches" CACHE PATH "The directory to your D2.Detours embedded patches. Defaults to the root D2.Detours.patches directory") if(NOT DEFINED BUILD_SHARED_LIBS AND D2MOO_ORDINALS_VERSION VERSION_LESS "1.14" ) set(BUILD_SHARED_LIBS ON CACHE BOOL "Should we build shared libraries (.DLLs) instead of static libraries.") endif() endif() option(D2MOO_INSTALL "Should we install the D2MOO targets?" ${D2MOO_IS_ROOT_PROJECT}) option(D2MOO_WITH_STATIC_TESTS "Enable static tests for struct layouts. Use for original game only, not mods." ON) cmake_dependent_option(D2MOO_BUILD_TESTS "Enable D2Moo project tests targets" ON # By default we want tests if CTest is enabled "BUILD_TESTING" OFF # Stay coherent with CTest variables ) ``` -------------------------------- ### Register D2 DLL Patches Source: https://github.com/thephrozenkeep/d2moo/blob/master/D2.Detours.patches/CMakeLists.txt Registers patching ordinal information directly into the .DLLs. This is a core setup step for D2MOO's patching mechanism. ```cmake D2MOO_register_D2_DLL_patches() ``` -------------------------------- ### Patch D2Common.patch.cpp to Ignore Original Function Source: https://github.com/thephrozenkeep/d2moo/blob/master/doc/Debugging.md Modify the D2Common.patch.cpp file to ignore the original D2Common_11263 function and instead use the patched version. This is part of the detour setup. ```diff diff --git a/D2.Detours.patches/1.10f/D2Common.patch.cpp b/D2.Detours.patches/1.10f/D2Common.patch.cpp index 248c662..9c447ac 100644 --- a/D2.Detours.patches/1.10f/D2Common.patch.cpp +++ b/D2.Detours.patches/1.10f/D2Common.patch.cpp @@ -8,6 +8,7 @@ #include #include #include +#include //#defineDISABLE_ALL_PATCHES @@ -1310,7 +1311,7 @@ static PatchAction patchActions[GetOrdinalCount()] = { PatchAction::FunctionReplacePatchByOriginal, // DATATBLS_GetMonSeqTableRecord @11262 - PatchAction::FunctionReplacePatchByOriginal, // D2Common_11263 @11263 + PatchAction::Ignore, // D2Common_11263 @11263 PatchAction::FunctionReplacePatchByOriginal, // STATLIST_SetSkillId @11264 @@ -1419,7 +1420,10 @@ static ExtraPatchAction extraPatchActions[] = { + + + { 0x6FD45210 - D2CommonImageBase, &D2Common_11263, PatchAction::FunctionReplaceOriginalByPatch, &D2Common_11263OrgPtr}, + { 0, 0, PatchAction::Ignore}, // Here because we need at least one element in the array }; ``` -------------------------------- ### Run D2.DetoursLauncher Manually Source: https://github.com/thephrozenkeep/d2moo/blob/master/doc/AdvancedBuildAndRun.md Launch Diablo 2 or D2SE using D2.DetoursLauncher. You can specify the game executable and pass parameters using '--'. The launcher looks for patch DLLs in the './patch' folder by default. ```sh D2.DetoursLauncher [Path to Game.exe or D2SE.exe] D2.DetoursLauncher [Game.exe] -- -direct -txt -w ``` -------------------------------- ### Set Visual Studio Startup Project Source: https://github.com/thephrozenkeep/d2moo/blob/master/D2.Detours.patches/CMakeLists.txt Sets the D2Debugger as the startup project within Visual Studio for the specified directory. This is useful for development and debugging workflows. ```cmake set_property(DIRECTORY ${D2MOO_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT D2Debugger) ``` -------------------------------- ### Prepare D2CMP Target Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2CMP/CMakeLists.txt Prepares the D2CMP target and links it with public libraries. ```cmake D2MOO_prepare_targets(D2CMP) target_link_libraries(${D2CMPImplName} PUBLIC D2CommonDefinitions Fog) ``` -------------------------------- ### Build Release Configuration with CMake Source: https://github.com/thephrozenkeep/d2moo/blob/master/README.md This command builds the project in Release configuration using the 'DefaultGenerator' preset. This can also be done via Visual Studio. ```shell cmake --build --preset DefaultGenerator --config Release ``` -------------------------------- ### Add Inventory Module Source Files Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2Game/CMakeLists.txt Includes source and header files for the Inventory module. This manages the player's inventory system and item modes. ```cmake target_sources(${D2GameImplName} PRIVATE src/INVENTORY/InvMode.cpp include/INVENTORY/InvMode.h ) ``` -------------------------------- ### Check for 32-bit Architecture Source: https://github.com/thephrozenkeep/d2moo/blob/master/CMakeLists.txt Warns the user if the build is not targeting a 32-bit architecture, as Diablo 2 is 32-bit only. ```cmake if(NOT ${CMAKE_SIZEOF_VOID_P} EQUAL 4) message(WARNING "Diablo2 is 32bits only, 64bits build are unsupported. Invoke CMake with '-A Win32'") endif() ``` -------------------------------- ### Define ImGui library target Source: https://github.com/thephrozenkeep/d2moo/blob/master/external/CMakeLists.txt Adds ImGui source and header files to a library target. Configures system include directories for ImGui and its backends, and creates an ALIAS target. ```cmake add_library(imgui #source files imgui/imgui.cpp imgui/imgui_draw.cpp imgui/imgui_demo.cpp imgui/imgui_tables.cpp imgui/imgui_widgets.cpp #headers imgui/imgui.h imgui/imgui_internal.h #backend imgui/backends/imgui_impl_win32.cpp imgui/backends/imgui_impl_win32.h imgui/backends/imgui_impl_dx9.cpp imgui/backends/imgui_impl_dx9.h ) target_include_directories(imgui SYSTEM PUBLIC imgui PUBLIC imgui/backends/ ) add_library(imgui::imgui ALIAS imgui) ``` -------------------------------- ### Prepare D2Gfx Target Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2Gfx/CMakeLists.txt Prepares the D2Gfx target for further configuration. This is a project-specific macro. ```cmake D2MOO_prepare_targets(D2Gfx) ``` -------------------------------- ### Initialize and Update Git Submodules Source: https://github.com/thephrozenkeep/d2moo/blob/master/README.md This command is used to initialize and update git submodules, including the D2.Detours project, which is a dependency for patching. ```shell git submodule update --init --recursive ``` -------------------------------- ### Enable IDE Folder Organization Source: https://github.com/thephrozenkeep/d2moo/blob/master/CMakeLists.txt Sets a global property to organize projects into folders within IDEs for better navigation. ```cmake set_property(GLOBAL PROPERTY USE_FOLDERS ON) ``` -------------------------------- ### Prepare D2Lang Target Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2Lang/CMakeLists.txt Prepares the D2Lang target and links it with public libraries. Ensure D2Lang is defined as a CMake target before calling this. ```cmake D2MOO_prepare_targets(D2Lang FORCE_EXPORT) target_link_libraries(${D2LangImplName} PUBLIC D2CommonDefinitions D2Hell Fog) ``` -------------------------------- ### Include Storm Source Files Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/Storm/CMakeLists.txt Specifies the private source files for the Storm implementation target. This includes the main implementation file and header files. ```cmake target_sources(${StormImplName} PRIVATE src/Storm.cpp include/Storm.h include/StormHandles.h ) ``` -------------------------------- ### Set Include Directories for Game Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/Game/CMakeLists.txt Adds the 'include' directory to the include paths for the 'Game' target. This allows the project to find header files. ```cmake target_include_directories(Game PRIVATE include) ``` -------------------------------- ### Link D2Gfx Libraries Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2Gfx/CMakeLists.txt Links the D2Gfx implementation target with necessary libraries like Fog, Storm, and D2CommonDefinitions. ```cmake target_link_libraries(${D2GfxImplName} PRIVATE Fog Storm D2CommonDefinitions) ``` -------------------------------- ### Find Diablo II executable for D2Detours Source: https://github.com/thephrozenkeep/d2moo/blob/master/external/CMakeLists.txt Locates the Diablo II executable (D2SE.exe, Game.exe, or Diablo II.exe) to enable D2Detours. Sets the D2_PATH if found, otherwise prints a status message. ```cmake if(ENABLE_D2DETOURS_EMBEDDED_PATCHES) add_subdirectory(D2.Detours) # Look for D2SE first, then Diablo II. find_program(D2_EXE NAMES D2SE.exe "Game.exe" "Diablo II.exe" HINTS $ENV{D2INSTALL} $ENV{D2SE} PATH_SUFFIXES "Diablo II" ) if(D2_EXE) get_filename_component(D2_PATH ${D2_EXE} DIRECTORY CACHE) else() message(STATUS "D2 executable was not found, please set the `D2_EXE` CMake variable for debugging if your game executable is not at the install location.") endif() endif() ``` -------------------------------- ### Define Game Executable and Sources Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/Game/CMakeLists.txt Defines the main executable target 'Game' with its source files and resource files. It also conditionally adds another resource file based on existence. ```cmake add_executable(Game WIN32 src/Main.cpp include/Main.h resources/Game.rc ) if(EXISTS resources/Game.${D2MOO_ORDINALS_VERSION}.rc) target_sources(Game PRIVATE resources/Game.${D2MOO_ORDINALS_VERSION}.rc) endif() ``` -------------------------------- ### Configure CMake Project Source: https://github.com/thephrozenkeep/d2moo/blob/master/README.md This command configures the CMake project using the 'DefaultGenerator' preset. This step is necessary before building. ```shell cmake --preset DefaultGenerator ``` -------------------------------- ### Version Parsing and Definition Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2CommonDefinitions/CMakeLists.txt Parses the D2MOO_ORDINALS_VERSION string using a regex and defines version-related preprocessor macros if the format is correct. Includes a fatal error if the version format is invalid. ```cmake if(D2MOO_ORDINALS_VERSION) set(D2_VERSION_REGEX "^([0-9]+)\.([0-9][0-9])([A-Za-z]?)(-(.+))?$") if(D2MOO_ORDINALS_VERSION MATCHES ${D2_VERSION_REGEX}) set(D2MOO_ORDINAL_VERSION_MAJOR ${CMAKE_MATCH_1}) set(D2MOO_ORDINAL_VERSION_MINOR ${CMAKE_MATCH_2}) set(D2MOO_ORDINAL_VERSION_PATCH ${CMAKE_MATCH_3}) set(D2MOO_ORDINAL_VERSION_SPECIAL ${CMAKE_MATCH_5}) set(D2MOO_ORDINAL_VERSION_DEFINE_NAME "D2_VERSION_${D2MOO_ORDINAL_VERSION_MAJOR}${D2MOO_ORDINAL_VERSION_MINOR}${D2MOO_ORDINAL_VERSION_PATCH}") string(TOUPPER "${D2MOO_ORDINAL_VERSION_DEFINE_NAME}" D2MOO_ORDINAL_VERSION_DEFINE_NAME) cmake_print_variables(D2MOO_ORDINAL_VERSION_MAJOR D2MOO_ORDINAL_VERSION_MINOR D2MOO_ORDINAL_VERSION_PATCH D2MOO_ORDINAL_VERSION_SPECIAL D2MOO_ORDINAL_VERSION_DEFINE_NAME) string(REGEX REPLACE "^0+" "" D2MOO_ORDINAL_VERSION_MINOR_NO_LEADING_ZEROS ${D2MOO_ORDINAL_VERSION_MINOR}) if(D2MOO_ORDINAL_VERSION_MINOR_NO_LEADING_ZEROS STREQUAL "") set(D2MOO_ORDINAL_VERSION_MINOR_NO_LEADING_ZEROS 0) endif() target_compile_definitions(D2CommonDefinitions INTERFACE ${D2MOO_ORDINAL_VERSION_DEFINE_NAME} D2_VERSION_MAJOR=${D2MOO_ORDINAL_VERSION_MAJOR} D2_VERSION_MINOR=${D2MOO_ORDINAL_VERSION_MINOR_NO_LEADING_ZEROS} D2_VERSION_PATCH='${D2MOO_ORDINAL_VERSION_PATCH}' # Allow only single character $<$ ) else() message(FATAL_ERROR "Ordinal version format is incorrect. Needs to match '${D2_VERSION_REGEX}'") endif() endif() ``` -------------------------------- ### Prepare Storm Targets Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/Storm/CMakeLists.txt Prepares the CMake targets for the Storm module. This function likely sets up necessary variables and includes for the Storm component. ```cmake D2MOO_prepare_targets(Storm) ``` -------------------------------- ### Link Libraries for D2Net Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2Net/CMakeLists.txt Links necessary libraries to the D2Net implementation target. Includes common definitions, Fog, Storm, and Windows Sockets. ```cmake target_link_libraries(${D2NetImplName} PRIVATE D2CommonDefinitions Fog Storm ws2_32) ``` -------------------------------- ### Include Source Files for D2MCPClient Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2MCPClient/CMakeLists.txt Specifies the source files to be included in the D2MCPClient implementation target. ```cmake target_sources(${D2MCPClientImplName} PRIVATE src/D2MCPClient.cpp include/D2MCPClient.h ) ``` -------------------------------- ### Add D2Gfx Source Files Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2Gfx/CMakeLists.txt Specifies the source and header files for the D2Gfx implementation target. ```cmake target_sources(${D2GfxImplName} PRIVATE src/CmnSubtile.cpp src/D2Gfx.cpp src/Scale.cpp src/Texture.cpp src/Tile.cpp src/Window.cpp include/CmnSubtile.h include/DisplayType.h include/DrawMode.h include/D2Gfx.h include/Scale.h include/Texture.h include/Tile.h include/Window.h ) ``` -------------------------------- ### Link Libraries for D2CommonTests Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2Common/tests/CMakeLists.txt Links the D2CommonTests executable against the doctest framework and the D2Common implementation library. Ensures necessary dependencies are available during linking. ```cmake target_link_libraries(D2CommonTests PRIVATE doctest::doctest ${D2CommonImplName}) ``` -------------------------------- ### Add D2Sound Source Files Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2Sound/CMakeLists.txt Adds C++ and header files to the D2Sound implementation target. ```cmake target_sources(${D2SoundImplName} PRIVATE src/D2Sound.cpp include/D2Sound.h ) ``` -------------------------------- ### Set Include Directories for D2CommonDefinitions Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2CommonDefinitions/CMakeLists.txt Configures the include directories for the D2CommonDefinitions library. The 'include' directory is made available to targets linking to this library. ```cmake target_include_directories(D2CommonDefinitions INTERFACE include) ``` -------------------------------- ### Link Storm Libraries Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/Storm/CMakeLists.txt Links the Storm implementation target against public libraries, including D2CommonDefinitions and the squall::Storm library. This ensures all necessary dependencies are available. ```cmake target_link_libraries(${StormImplName} PUBLIC D2CommonDefinitions squall::Storm) ``` -------------------------------- ### Add Game Module Source Files Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2Game/CMakeLists.txt Includes source and header files for the core Game module. This defines fundamental game mechanics, client management, and event handling. ```cmake target_sources(${D2GameImplName} PRIVATE src/GAME/Arena.cpp src/GAME/CCmd.cpp src/GAME/Clients.cpp src/GAME/Event.cpp src/GAME/Game.cpp src/GAME/Level.cpp src/GAME/SCmd.cpp src/GAME/Targets.cpp src/GAME/Task.cpp include/GAME/Arena.h include/GAME/CCmd.h include/GAME/Clients.h include/GAME/Event.h include/GAME/Game.h include/GAME/Level.h include/GAME/SCmd.h include/GAME/Targets.h include/GAME/Task.h ) ``` -------------------------------- ### Add D2Hell Static Library Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2Hell/CMakeLists.txt Defines the D2Hell library as a static library, listing its source and header files. ```cmake add_library(D2Hell STATIC src/Archive.cpp src/CRC.cpp src/Fault.cpp src/File.cpp include/Archive.h include/CRC.h include/Fault.h include/File.h ) ``` -------------------------------- ### Add AI Source Files Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2Game/CMakeLists.txt Includes source and header files for the Artificial Intelligence module. This is used to define the AI behavior and logic within the game. ```cmake target_sources(${D2GameImplName} PRIVATE src/AI/AiBaal.cpp src/AI/AiGeneral.cpp src/AI/AiTactics.cpp src/AI/AiThink.cpp src/AI/AiUtil.cpp include/AI/AiBaal.h include/AI/AiGeneral.h include/AI/AiStates.h include/AI/AiTactics.h include/AI/AiThink.h include/AI/AiUtil.h ) ``` -------------------------------- ### Configure Test Runner Parameters Source: https://github.com/thephrozenkeep/d2moo/blob/master/CMakeLists.txt Sets custom parameters for the test runner, such as forcing colors, and configures CTest settings by generating a custom CMake file. ```cmake if(D2MOO_BUILD_TESTS) # Let the user add options to the test runner if needed set(TEST_RUNNER_PARAMS "--force-colors=true" CACHE STRING "Options to add to our test runners commands") # In a real project you most likely want to exclude test folders # list(APPEND CUSTOM_COVERAGE_EXCLUDE "/test/") # You can setup some custom variables and add them to the CTestCustom.cmake.in template to have custom ctest settings # For example, you can exclude some directories from the coverage reports such as third-parties and tests configure_file( ${CMAKE_CURRENT_LIST_DIR}/cmake/CTestCustom.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/CTestCustom.cmake @ONLY ) endif() ``` -------------------------------- ### Clone Repository with Submodules Source: https://github.com/thephrozenkeep/d2moo/blob/master/README.md This command clones the project repository and its git submodules recursively, ensuring all dependencies are included. ```shell git clone --recursive ``` -------------------------------- ### Set D2Hell Include Directories Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2Hell/CMakeLists.txt Configures the public include directory for the D2Hell library. ```cmake target_include_directories(D2Hell PUBLIC include) ``` -------------------------------- ### Configure D2Debugger Include Directories Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2Debugger/CMakeLists.txt Sets the public include directory for the D2Debugger library to 'include'. ```cmake target_include_directories(D2Debugger PUBLIC include) ``` -------------------------------- ### Implement Function Detour for Comparison Source: https://github.com/thephrozenkeep/d2moo/blob/master/doc/Debugging.md In D2Collision.cpp, define the original function pointer, the implementation of the real function, and the detour function. The detour function calls both the original and the implementation, comparing their results and triggering a breakpoint if they differ. ```cpp // Define the original function pointer D2Common_11263Type D2Common_11263OrgPtr; // Rename the real function to D2Common_11263_Impl BOOL __stdcall D2Common_11263_Impl(D2RoomStrc* pRoom, D2CoordStrc* pBeginCoord, D2CoordStrc* pEndCoord, uint16_t nCollisionType); // Our detour BOOL __stdcall D2Common_11263(D2RoomStrc* pRoom, D2CoordStrc* pBeginCoord, D2CoordStrc* pEndCoord, uint16_t nCollisionType) { static bool useOriginal = true; static bool debugging = false; // Keep copies of the returned / modified values BOOL retValOrg; BOOL retValImpl; D2CoordStrc pEndCoordCopyOrg; D2CoordStrc pEndCoordCopyImpl; do { // Reset params to original values pEndCoordCopyOrg = *pEndCoord; pEndCoordCopyImpl = *pEndCoord; // Call both functions (assumes there's no side-effects) retValOrg = D2Common_11263OrgPtr(pRoom, pBeginCoord, &pEndCoordCopyOrg, nCollisionType); retValImpl = D2Common_11263_Impl(pRoom, pBeginCoord, &pEndCoordCopyImpl, nCollisionType); // Compare results if (retValOrg != retValImpl || pEndCoordCopyOrg.nX != pEndCoordCopyImpl.nX || pEndCoordCopyOrg.nY != pEndCoordCopyImpl.nY ) { // Trigger breakpoint and loop if something does not match if (!debugging) { DebugBreak(); debugging = true; } } } while (debugging); // Return the value you want if (useOriginal) { *pEndCoord = pEndCoordCopyOrg; return retValOrg; } else { *pEndCoord = pEndCoordCopyImpl; return retValImpl; } } ``` -------------------------------- ### Specify Source Files for D2CommonDefinitions Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2CommonDefinitions/CMakeLists.txt Lists the header files to be included in the D2CommonDefinitions library. The usage of these sources is determined by SOURCES_TRANSITIVE_USAGE. ```cmake target_sources(D2CommonDefinitions ${SOURCES_TRANSITIVE_USAGE} include/BnClient.h include/D2BasicTypes.h include/D2Constants.h include/D2CommonDefinitions.h include/D2Math.h include/D2Structs.OtherDLLs.h include/D2PacketDef.h include/D2Dll.h include/D2BuildInformation.h include/D2Config.h ) ``` -------------------------------- ### Include Source Files for D2Common Implementation Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2Common/CMakeLists.txt Adds source files to the D2Common implementation target. This includes ordinals, headers, and miscellaneous files. ```cmake target_sources(${D2CommonImplName} PRIVATE # Ordinals that correspond to empty functions due to removed (debug) code src/UselessOrdinals.cpp include/UselessOrdinals.h # Misc include/D2Common.h include/Imports/DllBases.h ) ``` -------------------------------- ### Define Compile Options for D2CommonDefinitions Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2CommonDefinitions/CMakeLists.txt Sets compile definitions for the D2CommonDefinitions library. NOMINMAX and WIN32_LEAN_AND_MEAN are common Windows-specific definitions. ```cmake target_compile_definitions(D2CommonDefinitions INTERFACE NOMINMAX WIN32_LEAN_AND_MEAN) ``` -------------------------------- ### Add Items Module Source Files Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2Game/CMakeLists.txt Includes source and header files for the Items module. This handles item management, item modes, and magical item properties. ```cmake target_sources(${D2GameImplName} PRIVATE src/ITEMS/ItemMode.cpp src/ITEMS/Items.cpp src/ITEMS/ItemsMagic.cpp include/ITEMS/ItemMode.h include/ITEMS/Items.h include/ITEMS/ItemsMagic.h ) ``` -------------------------------- ### Define squallstorm library target Source: https://github.com/thephrozenkeep/d2moo/blob/master/external/CMakeLists.txt Adds specific squallstorm source files to a library target, sets system include directories, and defines a compile definition. An ALIAS target is created. ```cmake add_library(squallstorm squall/storm/thread/CCritSect.cpp ) target_include_directories(squallstorm SYSTEM PUBLIC squall) target_compile_definitions(squallstorm PUBLIC WHOA_SYSTEM_WIN) add_library(squall::Storm ALIAS squallstorm) ``` -------------------------------- ### Include Sources for D2Net Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2Net/CMakeLists.txt Specifies the source files and header files for the D2Net implementation target. This ensures all necessary components are compiled. ```cmake target_sources(${D2NetImplName} PRIVATE src/Client.cpp src/D2Net.cpp src/Server.cpp include/Client.h include/D2Net.h include/Packet.h include/Server.h ) ``` -------------------------------- ### Add Subdirectories for Dependencies Source: https://github.com/thephrozenkeep/d2moo/blob/master/CMakeLists.txt Includes external dependencies and source code by adding subdirectories to the build. ```cmake add_subdirectory(external) add_subdirectory(source) ``` -------------------------------- ### Configure Compiler Options for Clang-cl Source: https://github.com/thephrozenkeep/d2moo/blob/master/CMakeLists.txt Adds specific compiler options for Clang-cl to suppress certain warnings, such as microsoft-cast and multichar. ```cmake if(D2MOO_IS_ROOT_PROJECT) # clang-cl if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" AND "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC") add_compile_options("-Wno-microsoft-cast" "-Wno-multichar") endif() endif() ``` -------------------------------- ### Configure D2Debugger Exports Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2Debugger/CMakeLists.txt Configures the export behavior for the D2Debugger library, ignoring missing definition files. ```cmake D2MOO_configure_exports(D2Debugger IGNORE_MISSING_DEF) ``` -------------------------------- ### Add Missiles Module Source Files Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2Game/CMakeLists.txt Includes source and header files for the Missiles module. This manages missile projectiles and their modes within the game. ```cmake target_sources(${D2GameImplName} PRIVATE src/MISSILES/Missiles.cpp src/MISSILES/MissMode.cpp include/MISSILES/Missiles.h include/MISSILES/MissMode.h ) ``` -------------------------------- ### Register D2LangTests Unit Test Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2Lang/tests/CMakeLists.txt Registers the D2LangTests executable as a CTest test case named 'D2LangTests.unittests'. It specifies the command to run and the working directory. ```cmake add_test( NAME D2LangTests.unittests COMMAND D2LangTests ${TEST_RUNNER_PARAMS} WORKING_DIRECTORY $ ) ``` -------------------------------- ### Link Libraries for D2Game Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2Game/CMakeLists.txt Links essential libraries to the D2Game implementation target. Includes game-specific, common, and networking libraries, as well as a Windows multimedia library for timing functions. ```cmake target_link_libraries(${D2GameImplName} PRIVATE D2CommonDefinitions D2CMP D2Common D2Lang D2Net Fog winmm # For timeGetTime() ) ``` -------------------------------- ### Add Debug Source Files Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2Game/CMakeLists.txt Includes source and header files for the Debug module. This is used for development and debugging purposes within the game. ```cmake target_sources(${D2GameImplName} PRIVATE src/DEBUG/Debug.cpp include/DEBUG/Debug.h ) ``` -------------------------------- ### Link Libraries for D2Common Implementation Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2Common/CMakeLists.txt Links the D2Common implementation target to its required libraries. This ensures all necessary components are available during the build process. ```cmake target_link_libraries(${D2CommonImplName} PUBLIC D2CommonDefinitions D2CMP D2Hell D2Lang Fog) ``` -------------------------------- ### Configure Parallel Compilation for Visual Studio Source: https://github.com/thephrozenkeep/d2moo/blob/master/CMakeLists.txt Enables parallel compilation using the /MP flag for Visual Studio generators when D2MOO_ENABLE_PARALLEL_BUILD is set. ```cmake if(CMAKE_GENERATOR MATCHES "Visual Studio" AND MSVC) option(D2MOO_ENABLE_PARALLEL_BUILD "Force /MP parallel compilation" ${D2MOO_IS_ROOT_PROJECT}) if(D2MOO_ENABLE_PARALLEL_BUILD) add_compile_options("/MP") endif() endif() ``` -------------------------------- ### Add D2Debugger Shared Library Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2Debugger/CMakeLists.txt Defines the D2Debugger library as a SHARED library, listing its source and header files. Includes Font Awesome 6 headers. ```cmake add_library(D2Debugger SHARED src/D2Debugger.cpp src/D2Debugger.Game.cpp src/D2Debugger.imgui.d3d9.cpp src/D2Debugger.patch.common.cpp # Font awesome 6 #src/fa-solid-900.cpp src/IconsFontAwesome6.h include/D2Debugger.h include/D2Debugger.patch.common.h ) ``` -------------------------------- ### Define doctest library target Source: https://github.com/thephrozenkeep/d2moo/blob/master/external/CMakeLists.txt Creates an INTERFACE library target for doctest and exposes its include directory. An ALIAS target is also created for convenience. ```cmake add_library(doctest INTERFACE) target_include_directories(doctest SYSTEM INTERFACE doctest/doctest # note : will expose the parts/ folder... ) add_library(doctest::doctest ALIAS doctest) ``` -------------------------------- ### Link D2Sound Libraries Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2Sound/CMakeLists.txt Links the D2Sound implementation target with public D2CommonDefinitions. ```cmake target_link_libraries(${D2SoundImplName} PUBLIC D2CommonDefinitions) ``` -------------------------------- ### Link Libraries for D2Win Target Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2Win/CMakeLists.txt Links private and public libraries to the D2Win target. Use this to manage dependencies for the D2Win module. ```cmake target_link_libraries(${D2WinImplName} PRIVATE Fog D2CMP D2Gfx D2Lang Storm D2Sound stb::stb PUBLIC D2Hell ) ``` -------------------------------- ### Group Storm Source Files Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/Storm/CMakeLists.txt Groups the source files for the Storm target, likely for better organization within IDEs. This function is specific to the D2MOO build system. ```cmake D2MOO_target_source_group(Storm) ``` -------------------------------- ### Set Storm Compile Definitions Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/Storm/CMakeLists.txt Sets a public compile definition WITH_SQUALL=1 for the Storm implementation target. This is used to enable specific features or configurations during compilation. ```cmake target_compile_definitions(${StormImplName} PUBLIC WITH_SQUALL=1) ``` -------------------------------- ### Specify Source Files for D2Win Target Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2Win/CMakeLists.txt Adds source and header files to the D2Win target. This ensures all necessary code and definitions are compiled for the D2Win module. ```cmake target_sources(${D2WinImplName} PRIVATE src/D2Comp.cpp src/D2WinAccountList.cpp src/D2WinAnimImage.cpp src/D2WinArchive.cpp src/D2WinButton.cpp src/D2WinEditBox.cpp src/D2WinFont.cpp src/D2WinImage.cpp src/D2WinList.cpp src/D2WinMain.cpp src/D2WinPalette.cpp src/D2WinPopUp.cpp src/D2WinProgressBar.cpp src/D2WinScrollBar.cpp src/D2WinSmack.cpp src/D2WinTextBox.cpp src/D2WinTimer.cpp src/D2WRegister.cpp src/JpegLibraryWrapper.cpp src/JpegLibraryWrapper.h include/Font.h include/D2WinComp.h include/D2WinAccountList.h include/D2WinAnimImage.h include/D2WinArchive.h include/D2WinButton.h include/D2WinControlHeader.h include/D2WinEditBox.h include/D2WinFont.h include/D2WinImage.h include/D2WinList.h include/D2WinMain.h include/D2WinPalette.h include/D2WinPopUp.h include/D2WinProgressBar.h include/D2WinScrollBar.h include/D2WinSmack.h include/D2WinTextBox.h include/D2WinTimer.h include/D2WRegister.h ) ``` -------------------------------- ### RC Resource for Patching Different DLL Name Source: https://github.com/thephrozenkeep/d2moo/blob/master/doc/Patching.md This RC resource allows a patch DLL to target a different DLL than its own name. It specifies the module to patch and its size. ```rc NameOfModuleToPatch 256 { L"OTHERDLLNAME.dll\0" } ``` -------------------------------- ### Define D2CommonTests Executable Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2Common/tests/CMakeLists.txt Defines the main executable for D2Common tests. This is a standard CMake command to create an executable target. ```cmake add_executable(D2CommonTests D2CommonTests.cpp) ``` -------------------------------- ### Define stb library target Source: https://github.com/thephrozenkeep/d2moo/blob/master/external/CMakeLists.txt Creates an INTERFACE library target for stb and exposes its include directory. An ALIAS target is also created for convenience. ```cmake add_library(stb INTERFACE) target_include_directories(stb SYSTEM INTERFACE stb # note : will expose the parts/ folder... ) add_library(stb::stb ALIAS stb) ``` -------------------------------- ### Link Libraries to Game Target Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/Game/CMakeLists.txt Links several game-related libraries to the 'Game' executable. These libraries provide necessary functionalities for the game. ```cmake target_link_libraries(Game PRIVATE Fog Storm D2Win D2Gfx D2Sound D2MCPClient ) ``` -------------------------------- ### Define D2LangTests Executable Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2Lang/tests/CMakeLists.txt Defines the main test executable for the D2Lang module. It links against the doctest framework and the D2Lang implementation library. ```cmake add_executable(D2LangTests D2LangTests.cpp) target_link_libraries(D2LangTests PRIVATE doctest::doctest ${D2LangImplName}) target_compile_definitions(D2LangTests PRIVATE NOMINMAX WIN32_LEAN_AND_MEAN) target_compile_features(D2LangTests PRIVATE cxx_std_17) ``` -------------------------------- ### Link D2Hell Dependencies Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2Hell/CMakeLists.txt Specifies the public libraries that D2Hell depends on. ```cmake target_link_libraries(D2Hell PUBLIC Fog Storm) ``` -------------------------------- ### Group D2CMP Source Files Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2CMP/CMakeLists.txt Groups source files for the D2CMP target for better organization in IDEs. ```cmake D2MOO_target_source_group(D2CMP) ``` -------------------------------- ### Set Output Name for Game Executable Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/Game/CMakeLists.txt Sets the output name of the 'Game' executable to 'Game.D2MOO'. This is typically used for versioning or specific project naming conventions. ```cmake set_target_properties(Game PROPERTIES OUTPUT_NAME Game.D2MOO) ``` -------------------------------- ### Configure external libraries build type Source: https://github.com/thephrozenkeep/d2moo/blob/master/external/CMakeLists.txt Temporarily sets external libraries to be built as static libraries. The original setting for BUILD_SHARED_LIBS is backed up and restored later. ```cmake set(BUILD_SHARED_LIBS_BACKUP ${BUILD_SHARED_LIBS}) set(BUILD_SHARED_LIBS OFF) ``` -------------------------------- ### Delayed Loading for d3d9.dll on MSVC Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2Debugger/CMakeLists.txt Applies delayed loading options for 'd3d9.dll' on MSVC compilers to prevent crashes during library loading. ```cmake if(MSVC) target_link_options(D2Debugger PRIVATE "/DELAYLOAD:d3d9.dll" "Delayimp.lib") endif() ``` -------------------------------- ### Include Data Table Source Files for D2Common Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2Common/CMakeLists.txt Adds source and header files related to data tables to the D2Common implementation target. This organizes game data definitions. ```cmake target_sources(${D2CommonImplName} PRIVATE src/DataTbls/AnimTbls.cpp src/DataTbls/ArenaTbls.cpp src/DataTbls/BeltsTbls.cpp src/DataTbls/DataTbls.cpp src/DataTbls/FieldTbls.cpp src/DataTbls/HoradricCube.cpp src/DataTbls/InvTbls.cpp src/DataTbls/ItemsTbls.cpp src/DataTbls/LevelsTbls.cpp src/DataTbls/MissilesTbls.cpp src/DataTbls/MonsterTbls.cpp src/DataTbls/ObjectsTbls.cpp src/DataTbls/OverlayTbls.cpp src/DataTbls/SequenceTbls.cpp src/DataTbls/SkillsTbls.cpp src/DataTbls/TokenTbls.cpp src/DataTbls/TransformTbls.cpp include/DataTbls/AnimTbls.h include/DataTbls/ArenaTbls.h include/DataTbls/BeltsTbls.h include/DataTbls/DataTbls.h include/DataTbls/FieldTbls.h include/DataTbls/HoradricCube.h include/DataTbls/InvTbls.h include/DataTbls/ItemsTbls.h include/DataTbls/LevelsTbls.h include/DataTbls/MissilesTbls.h include/DataTbls/MonsterTbls.h include/DataTbls/ObjectsTbls.h include/DataTbls/OverlayTbls.h include/DataTbls/SequenceTbls.h include/DataTbls/SkillsTbls.h include/DataTbls/TokenTbls.h include/DataTbls/TransformTbls.h # Enums for asset indices, should be generated from .txt files include/DataTbls/LevelsIds.h include/DataTbls/MissilesIds.h include/DataTbls/MonsterIds.h include/DataTbls/MonsterTypes.h include/DataTbls/ObjectsIds.h include/DataTbls/StringIds.h include/DataTbls/SkillsIds.h ) ``` -------------------------------- ### Set VS Debugger Working Directory Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2Lang/tests/CMakeLists.txt Configures the working directory for the Visual Studio debugger when running the D2LangTests executable. ```cmake set_target_properties(D2LangTests PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/workingDirectory ) ``` -------------------------------- ### Set C++ Standard for D2CommonTests Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2Common/tests/CMakeLists.txt Specifies that the D2CommonTests executable should be compiled with C++17 standard features. This ensures modern C++ features are available and enabled. ```cmake target_compile_features(D2CommonTests PRIVATE cxx_std_17) ``` -------------------------------- ### Add Sources to D2CMP Target Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2CMP/CMakeLists.txt Specifies the private source files for the D2CMP implementation target. ```cmake target_sources(${D2CMPImplName} PRIVATE src/D2CMP.cpp include/D2CMP.h src/CelCmp.cpp src/CelDataHash.cpp src/Codec.cpp src/Count.cpp src/DrwCntxt.cpp src/FastCmp.cpp src/FindTiles.cpp src/GfxHash.cpp src/LRUCache.cpp src/Palette.cpp src/PalShift.cpp src/Raw.cpp src/SpriteCache.cpp src/SubTile.cpp src/TileCache.cpp src/Tilecmp.cpp src/TileLib.cpp src/TileProjects.cpp include/CelCmp.h include/CelDataHash.h include/Codec.h include/Count.h include/DrwCntxt.h include/FastCmp.h include/FindTiles.h include/GfxHash.h include/LRUCache.h include/Palette.h include/PalShift.h include/Raw.h include/SpriteCache.h include/SubTile.h include/TileCache.h include/Tilecmp.h include/TileLib.h include/TileProjects.h ) ``` -------------------------------- ### Link Libraries for D2Debugger Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2Debugger/CMakeLists.txt Links necessary private libraries to the D2Debugger target, including D2Common, D2Game, imgui, and d3d9. ```cmake target_link_libraries(D2Debugger PRIVATE D2Common D2Game imgui::imgui d3d9 ) ``` -------------------------------- ### Group D2Lang Source Files Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2Lang/CMakeLists.txt Organizes the source files for the D2Lang target using the D2MOO_target_source_group function. This is typically used for better project organization in IDEs. ```cmake D2MOO_target_source_group(D2Lang) ``` -------------------------------- ### Group D2Gfx Source Files Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2Gfx/CMakeLists.txt Groups the source files for the D2Gfx target, likely for better organization in IDEs. This is a project-specific macro. ```cmake D2MOO_target_source_group(D2Gfx) ``` -------------------------------- ### C++ PatchAction Enum and ExtraPatchAction Struct Source: https://github.com/thephrozenkeep/d2moo/blob/master/doc/Patching.md Defines the possible actions for patching (e.g., replacing original with patch) and the structure for extra patch actions, including offset, data, action type, and a pointer to the detoured original function. ```cpp enum PatchAction { FunctionReplaceOriginalByPatch, FunctionReplacePatchByOriginal, PointerReplaceOriginalByPatch, PointerReplacePatchByOriginal, Ignore }; struct ExtraPatchAction { size_t originalDllOffset; void* patchData; PatchAction action; void* detouredPatchedFunction; // Filled with new address of the original function. You can use it to call the old function from your patch. }; ``` -------------------------------- ### Set VS Debugger Working Directory Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2Common/tests/CMakeLists.txt Configures the working directory for the Visual Studio debugger when running the D2CommonTests executable. This is useful for ensuring relative paths in tests function correctly. ```cmake set_target_properties(D2CommonTests PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/workingDirectory ) ``` -------------------------------- ### Conditionally Add Static Checks Source Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/Game/CMakeLists.txt Adds a static checks source file to the 'Game' target only if the 'D2MOO_WITH_STATIC_TESTS' build option is enabled. ```cmake if(D2MOO_WITH_STATIC_TESTS) target_sources(Game PRIVATE statictests/Game_staticchecks.cpp ) endif() ``` -------------------------------- ### Define Source Group for D2MCPClient Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2MCPClient/CMakeLists.txt Defines a source group for the D2MCPClient target, aiding in project organization within IDEs. ```cmake D2MOO_target_source_group(D2MCPClient) ``` -------------------------------- ### Add Sources to D2Lang Target Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2Lang/CMakeLists.txt Specifies the private source files and header files for the D2Lang target. This ensures all necessary components are compiled with the target. ```cmake target_sources(${D2LangImplName} PRIVATE src/D2LangStubs.cpp src/D2Crc16.cpp src/D2Unicode/D2UnicodeChar.cpp src/D2Unicode/D2UnicodeStr.cpp src/D2Unicode/D2UnicodeUtf.cpp src/D2Unicode/D2UnicodeWin.cpp src/D2StrTable.cpp include/D2Lang.h include/D2Crc16.h include/D2StrTable.h include/D2Unicode.h ) ``` -------------------------------- ### Define Source Group for D2Win Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2Win/CMakeLists.txt Organizes source files for the D2Win target into a group within the IDE. This is a CMake utility for project organization. ```cmake D2MOO_target_source_group(D2Win) ``` -------------------------------- ### Add D2CommonTests as a CMake Test Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2Common/tests/CMakeLists.txt Registers 'D2CommonTests.unittests' as a test within the CMake testing framework. This allows tests to be discovered and run using CTest or other CMake testing tools. ```cmake add_test( # Use some per-module/project prefix so that it is easier to run only tests for this module NAME D2CommonTests.unittests COMMAND D2CommonTests ${TEST_RUNNER_PARAMS} WORKING_DIRECTORY $ ) ``` -------------------------------- ### Add D2CommonDefinitions Interface Library Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2CommonDefinitions/CMakeLists.txt Adds an INTERFACE library target named D2CommonDefinitions. Interface libraries are used for defining properties that are propagated to targets linking to them. ```cmake add_library(D2CommonDefinitions INTERFACE) ``` -------------------------------- ### Define D2Sound Source Group Source: https://github.com/thephrozenkeep/d2moo/blob/master/source/D2Sound/CMakeLists.txt Defines a source group for the D2Sound module in CMake. ```cmake D2MOO_target_source_group(D2Sound) ```