Skip to content

add cmake support #64

New issue

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

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

Already on GitHub? Sign in to your account

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

add cmake support #64

wants to merge 8 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 4 times, most recently from ebbab67 to 1020b8a Compare May 16, 2025 13:46
Dan Dees added 8 commits June 1, 2025 15:26
- 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
@dand-oss dand-oss force-pushed the cmake-dll branch 2 times, most recently from 9b5ccd3 to 6250b39 Compare June 1, 2025 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant