Protobuf is now module cmake loaded on linux, and generates files on build

This commit is contained in:
Xackery 2018-03-11 22:27:37 -07:00
parent f990292660
commit 1a71237dc2
14 changed files with 2024 additions and 24539 deletions

4
.gitignore vendored
View File

@ -34,7 +34,9 @@ x86/
log/
logs/
# Proto
# Protobuf generated files
*.pb.cc
*.pb.h
protobuf/csharp/*
protobuf/go/*
protobuf/java/*

View File

@ -29,7 +29,7 @@
#We set a fairly new version (as of 2013) because I found finding perl was a bit... buggy on older ones
#Can change this if you really want but you should upgrade!
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)
#FindMySQL is located here so lets make it so CMake can find it
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/" ${CMAKE_MODULE_PATH})
@ -54,14 +54,44 @@ ENDIF(MSVC OR MINGW)
# include dirs are universal
SET(NATS_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/nats")
SET(PROTOBUF_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/protobuf")
#Try to find protobuf automatically
FIND_PACKAGE(Protobuf QUIET)
IF(NOT PROTOBUF_FOUND)
SET(Protobuf_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/protobuf" CACHE PATH "Root protobuf directory" FORCE)
SET(Protobuf_PROTOC_EXECUTABLE "${Protobuf_DIR}/bin/protoc.exe" CACHE PATH "Executable path" FORCE)
SET(Protobuf_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/protobuf/include" CACHE PATH "Include dir" FORCE)
SET(Protobuf_SRC_ROOT_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/protobuf/include" CACHE PATH "Include dir" FORCE)
SET(PROTOBUF_FOUND TRUE CACHE BOOL "" FORCE)
IF(NOT MSVC)
MESSAGE(STATUS "Could not find protobuf library, setting to ${Protobuf_DIR}")
ENDIF()
IF(MSVC)
IF(CMAKE_CL_64)
SET(Protobuf_LIBRARY_DEBUG "${Protobuf_DIR}/lib_x64/libprotobufd.lib" CACHE PATH "Root protobuf directory" FORCE)
SET(Protobuf_LIBRARY_RELEASE "${Protobuf_DIR}/lib_x64/libprotobufd.lib" CACHE PATH "Root protobuf directory" FORCE)
ELSE(CMAKE_CL_64)
SET(Protobuf_LIBRARY_DEBUG "${Protobuf_DIR}/lib_x86/libprotobufd.lib" CACHE PATH "Root protobuf directory" FORCE)
SET(Protobuf_LIBRARY_RELEASE "${Protobuf_DIR}/lib_x86/libprotobufd.lib" CACHE PATH "Root protobuf directory" FORCE)
ENDIF()
ELSE(MSVC)
SET(Protobuf_LIBRARY_DEBUG "${Protobuf_DIR}/lib_x64/libprotobuf.so.15" CACHE PATH "Root protobuf directory" FORCE)
SET(Protobuf_LIBRARY_RELEASE "${Protobuf_DIR}/lib_x64/libprotobuf.so.15" CACHE PATH "Root protobuf directory" FORCE)
ENDIF()
#SET(Protobuf_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/protobuf/include" CACHE PATH "Include dir")
#SET(Protobuf_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/protobuf/include")
#SET(Protobuf_PROTOC_EXECUTABLE "${Protobuf_DIR}/bin/protoc.exe")
ENDIF()
INCLUDE_DIRECTORIES(SYSTEM "${Protobuf_INCLUDE_DIR}")
SET(NATS_INCLUDE_DIR "${NATS_ROOT}/include")
SET(PROTOBUF_INCLUDE_DIR "${PROTOBUF_ROOT}/include")
IF(MSVC)
IF(MSVC)
#Set our default locations for zlib/mysql based on x86/x64
IF(CMAKE_CL_64)
SET(ZLIB_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/zlib_x64")
@ -77,7 +107,6 @@ IF(MSVC)
SET(SODIUM_LIBRARY_HINTS "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/libsodium/x64/Release/v110/dynamic")
ENDIF()
SET(NATS_LIBRARY "${NATS_ROOT}/lib_x64/nats.lib")
SET(PROTOBUF_LIBRARY "${PROTOBUF_ROOT}/lib_x64/libprotobufd.lib")
ELSE(CMAKE_CL_64)
SET(ZLIB_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/zlib_x86")
SET(MYSQL_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/mysql_x86")
@ -85,7 +114,6 @@ IF(MSVC)
SET(SODIUM_INCLUDE_HINTS "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/libsodium/include")
SET(OPENSSL_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/openssl_x86")
SET(NATS_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/nats_x86")
SET(PROTOBUF_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/protobuf_x86")
IF(MSVC_VERSION GREATER 1800)
SET(SODIUM_LIBRARY_HINTS "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/libsodium/Win32/Release/v140/dynamic")
ELSEIF(MSVC_VERSION EQUAL 1800)
@ -94,7 +122,6 @@ IF(MSVC)
SET(SODIUM_LIBRARY_HINTS "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/libsodium/Win32/Release/v110/dynamic")
ENDIF()
SET(NATS_LIBRARY "${NATS_ROOT}/lib_x86/nats.lib")
SET(PROTOBUF_LIBRARY "${PROTOBUF_ROOT}/lib_x86/libprotobufd.lib")
ENDIF(CMAKE_CL_64)
#disable CRT warnings on windows cause they're annoying as shit and we use C functions everywhere
@ -148,7 +175,6 @@ IF(MSVC)
ELSE(MSVC)
SET(NATS_LIBRARY "${NATS_ROOT}/lib_x64/libnats.so")
SET(PROTOBUF_LIBRARY "${PROTOBUF_ROOT}/lib_x64/libprotobuf.so.15")
#Normally set by perl but we don't use the perl flags anymore so we set it.
ADD_DEFINITIONS(-DHAS_UNION_SEMUN)
@ -328,7 +354,7 @@ IF(EQEMU_BUILD_PERL)
INCLUDE_DIRECTORIES(SYSTEM "${PERL_INCLUDE_PATH}")
ENDIF(EQEMU_BUILD_PERL)
SET(SERVER_LIBS common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY} libuv fmt ${NATS_LIBRARY} ${PROTOBUF_LIBRARY})
SET(SERVER_LIBS common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY} libuv fmt ${NATS_LIBRARY} ${PROTOBUF_LIBRARY_DEBUG})
FIND_PACKAGE(Sodium REQUIRED)
IF(SODIUM_FOUND)
@ -372,13 +398,14 @@ ENDIF(EQEMU_BUILD_LUA)
INCLUDE_DIRECTORIES(SYSTEM "${ZLIB_INCLUDE_DIRS}")
INCLUDE_DIRECTORIES(SYSTEM "${MySQL_INCLUDE_DIR}")
INCLUDE_DIRECTORIES(SYSTEM "${NATS_INCLUDE_DIR}")
INCLUDE_DIRECTORIES(SYSTEM "${PROTOBUF_INCLUDE_DIR}")
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/common/glm")
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/libs/cereal")
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/libs/libuv/include" )
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/libs/libuv/src")
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/libs/format")
IF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS OR EQEMU_BUILD_HC)
ADD_SUBDIRECTORY(common)
ADD_SUBDIRECTORY(libs)

View File

@ -0,0 +1,386 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindPackageHandleStandardArgs
-----------------------------
This module provides a function intended to be used in :ref:`Find Modules`
implementing :command:`find_package(<PackageName>)` calls. It handles the
``REQUIRED``, ``QUIET`` and version-related arguments of ``find_package``.
It also sets the ``<PackageName>_FOUND`` variable. The package is
considered found if all variables listed contain valid results, e.g.
valid filepaths.
.. command:: find_package_handle_standard_args
There are two signatures::
find_package_handle_standard_args(<PackageName>
(DEFAULT_MSG|<custom-failure-message>)
<required-var>...
)
find_package_handle_standard_args(<PackageName>
[FOUND_VAR <result-var>]
[REQUIRED_VARS <required-var>...]
[VERSION_VAR <version-var>]
[HANDLE_COMPONENTS]
[CONFIG_MODE]
[FAIL_MESSAGE <custom-failure-message>]
)
The ``<PackageName>_FOUND`` variable will be set to ``TRUE`` if all
the variables ``<required-var>...`` are valid and any optional
constraints are satisfied, and ``FALSE`` otherwise. A success or
failure message may be displayed based on the results and on
whether the ``REQUIRED`` and/or ``QUIET`` option was given to
the :command:`find_package` call.
The options are:
``(DEFAULT_MSG|<custom-failure-message>)``
In the simple signature this specifies the failure message.
Use ``DEFAULT_MSG`` to ask for a default message to be computed
(recommended). Not valid in the full signature.
``FOUND_VAR <result-var>``
Obsolete. Specifies either ``<PackageName>_FOUND`` or
``<PACKAGENAME>_FOUND`` as the result variable. This exists only
for compatibility with older versions of CMake and is now ignored.
Result variables of both names are always set for compatibility.
``REQUIRED_VARS <required-var>...``
Specify the variables which are required for this package.
These may be named in the generated failure message asking the
user to set the missing variable values. Therefore these should
typically be cache entries such as ``FOO_LIBRARY`` and not output
variables like ``FOO_LIBRARIES``.
``VERSION_VAR <version-var>``
Specify the name of a variable that holds the version of the package
that has been found. This version will be checked against the
(potentially) specified required version given to the
:command:`find_package` call, including its ``EXACT`` option.
The default messages include information about the required
version and the version which has been actually found, both
if the version is ok or not.
``HANDLE_COMPONENTS``
Enable handling of package components. In this case, the command
will report which components have been found and which are missing,
and the ``<PackageName>_FOUND`` variable will be set to ``FALSE``
if any of the required components (i.e. not the ones listed after
the ``OPTIONAL_COMPONENTS`` option of :command:`find_package`) are
missing.
``CONFIG_MODE``
Specify that the calling find module is a wrapper around a
call to ``find_package(<PackageName> NO_MODULE)``. This implies
a ``VERSION_VAR`` value of ``<PackageName>_VERSION``. The command
will automatically check whether the package configuration file
was found.
``FAIL_MESSAGE <custom-failure-message>``
Specify a custom failure message instead of using the default
generated message. Not recommended.
Example for the simple signature:
.. code-block:: cmake
find_package_handle_standard_args(LibXml2 DEFAULT_MSG
LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR)
The ``LibXml2`` package is considered to be found if both
``LIBXML2_LIBRARY`` and ``LIBXML2_INCLUDE_DIR`` are valid.
Then also ``LibXml2_FOUND`` is set to ``TRUE``. If it is not found
and ``REQUIRED`` was used, it fails with a
:command:`message(FATAL_ERROR)`, independent whether ``QUIET`` was
used or not. If it is found, success will be reported, including
the content of the first ``<required-var>``. On repeated CMake runs,
the same message will not be printed again.
Example for the full signature:
.. code-block:: cmake
find_package_handle_standard_args(LibArchive
REQUIRED_VARS LibArchive_LIBRARY LibArchive_INCLUDE_DIR
VERSION_VAR LibArchive_VERSION)
In this case, the ``LibArchive`` package is considered to be found if
both ``LibArchive_LIBRARY`` and ``LibArchive_INCLUDE_DIR`` are valid.
Also the version of ``LibArchive`` will be checked by using the version
contained in ``LibArchive_VERSION``. Since no ``FAIL_MESSAGE`` is given,
the default messages will be printed.
Another example for the full signature:
.. code-block:: cmake
find_package(Automoc4 QUIET NO_MODULE HINTS /opt/automoc4)
find_package_handle_standard_args(Automoc4 CONFIG_MODE)
In this case, a ``FindAutmoc4.cmake`` module wraps a call to
``find_package(Automoc4 NO_MODULE)`` and adds an additional search
directory for ``automoc4``. Then the call to
``find_package_handle_standard_args`` produces a proper success/failure
message.
#]=======================================================================]
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageMessage.cmake)
# internal helper macro
macro(_FPHSA_FAILURE_MESSAGE _msg)
if (${_NAME}_FIND_REQUIRED)
message(FATAL_ERROR "${_msg}")
else ()
if (NOT ${_NAME}_FIND_QUIETLY)
message(STATUS "${_msg}")
endif ()
endif ()
endmacro()
# internal helper macro to generate the failure message when used in CONFIG_MODE:
macro(_FPHSA_HANDLE_FAILURE_CONFIG_MODE)
# <name>_CONFIG is set, but FOUND is false, this means that some other of the REQUIRED_VARS was not found:
if(${_NAME}_CONFIG)
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: missing:${MISSING_VARS} (found ${${_NAME}_CONFIG} ${VERSION_MSG})")
else()
# If _CONSIDERED_CONFIGS is set, the config-file has been found, but no suitable version.
# List them all in the error message:
if(${_NAME}_CONSIDERED_CONFIGS)
set(configsText "")
list(LENGTH ${_NAME}_CONSIDERED_CONFIGS configsCount)
math(EXPR configsCount "${configsCount} - 1")
foreach(currentConfigIndex RANGE ${configsCount})
list(GET ${_NAME}_CONSIDERED_CONFIGS ${currentConfigIndex} filename)
list(GET ${_NAME}_CONSIDERED_VERSIONS ${currentConfigIndex} version)
string(APPEND configsText " ${filename} (version ${version})\n")
endforeach()
if (${_NAME}_NOT_FOUND_MESSAGE)
string(APPEND configsText " Reason given by package: ${${_NAME}_NOT_FOUND_MESSAGE}\n")
endif()
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} ${VERSION_MSG}, checked the following files:\n${configsText}")
else()
# Simple case: No Config-file was found at all:
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: found neither ${_NAME}Config.cmake nor ${_NAME_LOWER}-config.cmake ${VERSION_MSG}")
endif()
endif()
endmacro()
function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
# Set up the arguments for `cmake_parse_arguments`.
set(options CONFIG_MODE HANDLE_COMPONENTS)
set(oneValueArgs FAIL_MESSAGE VERSION_VAR FOUND_VAR)
set(multiValueArgs REQUIRED_VARS)
# Check whether we are in 'simple' or 'extended' mode:
set(_KEYWORDS_FOR_EXTENDED_MODE ${options} ${oneValueArgs} ${multiValueArgs} )
list(FIND _KEYWORDS_FOR_EXTENDED_MODE "${_FIRST_ARG}" INDEX)
if(${INDEX} EQUAL -1)
set(FPHSA_FAIL_MESSAGE ${_FIRST_ARG})
set(FPHSA_REQUIRED_VARS ${ARGN})
set(FPHSA_VERSION_VAR)
else()
cmake_parse_arguments(FPHSA "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN})
if(FPHSA_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "Unknown keywords given to FIND_PACKAGE_HANDLE_STANDARD_ARGS(): \"${FPHSA_UNPARSED_ARGUMENTS}\"")
endif()
if(NOT FPHSA_FAIL_MESSAGE)
set(FPHSA_FAIL_MESSAGE "DEFAULT_MSG")
endif()
# In config-mode, we rely on the variable <package>_CONFIG, which is set by find_package()
# when it successfully found the config-file, including version checking:
if(FPHSA_CONFIG_MODE)
list(INSERT FPHSA_REQUIRED_VARS 0 ${_NAME}_CONFIG)
list(REMOVE_DUPLICATES FPHSA_REQUIRED_VARS)
set(FPHSA_VERSION_VAR ${_NAME}_VERSION)
endif()
if(NOT FPHSA_REQUIRED_VARS)
message(FATAL_ERROR "No REQUIRED_VARS specified for FIND_PACKAGE_HANDLE_STANDARD_ARGS()")
endif()
endif()
# now that we collected all arguments, process them
if("x${FPHSA_FAIL_MESSAGE}" STREQUAL "xDEFAULT_MSG")
set(FPHSA_FAIL_MESSAGE "Could NOT find ${_NAME}")
endif()
list(GET FPHSA_REQUIRED_VARS 0 _FIRST_REQUIRED_VAR)
string(TOUPPER ${_NAME} _NAME_UPPER)
string(TOLOWER ${_NAME} _NAME_LOWER)
if(FPHSA_FOUND_VAR)
if(FPHSA_FOUND_VAR MATCHES "^${_NAME}_FOUND$" OR FPHSA_FOUND_VAR MATCHES "^${_NAME_UPPER}_FOUND$")
set(_FOUND_VAR ${FPHSA_FOUND_VAR})
else()
message(FATAL_ERROR "The argument for FOUND_VAR is \"${FPHSA_FOUND_VAR}\", but only \"${_NAME}_FOUND\" and \"${_NAME_UPPER}_FOUND\" are valid names.")
endif()
else()
set(_FOUND_VAR ${_NAME_UPPER}_FOUND)
endif()
# collect all variables which were not found, so they can be printed, so the
# user knows better what went wrong (#6375)
set(MISSING_VARS "")
set(DETAILS "")
# check if all passed variables are valid
set(FPHSA_FOUND_${_NAME} TRUE)
foreach(_CURRENT_VAR ${FPHSA_REQUIRED_VARS})
if(NOT ${_CURRENT_VAR})
set(FPHSA_FOUND_${_NAME} FALSE)
string(APPEND MISSING_VARS " ${_CURRENT_VAR}")
else()
string(APPEND DETAILS "[${${_CURRENT_VAR}}]")
endif()
endforeach()
if(FPHSA_FOUND_${_NAME})
set(${_NAME}_FOUND TRUE)
set(${_NAME_UPPER}_FOUND TRUE)
else()
set(${_NAME}_FOUND FALSE)
set(${_NAME_UPPER}_FOUND FALSE)
endif()
# component handling
unset(FOUND_COMPONENTS_MSG)
unset(MISSING_COMPONENTS_MSG)
if(FPHSA_HANDLE_COMPONENTS)
foreach(comp ${${_NAME}_FIND_COMPONENTS})
if(${_NAME}_${comp}_FOUND)
if(NOT DEFINED FOUND_COMPONENTS_MSG)
set(FOUND_COMPONENTS_MSG "found components: ")
endif()
string(APPEND FOUND_COMPONENTS_MSG " ${comp}")
else()
if(NOT DEFINED MISSING_COMPONENTS_MSG)
set(MISSING_COMPONENTS_MSG "missing components: ")
endif()
string(APPEND MISSING_COMPONENTS_MSG " ${comp}")
if(${_NAME}_FIND_REQUIRED_${comp})
set(${_NAME}_FOUND FALSE)
string(APPEND MISSING_VARS " ${comp}")
endif()
endif()
endforeach()
set(COMPONENT_MSG "${FOUND_COMPONENTS_MSG} ${MISSING_COMPONENTS_MSG}")
string(APPEND DETAILS "[c${COMPONENT_MSG}]")
endif()
# version handling:
set(VERSION_MSG "")
set(VERSION_OK TRUE)
# check with DEFINED here as the requested or found version may be "0"
if (DEFINED ${_NAME}_FIND_VERSION)
if(DEFINED ${FPHSA_VERSION_VAR})
set(_FOUND_VERSION ${${FPHSA_VERSION_VAR}})
if(${_NAME}_FIND_VERSION_EXACT) # exact version required
# count the dots in the version string
string(REGEX REPLACE "[^.]" "" _VERSION_DOTS "${_FOUND_VERSION}")
# add one dot because there is one dot more than there are components
string(LENGTH "${_VERSION_DOTS}." _VERSION_DOTS)
if (_VERSION_DOTS GREATER ${_NAME}_FIND_VERSION_COUNT)
# Because of the C++ implementation of find_package() ${_NAME}_FIND_VERSION_COUNT
# is at most 4 here. Therefore a simple lookup table is used.
if (${_NAME}_FIND_VERSION_COUNT EQUAL 1)
set(_VERSION_REGEX "[^.]*")
elseif (${_NAME}_FIND_VERSION_COUNT EQUAL 2)
set(_VERSION_REGEX "[^.]*\\.[^.]*")
elseif (${_NAME}_FIND_VERSION_COUNT EQUAL 3)
set(_VERSION_REGEX "[^.]*\\.[^.]*\\.[^.]*")
else ()
set(_VERSION_REGEX "[^.]*\\.[^.]*\\.[^.]*\\.[^.]*")
endif ()
string(REGEX REPLACE "^(${_VERSION_REGEX})\\..*" "\\1" _VERSION_HEAD "${_FOUND_VERSION}")
unset(_VERSION_REGEX)
if (NOT ${_NAME}_FIND_VERSION VERSION_EQUAL _VERSION_HEAD)
set(VERSION_MSG "Found unsuitable version \"${_FOUND_VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"")
set(VERSION_OK FALSE)
else ()
set(VERSION_MSG "(found suitable exact version \"${_FOUND_VERSION}\")")
endif ()
unset(_VERSION_HEAD)
else ()
if (NOT ${_NAME}_FIND_VERSION VERSION_EQUAL _FOUND_VERSION)
set(VERSION_MSG "Found unsuitable version \"${_FOUND_VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"")
set(VERSION_OK FALSE)
else ()
set(VERSION_MSG "(found suitable exact version \"${_FOUND_VERSION}\")")
endif ()
endif ()
unset(_VERSION_DOTS)
else() # minimum version specified:
if (${_NAME}_FIND_VERSION VERSION_GREATER _FOUND_VERSION)
set(VERSION_MSG "Found unsuitable version \"${_FOUND_VERSION}\", but required is at least \"${${_NAME}_FIND_VERSION}\"")
set(VERSION_OK FALSE)
else ()
set(VERSION_MSG "(found suitable version \"${_FOUND_VERSION}\", minimum required is \"${${_NAME}_FIND_VERSION}\")")
endif ()
endif()
else()
# if the package was not found, but a version was given, add that to the output:
if(${_NAME}_FIND_VERSION_EXACT)
set(VERSION_MSG "(Required is exact version \"${${_NAME}_FIND_VERSION}\")")
else()
set(VERSION_MSG "(Required is at least version \"${${_NAME}_FIND_VERSION}\")")
endif()
endif()
else ()
# Check with DEFINED as the found version may be 0.
if(DEFINED ${FPHSA_VERSION_VAR})
set(VERSION_MSG "(found version \"${${FPHSA_VERSION_VAR}}\")")
endif()
endif ()
if(VERSION_OK)
string(APPEND DETAILS "[v${${FPHSA_VERSION_VAR}}(${${_NAME}_FIND_VERSION})]")
else()
set(${_NAME}_FOUND FALSE)
endif()
# print the result:
if (${_NAME}_FOUND)
FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_FIRST_REQUIRED_VAR}} ${VERSION_MSG} ${COMPONENT_MSG}" "${DETAILS}")
else ()
if(FPHSA_CONFIG_MODE)
_FPHSA_HANDLE_FAILURE_CONFIG_MODE()
else()
if(NOT VERSION_OK)
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})")
else()
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} (missing:${MISSING_VARS}) ${VERSION_MSG}")
endif()
endif()
endif ()
set(${_NAME}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE)
set(${_NAME_UPPER}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE)
endfunction()

View File

@ -0,0 +1,47 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#.rst:
# FindPackageMessage
# ------------------
#
#
#
# FIND_PACKAGE_MESSAGE(<name> "message for user" "find result details")
#
# This macro is intended to be used in FindXXX.cmake modules files. It
# will print a message once for each unique find result. This is useful
# for telling the user where a package was found. The first argument
# specifies the name (XXX) of the package. The second argument
# specifies the message to display. The third argument lists details
# about the find result so that if they change the message will be
# displayed again. The macro also obeys the QUIET argument to the
# find_package command.
#
# Example:
#
# ::
#
# if(X11_FOUND)
# FIND_PACKAGE_MESSAGE(X11 "Found X11: ${X11_X11_LIB}"
# "[${X11_X11_LIB}][${X11_INCLUDE_DIR}]")
# else()
# ...
# endif()
function(FIND_PACKAGE_MESSAGE pkg msg details)
# Avoid printing a message repeatedly for the same find result.
if(NOT ${pkg}_FIND_QUIETLY)
string(REPLACE "\n" "" details "${details}")
set(DETAILS_VAR FIND_PACKAGE_MESSAGE_DETAILS_${pkg})
if(NOT "${details}" STREQUAL "${${DETAILS_VAR}}")
# The message has not yet been printed.
message(STATUS "${msg}")
# Save the find details in the cache to avoid printing the same
# message again.
set("${DETAILS_VAR}" "${details}"
CACHE INTERNAL "Details about finding ${pkg}")
endif()
endif()
endfunction()

579
cmake/FindProtobuf.cmake Normal file
View File

@ -0,0 +1,579 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#.rst:
# FindProtobuf
# ------------
#
# Locate and configure the Google Protocol Buffers library.
#
# The following variables can be set and are optional:
#
# ``Protobuf_SRC_ROOT_FOLDER``
# When compiling with MSVC, if this cache variable is set
# the protobuf-default VS project build locations
# (vsprojects/Debug and vsprojects/Release
# or vsprojects/x64/Debug and vsprojects/x64/Release)
# will be searched for libraries and binaries.
# ``Protobuf_IMPORT_DIRS``
# List of additional directories to be searched for
# imported .proto files.
# ``Protobuf_DEBUG``
# Show debug messages.
# ``Protobuf_USE_STATIC_LIBS``
# Set to ON to force the use of the static libraries.
# Default is OFF.
#
# Defines the following variables:
#
# ``Protobuf_FOUND``
# Found the Google Protocol Buffers library
# (libprotobuf & header files)
# ``Protobuf_VERSION``
# Version of package found.
# ``Protobuf_INCLUDE_DIRS``
# Include directories for Google Protocol Buffers
# ``Protobuf_LIBRARIES``
# The protobuf libraries
# ``Protobuf_PROTOC_LIBRARIES``
# The protoc libraries
# ``Protobuf_LITE_LIBRARIES``
# The protobuf-lite libraries
#
# The following :prop_tgt:`IMPORTED` targets are also defined:
#
# ``protobuf::libprotobuf``
# The protobuf library.
# ``protobuf::libprotobuf-lite``
# The protobuf lite library.
# ``protobuf::libprotoc``
# The protoc library.
# ``protobuf::protoc``
# The protoc compiler.
#
# The following cache variables are also available to set or use:
#
# ``Protobuf_LIBRARY``
# The protobuf library
# ``Protobuf_PROTOC_LIBRARY``
# The protoc library
# ``Protobuf_INCLUDE_DIR``
# The include directory for protocol buffers
# ``Protobuf_PROTOC_EXECUTABLE``
# The protoc compiler
# ``Protobuf_LIBRARY_DEBUG``
# The protobuf library (debug)
# ``Protobuf_PROTOC_LIBRARY_DEBUG``
# The protoc library (debug)
# ``Protobuf_LITE_LIBRARY``
# The protobuf lite library
# ``Protobuf_LITE_LIBRARY_DEBUG``
# The protobuf lite library (debug)
#
# Example:
#
# .. code-block:: cmake
#
# find_package(Protobuf REQUIRED)
# include_directories(${Protobuf_INCLUDE_DIRS})
# include_directories(${CMAKE_CURRENT_BINARY_DIR})
# protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS foo.proto)
# protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS EXPORT_MACRO DLL_EXPORT foo.proto)
# protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS DESCRIPTORS PROTO_DESCS foo.proto)
# protobuf_generate_python(PROTO_PY foo.proto)
# add_executable(bar bar.cc ${PROTO_SRCS} ${PROTO_HDRS})
# target_link_libraries(bar ${Protobuf_LIBRARIES})
#
# .. note::
# The ``protobuf_generate_cpp`` and ``protobuf_generate_python``
# functions and :command:`add_executable` or :command:`add_library`
# calls only work properly within the same directory.
#
# .. command:: protobuf_generate_cpp
#
# Add custom commands to process ``.proto`` files to C++::
#
# protobuf_generate_cpp (<SRCS> <HDRS>
# [DESCRIPTORS <DESC>] [EXPORT_MACRO <MACRO>] [<ARGN>...])
#
# ``SRCS``
# Variable to define with autogenerated source files
# ``HDRS``
# Variable to define with autogenerated header files
# ``DESCRIPTORS``
# Variable to define with autogenerated descriptor files, if requested.
# ``EXPORT_MACRO``
# is a macro which should expand to ``__declspec(dllexport)`` or
# ``__declspec(dllimport)`` depending on what is being compiled.
# ``ARGN``
# ``.proto`` files
#
# .. command:: protobuf_generate_python
#
# Add custom commands to process ``.proto`` files to Python::
#
# protobuf_generate_python (<PY> [<ARGN>...])
#
# ``PY``
# Variable to define with autogenerated Python files
# ``ARGN``
# ``.proto`` filess
function(PROTOBUF_GENERATE_CPP SRCS HDRS)
cmake_parse_arguments(protobuf "" "EXPORT_MACRO;DESCRIPTORS" "" ${ARGN})
set(PROTO_FILES "${protobuf_UNPARSED_ARGUMENTS}")
if(NOT PROTO_FILES)
message(SEND_ERROR "Error: PROTOBUF_GENERATE_CPP() called without any proto files")
return()
endif()
if(protobuf_EXPORT_MACRO)
set(DLL_EXPORT_DECL "dllexport_decl=${protobuf_EXPORT_MACRO}:")
endif()
if(PROTOBUF_GENERATE_CPP_APPEND_PATH)
# Create an include path for each file specified
foreach(FIL ${PROTO_FILES})
get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
get_filename_component(ABS_PATH ${ABS_FIL} PATH)
list(FIND _protobuf_include_path ${ABS_PATH} _contains_already)
if(${_contains_already} EQUAL -1)
list(APPEND _protobuf_include_path -I ${ABS_PATH})
endif()
endforeach()
else()
set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR})
endif()
if(DEFINED PROTOBUF_IMPORT_DIRS AND NOT DEFINED Protobuf_IMPORT_DIRS)
set(Protobuf_IMPORT_DIRS "${PROTOBUF_IMPORT_DIRS}")
endif()
if(DEFINED Protobuf_IMPORT_DIRS)
foreach(DIR ${Protobuf_IMPORT_DIRS})
get_filename_component(ABS_PATH ${DIR} ABSOLUTE)
list(FIND _protobuf_include_path ${ABS_PATH} _contains_already)
if(${_contains_already} EQUAL -1)
list(APPEND _protobuf_include_path -I ${ABS_PATH})
endif()
endforeach()
endif()
set(${SRCS})
set(${HDRS})
if (protobuf_DESCRIPTORS)
set(${protobuf_DESCRIPTORS})
endif()
foreach(FIL ${PROTO_FILES})
get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
get_filename_component(FIL_WE ${FIL} NAME_WE)
if(NOT PROTOBUF_GENERATE_CPP_APPEND_PATH)
get_filename_component(FIL_DIR ${FIL} DIRECTORY)
if(FIL_DIR)
set(FIL_WE "${FIL_DIR}/${FIL_WE}")
endif()
endif()
set(_protobuf_protoc_src "${CMAKE_CURRENT_SOURCE_DIR}/${FIL_WE}.pb.cc")
set(_protobuf_protoc_hdr "${CMAKE_CURRENT_SOURCE_DIR}/${FIL_WE}.pb.h")
list(APPEND ${SRCS} "${_protobuf_protoc_src}")
list(APPEND ${HDRS} "${_protobuf_protoc_hdr}")
if(protobuf_DESCRIPTORS)
set(_protobuf_protoc_desc "${CMAKE_CURRENT_SOURCE_DIR}/${FIL_WE}.desc")
set(_protobuf_protoc_flags "--descriptor_set_out=${_protobuf_protoc_desc}")
list(APPEND ${protobuf_DESCRIPTORS} "${_protobuf_protoc_desc}")
else()
set(_protobuf_protoc_desc "")
set(_protobuf_protoc_flags "")
endif()
add_custom_command(
OUTPUT "${_protobuf_protoc_src}"
"${_protobuf_protoc_hdr}"
${_protobuf_protoc_desc}
COMMAND protobuf::protoc
"--cpp_out=${DLL_EXPORT_DECL}${CMAKE_CURRENT_SOURCE_DIR}"
${_protobuf_protoc_flags}
${_protobuf_include_path} ${ABS_FIL}
DEPENDS ${ABS_FIL} protobuf::protoc
COMMENT "Running C++ protocol buffer compiler on ${FIL}"
VERBATIM )
endforeach()
set(${SRCS} "${${SRCS}}" PARENT_SCOPE)
set(${HDRS} "${${HDRS}}" PARENT_SCOPE)
if(protobuf_DESCRIPTORS)
set(${protobuf_DESCRIPTORS} "${${protobuf_DESCRIPTORS}}" PARENT_SCOPE)
endif()
endfunction()
function(PROTOBUF_GENERATE_PYTHON SRCS)
if(NOT ARGN)
message(SEND_ERROR "Error: PROTOBUF_GENERATE_PYTHON() called without any proto files")
return()
endif()
if(PROTOBUF_GENERATE_CPP_APPEND_PATH)
# Create an include path for each file specified
foreach(FIL ${ARGN})
get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
get_filename_component(ABS_PATH ${ABS_FIL} PATH)
list(FIND _protobuf_include_path ${ABS_PATH} _contains_already)
if(${_contains_already} EQUAL -1)
list(APPEND _protobuf_include_path -I ${ABS_PATH})
endif()
endforeach()
else()
set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR})
endif()
if(DEFINED PROTOBUF_IMPORT_DIRS AND NOT DEFINED Protobuf_IMPORT_DIRS)
set(Protobuf_IMPORT_DIRS "${PROTOBUF_IMPORT_DIRS}")
endif()
if(DEFINED Protobuf_IMPORT_DIRS)
foreach(DIR ${Protobuf_IMPORT_DIRS})
get_filename_component(ABS_PATH ${DIR} ABSOLUTE)
list(FIND _protobuf_include_path ${ABS_PATH} _contains_already)
if(${_contains_already} EQUAL -1)
list(APPEND _protobuf_include_path -I ${ABS_PATH})
endif()
endforeach()
endif()
set(${SRCS})
foreach(FIL ${ARGN})
get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
get_filename_component(FIL_WE ${FIL} NAME_WE)
if(NOT PROTOBUF_GENERATE_CPP_APPEND_PATH)
get_filename_component(FIL_DIR ${FIL} DIRECTORY)
if(FIL_DIR)
set(FIL_WE "${FIL_DIR}/${FIL_WE}")
endif()
endif()
list(APPEND ${SRCS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}_pb2.py")
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}_pb2.py"
COMMAND protobuf::protoc --python_out ${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${ABS_FIL}
DEPENDS ${ABS_FIL} protobuf::protoc
COMMENT "Running Python protocol buffer compiler on ${FIL}"
VERBATIM )
endforeach()
set(${SRCS} ${${SRCS}} PARENT_SCOPE)
endfunction()
if(Protobuf_DEBUG)
# Output some of their choices
message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
"Protobuf_USE_STATIC_LIBS = ${Protobuf_USE_STATIC_LIBS}")
endif()
# Backwards compatibility
# Define camel case versions of input variables
foreach(UPPER
PROTOBUF_SRC_ROOT_FOLDER
PROTOBUF_IMPORT_DIRS
PROTOBUF_DEBUG
PROTOBUF_LIBRARY
PROTOBUF_PROTOC_LIBRARY
PROTOBUF_INCLUDE_DIR
PROTOBUF_PROTOC_EXECUTABLE
PROTOBUF_LIBRARY_DEBUG
PROTOBUF_PROTOC_LIBRARY_DEBUG
PROTOBUF_LITE_LIBRARY
PROTOBUF_LITE_LIBRARY_DEBUG
)
if (DEFINED ${UPPER})
string(REPLACE "PROTOBUF_" "Protobuf_" Camel ${UPPER})
if (NOT DEFINED ${Camel})
set(${Camel} ${${UPPER}})
endif()
endif()
endforeach()
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(_PROTOBUF_ARCH_DIR x64/)
endif()
# Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES
if( Protobuf_USE_STATIC_LIBS )
set( _protobuf_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
if(WIN32)
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
else()
set(CMAKE_FIND_LIBRARY_SUFFIXES .a )
endif()
endif()
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
# Internal function: search for normal library as well as a debug one
# if the debug one is specified also include debug/optimized keywords
# in *_LIBRARIES variable
function(_protobuf_find_libraries name filename)
if(${name}_LIBRARIES)
# Use result recorded by a previous call.
return()
elseif(${name}_LIBRARY)
# Honor cache entry used by CMake 3.5 and lower.
set(${name}_LIBRARIES "${${name}_LIBRARY}" PARENT_SCOPE)
else()
find_library(${name}_LIBRARY_RELEASE
NAMES ${filename}
PATHS ${Protobuf_SRC_ROOT_FOLDER}/vsprojects/${_PROTOBUF_ARCH_DIR}Release)
mark_as_advanced(${name}_LIBRARY_RELEASE)
find_library(${name}_LIBRARY_DEBUG
NAMES ${filename}d ${filename}
PATHS ${Protobuf_SRC_ROOT_FOLDER}/vsprojects/${_PROTOBUF_ARCH_DIR}Debug)
mark_as_advanced(${name}_LIBRARY_DEBUG)
select_library_configurations(${name})
set(${name}_LIBRARY "${${name}_LIBRARY}" PARENT_SCOPE)
set(${name}_LIBRARIES "${${name}_LIBRARIES}" PARENT_SCOPE)
endif()
endfunction()
# Internal function: find threads library
function(_protobuf_find_threads)
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
find_package(Threads)
if(Threads_FOUND)
list(APPEND Protobuf_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
set(Protobuf_LIBRARIES "${Protobuf_LIBRARIES}" PARENT_SCOPE)
endif()
endfunction()
#
# Main.
#
# By default have PROTOBUF_GENERATE_CPP macro pass -I to protoc
# for each directory where a proto file is referenced.
if(NOT DEFINED PROTOBUF_GENERATE_CPP_APPEND_PATH)
set(PROTOBUF_GENERATE_CPP_APPEND_PATH TRUE)
endif()
# Google's provided vcproj files generate libraries with a "lib"
# prefix on Windows
if(MSVC)
set(Protobuf_ORIG_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES}")
set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "")
find_path(Protobuf_SRC_ROOT_FOLDER protobuf.pc.in)
endif()
# The Protobuf library
_protobuf_find_libraries(Protobuf protobuf)
#DOC "The Google Protocol Buffers RELEASE Library"
_protobuf_find_libraries(Protobuf_LITE protobuf-lite)
# The Protobuf Protoc Library
_protobuf_find_libraries(Protobuf_PROTOC protoc)
# Restore original find library prefixes
if(MSVC)
set(CMAKE_FIND_LIBRARY_PREFIXES "${Protobuf_ORIG_FIND_LIBRARY_PREFIXES}")
endif()
if(UNIX)
_protobuf_find_threads()
endif()
# Find the include directory
find_path(Protobuf_INCLUDE_DIR
google/protobuf/service.h
PATHS ${Protobuf_SRC_ROOT_FOLDER}/src
)
mark_as_advanced(Protobuf_INCLUDE_DIR)
# Find the protoc Executable
find_program(Protobuf_PROTOC_EXECUTABLE
NAMES protoc
DOC "The Google Protocol Buffers Compiler"
PATHS
${Protobuf_SRC_ROOT_FOLDER}/vsprojects/${_PROTOBUF_ARCH_DIR}Release
${Protobuf_SRC_ROOT_FOLDER}/vsprojects/${_PROTOBUF_ARCH_DIR}Debug
)
mark_as_advanced(Protobuf_PROTOC_EXECUTABLE)
if(Protobuf_DEBUG)
message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
"requested version of Google Protobuf is ${Protobuf_FIND_VERSION}")
endif()
if(Protobuf_INCLUDE_DIR)
set(_PROTOBUF_COMMON_HEADER ${Protobuf_INCLUDE_DIR}/google/protobuf/stubs/common.h)
if(Protobuf_DEBUG)
message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
"location of common.h: ${_PROTOBUF_COMMON_HEADER}")
endif()
set(Protobuf_VERSION "")
set(Protobuf_LIB_VERSION "")
file(STRINGS ${_PROTOBUF_COMMON_HEADER} _PROTOBUF_COMMON_H_CONTENTS REGEX "#define[ \t]+GOOGLE_PROTOBUF_VERSION[ \t]+")
if(_PROTOBUF_COMMON_H_CONTENTS MATCHES "#define[ \t]+GOOGLE_PROTOBUF_VERSION[ \t]+([0-9]+)")
set(Protobuf_LIB_VERSION "${CMAKE_MATCH_1}")
endif()
unset(_PROTOBUF_COMMON_H_CONTENTS)
math(EXPR _PROTOBUF_MAJOR_VERSION "${Protobuf_LIB_VERSION} / 1000000")
math(EXPR _PROTOBUF_MINOR_VERSION "${Protobuf_LIB_VERSION} / 1000 % 1000")
math(EXPR _PROTOBUF_SUBMINOR_VERSION "${Protobuf_LIB_VERSION} % 1000")
set(Protobuf_VERSION "${_PROTOBUF_MAJOR_VERSION}.${_PROTOBUF_MINOR_VERSION}.${_PROTOBUF_SUBMINOR_VERSION}")
if(Protobuf_DEBUG)
message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
"${_PROTOBUF_COMMON_HEADER} reveals protobuf ${Protobuf_VERSION}")
endif()
# Check Protobuf compiler version to be aligned with libraries version
execute_process(COMMAND ${Protobuf_PROTOC_EXECUTABLE} --version
OUTPUT_VARIABLE _PROTOBUF_PROTOC_EXECUTABLE_VERSION)
if("${_PROTOBUF_PROTOC_EXECUTABLE_VERSION}" MATCHES "libprotoc ([0-9.]+)")
set(_PROTOBUF_PROTOC_EXECUTABLE_VERSION "${CMAKE_MATCH_1}")
endif()
if(Protobuf_DEBUG)
message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
"${Protobuf_PROTOC_EXECUTABLE} reveals version ${_PROTOBUF_PROTOC_EXECUTABLE_VERSION}")
endif()
if(NOT "${_PROTOBUF_PROTOC_EXECUTABLE_VERSION}" VERSION_EQUAL "${Protobuf_VERSION}")
message(WARNING "Protobuf compiler version ${_PROTOBUF_PROTOC_EXECUTABLE_VERSION}"
" doesn't match library version ${Protobuf_VERSION}")
endif()
if(Protobuf_LIBRARY)
if(NOT TARGET protobuf::libprotobuf)
add_library(protobuf::libprotobuf UNKNOWN IMPORTED)
set_target_properties(protobuf::libprotobuf PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${Protobuf_INCLUDE_DIR}")
if(EXISTS "${Protobuf_LIBRARY}")
set_target_properties(protobuf::libprotobuf PROPERTIES
IMPORTED_LOCATION "${Protobuf_LIBRARY}")
endif()
if(EXISTS "${Protobuf_LIBRARY_RELEASE}")
set_property(TARGET protobuf::libprotobuf APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(protobuf::libprotobuf PROPERTIES
IMPORTED_LOCATION_RELEASE "${Protobuf_LIBRARY_RELEASE}")
endif()
if(EXISTS "${Protobuf_LIBRARY_DEBUG}")
set_property(TARGET protobuf::libprotobuf APPEND PROPERTY
IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(protobuf::libprotobuf PROPERTIES
IMPORTED_LOCATION_DEBUG "${Protobuf_LIBRARY_DEBUG}")
endif()
endif()
endif()
if(Protobuf_LITE_LIBRARY)
if(NOT TARGET protobuf::libprotobuf-lite)
add_library(protobuf::libprotobuf-lite UNKNOWN IMPORTED)
set_target_properties(protobuf::libprotobuf-lite PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${Protobuf_INCLUDE_DIR}")
if(EXISTS "${Protobuf_LITE_LIBRARY}")
set_target_properties(protobuf::libprotobuf-lite PROPERTIES
IMPORTED_LOCATION "${Protobuf_LITE_LIBRARY}")
endif()
if(EXISTS "${Protobuf_LITE_LIBRARY_RELEASE}")
set_property(TARGET protobuf::libprotobuf-lite APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(protobuf::libprotobuf-lite PROPERTIES
IMPORTED_LOCATION_RELEASE "${Protobuf_LITE_LIBRARY_RELEASE}")
endif()
if(EXISTS "${Protobuf_LITE_LIBRARY_DEBUG}")
set_property(TARGET protobuf::libprotobuf-lite APPEND PROPERTY
IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(protobuf::libprotobuf-lite PROPERTIES
IMPORTED_LOCATION_DEBUG "${Protobuf_LITE_LIBRARY_DEBUG}")
endif()
endif()
endif()
if(Protobuf_PROTOC_LIBRARY)
if(NOT TARGET protobuf::libprotoc)
add_library(protobuf::libprotoc UNKNOWN IMPORTED)
set_target_properties(protobuf::libprotoc PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${Protobuf_INCLUDE_DIR}")
if(EXISTS "${Protobuf_PROTOC_LIBRARY}")
set_target_properties(protobuf::libprotoc PROPERTIES
IMPORTED_LOCATION "${Protobuf_PROTOC_LIBRARY}")
endif()
if(EXISTS "${Protobuf_PROTOC_LIBRARY_RELEASE}")
set_property(TARGET protobuf::libprotoc APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(protobuf::libprotoc PROPERTIES
IMPORTED_LOCATION_RELEASE "${Protobuf_PROTOC_LIBRARY_RELEASE}")
endif()
if(EXISTS "${Protobuf_PROTOC_LIBRARY_DEBUG}")
set_property(TARGET protobuf::libprotoc APPEND PROPERTY
IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(protobuf::libprotoc PROPERTIES
IMPORTED_LOCATION_DEBUG "${Protobuf_PROTOC_LIBRARY_DEBUG}")
endif()
endif()
endif()
if(Protobuf_PROTOC_EXECUTABLE)
if(NOT TARGET protobuf::protoc)
add_executable(protobuf::protoc IMPORTED)
if(EXISTS "${Protobuf_PROTOC_EXECUTABLE}")
set_target_properties(protobuf::protoc PROPERTIES
IMPORTED_LOCATION "${Protobuf_PROTOC_EXECUTABLE}")
endif()
endif()
endif()
endif()
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Protobuf
REQUIRED_VARS Protobuf_LIBRARIES Protobuf_INCLUDE_DIR
VERSION_VAR Protobuf_VERSION
)
if(Protobuf_FOUND)
set(Protobuf_INCLUDE_DIRS ${Protobuf_INCLUDE_DIR})
endif()
# Restore the original find library ordering
if( Protobuf_USE_STATIC_LIBS )
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_protobuf_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
endif()
# Backwards compatibility
# Define upper case versions of output variables
foreach(Camel
Protobuf_SRC_ROOT_FOLDER
Protobuf_IMPORT_DIRS
Protobuf_DEBUG
Protobuf_INCLUDE_DIRS
Protobuf_LIBRARIES
Protobuf_PROTOC_LIBRARIES
Protobuf_LITE_LIBRARIES
Protobuf_LIBRARY
Protobuf_PROTOC_LIBRARY
Protobuf_INCLUDE_DIR
Protobuf_PROTOC_EXECUTABLE
Protobuf_LIBRARY_DEBUG
Protobuf_PROTOC_LIBRARY_DEBUG
Protobuf_LITE_LIBRARY
Protobuf_LITE_LIBRARY_DEBUG
)
string(TOUPPER ${Camel} UPPER)
set(${UPPER} ${${Camel}})
endforeach()

View File

@ -0,0 +1,71 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#.rst:
# SelectLibraryConfigurations
# ---------------------------
#
#
#
# select_library_configurations( basename )
#
# This macro takes a library base name as an argument, and will choose
# good values for basename_LIBRARY, basename_LIBRARIES,
# basename_LIBRARY_DEBUG, and basename_LIBRARY_RELEASE depending on what
# has been found and set. If only basename_LIBRARY_RELEASE is defined,
# basename_LIBRARY will be set to the release value, and
# basename_LIBRARY_DEBUG will be set to basename_LIBRARY_DEBUG-NOTFOUND.
# If only basename_LIBRARY_DEBUG is defined, then basename_LIBRARY will
# take the debug value, and basename_LIBRARY_RELEASE will be set to
# basename_LIBRARY_RELEASE-NOTFOUND.
#
# If the generator supports configuration types, then basename_LIBRARY
# and basename_LIBRARIES will be set with debug and optimized flags
# specifying the library to be used for the given configuration. If no
# build type has been set or the generator in use does not support
# configuration types, then basename_LIBRARY and basename_LIBRARIES will
# take only the release value, or the debug value if the release one is
# not set.
# This macro was adapted from the FindQt4 CMake module and is maintained by Will
# Dicharry <wdicharry@stellarscience.com>.
macro( select_library_configurations basename )
if(NOT ${basename}_LIBRARY_RELEASE)
set(${basename}_LIBRARY_RELEASE "${basename}_LIBRARY_RELEASE-NOTFOUND" CACHE FILEPATH "Path to a library.")
endif()
if(NOT ${basename}_LIBRARY_DEBUG)
set(${basename}_LIBRARY_DEBUG "${basename}_LIBRARY_DEBUG-NOTFOUND" CACHE FILEPATH "Path to a library.")
endif()
get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if( ${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE AND
NOT ${basename}_LIBRARY_DEBUG STREQUAL ${basename}_LIBRARY_RELEASE AND
( _isMultiConfig OR CMAKE_BUILD_TYPE ) )
# if the generator is multi-config or if CMAKE_BUILD_TYPE is set for
# single-config generators, set optimized and debug libraries
set( ${basename}_LIBRARY "" )
foreach( _libname IN LISTS ${basename}_LIBRARY_RELEASE )
list( APPEND ${basename}_LIBRARY optimized "${_libname}" )
endforeach()
foreach( _libname IN LISTS ${basename}_LIBRARY_DEBUG )
list( APPEND ${basename}_LIBRARY debug "${_libname}" )
endforeach()
elseif( ${basename}_LIBRARY_RELEASE )
set( ${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE} )
elseif( ${basename}_LIBRARY_DEBUG )
set( ${basename}_LIBRARY ${${basename}_LIBRARY_DEBUG} )
else()
set( ${basename}_LIBRARY "${basename}_LIBRARY-NOTFOUND")
endif()
set( ${basename}_LIBRARIES "${${basename}_LIBRARY}" )
if( ${basename}_LIBRARY )
set( ${basename}_FOUND TRUE )
endif()
mark_as_advanced( ${basename}_LIBRARY_RELEASE
${basename}_LIBRARY_DEBUG
)
endmacro()

View File

@ -1,4 +1,7 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
SET(PROTOBUF_GENERATE_CPP_APPEND_PATH "../../")
PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HEADERS message.proto)
SET(common_sources
base_packet.cpp
@ -39,9 +42,10 @@ SET(common_sources
item_instance.cpp
json_config.cpp
light_source.cpp
md5.cpp
md5.cpp
memory_buffer.cpp
memory_mapped_file.cpp
message.pb.cc
misc.cpp
misc_functions.cpp
mutex.cpp
@ -97,8 +101,7 @@ SET(common_sources
patches/titanium.cpp
patches/titanium_limits.cpp
patches/uf.cpp
patches/uf_limits.cpp
proto/message.pb.cc
patches/uf_limits.cpp
StackWalker/StackWalker.cpp
tinyxml/tinystr.cpp
tinyxml/tinyxml.cpp
@ -168,6 +171,7 @@ SET(common_headers
md5.h
memory_buffer.h
memory_mapped_file.h
message.pb.h
misc.h
misc_functions.h
mutex.h
@ -255,7 +259,6 @@ SET(common_headers
patches/uf_limits.h
patches/uf_ops.h
patches/uf_structs.h
proto/message.pb.h
StackWalker/StackWalker.h
tinyxml/tinystr.h
tinyxml/tinyxml.h

883
common/message.proto Normal file
View File

@ -0,0 +1,883 @@
syntax = "proto3";
package eqproto;
message ChannelMessage {
int32 chan_num = 1;
int32 language = 2;
string from = 3;
string to = 4;
string message = 5;
int32 guilddbid = 6;
string deliverto = 7;
int32 type = 8;
int32 minstatus = 9;
int32 fromadmin = 10;
bool noreply = 11;
bool is_emote = 12;
//0 not queued, 1 queued, 2 queue full, 3 offline
int32 queued = 13;
//You can specify a zone id if you want a message exclusively to one zone
int32 zone_id = 14;
}
message CommandMessage {
string author = 1;
string command = 2;
repeated string params = 3;
string result = 4;
bytes payload = 5;
}
//Daily Gain is a special system for tracking players progression in a daily snapshot.
message DailyGain {
int32 account_id = 1;
int32 character_id = 2;
int32 levels_gained = 3;
int32 experience_gained = 4;
int32 money_earned = 5;
string identity = 6;
}
//Entity is full of entity data.
message Entity {
int32 id = 1;
string name = 2;
int32 type = 3;
int32 hp = 4;
int32 level = 5;
Position position = 6;
int32 race = 7;
int32 class = 8;
}
message Entities {
repeated Entity entities = 1;
}
message Position {
float x = 1;
float y = 2;
float z = 3;
float h = 4;
}
message TextureProfile {
Texture Head = 1;
Texture Chest = 2;
Texture Arms = 3;
Texture Wrist = 4;
Texture Hands = 5;
Texture Legs = 6;
Texture Feet = 7;
Texture Primary = 8;
Texture Secondary = 9;
}
message Texture {
uint32 material = 1;
uint32 unknown1 = 2;
uint32 EliteModel = 3;
uint32 HerosForgeModel = 4;
uint32 Unknown2 = 5;
}
message TintProfile {
Tint Head = 1;
Tint Chest = 2;
Tint Arms = 3;
Tint Wrist = 4;
Tint Hands = 5;
Tint Legs = 6;
Tint Feet = 7;
Tint Primary = 8;
Tint Secondary = 9;
}
message Tint {
uint32 Blue = 1;
uint32 Green = 2;
uint32 Red = 3;
uint32 UseTint = 4; // if there's a tint, this is FF
uint32 Color = 5;
}
message Event {
OpCode op = 1;
bytes payload = 2;
}
//OP_Death
message DeathEvent {
uint32 spawn_id = 1;
uint32 killer_id = 2;
uint32 corpse_id = 3;
uint32 bind_zone_id = 4;
uint32 spell_id = 5;
uint32 attack_skill_id = 6;
uint32 damage = 7;
uint32 unknown028 = 8;
}
//OP_Damage
message DamageEvent {
uint32 target = 1;
uint32 source = 2;
uint32 type = 3; //slashing, etc. 231 (0xE7) for spells
uint32 spellid = 4;
uint32 damage = 5;
float force = 6;
float meleepush_xy = 7; // see above notes in Action_Struct
float meleepush_z = 8;
}
//OP_Assist OP_Camp
message EntityEvent {
uint32 entity_id = 1; //source of event trigger.
uint32 target_id = 2; //target or other/source/target entity
}
//OP_ChannelMessage
message ChannelMessageEvent {
string target_name = 1; // Tell recipient
string sender = 2; // The senders name (len might be wrong)
uint32 language = 3; // Language
uint32 chan_num = 4; // Channel
uint32 cm_unknown4 = 5; // ***Placeholder
uint32 skill_in_language = 6; // The players skill in this language? might be wrong
string message = 7; // Variable length message
}
//OP_WearChange
message WearChangeEvent {
uint32 spawn_id = 1;
uint32 material = 2;
uint32 unknown06 = 3;
uint32 elite_material = 4; // 1 for Drakkin Elite Material
uint32 hero_forge_model = 5; // New to VoA
uint32 unknown18 = 6; // New to RoF
Tint color = 7;
uint32 wear_slot_id = 8;
}
//OP_DeleteSpawn
message DeleteSpawnEvent {
uint32 spawn_id = 1; // Spawn ID to delete
uint32 decay = 2; // 0 = vanish immediately, 1 = 'Decay' sparklies for corpses.
}
//OP_MobHealth, OP_HPUpdate
message HPEvent {
uint32 spawn_id = 1;
uint32 cur_hp = 2;
uint32 max_hp = 3;
}
//OP_ClientUpdate
message PlayerPositionUpdateEvent {
uint32 spawn_id = 1;
int32 delta_heading = 2; // change in heading
int32 x_pos = 3; // x coord
int32 padding0002 = 4; // ***Placeholder
int32 y_pos = 5; // y coord
int32 animation = 6; // animation
int32 padding0006 = 7; // ***Placeholder
int32 z_pos = 8; // z coord
int32 delta_y = 9; // change in y
int32 delta_x = 10; // change in x
int32 heading = 11; // heading
int32 padding0014 = 12; // ***Placeholder
int32 delta_z = 13; // change in z
int32 padding0018 = 14; // ***Placeholder
}
//OP_Animation
message AnimationEvent {
uint32 spawnid = 1;
uint32 speed = 2;
uint32 action = 3;
}
//OP_ZoneEntry OP_NewSpawn
message SpawnEvent {
uint32 unknown0000= 1;
uint32 gm = 2; // 0=no, 1=gm
uint32 unknown0003 = 3;
uint32 aaitle = 4; // 0=none, 1=general, 2=archtype, 3=class
uint32 unknown0004 = 5;
uint32 anon = 6; // 0=normal, 1=anon, 2=roleplay
uint32 face = 7; // Face id for players
string name = 8; // Player's Name
uint32 deity = 9; // Player's Deity
uint32 unknown0073 = 10;
float size = 11; // Model size
uint32 unknown0079 = 12;
uint32 NPC = 13; // 0=player,1=npc,2=pc corpse,3=npc corpse,a
uint32 invis = 14; // Invis (0=not, 1=invis)
uint32 haircolor = 15; // Hair color
uint32 curHp = 16; // Current hp %%% wrong
uint32 max_hp = 17; // (name prolly wrong)takes on the value 100 for players, 100 or 110 for NPCs and 120 for PC corpses...
uint32 findable = 18; // 0=can't be found, 1=can be found
uint32 unknown0089 = 19;
int32 deltaHeading = 20; // change in heading
int32 x = 21; // x coord
int32 padding0054 = 22; // ***Placeholder
int32 y = 23; // y coord
int32 animation = 24; // animation
int32 padding0058 = 25; // ***Placeholder
int32 z = 26; // z coord
int32 deltaY = 27; // change in y
int32 deltaX = 28; // change in x
uint32 heading = 29; // heading
int32 padding0066 = 30; // ***Placeholder
int32 deltaZ = 31; // change in z
int32 padding0070 = 32; // ***Placeholder
uint32 eyecolor1 = 33; // Player's left eye color
uint32 unknown0115 = 34; // Was [24]
uint32 StandState = 35; // stand state for SoF+ 0x64 for normal animation
uint32 drakkin_heritage = 36; // Added for SoF
uint32 drakkin_tattoo = 37; // Added for SoF
uint32 drakkin_details = 38; // Added for SoF
uint32 showhelm = 39; // 0=no, 1=yes
uint32 unknown0140 = 40;
uint32 is_npc = 41; // 0=no, 1=yes
uint32 hairstyle = 42; // Hair style
uint32 beard = 43; // Beard style (not totally, sure but maybe!)
uint32 unknown0147 = 44;
uint32 level = 45; // Spawn Level
uint32 PlayerState = 46; // Controls animation stuff // None = 0, Open = 1, WeaponSheathed = 2, Aggressive = 4, ForcedAggressive = 8, InstrumentEquipped = 16, Stunned = 32, PrimaryWeaponEquipped = 64, SecondaryWeaponEquipped = 128
uint32 beardcolor = 47; // Beard color
string suffix = 48; // Player's suffix (of Veeshan, etc.)
uint32 petOwnerId = 49; // If this is a pet, the spawn id of owner
uint32 guildrank = 50; // 0=normal, 1=officer, 2=leader
uint32 unknown0194 = 51;
TextureProfile equipment = 52;
float runspeed = 53; // Speed when running
uint32 afk = 54; // 0=no, 1=afk
uint32 guildID = 55; // Current guild
string title = 56; // Title
uint32 unknown0274 = 57; // non-zero prefixes name with '!'
uint32 set_to_0xFF = 58; // ***Placeholder (all ff)
uint32 helm = 59; // Helm texture
uint32 race = 60; // Spawn race
uint32 unknown0288 = 61;
string lastName = 62; // Player's Lastname
float walkspeed = 63; // Speed when walking
uint32 unknown0328 = 64;
uint32 is_pet = 65; // 0=no, 1=yes
uint32 light = 66; // Spawn's lightsource %%% wrong
uint32 class_ = 67; // Player's class
uint32 eyecolor2 = 68; // Left eye color
uint32 flymode = 69;
uint32 gender = 70; // Gender (0=male, 1=female)
uint32 bodytype = 71; // Bodytype
uint32 unknown0336 = 72;
//union
uint32 equip_chest2 = 73; // Second place in packet for chest texture (usually 0xFF in live packets) // Not sure why there are 2 of them, but it effects chest texture!
uint32 mount_color = 74; // drogmor: 0=white, 1=black, 2=green, 3=red horse: 0=brown, 1=white, 2=black, 3=tan
//endunion
uint32 spawnId = 75; // Spawn Id
uint32 unknown0344 = 76;
uint32 IsMercenary = 77;
TintProfile equipment_tint = 78;
uint32 lfg = 79; // 0=off, 1=lfg on
bool DestructibleObject = 80; // Only used to flag as a destrible object
string DestructibleModel = 82; // Model of the Destructible Object - Required - Seen "DEST_TNT_G"
string DestructibleName2 = 83; // Secondary name - Not Required - Seen "a_tent"
string DestructibleString = 84; // Unknown - Not Required - Seen "ZoneActor_01186"
uint32 DestructibleAppearance = 85; // Damage Appearance
uint32 DestructibleUnk1 = 86;
uint32 DestructibleID1 = 87;
uint32 DestructibleID2 = 88;
uint32 DestructibleID3 = 89;
uint32 DestructibleID4 = 90;
uint32 DestructibleUnk2 = 91;
uint32 DestructibleUnk3 = 92;
uint32 DestructibleUnk4 = 93;
uint32 DestructibleUnk5 = 94;
uint32 DestructibleUnk6 = 95;
uint32 DestructibleUnk7 = 96;
uint32 DestructibleUnk8 = 97;
uint32 DestructibleUnk9 = 98;
bool targetable_with_hotkey = 99;
bool show_name= 100;
}
enum OpCode {
//option allow_alias = true;
OP_Unknown = 0;
OP_ExploreUnknown = 1;
OP_0x0193 = 2;
OP_0x0347 = 3;
OP_AAAction = 4;
OP_AAExpUpdate = 5;
OP_AcceptNewTask = 6;
OP_AckPacket = 7;
OP_Action = 8;
OP_Action2 = 9;
OP_AddNimbusEffect = 10;
OP_AdventureData = 11;
OP_AdventureDetails = 12;
OP_AdventureFinish = 13;
OP_AdventureInfo = 14;
OP_AdventureInfoRequest = 15;
OP_AdventureLeaderboardReply = 16;
OP_AdventureLeaderboardRequest = 17;
OP_AdventureMerchantPurchase = 18;
OP_AdventureMerchantRequest = 19;
OP_AdventureMerchantResponse = 20;
OP_AdventureMerchantSell = 21;
OP_AdventurePointsUpdate = 22;
OP_AdventureRequest = 23;
OP_AdventureStatsReply = 24;
OP_AdventureStatsRequest = 25;
OP_AdventureUpdate = 26;
OP_AggroMeterLockTarget = 27;
OP_AggroMeterTargetInfo = 28;
OP_AggroMeterUpdate = 29;
OP_AltCurrency = 30;
OP_AltCurrencyMerchantReply = 31;
OP_AltCurrencyMerchantRequest = 32;
OP_AltCurrencyPurchase = 33;
OP_AltCurrencyReclaim = 34;
OP_AltCurrencySell = 35;
OP_AltCurrencySellSelection = 36;
OP_Animation = 37; //supported
OP_AnnoyingZoneUnknown = 38;
OP_ApplyPoison = 39;
OP_ApproveName = 40;
OP_ApproveWorld = 41;
OP_ApproveZone = 42;
OP_Assist = 43; //supported
OP_AssistGroup = 44;
OP_AugmentInfo = 45;
OP_AugmentItem = 46;
OP_AutoAttack = 47;
OP_AutoAttack2 = 48;
OP_AutoFire = 49;
OP_Bandolier = 50;
OP_BankerChange = 51;
OP_Barter = 52;
OP_Bazaar = 53;
OP_BazaarInspect = 54;
OP_BazaarSearch = 55;
OP_BecomeCorpse = 56;
OP_BecomeTrader = 57;
OP_Begging = 58;
OP_BeginCast = 59;
OP_Bind_Wound = 60;
OP_BlockedBuffs = 61;
OP_BoardBoat = 62;
OP_Buff = 63;
OP_BuffCreate = 64;
OP_BuffRemoveRequest = 65;
OP_Bug = 66;
OP_CameraEffect = 67;
OP_Camp = 68; //supported
OP_CancelSneakHide = 69;
OP_CancelTask = 70;
OP_CancelTrade = 71;
OP_CastSpell = 72;
OP_ChangeSize = 73;
OP_ChannelMessage = 74;
OP_CharacterCreate = 75;
OP_CharacterCreateRequest = 76;
OP_CharInventory = 77;
OP_Charm = 78;
OP_ChatMessage = 79; //used by lua
OP_ClearAA = 80;
OP_ClearBlockedBuffs = 81;
OP_ClearLeadershipAbilities = 82;
OP_ClearNPCMarks = 83;
OP_ClearObject = 84;
OP_ClearSurname = 85;
OP_ClickDoor = 86;
OP_ClickObject = 87;
OP_ClickObjectAction = 88;
OP_ClientError = 89;
OP_ClientReady = 90;
OP_ClientTimeStamp = 91;
OP_ClientUpdate = 92; //supported
OP_CloseContainer = 93;
OP_CloseTributeMaster = 94;
OP_ColoredText = 95;
OP_CombatAbility = 96;
OP_Command = 97;
OP_CompletedTasks = 98;
OP_ConfirmDelete = 99;
OP_Consent = 100;
OP_ConsentDeny = 101;
OP_ConsentResponse = 102;
OP_Consider = 103;
OP_ConsiderCorpse = 104;
OP_Consume = 105;
OP_ControlBoat = 106;
OP_CorpseDrag = 107;
OP_CorpseDrop = 108;
OP_CrashDump = 109;
OP_CrystalCountUpdate = 110;
OP_CrystalCreate = 111;
OP_CrystalReclaim = 112;
OP_CustomTitles = 113;
OP_Damage = 114;
OP_Death = 115;
OP_DelegateAbility = 116;
OP_DeleteCharacter = 117;
OP_DeleteCharge = 118;
OP_DeleteItem = 119;
OP_DeletePetition = 120;
OP_DeleteSpawn = 121; //supported
OP_DeleteSpell = 122;
OP_DenyResponse = 123;
OP_Disarm = 124;
OP_DisarmTraps = 125;
OP_DisciplineTimer = 126;
OP_DisciplineUpdate = 127;
OP_DiscordMerchantInventory = 128;
OP_DoGroupLeadershipAbility = 129;
OP_DuelResponse = 130;
OP_DuelResponse2 = 131;
OP_DumpName = 132;
OP_Dye = 133;
OP_DynamicWall = 134;
OP_DzAddPlayer = 135;
OP_DzChooseZone = 136;
OP_DzCompass = 137;
OP_DzExpeditionEndsWarning = 138;
OP_DzExpeditionInfo = 139;
OP_DzExpeditionList = 140;
OP_DzJoinExpeditionConfirm = 141;
OP_DzJoinExpeditionReply = 142;
OP_DzLeaderStatus = 143;
OP_DzListTimers = 144;
OP_DzMakeLeader = 145;
OP_DzMemberList = 146;
OP_DzMemberStatus = 147;
OP_DzPlayerList = 148;
OP_DzQuit = 149;
OP_DzRemovePlayer = 150;
OP_DzSwapPlayer = 151;
OP_Emote = 152;
OP_EndLootRequest = 153;
OP_EnduranceUpdate = 154;
OP_EnterChat = 155;
OP_EnterWorld = 156;
OP_EnvDamage = 157;
OP_ExpansionInfo = 158;
OP_ExpUpdate = 159;
OP_FaceChange = 160;
OP_Feedback = 161;
OP_FeignDeath = 162;
OP_FellowshipUpdate = 163;
OP_FindPersonReply = 164;
OP_FindPersonRequest = 165;
OP_FinishTrade = 166;
OP_FinishWindow = 167;
OP_FinishWindow2 = 168;
OP_Fishing = 169;
OP_Fling = 170;
OP_FloatListThing = 171;
OP_Forage = 172;
OP_ForceFindPerson = 173;
OP_FormattedMessage = 174;
OP_FriendsWho = 175;
OP_GetGuildMOTD = 176;
OP_GetGuildMOTDReply = 177;
OP_GetGuildsList = 178;
OP_GiveMoney = 179;
OP_GMApproval = 180;
OP_GMBecomeNPC = 181;
OP_GMDelCorpse = 182;
OP_GMEmoteZone = 183;
OP_GMEndTraining = 184;
OP_GMEndTrainingResponse = 185;
OP_GMFind = 186;
OP_GMGoto = 187;
OP_GMHideMe = 188;
OP_GMKick = 189;
OP_GMKill = 190;
OP_GMLastName = 191;
OP_GMNameChange = 192;
OP_GMSearchCorpse = 193;
OP_GMServers = 194;
OP_GMSummon = 195;
OP_GMToggle = 196;
OP_GMTraining = 197;
OP_GMTrainSkill = 198;
OP_GMTrainSkillConfirm = 199;
OP_GMZoneRequest = 200;
OP_GMZoneRequest2 = 201;
OP_GroundSpawn = 202;
OP_GroupAcknowledge = 203;
OP_GroupCancelInvite = 204;
OP_GroupDelete = 205;
OP_GroupDisband = 206;
OP_GroupDisbandOther = 207;
OP_GroupDisbandYou = 208;
OP_GroupFollow = 209;
OP_GroupFollow2 = 210;
OP_GroupInvite = 211;
OP_GroupInvite2 = 212;
OP_GroupLeaderChange = 213;
OP_GroupLeadershipAAUpdate = 214;
OP_GroupMakeLeader = 215;
OP_GroupMentor = 216;
OP_GroupRoles = 217;
OP_GroupUpdate = 218;
OP_GroupUpdateB = 219;
OP_GroupUpdateLeaderAA = 220;
OP_GuildBank = 221;
OP_GuildBankItemList = 222;
OP_GuildCreate = 223;
OP_GuildDelete = 224;
OP_GuildDemote = 225;
OP_GuildInvite = 226;
OP_GuildInviteAccept = 227;
OP_GuildLeader = 228;
OP_GuildManageAdd = 229;
OP_GuildManageBanker = 230;
OP_GuildManageRemove = 231;
OP_GuildManageStatus = 232;
OP_GuildMemberLevelUpdate = 233;
OP_GuildMemberList = 234;
OP_GuildMemberUpdate = 235;
OP_GuildMOTD = 236;
OP_GuildPeace = 237;
OP_GuildPromote = 238;
OP_GuildPublicNote = 239;
OP_GuildRemove = 240;
OP_GuildsList = 241;
OP_GuildStatus = 242;
OP_GuildTributeInfo = 243;
OP_GuildUpdateURLAndChannel = 244;
OP_GuildWar = 245;
OP_Heartbeat = 246;
OP_Hide = 247;
OP_HideCorpse = 248;
OP_HPUpdate = 249; //supported
OP_Illusion = 250;
OP_IncreaseStats = 251;
OP_InitialHPUpdate = 252;
OP_InitialMobHealth = 253;
OP_InspectAnswer = 254;
OP_InspectBuffs = 255;
OP_InspectMessageUpdate = 256;
OP_InspectRequest = 257;
OP_InstillDoubt = 258;
OP_InterruptCast = 259;
OP_ItemLinkClick = 260;
OP_ItemLinkResponse = 261;
OP_ItemLinkText = 262;
OP_ItemName = 263;
OP_ItemPacket = 264;
OP_ItemPreview = 265;
OP_ItemRecastDelay = 266;
OP_ItemVerifyReply = 267;
OP_ItemVerifyRequest = 268;
OP_ItemViewUnknown = 269;
OP_Jump = 270;
OP_KeyRing = 271;
OP_KnowledgeBase = 272;
OP_LDoNButton = 273;
OP_LDoNDisarmTraps = 274;
OP_LDoNInspect = 275;
OP_LDoNOpen = 276;
OP_LDoNPickLock = 277;
OP_LDoNSenseTraps = 278;
OP_LeadershipExpToggle = 279;
OP_LeadershipExpUpdate = 280;
OP_LeaveAdventure = 281;
OP_LeaveBoat = 282;
OP_LevelAppearance = 283;
OP_LevelUpdate = 284;
OP_LFGAppearance = 285;
OP_LFGCommand = 286;
OP_LFGGetMatchesRequest = 287;
OP_LFGGetMatchesResponse = 288;
OP_LFGResponse = 289;
OP_LFGuild = 290;
OP_LFPCommand = 291;
OP_LFPGetMatchesRequest = 292;
OP_LFPGetMatchesResponse = 293;
OP_LinkedReuse = 294;
OP_LoadSpellSet = 295;
OP_LocInfo = 296;
OP_LockoutTimerInfo = 297;
OP_Login = 298;
OP_LoginAccepted = 299;
OP_LoginComplete = 300;
OP_LoginUnknown1 = 301;
OP_LoginUnknown2 = 302;
OP_Logout = 303;
OP_LogoutReply = 304;
OP_LogServer = 305;
OP_LootComplete = 306;
OP_LootItem = 307;
OP_LootRequest = 308;
OP_ManaChange = 309;
OP_ManaUpdate = 310;
OP_MarkNPC = 311;
OP_Marquee = 312;
OP_MemorizeSpell = 313;
OP_Mend = 314;
OP_MendHPUpdate = 315;
OP_MercenaryAssign = 316;
OP_MercenaryCommand = 317;
OP_MercenaryDataRequest = 318;
OP_MercenaryDataResponse = 319;
OP_MercenaryDataUpdate = 320;
OP_MercenaryDataUpdateRequest = 321;
OP_MercenaryDismiss = 322;
OP_MercenaryHire = 323;
OP_MercenarySuspendRequest = 324;
OP_MercenarySuspendResponse = 325;
OP_MercenaryTimer = 326;
OP_MercenaryTimerRequest = 327;
OP_MercenaryUnknown1 = 328;
OP_MercenaryUnsuspendResponse = 329;
OP_MobEnduranceUpdate = 330;
OP_MobHealth = 331; //supported
OP_MobManaUpdate = 332;
OP_MobRename = 333;
OP_MobUpdate = 334; // not used anymore, here for lecacy reasons eqextractor
OP_MoneyOnCorpse = 335;
OP_MoneyUpdate = 336;
OP_MOTD = 337;
OP_MoveCoin = 338;
OP_MoveDoor = 339;
OP_MoveItem = 340;
OP_MoveLogDisregard = 341;
OP_MoveLogRequest = 342;
OP_MultiLineMsg = 343;
OP_NewSpawn = 344; //supported
OP_NewTitlesAvailable = 345;
OP_NewZone = 346;
OP_OnLevelMessage = 347;
OP_OpenContainer = 348;
OP_OpenDiscordMerchant = 349;
OP_OpenGuildTributeMaster = 350;
OP_OpenInventory = 351;
OP_OpenNewTasksWindow = 352;
OP_OpenTributeMaster = 353;
OP_PDeletePetition = 354;
OP_PetBuffWindow = 355;
OP_PetCommands = 356;
OP_PetCommandState = 357;
OP_PetHoTT = 358;
OP_Petition = 359;
OP_PetitionBug = 360;
OP_PetitionCheckIn = 361;
OP_PetitionCheckout = 362;
OP_PetitionCheckout2 = 363;
OP_PetitionDelete = 364;
OP_PetitionQue = 365;
OP_PetitionRefresh = 366;
OP_PetitionResolve = 367;
OP_PetitionSearch = 368;
OP_PetitionSearchResults = 369;
OP_PetitionSearchText = 370;
OP_PetitionUnCheckout = 371;
OP_PetitionUpdate = 372;
OP_PickPocket = 373;
OP_PlayerProfile = 374;
OP_PlayerStateAdd = 375;
OP_PlayerStateRemove = 376;
OP_PlayEverquestRequest = 377;
OP_PlayEverquestResponse = 378;
OP_PlayMP3 = 379;
OP_Poll = 380;
OP_PollResponse = 381;
OP_PopupResponse = 382;
OP_PostEnterWorld = 383; //this is really OP_WorldAccessGrant
OP_PotionBelt = 384;
OP_PreLogoutReply = 385;
OP_PurchaseLeadershipAA = 386;
OP_PVPLeaderBoardDetailsReply = 387;
OP_PVPLeaderBoardDetailsRequest = 388;
OP_PVPLeaderBoardReply = 389;
OP_PVPLeaderBoardRequest = 390;
OP_PVPStats = 391;
OP_QueryResponseThing = 392;
OP_RaidInvite = 393;
OP_RaidJoin = 394;
OP_RaidUpdate = 395;
OP_RandomNameGenerator = 396;
OP_RandomReply = 397;
OP_RandomReq = 398;
OP_ReadBook = 399;
OP_RecipeAutoCombine = 400;
OP_RecipeDetails = 401;
OP_RecipeReply = 402;
OP_RecipesFavorite = 403;
OP_RecipesSearch = 404;
OP_ReclaimCrystals = 405;
OP_ReloadUI = 406;
OP_RemoveAllDoors = 407;
OP_RemoveBlockedBuffs = 408;
OP_RemoveNimbusEffect = 409;
OP_RemoveTrap = 410;
OP_Report = 411;
OP_ReqClientSpawn = 412;
OP_ReqNewZone = 413;
OP_RequestClientZoneChange = 414;
OP_RequestDuel = 415;
OP_RequestKnowledgeBase = 416;
OP_RequestTitles = 417;
OP_RespawnWindow = 418;
OP_RespondAA = 419;
OP_RestState = 420;
OP_Rewind = 421;
OP_RezzAnswer = 422;
OP_RezzComplete = 423;
OP_RezzRequest = 424;
OP_Sacrifice = 425;
OP_SafeFallSuccess = 426;
OP_SafePoint = 427;
OP_Save = 428;
OP_SaveOnZoneReq = 429;
OP_SelectTribute = 430;
OP_SendAAStats = 431;
OP_SendAATable = 432;
OP_SendCharInfo = 433;
OP_SendExpZonein = 434;
OP_SendFindableNPCs = 435;
OP_SendGuildTributes = 436;
OP_SendLoginInfo = 437;
OP_SendMaxCharacters = 438;
OP_SendMembership = 439;
OP_SendMembershipDetails = 440;
OP_SendSystemStats = 441;
OP_SendTitleList = 442;
OP_SendTributes = 443;
OP_SendZonepoints = 444;
OP_SenseHeading = 445;
OP_SenseTraps = 446;
OP_ServerListRequest = 447;
OP_ServerListResponse = 448;
OP_SessionReady = 449;
OP_SetChatServer = 450;
OP_SetChatServer2 = 451;
OP_SetGroupTarget = 452;
OP_SetGuildMOTD = 453;
OP_SetGuildRank = 454;
OP_SetRunMode = 455;
OP_SetServerFilter = 456;
OP_SetStartCity = 457;
OP_SetTitle = 458;
OP_SetTitleReply = 459;
OP_Shielding = 460;
OP_ShopDelItem = 461;
OP_ShopEnd = 462;
OP_ShopEndConfirm = 463;
OP_ShopItem = 464;
OP_ShopPlayerBuy = 465;
OP_ShopPlayerSell = 466;
OP_ShopRequest = 467;
OP_SimpleMessage = 468;
OP_SkillUpdate = 469;
OP_Sneak = 470;
OP_Some3ByteHPUpdate = 471;
OP_Some6ByteHPUpdate = 472;
OP_SomeItemPacketMaybe = 473;
OP_Sound = 474;
OP_SpawnAppearance = 475;
OP_SpawnDoor = 476;
OP_SpawnPositionUpdate = 477;
OP_SpecialMesg = 478;
OP_SpellEffect = 479;
OP_Split = 480;
OP_Stamina = 481;
OP_Stun = 482;
OP_Surname = 483;
OP_SwapSpell = 484;
OP_TargetBuffs = 485;
OP_TargetCommand = 486;
OP_TargetHoTT = 487;
OP_TargetMouse = 488;
OP_TargetReject = 489;
OP_TaskActivity = 490;
OP_TaskActivityComplete = 491;
OP_TaskDescription = 492;
OP_TaskHistoryReply = 493;
OP_TaskHistoryRequest = 494;
OP_TaskMemberList = 495;
OP_Taunt = 496;
OP_TestBuff = 497;
OP_TGB = 498;
OP_TimeOfDay = 499;
OP_Track = 500;
OP_TrackTarget = 501;
OP_TrackUnknown = 502;
OP_TradeAcceptClick = 503;
OP_TradeBusy = 504;
OP_TradeCoins = 505;
OP_TradeMoneyUpdate = 506;
OP_Trader = 507;
OP_TraderBuy = 508;
OP_TraderDelItem = 509;
OP_TradeRequest = 510;
OP_TradeRequestAck = 511;
OP_TraderItemUpdate = 512;
OP_TraderShop = 513;
OP_TradeSkillCombine = 514;
OP_Translocate = 515;
OP_TributeInfo = 516;
OP_TributeItem = 517;
OP_TributeMoney = 518;
OP_TributeNPC = 519;
OP_TributePointUpdate = 520;
OP_TributeTimer = 521;
OP_TributeToggle = 522;
OP_TributeUpdate = 523;
OP_Untargetable = 524;
OP_UpdateAA = 525;
OP_UpdateAura = 526;
OP_UpdateLeadershipAA = 527;
OP_VetClaimReply = 528;
OP_VetClaimRequest = 529;
OP_VetRewardsAvaliable = 530;
OP_VoiceMacroIn = 531;
OP_VoiceMacroOut = 532;
OP_WeaponEquip1 = 533;
OP_WearChange = 534; //supported
OP_Weather = 535;
OP_Weblink = 536;
OP_WhoAllRequest = 537;
OP_WhoAllResponse = 538;
OP_World_Client_CRC1 = 539;
OP_World_Client_CRC2 = 540;
OP_WorldClientReady = 541;
OP_WorldComplete = 542;
OP_WorldLogout = 543;
OP_WorldObjectsSent = 544;
OP_WorldUnknown001 = 545;
OP_XTargetAutoAddHaters = 546;
OP_XTargetOpen = 547;
OP_XTargetOpenResponse = 548;
OP_XTargetRequest = 549;
OP_XTargetResponse = 550;
OP_YellForHelp = 551;
OP_ZoneChange = 552;
OP_ZoneComplete = 553;
OP_ZoneEntry = 554; //supported
OP_ZoneGuildList = 555;
OP_ZoneInUnknown = 556;
OP_ZonePlayerToBind = 557;
OP_ZoneServerInfo = 558;
OP_ZoneServerReady = 559;
OP_ZoneSpawns = 560;
OP_ZoneUnavail = 561;
OP_ResetAA = 562;
OP_Buddy = 563;
OP_ChannelAnnounceJoin = 564;
OP_ChannelAnnounceLeave = 565;
OP_Ignore = 566;
OP_Mail = 567;
OP_MailboxChange = 568;
OP_MailDeliveryStatus = 569;
OP_MailHeader = 570;
OP_MailHeaderCount = 571;
OP_MailLogin = 572;
OP_MailNew = 573;
OP_MailSendBody = 574;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,8 @@
@echo off
mkdir go\eqproto python\proto java\eqproto csharp\proto
del /q ..\common\proto\*
del /q go\eqproto\*
del /q python\proto\*pb2*
del /q java\eqproto\*.java
del /q csharp\proto\*.cs
protoc --cpp_out=../common/proto --go_out=go/eqproto --python_out=python/proto --csharp_out=csharp/proto --java_out=java message.proto
del /q python\proto\*
del /q java\eqproto\*
del /q csharp\proto\*
..\dependencies\protobuf\bin\protoc --go_out=go/eqproto --python_out=python/proto --csharp_out=csharp/proto --java_out=java --proto_path=../common message.proto

View File

@ -1,5 +1,5 @@
#!/bin/bash
set -e
echo "Cleaning up existing .pb* files"
echo "Cleaning up existing .pb files"
rm -rf ../common/proto/* go/eqproto/* csharp/proto/*.cs java/eqproto/*.java python/proto/*pb2*
protoc --cpp_out=../common/proto --go_out=go/eqproto --python_out=python/proto --csharp_out=csharp/proto --java_out=java message.proto
protoc --go_out=go/eqproto --python_out=python/proto --csharp_out=csharp/proto --java_out=java -I ../common/ message.proto

View File

@ -9,7 +9,7 @@
#include "../common/timer.h"
#ifndef PROTO_H
#define PROTO_H
#include "../common/proto/message.pb.h"
#include "../common/message.pb.h"
#endif
#include "../common/servertalk.h"

View File

@ -13,7 +13,7 @@
#include "../common/string_util.h"
#ifndef PROTO_H
#define PROTO_H
#include "../common/proto/message.pb.h"
#include "../common/message.pb.h"
#endif
const ZoneConfig *zoneConfig;