-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
87 lines (73 loc) · 2.74 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
cmake_minimum_required(VERSION 3.22)
option(TODDS_ISPC "Use bc7e_ispc and SIMD for BC7 encoding." ON)
option(TODDS_MIMALLOC_ALLOCATOR "Use mimalloc." OFF)
option(TODDS_NEON_SIMD "Use Neon SIMD instructions instead of defaulting to x64 ones." OFF)
option(TODDS_PIPELINE_DUMP "Dump the binary data generated by each pipeline stage. Limited to a single file. The dump files will be generated next to the todds executable." OFF)
option(TODDS_REGULAR_EXPRESSIONS "Compile todds with Hyperscan support" ON)
option(TODDS_TBB_ALLOCATOR "Use OneAPI TBB scalable_allocator." OFF)
option(TODDS_TRACY "Compile todds with Tracy Profiler support" OFF)
option(TODDS_UNIT_TESTS "Build todds unit tests" OFF)
# Update vcpkg manifest features depending on the chosen todds CMake options.
if (TODDS_MIMALLOC_ALLOCATOR)
list(APPEND VCPKG_MANIFEST_FEATURES "mimalloc")
endif ()
if (TODDS_PIPELINE_DUMP)
list(APPEND VCPKG_MANIFEST_FEATURES "program-location")
endif ()
if (TODDS_REGULAR_EXPRESSIONS)
list(APPEND VCPKG_MANIFEST_FEATURES "regex")
endif ()
if (TODDS_TRACY)
list(APPEND VCPKG_MANIFEST_FEATURES "profiling")
endif ()
if (TODDS_UNIT_TESTS)
list(APPEND VCPKG_MANIFEST_FEATURES "tests")
endif ()
project(ToDDS
VERSION 0.4.1
DESCRIPTION "A CPU-based DDS texture encoder optimized for fast batch conversions with high encoding quality."
HOMEPAGE_URL "https://github.com/todds-encoder/todds"
)
# Set the C++ standard used by this project.
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Disable non-standard compiler extensions.
set(CMAKE_CXX_EXTENSIONS OFF)
# Export compile commands information.
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
include(cmake/platform.cmake)
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules")
find_package(Boost 1.73 REQUIRED COMPONENTS
# Support UTF-8 on Windows.
nowide
# Use UTF-8 when converting char*/string to filesystem::path and vice-versa.
filesystem
)
find_package(fmt REQUIRED)
if (TODDS_REGULAR_EXPRESSIONS)
find_package(Hyperscan REQUIRED)
endif ()
find_package(OpenCV 4.0 REQUIRED)
find_package(Threads REQUIRED)
find_package(TBB 2021.5.0 REQUIRED)
if (TODDS_TRACY)
find_package(Tracy REQUIRED)
add_compile_definitions(TRACY_ENABLE)
link_libraries(Tracy::TracyClient)
endif ()
if (TODDS_MIMALLOC_ALLOCATOR)
find_package(mimalloc REQUIRED)
endif ()
add_subdirectory(thirdparty)
include_directories(SYSTEM ${OpenCV_INCLUDE_DIRS})
include(cmake/clang_tidy.cmake)
include(cmake/warnings.cmake)
include(cmake/sanitizer.cmake)
include(cmake/options.cmake)
add_subdirectory(src)
if (TODDS_UNIT_TESTS)
add_subdirectory(test)
endif ()