forked from metin2/server
Add project files.
This commit is contained in:
108
cmake/Modules/FindCryptoPP.cmake
Normal file
108
cmake/Modules/FindCryptoPP.cmake
Normal file
@ -0,0 +1,108 @@
|
||||
# Module for locating the Crypto++ encryption library.
|
||||
#
|
||||
# Customizable variables:
|
||||
# CRYPTOPP_ROOT_DIR
|
||||
# This variable points to the CryptoPP root directory. On Windows the
|
||||
# library location typically will have to be provided explicitly using the
|
||||
# -D command-line option. The directory should include the include/cryptopp,
|
||||
# lib and/or bin sub-directories.
|
||||
#
|
||||
# Read-only variables:
|
||||
# CRYPTOPP_FOUND
|
||||
# Indicates whether the library has been found.
|
||||
#
|
||||
# CRYPTOPP_INCLUDE_DIRS
|
||||
# Points to the CryptoPP include directory.
|
||||
#
|
||||
# CRYPTOPP_LIBRARIES
|
||||
# Points to the CryptoPP libraries that should be passed to
|
||||
# target_link_libararies.
|
||||
#
|
||||
#
|
||||
# Copyright (c) 2012 Sergiu Dotenco
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
INCLUDE (FindPackageHandleStandardArgs)
|
||||
|
||||
FIND_PATH (CRYPTOPP_ROOT_DIR
|
||||
NAMES cryptopp/cryptlib.h include/cryptopp/cryptlib.h
|
||||
PATHS ENV CRYPTOPPROOT
|
||||
DOC "CryptoPP root directory")
|
||||
|
||||
# Re-use the previous path:
|
||||
FIND_PATH (CRYPTOPP_INCLUDE_DIR
|
||||
NAMES cryptopp/cryptlib.h
|
||||
HINTS ${CRYPTOPP_ROOT_DIR}
|
||||
PATH_SUFFIXES include
|
||||
DOC "CryptoPP include directory")
|
||||
|
||||
FIND_LIBRARY (CRYPTOPP_LIBRARY_DEBUG
|
||||
NAMES cryptlibd cryptoppd
|
||||
HINTS ${CRYPTOPP_ROOT_DIR}
|
||||
PATH_SUFFIXES lib
|
||||
DOC "CryptoPP debug library")
|
||||
|
||||
FIND_LIBRARY (CRYPTOPP_LIBRARY_RELEASE
|
||||
NAMES cryptlib cryptopp
|
||||
HINTS ${CRYPTOPP_ROOT_DIR}
|
||||
PATH_SUFFIXES lib
|
||||
DOC "CryptoPP release library")
|
||||
|
||||
IF (CRYPTOPP_LIBRARY_DEBUG AND CRYPTOPP_LIBRARY_RELEASE)
|
||||
SET (CRYPTOPP_LIBRARY
|
||||
optimized ${CRYPTOPP_LIBRARY_RELEASE}
|
||||
debug ${CRYPTOPP_LIBRARY_DEBUG} CACHE DOC "CryptoPP library")
|
||||
ELSEIF (CRYPTOPP_LIBRARY_RELEASE)
|
||||
SET (CRYPTOPP_LIBRARY ${CRYPTOPP_LIBRARY_RELEASE} CACHE DOC
|
||||
"CryptoPP library")
|
||||
ENDIF (CRYPTOPP_LIBRARY_DEBUG AND CRYPTOPP_LIBRARY_RELEASE)
|
||||
|
||||
IF (CRYPTOPP_INCLUDE_DIR)
|
||||
SET (_CRYPTOPP_VERSION_HEADER ${CRYPTOPP_INCLUDE_DIR}/cryptopp/config.h)
|
||||
|
||||
IF (EXISTS ${_CRYPTOPP_VERSION_HEADER})
|
||||
FILE (STRINGS ${_CRYPTOPP_VERSION_HEADER} _CRYPTOPP_VERSION_TMP REGEX
|
||||
"^#define CRYPTOPP_VERSION[ \t]+[0-9]+$")
|
||||
|
||||
STRING (REGEX REPLACE
|
||||
"^#define CRYPTOPP_VERSION[ \t]+([0-9]+)" "\\1" _CRYPTOPP_VERSION_TMP
|
||||
${_CRYPTOPP_VERSION_TMP})
|
||||
|
||||
STRING (REGEX REPLACE "([0-9]+)[0-9][0-9]" "\\1" CRYPTOPP_VERSION_MAJOR
|
||||
${_CRYPTOPP_VERSION_TMP})
|
||||
STRING (REGEX REPLACE "[0-9]([0-9])[0-9]" "\\1" CRYPTOPP_VERSION_MINOR
|
||||
${_CRYPTOPP_VERSION_TMP})
|
||||
STRING (REGEX REPLACE "[0-9][0-9]([0-9])" "\\1" CRYPTOPP_VERSION_PATCH
|
||||
${_CRYPTOPP_VERSION_TMP})
|
||||
|
||||
SET (CRYPTOPP_VERSION_COUNT 3)
|
||||
SET (CRYPTOPP_VERSION
|
||||
${CRYPTOPP_VERSION_MAJOR}.${CRYPTOPP_VERSION_MINOR}.${CRYPTOPP_VERSION_PATCH})
|
||||
ENDIF (EXISTS ${_CRYPTOPP_VERSION_HEADER})
|
||||
ENDIF (CRYPTOPP_INCLUDE_DIR)
|
||||
|
||||
SET (CRYPTOPP_INCLUDE_DIRS ${CRYPTOPP_INCLUDE_DIR})
|
||||
SET (CRYPTOPP_LIBRARIES ${CRYPTOPP_LIBRARY})
|
||||
|
||||
MARK_AS_ADVANCED (CRYPTOPP_INCLUDE_DIR CRYPTOPP_LIBRARY CRYPTOPP_LIBRARY_DEBUG
|
||||
CRYPTOPP_LIBRARY_RELEASE)
|
||||
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS (CryptoPP REQUIRED_VARS CRYPTOPP_ROOT_DIR
|
||||
CRYPTOPP_INCLUDE_DIR CRYPTOPP_LIBRARY VERSION_VAR CRYPTOPP_VERSION)
|
176
cmake/Modules/FindGit.cmake
Normal file
176
cmake/Modules/FindGit.cmake
Normal file
@ -0,0 +1,176 @@
|
||||
################################################################################
|
||||
#
|
||||
# Program: 3D Slicer
|
||||
#
|
||||
# Copyright (c) Kitware Inc.
|
||||
#
|
||||
# See COPYRIGHT.txt
|
||||
# or http://www.slicer.org/copyright/copyright.txt for details.
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# This file was originally developed by Jean-Christophe Fillion-Robin, Kitware Inc.
|
||||
# and was partially funded by NIH grant 3P41RR013218-12S1
|
||||
#
|
||||
################################################################################
|
||||
|
||||
#
|
||||
# The module defines the following variables:
|
||||
# GIT_EXECUTABLE - path to git command line client
|
||||
# GIT_FOUND - true if the command line client was found
|
||||
# GIT_VERSION_STRING - the version of git found (since CMake 2.8.8)
|
||||
#
|
||||
# If the command line client executable is found the macro
|
||||
# GIT_WC_INFO(<dir> <var-prefix>)
|
||||
# is defined to extract information of a git working copy at
|
||||
# a given location.
|
||||
#
|
||||
# The macro defines the following variables:
|
||||
# <var-prefix>_WC_REVISION_HASH - Current SHA1 hash
|
||||
# <var-prefix>_WC_REVISION - Current SHA1 hash
|
||||
# <var-prefix>_WC_REVISION_NAME - Name associated with <var-prefix>_WC_REVISION_HASH
|
||||
# <var-prefix>_WC_URL - output of command `git config --get remote.origin.url'
|
||||
# <var-prefix>_WC_ROOT - Same value as working copy URL
|
||||
# <var-prefix>_WC_LAST_CHANGED_DATE - date of last commit
|
||||
# <var-prefix>_WC_GITSVN - Set to false
|
||||
#
|
||||
# ... and also the following ones if it's a git-svn repository:
|
||||
# <var-prefix>_WC_GITSVN - Set to True if it is a
|
||||
# <var-prefix>_WC_INFO - output of command `git svn info'
|
||||
# <var-prefix>_WC_URL - url of the associated SVN repository
|
||||
# <var-prefix>_WC_ROOT - root url of the associated SVN repository
|
||||
# <var-prefix>_WC_REVISION - current SVN revision number
|
||||
# <var-prefix>_WC_LAST_CHANGED_AUTHOR - author of last commit
|
||||
# <var-prefix>_WC_LAST_CHANGED_DATE - date of last commit
|
||||
# <var-prefix>_WC_LAST_CHANGED_REV - revision of last commit
|
||||
# <var-prefix>_WC_LAST_CHANGED_LOG - last log of base revision
|
||||
#
|
||||
# Example usage:
|
||||
# find_package(Git)
|
||||
# if(GIT_FOUND)
|
||||
# GIT_WC_INFO(${PROJECT_SOURCE_DIR} Project)
|
||||
# message("Current revision is ${Project_WC_REVISION_HASH}")
|
||||
# message("git found: ${GIT_EXECUTABLE}")
|
||||
# endif()
|
||||
#
|
||||
|
||||
# Look for 'git' or 'eg' (easy git)
|
||||
#
|
||||
set(git_names git eg)
|
||||
|
||||
# Prefer .cmd variants on Windows unless running in a Makefile
|
||||
# in the MSYS shell.
|
||||
#
|
||||
if(WIN32)
|
||||
if(NOT CMAKE_GENERATOR MATCHES "MSYS")
|
||||
# Note: Due to a bug in 'git.cmd' preventing it from returning the exit code of 'git',
|
||||
# we excluded it from the list of executables to search.
|
||||
# See http://code.google.com/p/msysgit/issues/detail?id=428
|
||||
# TODO Check if 'git' exists, get the associated version, if the corresponding version
|
||||
# is known to have a working version of 'git.cmd', use it.
|
||||
set(git_names git eg.cmd eg)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_program(GIT_EXECUTABLE ${git_names}
|
||||
PATHS
|
||||
"C:/Program Files/Git/bin"
|
||||
"C:/Program Files (x86)/Git/bin"
|
||||
DOC "git command line client")
|
||||
# XXX Comment to workaround https://gitlab.kitware.com/cmake/cmake/issues/15448
|
||||
# mark_as_advanced(GIT_EXECUTABLE)
|
||||
|
||||
if(GIT_EXECUTABLE)
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} --version
|
||||
OUTPUT_VARIABLE git_version
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if (git_version MATCHES "^git version [0-9]")
|
||||
string(REPLACE "git version " "" GIT_VERSION_STRING "${git_version}")
|
||||
endif()
|
||||
unset(git_version)
|
||||
|
||||
macro(GIT_WC_INFO dir prefix)
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --verify -q --short=7 HEAD
|
||||
WORKING_DIRECTORY ${dir}
|
||||
ERROR_VARIABLE GIT_error
|
||||
OUTPUT_VARIABLE ${prefix}_WC_REVISION_HASH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
set(${prefix}_WC_REVISION ${${prefix}_WC_REVISION_HASH})
|
||||
if(NOT ${GIT_error} EQUAL 0)
|
||||
message(SEND_ERROR "Command \"${GIT_EXECUTBALE} rev-parse --verify -q --short=7 HEAD\" in directory ${dir} failed with output:\n${GIT_error}")
|
||||
else(NOT ${GIT_error} EQUAL 0)
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} name-rev ${${prefix}_WC_REVISION_HASH}
|
||||
WORKING_DIRECTORY ${dir}
|
||||
OUTPUT_VARIABLE ${prefix}_WC_REVISION_NAME
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
endif(NOT ${GIT_error} EQUAL 0)
|
||||
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} config --get remote.origin.url
|
||||
WORKING_DIRECTORY ${dir}
|
||||
OUTPUT_VARIABLE ${prefix}_WC_URL
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} show -s --format="%ci" ${${prefix}_WC_REVISION_HASH}
|
||||
WORKING_DIRECTORY ${dir}
|
||||
OUTPUT_VARIABLE ${prefix}_show_output
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(REGEX REPLACE "^([0-9][0-9][0-9][0-9]\\-[0-9][0-9]\\-[0-9][0-9]).*"
|
||||
"\\1" ${prefix}_WC_LAST_CHANGED_DATE "${${prefix}_show_output}")
|
||||
|
||||
set(${prefix}_WC_GITSVN False)
|
||||
|
||||
# Check if this git is likely to be a git-svn repository
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} config --get-regexp "^svn-remote"
|
||||
WORKING_DIRECTORY ${dir}
|
||||
OUTPUT_VARIABLE git_config_output
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
if(NOT "${git_config_output}" STREQUAL "")
|
||||
# In case git-svn is used, attempt to extract svn info
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} svn info
|
||||
WORKING_DIRECTORY ${dir}
|
||||
TIMEOUT 3
|
||||
ERROR_VARIABLE git_svn_info_error
|
||||
OUTPUT_VARIABLE ${prefix}_WC_INFO
|
||||
RESULT_VARIABLE git_svn_info_result
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
if(${git_svn_info_result} EQUAL 0)
|
||||
set(${prefix}_WC_GITSVN True)
|
||||
string(REGEX REPLACE "^(.*\n)?URL: ([^\n]+).*"
|
||||
"\\2" ${prefix}_WC_URL "${${prefix}_WC_INFO}")
|
||||
string(REGEX REPLACE "^(.*\n)?Revision: ([^\n]+).*"
|
||||
"\\2" ${prefix}_WC_REVISION "${${prefix}_WC_INFO}")
|
||||
string(REGEX REPLACE "^(.*\n)?Repository Root: ([^\n]+).*"
|
||||
"\\2" ${prefix}_WC_ROOT "${${prefix}_WC_INFO}")
|
||||
string(REGEX REPLACE "^(.*\n)?Last Changed Author: ([^\n]+).*"
|
||||
"\\2" ${prefix}_WC_LAST_CHANGED_AUTHOR "${${prefix}_WC_INFO}")
|
||||
string(REGEX REPLACE "^(.*\n)?Last Changed Rev: ([^\n]+).*"
|
||||
"\\2" ${prefix}_WC_LAST_CHANGED_REV "${${prefix}_WC_INFO}")
|
||||
string(REGEX REPLACE "^(.*\n)?Last Changed Date: ([^\n]+).*"
|
||||
"\\2" ${prefix}_WC_LAST_CHANGED_DATE "${${prefix}_WC_INFO}")
|
||||
endif(${git_svn_info_result} EQUAL 0)
|
||||
endif(NOT "${git_config_output}" STREQUAL "")
|
||||
|
||||
# If there is no 'remote.origin', default to "NA" value and print a warning message.
|
||||
if(NOT ${prefix}_WC_URL)
|
||||
message(WARNING "No remote origin set for git repository: ${dir}" )
|
||||
set( ${prefix}_WC_URL "NA" )
|
||||
else()
|
||||
set(${prefix}_WC_ROOT ${${prefix}_WC_URL})
|
||||
endif()
|
||||
|
||||
endmacro(GIT_WC_INFO)
|
||||
endif(GIT_EXECUTABLE)
|
||||
|
||||
# Handle the QUIETLY and REQUIRED arguments and set GIT_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Git DEFAULT_MSG GIT_EXECUTABLE)
|
45
cmake/Modules/FindLZO.cmake
Normal file
45
cmake/Modules/FindLZO.cmake
Normal file
@ -0,0 +1,45 @@
|
||||
# Find liblzo2
|
||||
# LZO_FOUND - system has the LZO library
|
||||
# LZO_INCLUDE_DIR - the LZO include directory
|
||||
# LZO_LIBRARIES - The libraries needed to use LZO
|
||||
|
||||
if (LZO_INCLUDE_DIR AND LZO_LIBRARIES)
|
||||
# in cache already
|
||||
SET(LZO_FOUND TRUE)
|
||||
else (LZO_INCLUDE_DIR AND LZO_LIBRARIES)
|
||||
FIND_PATH(LZO_INCLUDE_DIR lzo/lzo1x.h
|
||||
${LZO_ROOT}/include/
|
||||
/usr/include/
|
||||
/usr/local/include/
|
||||
/sw/lib/
|
||||
/sw/local/lib/
|
||||
)
|
||||
|
||||
if(WIN32 AND MSVC)
|
||||
else(WIN32 AND MSVC)
|
||||
FIND_LIBRARY(LZO_LIBRARIES NAMES lzo2
|
||||
PATHS
|
||||
${LZO_ROOT}/lib
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
/sw/lib
|
||||
/sw/local/lib
|
||||
)
|
||||
endif(WIN32 AND MSVC)
|
||||
|
||||
if (LZO_INCLUDE_DIR AND LZO_LIBRARIES)
|
||||
set(LZO_FOUND TRUE)
|
||||
endif (LZO_INCLUDE_DIR AND LZO_LIBRARIES)
|
||||
|
||||
if (LZO_FOUND)
|
||||
if (NOT LZO_FIND_QUIETLY)
|
||||
message(STATUS "Found LZO: ${LZO_LIBRARIES}")
|
||||
endif (NOT LZO_FIND_QUIETLY)
|
||||
else (LZO_FOUND)
|
||||
if (LZO_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "Could NOT find LZO")
|
||||
endif (LZO_FIND_REQUIRED)
|
||||
endif (LZO_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(LZO_INCLUDE_DIR LZO_LIBRARIES)
|
||||
endif (LZO_INCLUDE_DIR AND LZO_LIBRARIES)
|
Reference in New Issue
Block a user