• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#  SPDX-License-Identifier: Apache-2.0
2#  ----------------------------------------------------------------------------
3#  Copyright 2021 Arm Limited
4#
5#  Licensed under the Apache License, Version 2.0 (the "License"); you may not
6#  use this file except in compliance with the License. You may obtain a copy
7#  of the License at:
8#
9#      http://www.apache.org/licenses/LICENSE-2.0
10#
11#  Unless required by applicable law or agreed to in writing, software
12#  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13#  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14#  License for the specific language governing permissions and limitations
15#  under the License.
16#  ----------------------------------------------------------------------------
17
18# CMake configuration
19cmake_minimum_required(VERSION 3.15)
20include(ExternalProject)
21
22project(astcencoder_example VERSION 1.0.0)
23
24# Add the external project and pull out the project directories we need
25
26# The default build is a native build which supports the highest level of SIMD
27# exposed by the compiler when using default compiler flags. Add a single
28# SIMD enable to the CMAKE_CACHE_ARGS option to force something specific, but
29# remember to change the link library in target_link_libraries() to match.
30#
31#  *  Add "-DISA_SSE2:String=ON" and link against "astcenc-sse2-static"
32#  *  Add "-DISA_SSE41:String=ON" and link against "astcenc-sse4.1-static"
33#  *  Add "-DISA_AVX2:String=ON" and link against "astcenc-avx2-static"
34#  *  Add "-DISA_NEON:String=ON" and link against "astcenc-neon-static"
35ExternalProject_Add(astcencoder
36    GIT_REPOSITORY https://github.com/ARM-software/astc-encoder
37    GIT_TAG main
38    CMAKE_CACHE_ARGS -DCLI:STRING=OFF -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
39    INSTALL_COMMAND "")
40
41ExternalProject_Get_property(astcencoder
42    SOURCE_DIR)
43
44ExternalProject_Get_property(astcencoder
45    BINARY_DIR)
46
47# Build the command line
48add_executable(astcenc_example astc_api_example.cpp)
49
50# ... with astcencoder as a dependency
51add_dependencies(astcenc_example astcencoder)
52
53# ... with astcencoder Source dir on the include path
54target_include_directories(astcenc_example
55    PRIVATE
56        ${SOURCE_DIR}/Source)
57
58# ... with astcencoder Binary dir on the library path and as a library dep
59target_link_directories(astcenc_example
60    PRIVATE
61        ${BINARY_DIR}/Source)
62
63target_link_libraries(astcenc_example
64    PRIVATE
65        astcenc-native-static)
66