CMakeLists.txt 3.7 KB

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