tibia772/CMakeLists.txt
2026-11-13 10:20:03 -06:00

47 lines
1.3 KiB
CMake

cmake_minimum_required(VERSION 3.16)
project(tibia-kaplar VERSION 0.1.0 LANGUAGES C CXX)
option(TIBIA772 "Login/Protocol RSA for Tibia 7.72 (Required for the login to work" ON)
option(BUILD_GAME "Compile game server" OFF)
option(BUILD_LOGIN "Compile login server" ON)
option(BUILD_QUERYMANAGER "Compile querymanager" ON)
option(BUILD_IPCHANGER "Compile IP Changer" OFF)
set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_STANDARD 17)
# All binaries fall into /build/bin (dockerfile copies build/ -> /opt/tibia/bin/)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
if(CMAKE_CONFIGURATION_TYPES)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/$<CONFIG>)
endif()
# Critical flag: Without TIBIA772=1 the RSA is read from the offset 7.7
# and the cypher from the login fails silently.
if(TIBIA772)
add_compile_definitions(TIBIA772=1)
endif()
message(STATUS "tibia-kaplar")
message(STATUS "TIBIA772 : ${TIBIA772}")
message(STATUS "GAME : ${BUILD_GAME}")
message(STATUS "LOGIN : ${BUILD_LOGIN}")
message(STATUS "QUERYMGR : ${BUILD_QUERYMANAGER}")
if(BUILD_GAME)
add_subdirectory(src/game)
endif()
if(BUILD_LOGIN)
add_subdirectory(src/login)
endif()
if(BUILD_QUERYMANAGER)
add_subdirectory(src/querymanager)
endif()
if(BUILD_IPCHANGER)
add_subdirectory(src/ipchanger)
endif()