forked from Tugbars/Savitzky-Golay-Filter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
88 lines (76 loc) · 2.93 KB
/
CMakeLists.txt
File metadata and controls
88 lines (76 loc) · 2.93 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
# Minimum CMake version required
cmake_minimum_required(VERSION 3.15)
if(POLICY CMP0091)
cmake_policy(SET CMP0091 NEW)
endif()
# Project name and languages
project(SavitzkyGolayFilter LANGUAGES C CXX)
# Set C and C++ standards
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# =============================================================================
# BUILD OPTIONS
# =============================================================================
include (GNUInstallDirs)
set(INSTALL_BINDIR
${CMAKE_INSTALL_BINDIR} CACHE PATH "Installation directory for binaries")
set(INSTALL_LIBDIR
${CMAKE_INSTALL_LIBDIR} CACHE PATH "Installation directory for libraries")
set(INSTALL_INCLUDEDIR
${CMAKE_INSTALL_INCLUDEDIR} CACHE PATH "Installation directory for header files")
option(USE_PARALLEL_SAVGOL "Build parallel (OpenMP) version of Savitzky-Golay filter" OFF)
# Print selected build mode
if(USE_PARALLEL_SAVGOL)
message(STATUS "Building PARALLEL Savitzky-Golay implementation (with OpenMP)")
else()
message(STATUS "Building SEQUENTIAL Savitzky-Golay implementation")
endif()
# Ensure Cygwin runtime linkage for all targets
if (CYGWIN)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lc -lcygwin")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -lc -lcygwin")
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} -lc -lcygwin")
endif()
# Fetch GoogleTest
include(FetchContent)
# Forces GoogleTest to link against the Shared C Runtime (MSVC /MD), ensuring
# consistency with the project's runtime settings and preventing linker conflicts.
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.12.1
)
FetchContent_MakeAvailable(googletest)
# Suppress specific IntelLLVM compiler warnings for GoogleTest targets to prevent
# build failures when "Warnings as Errors" is enabled, specifically addressing
# char16_t to char32_t conversions.
if (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")
foreach(_target gtest gtest_main gmock gmock_main)
if(TARGET ${_target})
target_compile_options(${_target} PRIVATE "-W0" "-Wno-error=character-conversion")
endif()
endforeach()
endif()
# Fetch FFF (Fake Function Framework)
FetchContent_Declare(
fff
GIT_REPOSITORY https://github.com/meekrosoft/fff.git
GIT_TAG master
)
FetchContent_MakeAvailable(fff)
# =============================================================================
# INCLUDE SUBDIRECTORIES
# =============================================================================
# Conditionally include the appropriate implementation
if(USE_PARALLEL_SAVGOL)
#add_subdirectory(src/parallel)
else()
add_subdirectory(src)
endif()
# Always include tests (they should work with either implementation)
add_subdirectory(test/iterative)
# Enable testing
enable_testing()