• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14# ==============================================================================
15set(tf_tools_proto_text_src_dir "${tensorflow_source_dir}/tensorflow/tools/proto_text")
16
17file(GLOB tf_tools_proto_text_srcs
18    "${tf_tools_proto_text_src_dir}/gen_proto_text_functions.cc"
19    "${tf_tools_proto_text_src_dir}/gen_proto_text_functions_lib.h"
20    "${tf_tools_proto_text_src_dir}/gen_proto_text_functions_lib.cc"
21)
22
23set(proto_text "proto_text")
24
25add_executable(${proto_text}
26    ${tf_tools_proto_text_srcs}
27    $<TARGET_OBJECTS:tf_core_lib>
28)
29
30target_link_libraries(${proto_text} PUBLIC
31  ${tensorflow_EXTERNAL_LIBRARIES}
32  tf_protos_cc
33)
34
35add_dependencies(${proto_text} tf_core_lib)
36if(tensorflow_ENABLE_GRPC_SUPPORT)
37    add_dependencies(${proto_text} grpc)
38endif(tensorflow_ENABLE_GRPC_SUPPORT)
39
40file(GLOB_RECURSE tf_tools_transform_graph_lib_srcs
41    "${tensorflow_source_dir}/tensorflow/tools/graph_transforms/*.h"
42    "${tensorflow_source_dir}/tensorflow/tools/graph_transforms/*.cc"
43)
44
45file(GLOB_RECURSE tf_tools_transform_graph_lib_exclude_srcs
46    "${tensorflow_source_dir}/tensorflow/tools/graph_transforms/*test*.h"
47    "${tensorflow_source_dir}/tensorflow/tools/graph_transforms/*test*.cc"
48    "${tensorflow_source_dir}/tensorflow/tools/graph_transforms/compare_graphs.cc"
49    "${tensorflow_source_dir}/tensorflow/tools/graph_transforms/summarize_graph_main.cc"
50    "${tensorflow_source_dir}/tensorflow/tools/graph_transforms/transform_graph_main.cc"
51)
52list(REMOVE_ITEM tf_tools_transform_graph_lib_srcs ${tf_tools_transform_graph_lib_exclude_srcs})
53
54add_library(tf_tools_transform_graph_lib OBJECT ${tf_tools_transform_graph_lib_srcs})
55add_dependencies(tf_tools_transform_graph_lib tf_core_cpu)
56add_dependencies(tf_tools_transform_graph_lib tf_core_framework)
57add_dependencies(tf_tools_transform_graph_lib tf_core_kernels)
58add_dependencies(tf_tools_transform_graph_lib tf_core_lib)
59add_dependencies(tf_tools_transform_graph_lib tf_core_ops)
60
61set(transform_graph "transform_graph")
62
63add_executable(${transform_graph}
64    "${tensorflow_source_dir}/tensorflow/tools/graph_transforms/transform_graph_main.cc"
65    $<TARGET_OBJECTS:tf_tools_transform_graph_lib>
66    $<TARGET_OBJECTS:tf_core_lib>
67    $<TARGET_OBJECTS:tf_core_cpu>
68    $<TARGET_OBJECTS:tf_core_framework>
69    $<TARGET_OBJECTS:tf_core_ops>
70    $<TARGET_OBJECTS:tf_core_direct_session>
71    $<TARGET_OBJECTS:tf_tools_transform_graph_lib>
72    $<TARGET_OBJECTS:tf_core_kernels>
73    $<$<BOOL:${tensorflow_ENABLE_GPU}>:$<$<BOOL:${BOOL_WIN32}>:$<TARGET_OBJECTS:tf_core_kernels_cpu_only>>>
74    $<$<BOOL:${tensorflow_ENABLE_GPU}>:$<TARGET_OBJECTS:tf_stream_executor>>
75)
76
77target_link_libraries(${transform_graph} PUBLIC
78  tf_protos_cc
79  ${tf_core_gpu_kernels_lib}
80  ${tensorflow_EXTERNAL_LIBRARIES}
81)
82
83set(summarize_graph "summarize_graph")
84
85add_executable(${summarize_graph}
86    "${tensorflow_source_dir}/tensorflow/tools/graph_transforms/summarize_graph_main.cc"
87    $<TARGET_OBJECTS:tf_tools_transform_graph_lib>
88    $<TARGET_OBJECTS:tf_core_lib>
89    $<TARGET_OBJECTS:tf_core_cpu>
90    $<TARGET_OBJECTS:tf_core_framework>
91    $<TARGET_OBJECTS:tf_core_ops>
92    $<TARGET_OBJECTS:tf_core_direct_session>
93    $<TARGET_OBJECTS:tf_tools_transform_graph_lib>
94    $<TARGET_OBJECTS:tf_core_kernels>
95    $<$<BOOL:${tensorflow_ENABLE_GPU}>:$<$<BOOL:${BOOL_WIN32}>:$<TARGET_OBJECTS:tf_core_kernels_cpu_only>>>
96    $<$<BOOL:${tensorflow_ENABLE_GPU}>:$<TARGET_OBJECTS:tf_stream_executor>>
97)
98
99target_link_libraries(${summarize_graph} PUBLIC
100  tf_protos_cc
101  ${tf_core_gpu_kernels_lib}
102  ${tensorflow_EXTERNAL_LIBRARIES}
103)
104
105set(compare_graphs "compare_graphs")
106
107add_executable(${compare_graphs}
108    "${tensorflow_source_dir}/tensorflow/tools/graph_transforms/compare_graphs.cc"
109    $<TARGET_OBJECTS:tf_tools_transform_graph_lib>
110    $<TARGET_OBJECTS:tf_core_lib>
111    $<TARGET_OBJECTS:tf_core_cpu>
112    $<TARGET_OBJECTS:tf_core_framework>
113    $<TARGET_OBJECTS:tf_core_ops>
114    $<TARGET_OBJECTS:tf_core_direct_session>
115    $<TARGET_OBJECTS:tf_tools_transform_graph_lib>
116    $<TARGET_OBJECTS:tf_core_kernels>
117    $<$<BOOL:${tensorflow_ENABLE_GPU}>:$<$<BOOL:${BOOL_WIN32}>:$<TARGET_OBJECTS:tf_core_kernels_cpu_only>>>
118    $<$<BOOL:${tensorflow_ENABLE_GPU}>:$<TARGET_OBJECTS:tf_stream_executor>>
119)
120
121target_link_libraries(${compare_graphs} PUBLIC
122  tf_protos_cc
123  ${tf_core_gpu_kernels_lib}
124  ${tensorflow_EXTERNAL_LIBRARIES}
125)
126
127set(benchmark_model "benchmark_model")
128
129add_executable(${benchmark_model}
130    "${tensorflow_source_dir}/tensorflow/tools/benchmark/benchmark_model.cc"
131    "${tensorflow_source_dir}/tensorflow/tools/benchmark/benchmark_model_main.cc"
132    $<TARGET_OBJECTS:tf_core_lib>
133    $<TARGET_OBJECTS:tf_core_cpu>
134    $<TARGET_OBJECTS:tf_core_framework>
135    $<TARGET_OBJECTS:tf_core_ops>
136    $<TARGET_OBJECTS:tf_core_direct_session>
137    $<TARGET_OBJECTS:tf_core_kernels>
138    $<$<BOOL:${tensorflow_ENABLE_GPU}>:$<$<BOOL:${BOOL_WIN32}>:$<TARGET_OBJECTS:tf_core_kernels_cpu_only>>>
139    $<$<BOOL:${tensorflow_ENABLE_GPU}>:$<TARGET_OBJECTS:tf_stream_executor>>
140)
141
142target_link_libraries(${benchmark_model} PUBLIC
143  tf_protos_cc
144  ${tf_core_gpu_kernels_lib}
145  ${tensorflow_EXTERNAL_LIBRARIES}
146)
147
148install(TARGETS ${transform_graph} ${summarize_graph} ${compare_graphs} ${benchmark_model}
149        RUNTIME DESTINATION bin
150        LIBRARY DESTINATION lib
151        ARCHIVE DESTINATION lib)
152