1# Copyright 2018 Google LLC 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); you may not 4# use this file except in compliance with the License. You may obtain a copy of 5# the License at 6# 7# https://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, WITHOUT 11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12# License for the specific language governing permissions and limitations under 13# the License. 14add_library(footprint footprint.cc) 15target_link_libraries(footprint base) 16 17add_library(astc_utils 18 astc_file.cc 19 endpoint_codec.cc 20 integer_sequence_codec.cc 21 intermediate_astc_block.cc 22 logical_astc_block.cc 23 partition.cc 24 physical_astc_block.cc 25 quantization.cc 26 weight_infill.cc) 27target_link_libraries(astc_utils PRIVATE base footprint) 28target_include_directories(astc_utils PRIVATE ../..) 29 30add_library(astc-codec codec.cc) 31target_link_libraries(astc-codec PRIVATE astc_utils) 32target_include_directories(astc-codec PUBLIC ../../include) 33target_include_directories(astc-codec PRIVATE ../..) 34 35add_executable(astc_inspector_cli tools/astc_inspector_cli.cc) 36target_include_directories(astc_inspector_cli PRIVATE ../..) 37target_link_libraries(astc_inspector_cli PRIVATE astc_utils) 38 39# 40# Testing 41# 42if(OPTION_ASTC_TESTS) 43 # Note that we will execute all the tests in the project directory. 44 # We do this to ensure the unit tests can pick up the required test data 45 46 # Create interface library exposing the root as an include directory 47 add_library(codec_test_dependencies INTERFACE) 48 target_include_directories(codec_test_dependencies INTERFACE ../..) 49 50 add_executable(physical_astc_block_test test/physical_astc_block_test.cc) 51 add_test(NAME physical_astc_block_test COMMAND physical_astc_block_test WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) 52 target_link_libraries(physical_astc_block_test astc_utils codec_test_dependencies gmock_main) 53 54 add_executable(partition_test test/partition_test.cc) 55 add_test(NAME partition_test COMMAND partition_test WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) 56 target_link_libraries(partition_test PRIVATE astc_utils codec_test_dependencies gmock_main) 57 58 add_executable(integer_sequence_codec_test test/integer_sequence_codec_test.cc) 59 target_link_libraries(integer_sequence_codec_test PRIVATE astc_utils codec_test_dependencies gmock_main) 60 61 add_executable(intermediate_astc_block_test test/intermediate_astc_block_test.cc) 62 add_test(NAME intermediate_astc_block_test COMMAND intermediate_astc_block_test WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) 63 target_link_libraries(intermediate_astc_block_test PRIVATE astc_utils codec_test_dependencies gmock_main) 64 65 add_executable(quantization_test test/quantization_test.cc) 66 add_test(NAME quantization_test COMMAND quantization_test WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) 67 target_link_libraries(quantization_test PRIVATE astc_utils codec_test_dependencies gmock_main) 68 69 add_executable(weight_infill_test test/weight_infill_test.cc) 70 add_test(NAME weight_infill_test COMMAND weight_infill_test WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) 71 target_link_libraries(weight_infill_test PRIVATE astc_utils footprint codec_test_dependencies gmock_main) 72 73 add_executable(endpoint_codec_test test/endpoint_codec_test.cc) 74 add_test(NAME endpoint_codec_test COMMAND endpoint_codec_test WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) 75 target_link_libraries(endpoint_codec_test PRIVATE astc_utils codec_test_dependencies gmock_main) 76 77 add_executable(logical_astc_block_test test/logical_astc_block_test.cc) 78 add_test(NAME logical_astc_block_test COMMAND logical_astc_block_test WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) 79 target_link_libraries(logical_astc_block_test PRIVATE astc_utils codec_test_dependencies gmock_main) 80 81 add_executable(codec_test test/codec_test.cc) 82 add_test(NAME codec_test COMMAND codec_test WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) 83 84 target_link_libraries(codec_test PRIVATE astc-codec codec_test_dependencies gmock_main) 85 86 add_executable(footprint_test test/footprint_test.cc) 87 add_test(NAME footprint_test COMMAND footprint_test WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) 88 target_link_libraries(footprint_test PRIVATE footprint codec_test_dependencies gmock_main) 89 90 if(OPTION_BUILD_FUZZER) 91 message(FATAL_ERROR "Not yet supported due to missing dependencies") 92 add_executable(astc_fuzzer test/astc_fuzzer.cc codec_test_dependencies gmock_main) 93 target_link_libraries(astc_fuzzer PRIVATE astc-codec honggfuzz benchmark) 94 endif() 95endif() 96