diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
commit | 19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch) | |
tree | 42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/jaegertracing/thrift/build/cmake | |
parent | Initial commit. (diff) | |
download | ceph-upstream/16.2.11+ds.tar.xz ceph-upstream/16.2.11+ds.zip |
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
27 files changed, 1615 insertions, 0 deletions
diff --git a/src/jaegertracing/thrift/build/cmake/BoostMacros.cmake b/src/jaegertracing/thrift/build/cmake/BoostMacros.cmake new file mode 100644 index 000000000..cc50b53db --- /dev/null +++ b/src/jaegertracing/thrift/build/cmake/BoostMacros.cmake @@ -0,0 +1,49 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. +# + +set(BOOST_MINREV 1.56) + +# we are not ready for the new style link targets introduced in +# boost 1.70.0 and cmake 3.14.2 which showed up on appveyor in +# mingw builds +set(Boost_NO_BOOST_CMAKE ON) + +macro(REQUIRE_BOOST_HEADERS) + find_package(Boost ${BOOST_MINREV} QUIET REQUIRED) + if (NOT Boost_FOUND) + string(CONCAT fatal_message + "Boost ${BOOST_MINREV} or later is required to build sources in ${CMAKE_CURRENT_SOURCE_DIR}") + message(FATAL_ERROR, ${fatal_message}) + endif() + if (DEFINED Boost_INCLUDE_DIRS) + # pre-boost 1.70.0 aware cmake, otherwise it is using targets + include_directories(SYSTEM "${Boost_INCLUDE_DIRS}") + endif() +endmacro() + +macro(REQUIRE_BOOST_LIBRARIES libs) + message(STATUS "Locating boost libraries required by sources in ${CMAKE_CURRENT_SOURCE_DIR}") + find_package(Boost ${BOOST_MINREV} REQUIRED COMPONENTS ${${libs}}) + if (NOT Boost_FOUND) + string(CONCAT fatal_message + "Boost ${BOOST_MINREV} or later is required to build sources in ${CMAKE_CURRENT_SOURCE_DIR}, " + "or use -DBUILD_TESTING=OFF") + message(FATAL_ERROR, ${fatal_message}) + endif() +endmacro() diff --git a/src/jaegertracing/thrift/build/cmake/BuildType.cmake b/src/jaegertracing/thrift/build/cmake/BuildType.cmake new file mode 100644 index 000000000..b3bf35306 --- /dev/null +++ b/src/jaegertracing/thrift/build/cmake/BuildType.cmake @@ -0,0 +1,36 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. +# + +# originally from: +# https://raw.githubusercontent.com/OpenChemistry/tomviz/master/cmake/BuildType.cmake + +# Set a default build type if none was specified +set(default_build_type "RelWithDebInfo") +if(EXISTS "${CMAKE_SOURCE_DIR}/.git") + set(default_build_type "Debug") +endif() + +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to '${default_build_type}' as none was specified.") + set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE + STRING "Choose the type of build." FORCE) + # Set the possible values of build type for cmake-gui + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" + "MinSizeRel" "RelWithDebInfo") +endif() diff --git a/src/jaegertracing/thrift/build/cmake/CPackConfig.cmake b/src/jaegertracing/thrift/build/cmake/CPackConfig.cmake new file mode 100644 index 000000000..fdc1b4e76 --- /dev/null +++ b/src/jaegertracing/thrift/build/cmake/CPackConfig.cmake @@ -0,0 +1,68 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. +# + + +#TODO: Should we bundle system libraries for DLLs? +#include(InstallRequiredSystemLibraries) + +# For help take a look at: +# http://www.cmake.org/Wiki/CMake:CPackConfiguration + +### general settings +set(CPACK_PACKAGE_NAME "thrift") +set(CPACK_PACKAGE_VERSION "${PACKAGE_VERSION}") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Apache Thrift") +set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md") +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") +set(CPACK_PACKAGE_VENDOR "Apache Software Foundation") +set(CPACK_PACKAGE_CONTACT "dev@thrift.apache.org") +set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}") +set(CPACK_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}") + +### versions +set(CPACK_PACKAGE_VERSION_MAJOR ${thrift_VERSION_MAJOR}) +set(CPACK_PACKAGE_VERSION_MINOR ${thrift_VERSION_MINOR}) +set(CPACK_PACKAGE_VERSION_PATCH ${thrift_VERSION_PATCH}) + +### source generator +set(CPACK_SOURCE_GENERATOR "TGZ") +set(CPACK_SOURCE_IGNORE_FILES "~$;[.]swp$;/[.]svn/;/[.]git/;.gitignore;/build/;tags;cscope.*") +set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}") + +### zip generator +set(CPACK_GENERATOR "ZIP") +set(CPACK_PACKAGE_INSTALL_DIRECTORY "thrift") + + +if(CMAKE_SYSTEM_NAME STREQUAL "Windows") + set(CPACK_GENERATOR "NSIS") + set(CPACK_NSIS_HELP_LINK "http://thrift.apache.org") + set(CPACK_NSIS_MENU_LINKS + "http://thrift.apache.org" "Apache Thrift - Web Site" + "https://issues.apache.org/jira/browse/THRIFT" "Apache Thrift - Issues") + set(CPACK_NSIS_CONTACT ${CPACK_PACKAGE_CONTACT}) + set(CPACK_NSIS_MODIFY_PATH "ON") + set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}") +else() + set(CPACK_GENERATOR "DEB" ) + set(CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_CONTACT}) +endif() + + +include(CPack) diff --git a/src/jaegertracing/thrift/build/cmake/ConfigureChecks.cmake b/src/jaegertracing/thrift/build/cmake/ConfigureChecks.cmake new file mode 100644 index 000000000..457bfe05d --- /dev/null +++ b/src/jaegertracing/thrift/build/cmake/ConfigureChecks.cmake @@ -0,0 +1,79 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. +# + +include(CheckFunctionExists) +include(CheckIncludeFile) +include(CheckIncludeFiles) +include(CheckSymbolExists) + +if (Inttypes_FOUND) + # This allows the inttypes.h and stdint.h checks to succeed on platforms that + # do not natively provide there. + set (CMAKE_REQUIRED_INCLUDES ${INTTYPES_INCLUDE_DIRS}) +endif () + +check_include_file(arpa/inet.h HAVE_ARPA_INET_H) +check_include_file(fcntl.h HAVE_FCNTL_H) +check_include_file(getopt.h HAVE_GETOPT_H) +check_include_file(inttypes.h HAVE_INTTYPES_H) +check_include_file(netdb.h HAVE_NETDB_H) +check_include_file(netinet/in.h HAVE_NETINET_IN_H) +check_include_file(signal.h HAVE_SIGNAL_H) +check_include_file(stdint.h HAVE_STDINT_H) +check_include_file(unistd.h HAVE_UNISTD_H) +check_include_file(pthread.h HAVE_PTHREAD_H) +check_include_file(sys/ioctl.h HAVE_SYS_IOCTL_H) +check_include_file(sys/param.h HAVE_SYS_PARAM_H) +check_include_file(sys/resource.h HAVE_SYS_RESOURCE_H) +check_include_file(sys/socket.h HAVE_SYS_SOCKET_H) +check_include_file(sys/stat.h HAVE_SYS_STAT_H) +check_include_file(sys/time.h HAVE_SYS_TIME_H) +check_include_file(sys/un.h HAVE_SYS_UN_H) +check_include_file(poll.h HAVE_POLL_H) +check_include_file(sys/poll.h HAVE_SYS_POLL_H) +check_include_file(sys/select.h HAVE_SYS_SELECT_H) +check_include_file(sched.h HAVE_SCHED_H) +check_include_file(string.h HAVE_STRING_H) +check_include_file(strings.h HAVE_STRINGS_H) + +check_function_exists(gethostbyname HAVE_GETHOSTBYNAME) +check_function_exists(gethostbyname_r HAVE_GETHOSTBYNAME_R) +check_function_exists(strerror_r HAVE_STRERROR_R) +check_function_exists(sched_get_priority_max HAVE_SCHED_GET_PRIORITY_MAX) +check_function_exists(sched_get_priority_min HAVE_SCHED_GET_PRIORITY_MIN) + +include(CheckCSourceCompiles) +include(CheckCXXSourceCompiles) + +check_cxx_source_compiles( + " + #include <string.h> + int main(){char b;char *a = strerror_r(0, &b, 0); return(0);} + " + STRERROR_R_CHAR_P) + + +set(PACKAGE ${PACKAGE_NAME}) +set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") +set(VERSION ${thrift_VERSION}) + +# generate a config.h file +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/build/cmake/config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/thrift/config.h") + +include_directories("${CMAKE_CURRENT_BINARY_DIR}") diff --git a/src/jaegertracing/thrift/build/cmake/DefineCMakeDefaults.cmake b/src/jaegertracing/thrift/build/cmake/DefineCMakeDefaults.cmake new file mode 100644 index 000000000..2b0cdbb94 --- /dev/null +++ b/src/jaegertracing/thrift/build/cmake/DefineCMakeDefaults.cmake @@ -0,0 +1,92 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. +# + + +# Always include srcdir and builddir in include path +# This saves typing ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY} in +# about every subdir +# since cmake 2.4.0 +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +# Put the include dirs which are in the source or build tree +# before all other include dirs, so the headers in the sources +# are preferred over the already installed ones +# since cmake 2.4.1 +set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON) + +# Use colored output +# since cmake 2.4.0 +set(CMAKE_COLOR_MAKEFILE ON) + +# Create the compile command database for clang by default +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + +# Set the CMAKE_BUILD_TYPE if it is not already defined +include(BuildType) + +# Put the libraries and binaries that get built into directories at the +# top of the build tree rather than in hard-to-find leaf +# directories. This simplifies manual testing and the use of the build +# tree rather than installed thrift libraries. +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + +# +# "rpath" support. +# See http://www.itk.org/Wiki/index.php?title=CMake_RPATH_handling +# +# On MacOSX, for shared libraries, enable rpath support. +set(CMAKE_MACOSX_RPATH TRUE) +# +# On any OS, for executables, allow linking with shared libraries in non-system +# locations and running the executables without LD_PRELOAD or similar. +# This requires the library to be built with rpath support. +set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + +# +# C++ Language Level Defaults - this depends on the compiler capabilities +# +if (NOT DEFINED CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 11) # C++11 + message(STATUS "Setting C++11 as the default language level.") + message(STATUS "To specify a different C++ language level, set CMAKE_CXX_STANDARD") +endif() + +if (CMAKE_CXX_STANDARD EQUAL 98) + message(FATAL_ERROR "only C++11 or above C++ standard is supported") +elseif (CMAKE_CXX_STANDARD EQUAL 11) + # should not fallback to C++98 + set(CMAKE_CXX_STANDARD_REQUIRED ON) +endif() + +if (NOT DEFINED CMAKE_CXX_EXTENSIONS) + set(CMAKE_CXX_EXTENSIONS OFF) # use standards compliant language level for portability +endif() + +if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + include(CheckCXXCompilerFlag) + set(CMAKE_REQUIRED_QUIET ON) + check_cxx_compiler_flag("/Zc:__cplusplus" res_var) + if (res_var) + # Make MSVC reporting correct value for __cplusplus + # See https://blogs.msdn.microsoft.com/vcblog/2018/04/09/msvc-now-correctly-reports-__cplusplus/ + add_compile_options("/Zc:__cplusplus") + endif() +endif() diff --git a/src/jaegertracing/thrift/build/cmake/DefineInstallationPaths.cmake b/src/jaegertracing/thrift/build/cmake/DefineInstallationPaths.cmake new file mode 100644 index 000000000..0c824cc7a --- /dev/null +++ b/src/jaegertracing/thrift/build/cmake/DefineInstallationPaths.cmake @@ -0,0 +1,32 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. +# + + +# Define the default install paths +set(BIN_INSTALL_DIR "bin" CACHE PATH "The binary install dir (default: bin)") +set(LIB_INSTALL_DIR "lib${LIB_SUFFIX}" CACHE PATH "The library install dir (default: lib${LIB_SUFFIX})") +set(INCLUDE_INSTALL_DIR "include" CACHE PATH "The library install dir (default: include)") +set(CMAKE_INSTALL_DIR "lib/cmake" CACHE PATH "The subdirectory to install cmake config files (default: cmake)") +set(PKGCONFIG_INSTALL_DIR "lib/pkgconfig" CACHE PATH "The subdirectory to install pkgconfig config files (default: lib/pkgconfig)") +set(DOC_INSTALL_DIR "share/doc" CACHE PATH "The subdirectory to install documentation files (default: share/doc)") +set(prefix "${CMAKE_INSTALL_PREFIX}") +set(exec_prefix "${CMAKE_INSTALL_PREFIX}/bin") +set(libdir "${CMAKE_INSTALL_PREFIX}/lib") +set(includedir "${CMAKE_INSTALL_PREFIX}/include") +set(cmakedir "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DIR}") diff --git a/src/jaegertracing/thrift/build/cmake/DefineOptions.cmake b/src/jaegertracing/thrift/build/cmake/DefineOptions.cmake new file mode 100644 index 000000000..778be8dff --- /dev/null +++ b/src/jaegertracing/thrift/build/cmake/DefineOptions.cmake @@ -0,0 +1,196 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. +# + + +include(CMakeDependentOption) + +set(THRIFT_COMPILER "" CACHE FILEPATH "External Thrift compiler to use during build") + +# Additional components +option(BUILD_COMPILER "Build Thrift compiler" ON) + +if(BUILD_COMPILER OR EXISTS ${THRIFT_COMPILER}) + set(HAVE_COMPILER ON) +endif() +CMAKE_DEPENDENT_OPTION(BUILD_TESTING "Build with unit tests" ON "HAVE_COMPILER" OFF) +CMAKE_DEPENDENT_OPTION(BUILD_TUTORIALS "Build Thrift tutorials" ON "HAVE_COMPILER" OFF) +option(BUILD_LIBRARIES "Build Thrift libraries" ON) + +# Libraries to build + +# Each language library can be enabled or disabled using the WITH_<LANG> flag. +# By default CMake checks if the required dependencies for a language are present +# and enables the library if all are found. This means the default is to build as +# much as possible but leaving out libraries if their dependencies are not met. + +if (NOT Boost_USE_STATIC_LIBS) + add_definitions(-DBOOST_ALL_DYN_LINK) + add_definitions(-DBOOST_TEST_DYN_LINK) +endif() + +# as3 +option(WITH_AS3 "Build ActionScript 3 Thrift Library" ON) +if (WITH_AS3) + set(POSSIBLE_PATHS "${FLEX_HOME}/bin" "$ENV{FLEX_HOME}/bin") + find_program(HAVE_COMPC NAMES compc HINTS ${POSSIBLE_PATHS}) +endif () +CMAKE_DEPENDENT_OPTION(BUILD_AS3 "Build as3 library" ON + "BUILD_LIBRARIES;WITH_AS3;HAVE_COMPC" OFF) + +# C++ +option(WITH_CPP "Build C++ Thrift library" ON) +if(WITH_CPP) + # NOTE: Currently the following options are C++ specific, + # but in future other libraries might reuse them. + # So they are not dependent on WITH_CPP but setting them without WITH_CPP currently + # has no effect. + if(ZLIB_LIBRARY) + # FindZLIB.cmake does not normalize path so we need to do it ourselves. + file(TO_CMAKE_PATH ${ZLIB_LIBRARY} ZLIB_LIBRARY) + endif() + find_package(ZLIB QUIET) + CMAKE_DEPENDENT_OPTION(WITH_ZLIB "Build with ZLIB support" ON + "ZLIB_FOUND" OFF) + find_package(Libevent QUIET) + CMAKE_DEPENDENT_OPTION(WITH_LIBEVENT "Build with libevent support" ON + "Libevent_FOUND" OFF) + find_package(Qt5 QUIET COMPONENTS Core Network) + CMAKE_DEPENDENT_OPTION(WITH_QT5 "Build with Qt5 support" ON + "Qt5_FOUND" OFF) + find_package(OpenSSL QUIET) + CMAKE_DEPENDENT_OPTION(WITH_OPENSSL "Build with OpenSSL support" ON + "OPENSSL_FOUND" OFF) +endif() +CMAKE_DEPENDENT_OPTION(BUILD_CPP "Build C++ library" ON + "BUILD_LIBRARIES;WITH_CPP" OFF) + +# C GLib +option(WITH_C_GLIB "Build C (GLib) Thrift library" ON) +if(WITH_C_GLIB) + find_package(GLIB QUIET COMPONENTS gobject) +endif() +CMAKE_DEPENDENT_OPTION(BUILD_C_GLIB "Build C (GLib) library" ON + "BUILD_LIBRARIES;WITH_C_GLIB;GLIB_FOUND" OFF) + +# Java +option(WITH_JAVA "Build Java Thrift library" ON) +if(ANDROID) + find_package(Gradle QUIET) + CMAKE_DEPENDENT_OPTION(BUILD_JAVA "Build Java library" ON + "BUILD_LIBRARIES;WITH_JAVA;GRADLE_FOUND" OFF) +else() + find_package(Gradlew QUIET) + find_package(Java QUIET) + CMAKE_DEPENDENT_OPTION(BUILD_JAVA "Build Java library" ON + "BUILD_LIBRARIES;WITH_JAVA;JAVA_FOUND;GRADLEW_FOUND" OFF) +endif() + +# Python +option(WITH_PYTHON "Build Python Thrift library" ON) +find_package(PythonInterp QUIET) # for Python executable +find_package(PythonLibs QUIET) # for Python.h +CMAKE_DEPENDENT_OPTION(BUILD_PYTHON "Build Python library" ON + "BUILD_LIBRARIES;WITH_PYTHON;PYTHONINTERP_FOUND;PYTHONLIBS_FOUND" OFF) + +# Haskell +option(WITH_HASKELL "Build Haskell Thrift library" ON) +find_package(GHC QUIET) +find_package(Cabal QUIET) +CMAKE_DEPENDENT_OPTION(BUILD_HASKELL "Build GHC library" ON + "BUILD_LIBRARIES;WITH_HASKELL;GHC_FOUND;CABAL_FOUND" OFF) + +# Common library options +# https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html +# Default on Windows is static, shared mode library support needs work... +CMAKE_DEPENDENT_OPTION(BUILD_SHARED_LIBS "Build shared libraries" OFF "WIN32" ON) + +if (WITH_SHARED_LIB) + message(WARNING "WITH_SHARED_LIB is deprecated; use -DBUILD_SHARED_LIBS=ON instead") + set(BUILD_SHARED_LIBS ON) +elseif (WITH_STATIC_LIB) + if (WITH_SHARED_LIB) + message(FATAL_ERROR "Cannot build shared and static together; set BUILD_SHARED_LIBS instead.") + endif () + message(WARNING "WITH_STATIC_LIB is deprecated; use -DBUILD_SHARED_LIBS=OFF instead") + set(BUILD_SHARED_LIBS OFF) +endif () + +# Visual Studio only options +if(MSVC) + option(WITH_MT "Build using MT instead of MD (MSVC only)" OFF) +endif(MSVC) + +macro(MESSAGE_DEP flag summary) +if(NOT ${flag}) + message(STATUS " - ${summary}") +endif() +endmacro(MESSAGE_DEP flag summary) + +macro(PRINT_CONFIG_SUMMARY) +message(STATUS "----------------------------------------------------------") +message(STATUS "Thrift version: ${thrift_VERSION} (${thrift_VERSION_MAJOR}.${thrift_VERSION_MINOR}.${thrift_VERSION_PATCH})") +message(STATUS "Thrift package version: ${PACKAGE_VERSION}") +message(STATUS) +message(STATUS "Build configuration summary") +message(STATUS " Build compiler: ${BUILD_COMPILER}") +message(STATUS " Build libraries: ${BUILD_LIBRARIES}") +message(STATUS " Build tests: ${BUILD_TESTING}") +MESSAGE_DEP(HAVE_COMPILER "Disabled because BUILD_THRIFT=OFF and no valid THRIFT_COMPILER is given") +message(STATUS " Build type: ${CMAKE_BUILD_TYPE}") +message(STATUS) +message(STATUS "Language libraries:") +message(STATUS) +message(STATUS " Build as3 library: ${BUILD_AS3}") +MESSAGE_DEP(WITH_AS3 "Disabled by WITH_AS3=OFF") +MESSAGE_DEP(HAVE_COMPC "Adobe Flex compc was not found - did you set env var FLEX_HOME?") +message(STATUS) +message(STATUS " Build C++ library: ${BUILD_CPP}") +MESSAGE_DEP(WITH_CPP "Disabled by WITH_CPP=OFF") +if (BUILD_CPP) + message(STATUS " C++ Language Level: ${CXX_LANGUAGE_LEVEL}") + message(STATUS " Build shared libraries: ${BUILD_SHARED_LIBS}") + message(STATUS " Build with libevent support: ${WITH_LIBEVENT}") + message(STATUS " Build with Qt5 support: ${WITH_QT5}") + message(STATUS " Build with ZLIB support: ${WITH_ZLIB}") +endif () +message(STATUS) +message(STATUS " Build C (GLib) library: ${BUILD_C_GLIB}") +MESSAGE_DEP(WITH_C_GLIB "Disabled by WITH_C_GLIB=OFF") +MESSAGE_DEP(GLIB_FOUND "GLib missing") +message(STATUS) +message(STATUS " Build Java library: ${BUILD_JAVA}") +MESSAGE_DEP(WITH_JAVA "Disabled by WITH_JAVA=OFF") +if(ANDROID) + MESSAGE_DEP(GRADLE_FOUND "Gradle missing") +else() + MESSAGE_DEP(JAVA_FOUND "Java Runtime missing") + MESSAGE_DEP(GRADLEW_FOUND "Gradle Wrapper missing") +endif() +message(STATUS) +message(STATUS " Build Python library: ${BUILD_PYTHON}") +MESSAGE_DEP(WITH_PYTHON "Disabled by WITH_PYTHON=OFF") +MESSAGE_DEP(PYTHONLIBS_FOUND "Python libraries missing") +message(STATUS) +message(STATUS " Build Haskell library: ${BUILD_HASKELL}") +MESSAGE_DEP(WITH_HASKELL "Disabled by WITH_HASKELL=OFF") +MESSAGE_DEP(GHC_FOUND "GHC missing") +MESSAGE_DEP(CABAL_FOUND "Cabal missing") +message(STATUS) +message(STATUS "----------------------------------------------------------") +endmacro(PRINT_CONFIG_SUMMARY) diff --git a/src/jaegertracing/thrift/build/cmake/DefinePlatformSpecifc.cmake b/src/jaegertracing/thrift/build/cmake/DefinePlatformSpecifc.cmake new file mode 100644 index 000000000..c0bb529c3 --- /dev/null +++ b/src/jaegertracing/thrift/build/cmake/DefinePlatformSpecifc.cmake @@ -0,0 +1,116 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. +# + +# Uncomment this to show some basic cmake variables about platforms +# include (NewPlatformDebug) + +# For Debug build types, append a "d" to the library names. +set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Set debug library postfix" FORCE) + +# basic options +foreach(lang IN ITEMS C CXX) + if(CMAKE_${lang}_COMPILER_ID STREQUAL "Clang") + set(CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} -Wall") + set(CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} -ferror-limit=1") + elseif(CMAKE_${lang}_COMPILER_ID STREQUAL "GNU") + set(CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} -Wall -Wextra") + set(CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} -fmax-errors=1") + elseif(CMAKE_${lang}_COMPILER_ID STREQUAL "MSVC") + set(CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} /MP") # parallel build + set(CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} /W3") # warning level 3 + include(CheckCXXCompilerFlag) + set(CMAKE_REQUIRED_QUIET ON) + check_cxx_compiler_flag("/source-charset:utf-8" res_var) + if (res_var) + set(CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} /source-charset:utf-8") + endif() + check_cxx_compiler_flag("/execution-charset:utf-8" res_var) + if (res_var) + set(CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} /execution-charset:utf-8") + endif() + add_definitions("-DUNICODE -D_UNICODE") + endif() +endforeach() + +# Visual Studio specific options +if(MSVC) + # Allow for shared library builds + if(BUILD_SHARED_LIBS) + set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON CACHE TYPE BOOL FORCE) + endif() + + #For visual studio the library naming is as following: + # Dynamic libraries: + # - thrift.dll for release library + # - thriftd.dll for debug library + # + # Static libraries: + # - thriftmd.lib for /MD release build + # - thriftmt.lib for /MT release build + # + # - thriftmdd.lib for /MD debug build + # - thriftmtd.lib for /MT debug build + # + # the same holds for other libraries like libthriftz etc. + + # Build using /MT option instead of /MD if the WITH_MT options is set + if(WITH_MT) + set(CompilerFlags + CMAKE_CXX_FLAGS + CMAKE_CXX_FLAGS_DEBUG + CMAKE_CXX_FLAGS_RELEASE + CMAKE_CXX_FLAGS_RELWITHDEBINFO + CMAKE_C_FLAGS + CMAKE_C_FLAGS_DEBUG + CMAKE_C_FLAGS_RELEASE + CMAKE_C_FLAGS_RELWITHDEBINFO + ) + foreach(CompilerFlag ${CompilerFlags}) + string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}") + endforeach() + set(THRIFT_RUNTIME_POSTFIX "mt" CACHE STRING "Set runtime library postfix" FORCE) + else(WITH_MT) + set(THRIFT_RUNTIME_POSTFIX "md" CACHE STRING "Set runtime library postfix" FORCE) + endif(WITH_MT) + + # Disable boost auto linking pragmas - cmake includes the right files + add_definitions("-DBOOST_ALL_NO_LIB") +elseif(UNIX) + find_program( MEMORYCHECK_COMMAND valgrind ) + set( MEMORYCHECK_COMMAND_OPTIONS "--gen-suppressions=all --leak-check=full" ) + set( MEMORYCHECK_SUPPRESSIONS_FILE "${PROJECT_SOURCE_DIR}/test/valgrind.suppress" ) +endif() + +add_definitions("-D__STDC_FORMAT_MACROS") +add_definitions("-D__STDC_LIMIT_MACROS") + +# C++ Language Level +set(CXX_LANGUAGE_LEVEL "C++${CMAKE_CXX_STANDARD}") +if (CMAKE_CXX_STANDARD_REQUIRED) + string(CONCAT CXX_LANGUAGE_LEVEL "${CXX_LANGUAGE_LEVEL} [compiler must support it]") +else() + string(CONCAT CXX_LANGUAGE_LEVEL "${CXX_LANGUAGE_LEVEL} [fallback to earlier if compiler does not support it]") +endif() +if (CMAKE_CXX_EXTENSIONS) + string(CONCAT CXX_LANGUAGE_LEVEL "${CXX_LANGUAGE_LEVEL} [with compiler-specific extensions]") +endif() + +if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-register") +endif() diff --git a/src/jaegertracing/thrift/build/cmake/FindAnt.cmake b/src/jaegertracing/thrift/build/cmake/FindAnt.cmake new file mode 100644 index 000000000..8b0371d91 --- /dev/null +++ b/src/jaegertracing/thrift/build/cmake/FindAnt.cmake @@ -0,0 +1,30 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. +# + + +# ANT_FOUND - system has Ant +# Ant_EXECUTABLE - the Ant executable +# +# It will search the environment variable ANT_HOME if it is set + +include(FindPackageHandleStandardArgs) + +find_program(Ant_EXECUTABLE NAMES ant PATHS $ENV{ANT_HOME}/bin) +find_package_handle_standard_args(Ant DEFAULT_MSG Ant_EXECUTABLE) +mark_as_advanced(Ant_EXECUTABLE) diff --git a/src/jaegertracing/thrift/build/cmake/FindCabal.cmake b/src/jaegertracing/thrift/build/cmake/FindCabal.cmake new file mode 100644 index 000000000..fed337bd4 --- /dev/null +++ b/src/jaegertracing/thrift/build/cmake/FindCabal.cmake @@ -0,0 +1,30 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. +# + + +# Cabal_FOUND - system has Cabal +# Cabal - the Cabal executable +# +# It will search the environment variable CABAL_HOME if it is set + +include(FindPackageHandleStandardArgs) + +find_program(CABAL NAMES cabal PATHS $ENV{HOME}/.cabal/bin $ENV{CABAL_HOME}/bin) +find_package_handle_standard_args(CABAL DEFAULT_MSG CABAL) +mark_as_advanced(CABAL) diff --git a/src/jaegertracing/thrift/build/cmake/FindClangTools.cmake b/src/jaegertracing/thrift/build/cmake/FindClangTools.cmake new file mode 100644 index 000000000..b72bea765 --- /dev/null +++ b/src/jaegertracing/thrift/build/cmake/FindClangTools.cmake @@ -0,0 +1,28 @@ +# - Try to find Clang tools +# +# The following are set after configuration is done: +# clang-tidy_FOUND +# ClangTools::clang-tidy +# clang-apply-replacements_FOUND +# ClangTools::clang-apply-replacements +# run-clang-tidy_FOUND +# ClangTools::run-clang-tidy + +include_guard() +include(FindPackageHandleStandardArgs) + +foreach(program_name IN ITEMS clang-tidy clang-apply-replacements) + find_program(${program_name}_BINARY NAMES ${program_name}-devel ${program_name}-8 ${program_name} PATH_SUFFIXES "LLVM/bin") + find_package_handle_standard_args(${program_name} DEFAULT_MSG ${program_name}_BINARY) + if(${program_name}_FOUND AND NOT TARGET ClangTools::${program_name}) + add_executable(ClangTools::${program_name} IMPORTED) + set_property(TARGET ClangTools::${program_name} PROPERTY IMPORTED_LOCATION "${${program_name}_BINARY}") + endif() +endforeach() + +find_program(run-clang-tidy_BINARY NAMES run-clang-tidy run-clang-tidy.py PATH_SUFFIXES "LLVM/bin" "llvm-devel/share/clang") +find_package_handle_standard_args(run-clang-tidy DEFAULT_MSG run-clang-tidy_BINARY) +if(run-clang-tidy_FOUND AND NOT TARGET ClangTools::run-clang-tidy) + add_executable(ClangTools::run-clang-tidy IMPORTED) + set_property(TARGET ClangTools::run-clang-tidy PROPERTY IMPORTED_LOCATION "${run-clang-tidy_BINARY}") +endif() diff --git a/src/jaegertracing/thrift/build/cmake/FindGHC.cmake b/src/jaegertracing/thrift/build/cmake/FindGHC.cmake new file mode 100644 index 000000000..48738472c --- /dev/null +++ b/src/jaegertracing/thrift/build/cmake/FindGHC.cmake @@ -0,0 +1,36 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. +# + + +# GHC_FOUND - system has GHC +# GHC - the GHC executable +# RUN_HASKELL_FOUND - system has runhaskell +# RUN_HASKELL - the runhaskell executable +# +# It will search the environment variable GHC_HOME if it is set + +include(FindPackageHandleStandardArgs) + +find_program(GHC NAMES ghc PATHS $ENV{GHC_HOME}/bin) +find_package_handle_standard_args(GHC DEFAULT_MSG GHC) +mark_as_advanced(GHC) + +find_program(RUN_HASKELL NAMES runhaskell PATHS $ENV{GHC_HOME}/bin) +find_package_handle_standard_args(RUN_HASKELL DEFAULT_MSG RUN_HASKELL) +mark_as_advanced(RUN_HASKELL) diff --git a/src/jaegertracing/thrift/build/cmake/FindGLIB.cmake b/src/jaegertracing/thrift/build/cmake/FindGLIB.cmake new file mode 100644 index 000000000..acbe433e3 --- /dev/null +++ b/src/jaegertracing/thrift/build/cmake/FindGLIB.cmake @@ -0,0 +1,122 @@ +# - Try to find Glib and its components (gio, gobject etc) +# Once done, this will define +# +# GLIB_FOUND - system has Glib +# GLIB_INCLUDE_DIRS - the Glib include directories +# GLIB_LIBRARIES - link these to use Glib +# +# Optionally, the COMPONENTS keyword can be passed to find_package() +# and Glib components can be looked for. Currently, the following +# components can be used, and they define the following variables if +# found: +# +# gio: GLIB_GIO_LIBRARIES +# gobject: GLIB_GOBJECT_LIBRARIES +# gmodule: GLIB_GMODULE_LIBRARIES +# gthread: GLIB_GTHREAD_LIBRARIES +# +# Note that the respective _INCLUDE_DIR variables are not set, since +# all headers are in the same directory as GLIB_INCLUDE_DIRS. +# +# Copyright (C) 2012 Raphael Kubo da Costa <rakuco@webkit.org> +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS +# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +find_package(PkgConfig) +pkg_check_modules(PC_GLIB QUIET glib-2.0) + +find_library(GLIB_LIBRARIES + NAMES glib-2.0 + HINTS ${PC_GLIB_LIBDIR} + ${PC_GLIB_LIBRARY_DIRS} +) + +# Files in glib's main include path may include glibconfig.h, which, +# for some odd reason, is normally in $LIBDIR/glib-2.0/include. +get_filename_component(_GLIB_LIBRARY_DIR ${GLIB_LIBRARIES} PATH) +find_path(GLIBCONFIG_INCLUDE_DIR + NAMES glibconfig.h + HINTS ${PC_LIBDIR} ${PC_LIBRARY_DIRS} ${_GLIB_LIBRARY_DIR} + ${PC_GLIB_INCLUDEDIR} ${PC_GLIB_INCLUDE_DIRS} + PATH_SUFFIXES glib-2.0/include +) + +find_path(GLIB_INCLUDE_DIR + NAMES glib.h + HINTS ${PC_GLIB_INCLUDEDIR} + ${PC_GLIB_INCLUDE_DIRS} + PATH_SUFFIXES glib-2.0 +) + +set(GLIB_INCLUDE_DIRS ${GLIB_INCLUDE_DIR} ${GLIBCONFIG_INCLUDE_DIR}) + +if(GLIBCONFIG_INCLUDE_DIR) + # Version detection + file(READ "${GLIBCONFIG_INCLUDE_DIR}/glibconfig.h" GLIBCONFIG_H_CONTENTS) + string(REGEX MATCH "#define GLIB_MAJOR_VERSION ([0-9]+)" _dummy "${GLIBCONFIG_H_CONTENTS}") + set(GLIB_VERSION_MAJOR "${CMAKE_MATCH_1}") + string(REGEX MATCH "#define GLIB_MINOR_VERSION ([0-9]+)" _dummy "${GLIBCONFIG_H_CONTENTS}") + set(GLIB_VERSION_MINOR "${CMAKE_MATCH_1}") + string(REGEX MATCH "#define GLIB_MICRO_VERSION ([0-9]+)" _dummy "${GLIBCONFIG_H_CONTENTS}") + set(GLIB_VERSION_MICRO "${CMAKE_MATCH_1}") + set(GLIB_VERSION "${GLIB_VERSION_MAJOR}.${GLIB_VERSION_MINOR}.${GLIB_VERSION_MICRO}") +endif() + +# Additional Glib components. We only look for libraries, as not all of them +# have corresponding headers and all headers are installed alongside the main +# glib ones. +foreach (_component ${GLIB_FIND_COMPONENTS}) + if (${_component} STREQUAL "gio") + find_library(GLIB_GIO_LIBRARIES NAMES gio-2.0 HINTS ${_GLIB_LIBRARY_DIR}) + set(ADDITIONAL_REQUIRED_VARS ${ADDITIONAL_REQUIRED_VARS} GLIB_GIO_LIBRARIES) + elseif (${_component} STREQUAL "gobject") + find_library(GLIB_GOBJECT_LIBRARIES NAMES gobject-2.0 HINTS ${_GLIB_LIBRARY_DIR}) + set(ADDITIONAL_REQUIRED_VARS ${ADDITIONAL_REQUIRED_VARS} GLIB_GOBJECT_LIBRARIES) + elseif (${_component} STREQUAL "gmodule") + find_library(GLIB_GMODULE_LIBRARIES NAMES gmodule-2.0 HINTS ${_GLIB_LIBRARY_DIR}) + set(ADDITIONAL_REQUIRED_VARS ${ADDITIONAL_REQUIRED_VARS} GLIB_GMODULE_LIBRARIES) + elseif (${_component} STREQUAL "gthread") + find_library(GLIB_GTHREAD_LIBRARIES NAMES gthread-2.0 HINTS ${_GLIB_LIBRARY_DIR}) + set(ADDITIONAL_REQUIRED_VARS ${ADDITIONAL_REQUIRED_VARS} GLIB_GTHREAD_LIBRARIES) + elseif (${_component} STREQUAL "gio-unix") + # gio-unix is compiled as part of the gio library, but the include paths + # are separate from the shared glib ones. Since this is currently only used + # by WebKitGTK+ we don't go to extraordinary measures beyond pkg-config. + pkg_check_modules(GIO_UNIX QUIET gio-unix-2.0) + endif () +endforeach () + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLIB REQUIRED_VARS GLIB_INCLUDE_DIRS GLIB_LIBRARIES ${ADDITIONAL_REQUIRED_VARS} + VERSION_VAR GLIB_VERSION) + +mark_as_advanced( + GLIBCONFIG_INCLUDE_DIR + GLIB_GIO_LIBRARIES + GLIB_GIO_UNIX_LIBRARIES + GLIB_GMODULE_LIBRARIES + GLIB_GOBJECT_LIBRARIES + GLIB_GTHREAD_LIBRARIES + GLIB_INCLUDE_DIR + GLIB_INCLUDE_DIRS + GLIB_LIBRARIES +) diff --git a/src/jaegertracing/thrift/build/cmake/FindGradle.cmake b/src/jaegertracing/thrift/build/cmake/FindGradle.cmake new file mode 100644 index 000000000..8845d697e --- /dev/null +++ b/src/jaegertracing/thrift/build/cmake/FindGradle.cmake @@ -0,0 +1,30 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. +# + + +# GRADLE_FOUND - system has Gradle +# GRADLE_EXECUTABLE - the Gradle executable +# +# It will search the environment variable ANT_HOME if it is set + +include(FindPackageHandleStandardArgs) + +find_program(GRADLE_EXECUTABLE NAMES gradle PATHS $ENV{GRADLE_HOME}/bin NO_CMAKE_FIND_ROOT_PATH) +find_package_handle_standard_args(Gradle DEFAULT_MSG GRADLE_EXECUTABLE) +mark_as_advanced(GRADLE_EXECUTABLE) diff --git a/src/jaegertracing/thrift/build/cmake/FindGradlew.cmake b/src/jaegertracing/thrift/build/cmake/FindGradlew.cmake new file mode 100644 index 000000000..17bb99899 --- /dev/null +++ b/src/jaegertracing/thrift/build/cmake/FindGradlew.cmake @@ -0,0 +1,36 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. +# + + +# GRADLEW_FOUND - system has Gradlew +# GRADLEW_EXECUTABLE - the Gradlew executable +# +# It will search the location CMAKE_SOURCE_DIR/lib/java + +include(FindPackageHandleStandardArgs) + +find_program(GRADLEW_EXECUTABLE gradlew PATHS ${CMAKE_SOURCE_DIR}/lib/java NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) +find_package_handle_standard_args(Gradlew DEFAULT_MSG GRADLEW_EXECUTABLE) +mark_as_advanced(GRADLEW_EXECUTABLE) + +# Buggy find_program cannot find gradlew.bat when gradlew is at the same path +# and even buggier ctest will not execute gradlew.bat when gradlew is given. +if(CMAKE_HOST_WIN32) + string(REGEX REPLACE "(.+gradlew)$" "\\1.bat" GRADLEW_EXECUTABLE ${GRADLEW_EXECUTABLE}) +endif(CMAKE_HOST_WIN32) diff --git a/src/jaegertracing/thrift/build/cmake/FindInttypes.cmake b/src/jaegertracing/thrift/build/cmake/FindInttypes.cmake new file mode 100644 index 000000000..e661f7887 --- /dev/null +++ b/src/jaegertracing/thrift/build/cmake/FindInttypes.cmake @@ -0,0 +1,41 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. +# + +# find msinttypes on compilers that don't provide it, for example +# VS2010 + +# Usage: +# Provide INTTYPES_ROOT if you need it +# Result: INTTYPES_INCLUDE_DIRS, where to find inttypes.h +# Result: Inttypes_FOUND, If false, inttypes.h was not found + +find_path(INTTYPES_INCLUDE_DIRS inttypes.h HINTS ${INTTYPES_ROOT}) +if (INTTYPES_INCLUDE_DIRS) + set(Inttypes_FOUND TRUE) +else () + set(Inttypes_FOUND FALSE) + if (Inttypes_FIND_REQUIRED) + message(FATAL_ERROR "Could NOT find inttypes.h") + endif () + message(STATUS "inttypes.h NOT found") +endif () + +mark_as_advanced( + INTTYPES_INCLUDE_DIRS +) diff --git a/src/jaegertracing/thrift/build/cmake/FindLibevent.cmake b/src/jaegertracing/thrift/build/cmake/FindLibevent.cmake new file mode 100644 index 000000000..ac6a078a1 --- /dev/null +++ b/src/jaegertracing/thrift/build/cmake/FindLibevent.cmake @@ -0,0 +1,45 @@ +# find LibEvent +# an event notification library (http://libevent.org/) +# +# Usage: +# LIBEVENT_INCLUDE_DIRS, where to find LibEvent headers +# LIBEVENT_LIBRARIES, LibEvent libraries +# Libevent_FOUND, If false, do not try to use libevent + +set(LIBEVENT_ROOT CACHE PATH "Root directory of libevent installation") +set(LibEvent_EXTRA_PREFIXES /usr/local /opt/local "$ENV{HOME}" ${LIBEVENT_ROOT}) +foreach(prefix ${LibEvent_EXTRA_PREFIXES}) + list(APPEND LibEvent_INCLUDE_PATHS "${prefix}/include") + list(APPEND LibEvent_LIBRARIES_PATHS "${prefix}/lib") +endforeach() + +# Looking for "event.h" will find the Platform SDK include dir on windows +# so we also look for a peer header like evhttp.h to get the right path +find_path(LIBEVENT_INCLUDE_DIRS evhttp.h event.h PATHS ${LibEvent_INCLUDE_PATHS}) + +# "lib" prefix is needed on Windows in some cases +# newer versions of libevent use three libraries +find_library(LIBEVENT_LIBRARIES NAMES event event_core event_extra libevent PATHS ${LibEvent_LIBRARIES_PATHS}) + +if (LIBEVENT_LIBRARIES AND LIBEVENT_INCLUDE_DIRS) + set(Libevent_FOUND TRUE) + set(LIBEVENT_LIBRARIES ${LIBEVENT_LIBRARIES}) +else () + set(Libevent_FOUND FALSE) +endif () + +if (Libevent_FOUND) + if (NOT Libevent_FIND_QUIETLY) + message(STATUS "Found libevent: ${LIBEVENT_LIBRARIES}") + endif () +else () + if (LibEvent_FIND_REQUIRED) + message(FATAL_ERROR "Could NOT find libevent.") + endif () + message(STATUS "libevent NOT found.") +endif () + +mark_as_advanced( + LIBEVENT_LIBRARIES + LIBEVENT_INCLUDE_DIRS + ) diff --git a/src/jaegertracing/thrift/build/cmake/GenerateConfigModule.cmake b/src/jaegertracing/thrift/build/cmake/GenerateConfigModule.cmake new file mode 100644 index 000000000..9533c8235 --- /dev/null +++ b/src/jaegertracing/thrift/build/cmake/GenerateConfigModule.cmake @@ -0,0 +1,44 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. +# + +include(CMakePackageConfigHelpers) +set(PACKAGE_INCLUDE_INSTALL_DIR "${includedir}/thrift") +set(PACKAGE_CMAKE_INSTALL_DIR "${cmakedir}/thrift") +set(PACKAGE_BIN_INSTALL_DIR "${exec_prefix}") + +# In CYGWIN enviroment below commands does not work properly +if (NOT CYGWIN) + configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/build/cmake/ThriftConfig.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/ThriftConfig.cmake" + INSTALL_DESTINATION "${CMAKE_INSTALL_DIR}/thrift" + PATH_VARS + PACKAGE_INCLUDE_INSTALL_DIR + PACKAGE_CMAKE_INSTALL_DIR + PACKAGE_BIN_INSTALL_DIR + ) + + write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/ThriftConfigVersion.cmake" + VERSION ${thrift_VERSION_MAJOR}.${thrift_VERSION_MINOR}.${thrift_VERSION_PATCH} + COMPATIBILITY SameMajorVersion + ) + + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ThriftConfig.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/ThriftConfigVersion.cmake" + DESTINATION "${CMAKE_INSTALL_DIR}/thrift") +endif() diff --git a/src/jaegertracing/thrift/build/cmake/NewPlatformDebug.cmake b/src/jaegertracing/thrift/build/cmake/NewPlatformDebug.cmake new file mode 100644 index 000000000..aa4d30230 --- /dev/null +++ b/src/jaegertracing/thrift/build/cmake/NewPlatformDebug.cmake @@ -0,0 +1,44 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. +# + +# +# For debugging new platforms, just to see what some environment flags are... +# +macro(SHOWFLAG flag) + message(STATUS "${flag} = ${${flag}}") +endmacro(SHOWFLAG) + +set(NEWPLATFORMDEBUG ON) + +if(NEWPLATFORMDEBUG) + SHOWFLAG("APPLE") + SHOWFLAG("BORLAND") + SHOWFLAG("CMAKE_C_COMPILER_ID") + SHOWFLAG("CMAKE_CXX_COMPILER_ID") + SHOWFLAG("CMAKE_COMPILER_IS_GNUCC") + SHOWFLAG("CMAKE_COMPILER_IS_GNUCXX") + SHOWFLAG("CYGWIN") + SHOWFLAG("MINGW") + SHOWFLAG("MSVC") + SHOWFLAG("MSVC_VERSION") + SHOWFLAG("MSYS") + SHOWFLAG("UNIX") + SHOWFLAG("WATCOM") + SHOWFLAG("WIN32") +endif(NEWPLATFORMDEBUG) diff --git a/src/jaegertracing/thrift/build/cmake/README-MSYS2.md b/src/jaegertracing/thrift/build/cmake/README-MSYS2.md new file mode 100644 index 000000000..07cad92ba --- /dev/null +++ b/src/jaegertracing/thrift/build/cmake/README-MSYS2.md @@ -0,0 +1,63 @@ +<!--- +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +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. +--> + +# Building thrift on Windows (MinGW64/MSYS2) + +Thrift uses cmake to make it easier to build the project on multiple platforms, however to build a fully functional and production ready thrift on Windows requires a number of third party libraries to be obtained. Once third party libraries are ready, the right combination of options must be passed to cmake in order to generate the correct environment. + +> Note: libevent and libevent-devel do not work with this toolchain as they do not properly detect mingw64 and expect some headers to exist that do not, so the non-blocking server is not currently built into this solution. + +## MSYS2 + +Download and fully upgrade msys2 following the instructions at: + + https://msys2.github.io/ + +Install the necessary toolchain items for C++: + + $ pacman --needed -S bison flex make mingw-w64-x86_64-openssl \ + mingw-w64-x86_64-boost mingw-w64-x86_64-cmake \ + mingw-w64-x86_64-toolchain mingw-w64-x86_64-zlib + +Update your msys2 bash path to include /mingw64/bin by adding a line to your ~/.bash_profiles using this command: + + echo "export PATH=/mingw64/bin:\$PATH" >> ~/.bash_profile + +After that, close your shell and open a new one. + +Use cmake to create a MinGW makefile, out of tree (assumes you are in the top level of the thrift source tree): + + mkdir ../thrift-build + cd ../thrift-build + cmake -G"MinGW Makefiles" -DCMAKE_MAKE_PROGRAM=/mingw64/bin/mingw32-make \ + -DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc.exe \ + -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++.exe \ + -DWITH_LIBEVENT=OFF \ + -DWITH_SHARED_LIB=OFF -DWITH_STATIC_LIB=ON \ + -DWITH_JAVA=OFF -DWITH_PYTHON=OFF -DWITH_PERL=OFF \ + ../thrift + +Build thrift (inside thrift-build): + + cmake --build . + +Run the tests (inside thrift-build): + + ctest + +> If you run into issues, check Apache Jira THRIFT-4046 for patches relating to MinGW64/MSYS2 builds. + +## Tested With + +msys2 64-bit 2016-10-26 distribution diff --git a/src/jaegertracing/thrift/build/cmake/README.md b/src/jaegertracing/thrift/build/cmake/README.md new file mode 100644 index 000000000..a0eb859bd --- /dev/null +++ b/src/jaegertracing/thrift/build/cmake/README.md @@ -0,0 +1,78 @@ +# Apache Thrift - CMake Build + +## Goal + +Extend Apache Thrift's *make cross* approach to the build system. + +Due to growing the field of operating system support, a proper executable +and library detection mechanism running on as much platforms as possible +becomes required. The other aspect to simplify the release process and +package generation process. + +As nice side benefit of CMake is the generation of development environment +specific soultion files. => No solution files within source tree. + +## Prerequisites + +These are language-specific, however for C++ you must provide: + +- Boost +- OpenSSL + +You may optionally provide: + +- libevent +- zlib + +## Usage + +To use CMake you first create an out-of-tree build directory, then use +CMake to generate a build framework, then build: + + mkdir /tmp/build + cd /tmp/build + cmake /location/to/thrift + +if you use a specific toolchain pass it to cmake, the same for options: + + cmake -DCMAKE_TOOLCHAIN_FILE=../build/cmake/mingw32-toolchain.cmake .. + cmake -DCMAKE_C_COMPILER=clang-3.5 -DCMAKE_CXX_COMPILER=clang++-3.5 .. + cmake -DTHRIFT_COMPILER_HS=OFF .. + cmake -DWITH_ZLIB=ON .. + +and open the development environment you like with the solution or do this: + + make + make check + make cross + make dist + +or on Windows, the following will produce a solution file you can use +inside Visual Studio: + + cmake -G "Visual Studio 15 2017 Win64" \ + -DBOOST_ROOT=C:/3rdparty/boost_1_69_0 \ + -DBOOST_LIBRARYDIR=C:/3rdparty/boost_1_69_0/lib64-msvc-14.1^ + -DZLIB_ROOT=C:/3rdparty/zlib-1.2.11 + +<!-- +To generate an installer and distribution package do this: + + cpack +--> + +## TODO + +* git hash or tag based versioning depending on source state +* build tutorial +* build test +* enable/disable +* make cross +* make dist (create an alias to make package_source) +* make doc +* cpack (C++ and make dist only ?) + * thrift-compiler + * libthrift + * tutorial + * test +* merge into /README.md
\ No newline at end of file diff --git a/src/jaegertracing/thrift/build/cmake/StaticCodeAnalysis.cmake b/src/jaegertracing/thrift/build/cmake/StaticCodeAnalysis.cmake new file mode 100644 index 000000000..3356c761d --- /dev/null +++ b/src/jaegertracing/thrift/build/cmake/StaticCodeAnalysis.cmake @@ -0,0 +1,9 @@ +find_package(ClangTools QUIET) +if(clang-tidy_FOUND AND run-clang-tidy_FOUND AND NOT TARGET do_run_clang_tidy) + add_custom_target( + do_run_clang_tidy + COMMAND ClangTools::run-clang-tidy -clang-tidy-binary "$<TARGET_FILE:ClangTools::clang-tidy>" -p ${CMAKE_BINARY_DIR} "-quiet" > ./run-clang-tidy.txt + DEPENDS ${CMAKE_BINARY_DIR}/compile_commands.json + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + ) +endif() diff --git a/src/jaegertracing/thrift/build/cmake/ThriftConfig.cmake.in b/src/jaegertracing/thrift/build/cmake/ThriftConfig.cmake.in new file mode 100644 index 000000000..c304da04d --- /dev/null +++ b/src/jaegertracing/thrift/build/cmake/ThriftConfig.cmake.in @@ -0,0 +1,42 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. +# + +set(THRIFT_VERSION ${thrift_VERSION}) + +@PACKAGE_INIT@ + +set_and_check(THRIFT_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@") +set_and_check(THRIFT_CMAKE_DIR "@PACKAGE_CMAKE_INSTALL_DIR@") +set_and_check(THRIFT_BIN_DIR "@PACKAGE_BIN_INSTALL_DIR@") + +if (NOT TARGET thrift::thrift) + include("${THRIFT_CMAKE_DIR}/thriftTargets.cmake") +endif() + +set(THRIFT_LIBRARIES thrift::thrift) + +if ("${THRIFT_LIBRARIES}" STREQUAL "") + message(FATAL_ERROR "thrift libraries were not found") +endif() + +if (NOT Thrift_FIND_QUIETLY) + message(STATUS "Found thrift: ${PACKAGE_PREFIX_DIR}") +endif() + +check_required_components(Thrift) diff --git a/src/jaegertracing/thrift/build/cmake/ThriftMacros.cmake b/src/jaegertracing/thrift/build/cmake/ThriftMacros.cmake new file mode 100644 index 000000000..d068b2ae6 --- /dev/null +++ b/src/jaegertracing/thrift/build/cmake/ThriftMacros.cmake @@ -0,0 +1,62 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. +# + +macro(ADD_PKGCONFIG_THRIFT name) + configure_file("${name}.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/${name}.pc" @ONLY) + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${name}.pc" + DESTINATION "${PKGCONFIG_INSTALL_DIR}") +endmacro(ADD_PKGCONFIG_THRIFT) + +macro(ADD_LIBRARY_THRIFT name) + add_library(${name} ${ARGN}) + set_target_properties(${name} PROPERTIES + OUTPUT_NAME ${name}${THRIFT_RUNTIME_POSTFIX} # windows link variants (/MT, /MD, /MTd, /MDd) get different names + VERSION ${thrift_VERSION} ) + # set_target_properties(${name} PROPERTIES PUBLIC_HEADER "${thriftcpp_HEADERS}") + install(TARGETS ${name} EXPORT "${name}Targets" + RUNTIME DESTINATION "${BIN_INSTALL_DIR}" + LIBRARY DESTINATION "${LIB_INSTALL_DIR}" + ARCHIVE DESTINATION "${LIB_INSTALL_DIR}" + PUBLIC_HEADER DESTINATION "${INCLUDE_INSTALL_DIR}") + + export(EXPORT "${name}Targets" + FILE "${CMAKE_CURRENT_BINARY_DIR}/${name}/${name}Targets.cmake" + NAMESPACE "${name}::") + + install(EXPORT "${name}Targets" + FILE "${name}Targets.cmake" + NAMESPACE "${name}::" + DESTINATION "${CMAKE_INSTALL_DIR}/thrift") +endmacro() + +macro(TARGET_INCLUDE_DIRECTORIES_THRIFT name) + target_include_directories(${name} ${ARGN}) +endmacro() + +macro(TARGET_LINK_LIBRARIES_THRIFT name) + target_link_libraries(${name} ${ARGN}) +endmacro() + +macro(LINK_AGAINST_THRIFT_LIBRARY target libname) + target_link_libraries(${target} ${libname}) +endmacro() + +macro(TARGET_LINK_LIBRARIES_THRIFT_AGAINST_THRIFT_LIBRARY target libname) + target_link_libraries(${target} ${ARGN} ${libname}) +endmacro() diff --git a/src/jaegertracing/thrift/build/cmake/android-toolchain.cmake b/src/jaegertracing/thrift/build/cmake/android-toolchain.cmake new file mode 100644 index 000000000..15f3d002a --- /dev/null +++ b/src/jaegertracing/thrift/build/cmake/android-toolchain.cmake @@ -0,0 +1,26 @@ +set(ANDROID_NDK "/opt/android-ndk" CACHE) +set(ANDROID_PLATFORM "android-15" CACHE) +set(ANDROID_ARCH "arch-arm" CACHE) +set(ANDROID_TOOL_ARCH "android-arm" CACHE) +set(ANDROID_CPU "armeabi-v7a" CACHE) +set(ANDROID_GCC_VERSION 4.9 CACHE) +set(HOST_ARCH linux-x86_64 CACHE) + +set(CMAKE_SYSTEM_NAME Android) +set(ANDROID_SYSROOT "${ANDROID_NDK}/platforms/${ANDROID_PLATFORM}/${ANDROID_ARCH}") +set(ANDROID_TRIPLET arm-linux-androideabi) +set(ANDROID_STL "${ANDROID_NDK}/sources/cxx-stl/gnu-libstd++/${ANDROID_GCC_VERSION}") + +set(_COMPILER_ROOT ${ANDROID_NDK}/prebuilt/${ANDROID_TRIPLET}-${ANDROID_GCC_VERSION}/prebuilt/${HOST_ARCH}) +set(CMAKE_C_COMPILER ${_COMPILER_ROOT}/bin/${ANDROID_TRIPLET}-gcc) +set(CMAKE_CXCX_COMPILER ${_COMPILER_ROOT}/bin/${ANDROID_TRIPLET}-g++) + +include_directories( + ${ANDROID_STL}/include + ${ANDROID_STL}/libs/${ANDROID_CPU}/include) + +set(CMAKE_FIND_ROOT_PATH ${ANDROID_SYSROOT}) + +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) diff --git a/src/jaegertracing/thrift/build/cmake/config.h.in b/src/jaegertracing/thrift/build/cmake/config.h.in new file mode 100644 index 000000000..a3d66428c --- /dev/null +++ b/src/jaegertracing/thrift/build/cmake/config.h.in @@ -0,0 +1,157 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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. + */ + +/* config.h generated by CMake from config.h.in */ + +#ifndef CONFIG_H +#define CONFIG_H + + +/* Name of package */ +#cmakedefine PACKAGE "${PACKAGE}" + +/* Define to the address where bug reports for this package should be sent. */ +#cmakedefine PACKAGE_BUGREPORT "${PACKAGE_BUGREPORT}" + +/* Define to the full name of this package. */ +#cmakedefine PACKAGE_NAME "${PACKAGE_NAME}" + +/* Define to the one symbol short name of this package. */ +#cmakedefine PACKAGE_TARNAME "${PACKAGE_TARNAME}" + +/* Define to the home page for this package. */ +#cmakedefine PACKAGE_URL "${PACKAGE_URL}" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "${PACKAGE_VERSION}" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "${PACKAGE_STRING}" + +/************************** DEFINES *************************/ + +/* Define if the AI_ADDRCONFIG symbol is unavailable */ +#cmakedefine AI_ADDRCONFIG 0 + +/* Possible value for SIGNED_RIGHT_SHIFT_IS */ +/* TODO: This is just set to 1 for the moment + port the macro aclocal/ax_signed_right_shift.m4 to CMake to make this work */ +#define ARITHMETIC_RIGHT_SHIFT 1 + +/* Indicates the effect of the right shift operator on negative signed + integers */ +/* TODO: This is just set to 1 for the moment */ +#define SIGNED_RIGHT_SHIFT_IS 1 + +/* Use *.h extension for parser header file */ +/* TODO: This might now be necessary anymore as it is set only for automake < 1.11 + see: aclocal/ac_prog_bison.m4 */ +#cmakedefine BISON_USE_PARSER_H_EXTENSION 1 + +/* Define to 1 if strerror_r returns char *. */ +#cmakedefine STRERROR_R_CHAR_P 1 + + +/************************** HEADER FILES *************************/ + +/* Define to 1 if you have the <arpa/inet.h> header file. */ +#cmakedefine HAVE_ARPA_INET_H 1 + +/* Define to 1 if you have the <fcntl.h> header file. */ +#cmakedefine HAVE_FCNTL_H 1 + +/* Define to 1 if you have the <inttypes.h> header file. */ +#cmakedefine HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the <netdb.h> header file. */ +#cmakedefine HAVE_NETDB_H 1 + +/* Define to 1 if you have the <netinet/in.h> header file. */ +#cmakedefine HAVE_NETINET_IN_H 1 + +/* Define to 1 if you have the <signal.h> header file. */ +#cmakedefine HAVE_SIGNAL_H 1 + +/* Define to 1 if you have the <stdint.h> header file. */ +#cmakedefine HAVE_STDINT_H 1 + +/* Define to 1 if you have the <unistd.h> header file. */ +#cmakedefine HAVE_UNISTD_H 1 + +/* Define to 1 if you have the <pthread.h> header file. */ +#cmakedefine HAVE_PTHREAD_H 1 + +/* Define to 1 if you have the <sys/ioctl.h> header file. */ +#cmakedefine HAVE_SYS_IOCTL_H 1 + +/* Define to 1 if you have the <sys/param.h> header file. */ +#cmakedefine HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the <sys/resource.h> header file. */ +#cmakedefine HAVE_SYS_RESOURCE_H 1 + +/* Define to 1 if you have the <sys/socket.h> header file. */ +#cmakedefine HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#cmakedefine HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the <sys/un.h> header file. */ +#cmakedefine HAVE_SYS_UN_H 1 + +/* Define to 1 if you have the <poll.h> header file. */ +#cmakedefine HAVE_POLL_H 1 + +/* Define to 1 if you have the <sys/poll.h> header file. */ +#cmakedefine HAVE_SYS_POLL_H 1 + +/* Define to 1 if you have the <sys/select.h> header file. */ +#cmakedefine HAVE_SYS_SELECT_H 1 + +/* Define to 1 if you have the <sys/time.h> header file. */ +#cmakedefine HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the <sched.h> header file. */ +#cmakedefine HAVE_SCHED_H 1 + +/* Define to 1 if you have the <strings.h> header file. */ +#define HAVE_STRINGS_H 1 + +/*************************** FUNCTIONS ***************************/ + +/* Define to 1 if you have the `gethostbyname' function. */ +#cmakedefine HAVE_GETHOSTBYNAME 1 + +/* Define to 1 if you have the `gethostbyname_r' function. */ +#cmakedefine HAVE_GETHOSTBYNAME_R 1 + +/* Define to 1 if you have the `strerror_r' function. */ +#cmakedefine HAVE_STRERROR_R 1 + +/* Define to 1 if you have the `sched_get_priority_max' function. */ +#cmakedefine HAVE_SCHED_GET_PRIORITY_MAX 1 + +/* Define to 1 if you have the `sched_get_priority_min' function. */ +#cmakedefine HAVE_SCHED_GET_PRIORITY_MIN 1 + + +/* Define to 1 if strerror_r returns char *. */ +#cmakedefine STRERROR_R_CHAR_P 1 + +#endif diff --git a/src/jaegertracing/thrift/build/cmake/mingw32-toolchain.cmake b/src/jaegertracing/thrift/build/cmake/mingw32-toolchain.cmake new file mode 100644 index 000000000..864c0ebe4 --- /dev/null +++ b/src/jaegertracing/thrift/build/cmake/mingw32-toolchain.cmake @@ -0,0 +1,24 @@ +# CMake mingw32 cross compile toolchain file + +# the name of the target operating system +SET(CMAKE_SYSTEM_NAME Windows) + +# which compilers to use for C and C++ +SET(CMAKE_C_COMPILER i586-mingw32msvc-gcc) +SET(CMAKE_CXX_COMPILER i586-mingw32msvc-g++) +SET(CMAKE_RC_COMPILER i586-mingw32msvc-windres) + +# here is the target environment located +SET(CMAKE_FIND_ROOT_PATH /usr/i586-mingw32msvc) + +# adjust the default behaviour of the FIND_XXX() commands: +# search headers and libraries in the target environment, search +# programs in the host environment +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + +set(BUILD_SHARED_LIBS OFF) +SET(CMAKE_EXE_LINKER_FLAGS "-static") +set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} "-static-libgcc") +set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-static-libstdc++") |