-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
57 lines (46 loc) · 1.94 KB
/
CMakeLists.txt
File metadata and controls
57 lines (46 loc) · 1.94 KB
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
#
# file: CMakeLists.txt
# author: Sho Ikeda
#
# Copyright (c) 2026 Advanced Micro Devices, Inc. All Rights Reserved.
#
# SPDX-License-Identifier: MIT
#
cmake_minimum_required(VERSION 3.21)
# CMake dependencies
include(${CMAKE_CURRENT_LIST_DIR}/cmake/options.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/cmake/project.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/cmake/utility.cmake)
set(project_desc "A minimal DirectX-based neural network library")
project(MiniDXNN DESCRIPTION ${project_desc} VERSION 0.2.0 LANGUAGES CXX)
# Configure project options (build flags, sanitizers, etc.)
setProjectOptions()
# Top-level project configuration
# Only applied when MiniDXNN is the main project (not when included as a subproject)
if(PROJECT_IS_TOP_LEVEL)
# Configure available build types (multi-config generators like Visual Studio)
set(CMAKE_CONFIGURATION_TYPES "Debug" "RelWithDebInfo" "Release")
# Set default build type for single-config generators (Unix Makefiles, Ninja)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Debug")
message(STATUS "CMAKE_BUILD_TYPE not set, defaulting to Debug")
endif()
# Generate compile_commands.json for IDE integration and tools (clangd, clang-tidy, etc.)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
endif()
# Build third-party dependencies
add_subdirectory("${PROJECT_SOURCE_DIR}/third_party" "${PROJECT_BINARY_DIR}/third_party")
# Configure MiniDXNN core library
setMiniDXNNCore(minidxnn-core)
checkTarget(minidxnn-core)
# Configure and build examples
if(PROJECT_IS_TOP_LEVEL AND MINIDXNN_BUILD_EXAMPLES)
message(STATUS "Enable examples")
add_subdirectory("${PROJECT_SOURCE_DIR}/example" "${PROJECT_BINARY_DIR}/example")
endif()
# Configure and build unit tests
if(PROJECT_IS_TOP_LEVEL AND MINIDXNN_BUILD_TESTS)
message(STATUS "Enable unittests")
enable_testing()
add_subdirectory("${PROJECT_SOURCE_DIR}/unittest" "${PROJECT_BINARY_DIR}/unittest")
endif()