2024-12-21 15:38:37 +00:00
|
|
|
cmake_minimum_required(VERSION 3.14)
|
2024-10-17 00:50:14 +00:00
|
|
|
|
2024-12-20 02:03:20 +00:00
|
|
|
project(kgg-dec VERSION 0.6.0 LANGUAGES CXX)
|
2024-10-17 00:50:14 +00:00
|
|
|
|
2024-12-21 16:35:15 +00:00
|
|
|
option(USE_SYSTEM_SQLITE3 "Use system SQLite3 (if not using WinSQLite3 and available)" ON)
|
|
|
|
option(USE_OPENSSL "Use OpenSSL API (if not using WinCrypto API and available)" ON)
|
2024-12-20 19:42:16 +00:00
|
|
|
|
2024-12-21 16:35:15 +00:00
|
|
|
if(WIN32)
|
|
|
|
option(USE_WIN_SQLITE3 "Use Windows SQLite3 (MSVC Only)" ${MSVC})
|
|
|
|
option(USE_WIN_CRYPTO "Use Windows Crypto API" ${WIN32})
|
|
|
|
else()
|
|
|
|
set(USE_WIN_SQLITE3 OFF)
|
|
|
|
set(USE_WIN_CRYPTO OFF)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Setup CryptoAPI
|
|
|
|
if (NOT USE_WIN_CRYPTO AND USE_OPENSSL)
|
|
|
|
find_package(OpenSSL REQUIRED)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
include(cmake/SetupSQLite3.cmake)
|
2024-12-20 02:03:16 +00:00
|
|
|
add_subdirectory(third-party/aes)
|
|
|
|
add_subdirectory(third-party/md5)
|
2024-12-20 21:02:40 +00:00
|
|
|
|
2024-10-17 00:50:14 +00:00
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
|
|
|
|
add_executable(kgg-dec
|
2024-10-17 23:11:16 +00:00
|
|
|
src/main.cpp
|
|
|
|
src/common/base64.cpp
|
|
|
|
src/infra/infra.cpp
|
|
|
|
src/tc_tea/tc_tea.cpp
|
|
|
|
src/qmc2/ekey.cpp
|
|
|
|
src/qmc2/qmc2_factory.cpp
|
|
|
|
src/qmc2/qmc2_map.cpp
|
|
|
|
src/qmc2/qmc2_rc4.cpp
|
2024-11-25 21:17:20 +00:00
|
|
|
src/utils/cli.cpp
|
2024-10-17 00:50:14 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
target_include_directories(kgg-dec
|
2024-10-17 23:11:16 +00:00
|
|
|
PRIVATE
|
2024-10-17 00:50:14 +00:00
|
|
|
src/common
|
|
|
|
src/tc_tea
|
|
|
|
)
|
|
|
|
|
2024-12-21 15:38:37 +00:00
|
|
|
# Base crypto implementations
|
2024-12-21 04:23:44 +00:00
|
|
|
target_link_libraries(kgg-dec PRIVATE libaes libmd5)
|
2024-12-21 15:38:37 +00:00
|
|
|
if (USE_WIN_CRYPTO)
|
|
|
|
target_compile_definitions(kgg-dec PRIVATE USE_WIN_CRYPTO=1)
|
2024-12-21 16:35:15 +00:00
|
|
|
elseif(USE_OPENSSL)
|
|
|
|
target_compile_definitions(kgg-dec PRIVATE USE_OPENSSL=1)
|
2024-12-21 15:38:37 +00:00
|
|
|
endif ()
|
|
|
|
|
|
|
|
# Win32 specific
|
2024-12-21 04:23:44 +00:00
|
|
|
if (WIN32)
|
|
|
|
target_link_libraries(kgg-dec PRIVATE shell32 ole32)
|
2024-12-21 15:38:37 +00:00
|
|
|
target_compile_definitions(kgg-dec PRIVATE NOMINMAX)
|
2024-12-21 04:23:44 +00:00
|
|
|
endif ()
|
2024-12-21 15:38:37 +00:00
|
|
|
|
|
|
|
# SQLite3
|
2024-12-20 19:42:16 +00:00
|
|
|
if (WinSQLite3_Found)
|
|
|
|
target_link_libraries(kgg-dec PRIVATE WinSQLite3)
|
|
|
|
target_include_directories(kgg-dec PRIVATE ${WindowsKitInclude})
|
2024-12-21 15:38:37 +00:00
|
|
|
elseif(SQLite3_FOUND)
|
|
|
|
target_link_libraries(kgg-dec PRIVATE SQLite::SQLite3)
|
2024-12-20 19:42:16 +00:00
|
|
|
else ()
|
|
|
|
target_link_libraries(kgg-dec PRIVATE sqlite3)
|
|
|
|
endif ()
|
2024-12-20 21:02:40 +00:00
|
|
|
|
2024-12-21 15:38:37 +00:00
|
|
|
# Extra definitions
|
|
|
|
target_compile_definitions(kgg-dec PRIVATE KGGDEC_PROJECT_VERSION="${PROJECT_VERSION}")
|