CMakeLists.txt 3.7 KB

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