1# Copyright 2018 The Chromium Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5source_set("msgs") { 6 sources = [ 7 target_gen_dir + "/osp_messages.cc", 8 target_gen_dir + "/osp_messages.h", 9 ] 10 11 public_deps = [ ":cddl_gen" ] 12 deps = [ 13 "../../third_party/abseil", 14 "../../third_party/tinycbor", 15 ] 16 17 public_configs = [ 18 ":cddl_gen_config", 19 "../../build:openscreen_include_dirs", 20 ] 21} 22 23config("cddl_gen_config") { 24 include_dirs = [ "$root_gen_dir" + "/" + rebase_path("../..", "//") ] 25} 26 27action("cddl_gen") { 28 script = "../../tools/cddl/cddl.py" 29 sources = [ "osp_messages.cddl" ] 30 outputs_src = rebase_path([ 31 "osp_messages.h", 32 "osp_messages.cc", 33 ], 34 "//") 35 outputs = [] 36 foreach(o, outputs_src) { 37 outputs += [ root_gen_dir + "/" + o ] 38 } 39 40 cddl_label = "../../tools/cddl:cddl($host_toolchain)" 41 cddl_path = get_label_info(cddl_label, "root_out_dir") + "/cddl" 42 args = 43 [ 44 "--cddl", 45 46 # Path should be rebased because |root_build_dir| for current toolchain 47 # may be different from |root_out_dir| of cddl built on host toolchain. 48 "./" + rebase_path(cddl_path, root_build_dir), 49 "--header", 50 outputs_src[0], 51 "--cc", 52 outputs_src[1], 53 "--gen-dir", 54 rebase_path(root_gen_dir, root_build_dir), 55 "--log", 56 rebase_path("cddl.log", "//"), 57 ] + rebase_path(sources, root_build_dir) 58 59 deps = [ cddl_label ] 60} 61 62source_set("unittests") { 63 testonly = true 64 65 sources = [ "messages_unittest.cc" ] 66 67 deps = [ 68 ":msgs", 69 "../../third_party/googletest:gtest", 70 ] 71} 72