2020-08-26 22:18:31 +08:00
|
|
|
# Copyright 2020 Google LLC
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
2022-01-28 17:38:27 +08:00
|
|
|
# https://www.apache.org/licenses/LICENSE-2.0
|
2020-08-26 22:18:31 +08:00
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
2022-02-09 21:19:56 +08:00
|
|
|
cmake_minimum_required(VERSION 3.13..3.22)
|
2022-04-21 16:14:48 +08:00
|
|
|
|
2020-08-17 19:20:56 +08:00
|
|
|
project(pffft CXX C)
|
2022-04-21 16:14:48 +08:00
|
|
|
include(CTest)
|
2020-08-17 19:20:56 +08:00
|
|
|
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
|
|
|
|
2022-02-09 21:19:56 +08:00
|
|
|
if(NOT TARGET sapi::sapi)
|
|
|
|
set(SAPI_ROOT "../.." CACHE PATH "Path to the Sandboxed API source tree")
|
|
|
|
add_subdirectory("${SAPI_ROOT}"
|
|
|
|
"${CMAKE_BINARY_DIR}/sandboxed-api-build"
|
|
|
|
EXCLUDE_FROM_ALL)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
include(CheckLibraryExists)
|
|
|
|
|
|
|
|
FetchContent_Declare(pffft
|
|
|
|
GIT_REPOSITORY https://bitbucket.org/jpommier/pffft.git
|
|
|
|
GIT_TAG 988259a41d1522047a9420e6265a6ba8289c1654 # 2021-12-02
|
|
|
|
)
|
|
|
|
FetchContent_MakeAvailable(pffft)
|
|
|
|
|
2020-09-15 22:46:03 +08:00
|
|
|
add_library(pffft STATIC
|
2022-02-09 21:19:56 +08:00
|
|
|
"${pffft_SOURCE_DIR}/pffft.c"
|
|
|
|
"${pffft_SOURCE_DIR}/pffft.h"
|
|
|
|
"${pffft_SOURCE_DIR}/fftpack.c"
|
|
|
|
"${pffft_SOURCE_DIR}/fftpack.h"
|
2020-08-17 19:20:56 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
add_executable(pffft_main
|
2022-02-09 21:19:56 +08:00
|
|
|
"${pffft_SOURCE_DIR}/test_pffft.c"
|
2020-08-17 19:20:56 +08:00
|
|
|
)
|
2020-09-15 22:46:03 +08:00
|
|
|
target_link_libraries(pffft_main PRIVATE
|
|
|
|
pffft
|
2020-08-17 19:20:56 +08:00
|
|
|
)
|
|
|
|
|
2022-02-09 21:19:56 +08:00
|
|
|
check_library_exists(m sin "" _sapi_HAVE_LIBM)
|
|
|
|
if(_sapi_HAVE_LIBM)
|
|
|
|
target_link_libraries(pffft PUBLIC
|
|
|
|
m
|
|
|
|
)
|
2020-08-17 19:20:56 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
add_sapi_library(pffft_sapi
|
2020-09-15 22:46:03 +08:00
|
|
|
FUNCTIONS pffft_new_setup
|
|
|
|
pffft_destroy_setup
|
|
|
|
pffft_transform
|
|
|
|
pffft_transform_ordered
|
|
|
|
pffft_zreorder
|
|
|
|
pffft_zconvolve_accumulate
|
|
|
|
pffft_aligned_malloc
|
|
|
|
pffft_aligned_free
|
|
|
|
pffft_simd_size
|
|
|
|
cffti
|
|
|
|
cfftf
|
|
|
|
cfftb
|
|
|
|
rffti
|
|
|
|
rfftf
|
|
|
|
rfftb
|
|
|
|
cosqi
|
|
|
|
cosqf
|
|
|
|
cosqb
|
|
|
|
costi
|
|
|
|
cost
|
|
|
|
sinqi
|
|
|
|
sinqb
|
|
|
|
sinqf
|
|
|
|
sinti
|
|
|
|
sint
|
|
|
|
|
2022-02-09 21:19:56 +08:00
|
|
|
INPUTS "${pffft_SOURCE_DIR}/pffft.h"
|
|
|
|
"${pffft_SOURCE_DIR}/fftpack.h"
|
2020-09-15 22:46:03 +08:00
|
|
|
LIBRARY pffft
|
|
|
|
LIBRARY_NAME Pffft
|
|
|
|
|
|
|
|
NAMESPACE ""
|
2020-08-17 19:20:56 +08:00
|
|
|
)
|
2022-02-09 21:19:56 +08:00
|
|
|
add_library(sapi_contrib::pffft ALIAS pffft_sapi)
|
2020-08-17 19:20:56 +08:00
|
|
|
target_include_directories(pffft_sapi INTERFACE
|
2020-09-15 22:46:03 +08:00
|
|
|
"${PROJECT_BINARY_DIR}"
|
2022-02-09 21:19:56 +08:00
|
|
|
"${SAPI_SOURCE_DIR}"
|
2020-08-17 19:20:56 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
add_executable(pffft_sandboxed
|
2020-09-15 22:46:03 +08:00
|
|
|
main_pffft_sandboxed.cc
|
2020-08-17 19:20:56 +08:00
|
|
|
)
|
2022-04-29 17:13:32 +08:00
|
|
|
target_link_libraries(pffft_sandboxed
|
|
|
|
PRIVATE sapi_contrib::pffft
|
|
|
|
absl::flags
|
|
|
|
absl::flags_parse
|
|
|
|
sapi::logging
|
|
|
|
sapi::sapi
|
2020-09-15 22:46:03 +08:00
|
|
|
)
|