Skip to content

add cmake support #64

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

add cmake support #64

wants to merge 7 commits into from

Conversation

dand-oss
Copy link

tested cmake with ninja and visual studio 2022
dll and static version
as well as existing project

extensive explanations in the commits

@dand-oss dand-oss force-pushed the cmake-dll branch 3 times, most recently from ca2a88e to ebbab67 Compare May 16, 2025 13:45
Dan Dees added 7 commits May 16, 2025 20:45
- out of source build
    - no projects or build artifacts polluting source tree
    - supports CI/CD automation
- generates many build types with simple command line option
    - https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html
    - ninja - FAST command line
    - visual studio project
    - msbuild
    - msys make
    - name
- builds static, shared (DLL), and "reflection main" libraries
    - shared library includes 3rd party
    - no install needed of Detours as linked into DLL
    - support shared DLL and "relection" option DLL
- creates library/header installation
   - installs as package
   - supports vcpkg, conan, CPM
   - supports nuget
   - https://cmake.org/cmake/help/latest/cpack_gen/nuget.html
- builds 3rd party deps
- automates debug and release builds
   - done with ninja/msbuild
- exports config for use in other cmake project
   - MemoryModulePPConfigVersion.cmake
   - find_package(MemoryModulePP CONFIG) is enough to use in another project
   - https://cmake.org/cmake/help/latest/command/find_package.html
   - importing and exporting cmake project
   - https://cmake.org/cmake/help/latest/guide/importing-exporting/index.html
- maintainable
   - LLMs such as ChatGPT can create/maintain CMakeLists.txt
   - no longer need to learn the book and best practices
- CMakeList modern format with targets as objects
- CMAKE_DEBUG_POSTIFIX allows debug and release dll/exe in same directory

example ninja installation output

...
-- Install configuration: "Debug"

-- Install configuration: "Debug"
-- Installing: x:/vs17-64/memorymodulepp/lib/MemoryModulePP-static_d.lib
-- Installing: x:/vs17-64/memorymodulepp/include/BaseAddressIndex.h
-- Installing: x:/vs17-64/memorymodulepp/include/ImportTable.h
-- Installing: x:/vs17-64/memorymodulepp/include/Initialize.h
-- Installing: x:/vs17-64/memorymodulepp/include/InvertedFunctionTable.h
-- Installing: x:/vs17-64/memorymodulepp/include/LdrEntry.h
-- Installing: x:/vs17-64/memorymodulepp/include/LoadDllMemoryApi.h
-- Installing: x:/vs17-64/memorymodulepp/include/Loader.h
-- Installing: x:/vs17-64/memorymodulepp/include/MemoryModule.h
-- Installing: x:/vs17-64/memorymodulepp/include/MmpGlobalData.h
-- Installing: x:/vs17-64/memorymodulepp/include/MmpDotNet.h
-- Installing: x:/vs17-64/memorymodulepp/include/MmpTls.h
-- Installing: x:/vs17-64/memorymodulepp/include/Utils.h
-- Installing: x:/vs17-64/memorymodulepp/lib/MemoryModulePP-shared_d.lib
-- Installing: x:/vs17-64/memorymodulepp/bin/MemoryModulePP-shared_d.dll
-- Installing: x:/vs17-64/memorymodulepp/include/BaseAddressIndex.h
-- Installing: x:/vs17-64/memorymodulepp/include/ImportTable.h
-- Installing: x:/vs17-64/memorymodulepp/include/Initialize.h
-- Installing: x:/vs17-64/memorymodulepp/include/InvertedFunctionTable.h
-- Installing: x:/vs17-64/memorymodulepp/include/LdrEntry.h
-- Installing: x:/vs17-64/memorymodulepp/include/LoadDllMemoryApi.h
-- Installing: x:/vs17-64/memorymodulepp/include/Loader.h
-- Installing: x:/vs17-64/memorymodulepp/include/MemoryModule.h
-- Installing: x:/vs17-64/memorymodulepp/include/MmpGlobalData.h
-- Installing: x:/vs17-64/memorymodulepp/include/MmpDotNet.h
-- Installing: x:/vs17-64/memorymodulepp/include/MmpTls.h
-- Installing: x:/vs17-64/memorymodulepp/include/Utils.h
-- Installing: x:/vs17-64/memorymodulepp/lib/MemoryModulePP-relfect-shared_d.lib
-- Installing: x:/vs17-64/memorymodulepp/bin/MemoryModulePP-relfect-shared_d.dll
-- Installing: x:/vs17-64/memorymodulepp/include/BaseAddressIndex.h
-- Installing: x:/vs17-64/memorymodulepp/include/ImportTable.h
-- Installing: x:/vs17-64/memorymodulepp/include/Initialize.h
-- Installing: x:/vs17-64/memorymodulepp/include/InvertedFunctionTable.h
-- Installing: x:/vs17-64/memorymodulepp/include/LdrEntry.h
-- Installing: x:/vs17-64/memorymodulepp/include/LoadDllMemoryApi.h
-- Installing: x:/vs17-64/memorymodulepp/include/Loader.h
-- Installing: x:/vs17-64/memorymodulepp/include/MemoryModule.h
-- Installing: x:/vs17-64/memorymodulepp/include/MmpGlobalData.h
-- Installing: x:/vs17-64/memorymodulepp/include/MmpDotNet.h
-- Installing: x:/vs17-64/memorymodulepp/include/MmpTls.h
-- Installing: x:/vs17-64/memorymodulepp/include/Utils.h
-- Installing: x:/vs17-64/memorymodulepp/lib/cmake/MemoryModulePP/MemoryModulePPTargets.cmake
-- Installing: x:/vs17-64/memorymodulepp/lib/cmake/MemoryModulePP/MemoryModulePPTargets-debug.cmake
-- Installing: x:/vs17-64/memorymodulepp/lib/cmake/MemoryModulePP/MemoryModulePPConfig.cmake
-- Installing: x:/vs17-64/memorymodulepp/lib/cmake/MemoryModulePP/MemoryModulePPConfigVersion.cmake
- problems with exported global at runtime
- wrapping data access in a function allows additional controls
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant