-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
128 lines (106 loc) · 5.24 KB
/
CMakeLists.txt
File metadata and controls
128 lines (106 loc) · 5.24 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
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# _____ _ _ __ #
# / ____| | | |/ / #
# ___ _ __ ___ _ __ | | __ | | ' / #
# / _ \| '_ \ / _ \ '_ \| | |_ |_ | | < #
# | (_) | |_) | __/ | | | |__| | |__| | . \ #
# \___/| .__/ \___|_| |_|\_____|\_____/|_|\_\ #
# | | #
# |_| #
# #
# Copyright 2022-2026 Mattia Montanari, University of Oxford #
# #
# Root CMakeLists.txt for OpenGJK - builds both scalar and SIMD variants #
# #
# This program is free software: you can redistribute it and/or modify it under #
# the terms of the GNU General Public License as published by the Free Software #
# Foundation, either version 3 of the License. You should have received a copy #
# of the GNU General Public License along with this program. If not, visit #
# #
# https://www.gnu.org/licenses/ #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
# FOR A PARTICULAR PURPOSE. See GNU General Public License for details. #
cmake_minimum_required(VERSION 3.14)
project(openGJK
VERSION 3.0.0
DESCRIPTION "GJK algorithm for computing minimum distance between convex shapes"
LANGUAGES C CXX)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Build type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
endif()
# Options
option(BUILD_SCALAR "Build scalar (C) implementation" ON)
option(BUILD_SIMD "Build SIMD (C++ Highway) implementation" ON)
option(BUILD_GPU "Build GPU (CUDA) implementation" OFF)
option(BUILD_TESTS "Build unit tests" ON)
option(BUILD_EXAMPLES "Build example applications" ON)
option(USE_32BITS "Use float instead of double" ON)
# Precision definition (shared between scalar and SIMD)
if(USE_32BITS)
add_compile_definitions(USE_32BITS)
endif()
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
message(STATUS "Building scalar: ${BUILD_SCALAR}")
message(STATUS "Building SIMD: ${BUILD_SIMD}")
message(STATUS "Building GPU: ${BUILD_GPU}")
message(STATUS "Building tests: ${BUILD_TESTS}")
message(STATUS "Building examples: ${BUILD_EXAMPLES}")
message(STATUS "Using 32-bit floats: ${USE_32BITS}")
# ============================================================================
# Testing (before subdirectories so both scalar and SIMD can register tests)
# ============================================================================
if(BUILD_TESTS)
enable_testing()
include(CTest)
message(STATUS "Tests enabled. Run 'ctest' or 'make test' to run tests.")
endif()
# ============================================================================
# Scalar Implementation
# ============================================================================
if(BUILD_SCALAR)
add_subdirectory(scalar)
endif()
# ============================================================================
# SIMD Implementation
# ============================================================================
if(BUILD_SIMD)
add_subdirectory(simd)
endif()
# ============================================================================
# GPU Implementation
# ============================================================================
if(BUILD_GPU)
enable_language(CUDA)
add_subdirectory(gpu)
endif()
# ============================================================================
# Package Configuration
# ============================================================================
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/opengjk-config-version.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion
)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/opengjk-config.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/opengjk-config.cmake"
@ONLY
)
# ============================================================================
# Summary
# ============================================================================
message(STATUS "")
message(STATUS "OpenGJK v${PROJECT_VERSION} Configuration Summary:")
message(STATUS " - Scalar library: ${BUILD_SCALAR}")
message(STATUS " - SIMD library: ${BUILD_SIMD}")
message(STATUS " - GPU library: ${BUILD_GPU}")
message(STATUS " - Tests: ${BUILD_TESTS}")
message(STATUS " - Examples: ${BUILD_EXAMPLES}")
message(STATUS " - Precision: ${USE_32BITS} (32-bit float)")
message(STATUS "")