CMakeLists.txt 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. cmake_minimum_required(VERSION 3.18)
  2. project(navicat_keygen)
  3. set(CMAKE_CXX_STANDARD 17)
  4. include(FetchContent)
  5. set(KEYSTONE_BUILD_STATIC_RUNTIME ON CACHE BOOL "" FORCE)
  6. set(BUILD_LIBS_ONLY ON CACHE BOOL "" FORCE)
  7. set(UNICORN_ARCH "x86" CACHE STRING "" FORCE)
  8. set(UNICORN_INSTALL OFF CACHE BOOL "" FORCE)
  9. set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
  10. set(UNICORN_BUILD_SAMPLES OFF CACHE BOOL "" FORCE)
  11. FetchContent_Declare(
  12. keystone
  13. GIT_REPOSITORY "https://github.com/keystone-engine/keystone.git"
  14. GIT_TAG "1475885daa7e566c064ae9754706e1a0ba24be3b"
  15. )
  16. FetchContent_Declare(
  17. unicorn
  18. URL "https://github.com/unicorn-engine/unicorn/archive/refs/tags/1.0.3.tar.gz"
  19. URL_HASH "SHA256=64fba177dec64baf3f11c046fbb70e91483e029793ec6a3e43b028ef14dc0d65"
  20. )
  21. FetchContent_MakeAvailable(keystone unicorn)
  22. set(
  23. NKG_COMMON_SOURCE
  24. ./common/exception.hpp
  25. ./common/exceptions/index_exception.hpp
  26. ./common/exceptions/key_exception.hpp
  27. ./common/exceptions/operation_canceled_exception.hpp
  28. ./common/exceptions/unix_exception.hpp
  29. ./common/resource_wrapper.hpp
  30. ./common/resource_traits/cxx_object_traits.hpp
  31. ./common/resource_traits/cxx_dynamic_array_traits.hpp
  32. ./common/resource_traits/keystone/keystone_alloc.hpp
  33. ./common/resource_traits/keystone/keystone_handle.hpp
  34. ./common/resource_traits/openssl/bignum.hpp
  35. ./common/resource_traits/openssl/bio.hpp
  36. ./common/resource_traits/openssl/bio_chain.hpp
  37. ./common/resource_traits/openssl/rsa.hpp
  38. ./common/resource_traits/unicorn/unicorn_handle.hpp
  39. ./common/resource_traits/unicorn/unicorn_alloc.hpp
  40. ./common/resource_traits/unix_os/file_descriptor.hpp
  41. ./common/resource_traits/unix_os/map_view.hpp
  42. ./common/rsa_cipher.hpp
  43. ./common/rsa_cipher.cpp
  44. )
  45. set(
  46. NKG_KEYGEN_SOURCE
  47. ./navicat-keygen/base32_rfc4648.hpp
  48. ./navicat-keygen/base32_rfc4648.cpp
  49. ./navicat-keygen/base64_rfc4648.hpp
  50. ./navicat-keygen/base64_rfc4648.cpp
  51. ./navicat-keygen/navicat_serial_generator.hpp
  52. ./navicat-keygen/navicat_serial_generator.cpp
  53. ./navicat-keygen/CollectInformation.cpp
  54. ./navicat-keygen/GenerateLicense.cpp
  55. ./navicat-keygen/main.cpp
  56. )
  57. set(
  58. NKG_PATCHER_SOURCE
  59. ./navicat-patcher/amd64_emulator.hpp
  60. ./navicat-patcher/amd64_emulator.cpp
  61. ./navicat-patcher/keystone_assembler.hpp
  62. ./navicat-patcher/keystone_assembler.cpp
  63. ./navicat-patcher/elf64_interpreter.hpp
  64. ./navicat-patcher/elf64_interpreter.cpp
  65. ./navicat-patcher/patch_solution.hpp
  66. ./navicat-patcher/patch_solution_since.hpp
  67. ./navicat-patcher/patch_solution_since_16.0.7.0.hpp
  68. ./navicat-patcher/patch_solution_since_16.0.7.0.cpp
  69. ./navicat-patcher/memory_utility.hpp
  70. ./navicat-patcher/main.cpp
  71. )
  72. add_executable(navicat-keygen ${NKG_COMMON_SOURCE} ${NKG_KEYGEN_SOURCE})
  73. target_include_directories(navicat-keygen PRIVATE ./common)
  74. target_link_libraries(navicat-keygen fmt crypto)
  75. add_executable(navicat-patcher ${NKG_COMMON_SOURCE} ${NKG_PATCHER_SOURCE})
  76. target_include_directories(navicat-patcher PRIVATE ./common ${keystone_SOURCE_DIR}/include)
  77. target_link_libraries(navicat-patcher fmt crypto keystone unicorn pthread)