]> git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/thrift/compiler/cpp/CMakeLists.txt
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / jaegertracing / thrift / compiler / cpp / CMakeLists.txt
1 #
2 # Licensed to the Apache Software Foundation (ASF) under one
3 # or more contributor license agreements. See the NOTICE file
4 # distributed with this work for additional information
5 # regarding copyright ownership. The ASF licenses this file
6 # to you under the Apache License, Version 2.0 (the
7 # "License"); you may not use this file except in compliance
8 # with the License. You may obtain a copy of the License at
9 #
10 # http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing,
13 # software distributed under the License is distributed on an
14 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 # KIND, either express or implied. See the License for the
16 # specific language governing permissions and limitations
17 # under the License.
18 #
19
20 cmake_minimum_required(VERSION 3.3)
21 project("thrift-compiler" VERSION ${PACKAGE_VERSION})
22
23 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/thrift/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/thrift/version.h)
24
25 find_package(FLEX REQUIRED)
26 find_package(BISON REQUIRED)
27
28 # create directory for thrifty and thriftl
29 file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/thrift/)
30
31 # Create flex and bison files and build the lib parse static library
32 BISON_TARGET(thrifty ${CMAKE_CURRENT_SOURCE_DIR}/src/thrift/thrifty.yy ${CMAKE_CURRENT_BINARY_DIR}/thrift/thrifty.cc)
33 FLEX_TARGET(thriftl ${CMAKE_CURRENT_SOURCE_DIR}/src/thrift/thriftl.ll ${CMAKE_CURRENT_BINARY_DIR}/thrift/thriftl.cc)
34 ADD_FLEX_BISON_DEPENDENCY(thriftl thrifty)
35
36 set(parse_SOURCES
37 ${CMAKE_CURRENT_BINARY_DIR}/thrift/thrifty.cc
38 ${CMAKE_CURRENT_BINARY_DIR}/thrift/thriftl.cc
39 ${CMAKE_CURRENT_BINARY_DIR}/thrift/thrifty.hh
40 )
41
42 add_library(parse STATIC ${parse_SOURCES})
43
44 # Create the thrift compiler
45 set(compiler_core
46 src/thrift/common.cc
47 src/thrift/generate/t_generator.cc
48 src/thrift/parse/t_typedef.cc
49 src/thrift/parse/parse.cc
50 ${CMAKE_CURRENT_BINARY_DIR}/thrift/version.h
51 )
52
53 set(thrift-compiler_SOURCES
54 src/thrift/main.cc
55 src/thrift/audit/t_audit.cpp
56 )
57
58 set(thrift_compiler_LANGS
59 )
60
61 # This macro adds an option THRIFT_COMPILER_${NAME}
62 # that allows enabling or disabling certain languages
63 macro(THRIFT_ADD_COMPILER name description initial)
64 string(TOUPPER "THRIFT_COMPILER_${name}" enabler)
65 set(src "src/thrift/generate/t_${name}_generator.cc")
66 option(${enabler} ${description} ${initial})
67 if(${enabler})
68 list(APPEND thrift-compiler_SOURCES ${src})
69 list(APPEND thrift_compiler_LANGS ${name})
70 endif()
71 endmacro()
72
73 # The following compiler can be enabled or disabled
74 THRIFT_ADD_COMPILER(as3 "Enable compiler for ActionScript 3" ON)
75 THRIFT_ADD_COMPILER(c_glib "Enable compiler for C with Glib" ON)
76 THRIFT_ADD_COMPILER(cl "Enable compiler for Common LISP" ON)
77 THRIFT_ADD_COMPILER(cpp "Enable compiler for C++" ON)
78 THRIFT_ADD_COMPILER(csharp "Enable compiler for C#" ON)
79 THRIFT_ADD_COMPILER(d "Enable compiler for D" ON)
80 THRIFT_ADD_COMPILER(dart "Enable compiler for Dart" ON)
81 THRIFT_ADD_COMPILER(delphi "Enable compiler for Delphi" ON)
82 THRIFT_ADD_COMPILER(erl "Enable compiler for Erlang" ON)
83 THRIFT_ADD_COMPILER(go "Enable compiler for Go" ON)
84 THRIFT_ADD_COMPILER(gv "Enable compiler for GraphViz" ON)
85 THRIFT_ADD_COMPILER(haxe "Enable compiler for Haxe" ON)
86 THRIFT_ADD_COMPILER(hs "Enable compiler for Haskell" ON)
87 THRIFT_ADD_COMPILER(html "Enable compiler for HTML Documentation" ON)
88 THRIFT_ADD_COMPILER(java "Enable compiler for Java" ON)
89 THRIFT_ADD_COMPILER(javame "Enable compiler for Java ME" ON)
90 THRIFT_ADD_COMPILER(js "Enable compiler for JavaScript" ON)
91 THRIFT_ADD_COMPILER(json "Enable compiler for JSON" ON)
92 THRIFT_ADD_COMPILER(lua "Enable compiler for Lua" ON)
93 THRIFT_ADD_COMPILER(netcore "Enable compiler for .NET Core" ON)
94 THRIFT_ADD_COMPILER(netstd "Enable compiler for .NET Standard" ON)
95 THRIFT_ADD_COMPILER(ocaml "Enable compiler for OCaml" ON)
96 THRIFT_ADD_COMPILER(perl "Enable compiler for Perl" ON)
97 THRIFT_ADD_COMPILER(php "Enable compiler for PHP" ON)
98 THRIFT_ADD_COMPILER(py "Enable compiler for Python 2.0" ON)
99 THRIFT_ADD_COMPILER(rb "Enable compiler for Ruby" ON)
100 THRIFT_ADD_COMPILER(rs "Enable compiler for Rust" ON)
101 THRIFT_ADD_COMPILER(st "Enable compiler for Smalltalk" ON)
102 THRIFT_ADD_COMPILER(swift "Enable compiler for Cocoa Swift" ON)
103 THRIFT_ADD_COMPILER(xml "Enable compiler for XML" ON)
104 THRIFT_ADD_COMPILER(xsd "Enable compiler for XSD" ON)
105
106 # Thrift is looking for include files in the src directory
107 # we also add the current binary directory for generated files
108 include_directories(${CMAKE_CURRENT_BINARY_DIR} src)
109
110 list(APPEND thrift-compiler_SOURCES ${compiler_core})
111
112 add_executable(thrift-compiler ${thrift-compiler_SOURCES})
113
114 set_target_properties(thrift-compiler PROPERTIES RUNTIME_OUTPUT_DIRECTORY bin/)
115 set_target_properties(thrift-compiler PROPERTIES OUTPUT_NAME thrift)
116
117 target_link_libraries(thrift-compiler parse)
118
119 install(TARGETS thrift-compiler DESTINATION bin)
120
121 if(BUILD_TESTING)
122 add_subdirectory(test)
123 endif()