Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ jobs:
new_plugin_ver=$tag-API$plugin_api
mkdir shared
cp -r $build_dir/*.so shared
cp -r libs/linux/bin/* shared
fftw_runtime_dir=$(cat Build/fftw-runtime-path.txt)
cp -r "$fftw_runtime_dir"/* shared
fftw_notices_dir=$(cat Build/fftw-notices-path.txt)
mkdir -p licenses
cp -r "$fftw_notices_dir" licenses/fftw
zipfile=${package}_${new_plugin_ver}.zip
zip -r -X $zipfile shared
zip -r -X $zipfile shared licenses
curl --fail --show-error --retry 3 -H "X-JFrog-Art-Api:$ARTIFACTORY_ACCESS_TOKEN" -T "$zipfile" "https://openephys.jfrog.io/artifactory/OpenEphysFFTW-plugin/linux/$zipfile"
11 changes: 8 additions & 3 deletions .github/workflows/mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ jobs:

mkdir shared
cp -r $build_dir/*.dylib shared
cp -r libs/macos/bin/* shared
fftw_runtime_dir=$(cat Build/fftw-runtime-path.txt)
cp -r "$fftw_runtime_dir"/* shared
fftw_notices_dir=$(cat Build/fftw-notices-path.txt)
mkdir -p licenses
cp -r "$fftw_notices_dir" licenses/fftw

# Turn our base64-encoded certificate back to a regular .p12 file
printf '%s' "$MACOS_CERTIFICATE" | base64 --decode > certificate.p12
Expand All @@ -75,10 +79,11 @@ jobs:
security import certificate.p12 -k build.keychain -P $MACOS_CERTIFICATE_PWD -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $MACOS_CI_KEYCHAIN_PWD build.keychain
/usr/bin/codesign --force -s "$MACOS_CERTIFICATE_NAME" -v shared/libOpenEphysFFTW.dylib --deep --strict --timestamp --options=runtime
/usr/bin/codesign --force -s "$MACOS_CERTIFICATE_NAME" -v shared/libfftw3.3.6.9.dylib --deep --strict --timestamp --options=runtime
/usr/bin/codesign --force -s "$MACOS_CERTIFICATE_NAME" -v shared/libfftw3.3.dylib --deep --strict --timestamp --options=runtime
/usr/bin/codesign --force -s "$MACOS_CERTIFICATE_NAME" -v shared/libfftw3f.3.dylib --deep --strict --timestamp --options=runtime

/usr/bin/codesign -dv --verbose=4 shared/libOpenEphysFFTW.dylib

zipfile=${package}_${new_plugin_ver}.zip
zip -r -X $zipfile shared
zip -r -X $zipfile shared licenses
curl --fail --show-error --retry 3 -H "X-JFrog-Art-Api:$ARTIFACTORY_ACCESS_TOKEN" -T "$zipfile" "https://openephys.jfrog.io/artifactory/OpenEphysFFTW-plugin/mac/$zipfile"
11 changes: 6 additions & 5 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,12 @@ jobs:
new_plugin_ver=$tag-API$plugin_api
mkdir shared
cp -v $build_dir/*.dll shared
if [ -d "libs" ]
then
cp -v libs/windows/bin/x64/*.dll shared
fi
fftw_runtime_dir=$(cat Build/fftw-runtime-path.txt)
cp -v "$fftw_runtime_dir"/*.dll shared
fftw_notices_dir=$(cat Build/fftw-notices-path.txt)
mkdir -p licenses
cp -r "$fftw_notices_dir" licenses/fftw
zipfile=${package}_${new_plugin_ver}.zip
powershell Compress-Archive -Path "shared" -DestinationPath ${zipfile}
powershell Compress-Archive -Path "shared","licenses" -DestinationPath ${zipfile}
curl --fail --show-error --retry 3 -H "X-JFrog-Art-Api:$ARTIFACTORY_ACCESS_TOKEN" -T "$zipfile" "https://openephys.jfrog.io/artifactory/OpenEphysFFTW-plugin/windows/$zipfile"
shell: bash
38 changes: 27 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ file(GLOB_RECURSE HEADER_FILES LIST_DIRECTORIES false "${SOURCE_PATH}/*.h")
list(APPEND SRC_FILES ${HEADER_FILES})
set(GUI_COMMONLIB_DIR ${GUI_BASE_DIR}/installed_libs)

include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/AcquireFFTW.cmake)
openephys_acquire_fftw(FFTW_BUNDLE_ROOT)

list(APPEND CMAKE_PREFIX_PATH
${GUI_COMMONLIB_DIR}
${GUI_COMMONLIB_DIR}/$<CONFIG>
Expand Down Expand Up @@ -67,6 +70,8 @@ install(TARGETS ${COMMONLIB_NAME}
RUNTIME DESTINATION ${GUI_COMMONLIB_DIR}/$<CONFIG>/bin/${CMAKE_LIBRARY_ARCHITECTURE} # .dll files
)
install(FILES ${HEADER_FILES} DESTINATION ${GUI_COMMONLIB_DIR}/include)
install(DIRECTORY ${FFTW_BUNDLE_ROOT}/share/fftw
DESTINATION ${GUI_COMMONLIB_DIR}/share)

#Libraries and compiler options
if(MSVC)
Expand All @@ -75,8 +80,6 @@ if(MSVC)

install(TARGETS ${COMMONLIB_NAME} RUNTIME DESTINATION ${GUI_BIN_DIR}/shared)

list(APPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/libs/windows)

elseif(LINUX)
target_link_libraries(${COMMONLIB_NAME} GL X11 Xext Xinerama asound dl freetype pthread rt)
set_property(TARGET ${COMMONLIB_NAME} APPEND_STRING PROPERTY LINK_FLAGS
Expand All @@ -86,8 +89,6 @@ elseif(LINUX)

install(TARGETS ${COMMONLIB_NAME} LIBRARY DESTINATION ${GUI_BIN_DIR}/shared)

list(APPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/libs/linux)

elseif(APPLE)
set_target_properties(${COMMONLIB_NAME} PROPERTIES BUNDLE FALSE)
set_property(TARGET ${COMMONLIB_NAME} APPEND_STRING PROPERTY LINK_FLAGS
Expand All @@ -97,7 +98,6 @@ elseif(APPLE)
XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED NO)

install(TARGETS ${COMMONLIB_NAME} DESTINATION $ENV{HOME}/Library/Application\ Support/open-ephys/shared-api10)
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/libs/macos)
endif()

#create filters for vs and xcode
Expand All @@ -111,27 +111,43 @@ endforeach()

#additional libraries

find_library(FFTW_LIBRARY NAMES libfftw3-3 fftw3 fftw3-3)
find_path(FFTW_INCLUDE_DIRS fftw3.h)
unset(FFTW_LIBRARY CACHE)
unset(FFTWF_LIBRARY CACHE)
unset(FFTW_INCLUDE_DIRS CACHE)
find_library(FFTW_LIBRARY NAMES libfftw3-3 fftw3 fftw3-3
PATHS "${FFTW_BUNDLE_ROOT}/lib" NO_DEFAULT_PATH)
find_library(FFTWF_LIBRARY NAMES libfftw3f-3 fftw3f fftw3f-3
PATHS "${FFTW_BUNDLE_ROOT}/lib" NO_DEFAULT_PATH)
find_path(FFTW_INCLUDE_DIRS fftw3.h
PATHS "${FFTW_BUNDLE_ROOT}/include" NO_DEFAULT_PATH)

if (NOT FFTW_LIBRARY)
message(FATAL_ERROR "FFTW library not found")
else()
message(STATUS "FFTW library: ${FFTW_LIBRARY}")
endif()

if (NOT FFTWF_LIBRARY)
message(FATAL_ERROR "Single-precision FFTW library not found")
else()
message(STATUS "Single-precision FFTW library: ${FFTWF_LIBRARY}")
endif()

if (NOT FFTW_INCLUDE_DIRS)
message(FATAL_ERROR "FFTW header not found")
endif()


if (MSVC)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/libs/windows/bin/${CMAKE_LIBRARY_ARCHITECTURE}/ DESTINATION ${GUI_BIN_DIR}/shared CONFIGURATIONS ${CMAKE_CONFIGURATION_TYPES})
install(DIRECTORY ${FFTW_BUNDLE_ROOT}/bin/ DESTINATION ${GUI_BIN_DIR}/shared CONFIGURATIONS ${CMAKE_CONFIGURATION_TYPES})
elseif(LINUX)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/libs/linux/bin/ DESTINATION ${GUI_BIN_DIR}/shared)
install(DIRECTORY ${FFTW_BUNDLE_ROOT}/bin/ DESTINATION ${GUI_BIN_DIR}/shared)
elseif(APPLE)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/libs/macos/bin/ DESTINATION $ENV{HOME}/Library/Application\ Support/open-ephys/shared-api10)
install(DIRECTORY ${FFTW_BUNDLE_ROOT}/bin/ DESTINATION $ENV{HOME}/Library/Application\ Support/open-ephys/shared-api10)
endif()

target_link_libraries(${COMMONLIB_NAME} ${FFTW_LIBRARY})
file(WRITE "${CMAKE_BINARY_DIR}/fftw-runtime-path.txt" "${FFTW_BUNDLE_ROOT}/bin\n")
file(WRITE "${CMAKE_BINARY_DIR}/fftw-notices-path.txt" "${FFTW_BUNDLE_ROOT}/share/fftw\n")

target_link_libraries(${COMMONLIB_NAME} ${FFTW_LIBRARY} ${FFTWF_LIBRARY})
target_include_directories(${COMMONLIB_NAME} PRIVATE ${FFTW_INCLUDE_DIRS})
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,16 @@ after the immutable release exists.

This library should be built outside of the main GUI file tree using CMake. In order to do so, it must be in a sibling directory (e.g. OEPlugins) to `plugin-GUI` and the GUI must have already been compiled.

By default, CMake downloads the platform bundle from the immutable
`fftw-dependencies-3.3.11-1` release and verifies its published checksum. For
offline builds, set `FFTW_ROOT` to an extracted bundle:

```bash
cmake -S . -B Build -DFFTW_ROOT=/path/to/fftw-3.3.11-linux-x86_64
```

To exercise the normal extraction path offline, set `FFTW_ARCHIVE` to a local
archive and place its release checksum sidecar at `<archive>.sha256`, or set
`FFTW_CHECKSUM_FILE` explicitly.

See the wiki page [here](https://open-ephys.github.io/gui-docs/Developer-Guide/Compiling-plugins.html) for build instructions.
98 changes: 98 additions & 0 deletions cmake/AcquireFFTW.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
include(FetchContent)

function(openephys_acquire_fftw OUT_ROOT)
set(FFTW_DEPENDENCY_VERSION "3.3.11")
set(FFTW_DEPENDENCY_TAG "fftw-dependencies-3.3.11-1" CACHE STRING
"Immutable OpenEphysFFTW dependency release tag")
set(FFTW_RELEASE_BASE_URL
"https://github.com/open-ephys-plugins/OpenEphysFFTW/releases/download"
CACHE STRING "Base URL for OpenEphysFFTW dependency releases")
set(FFTW_ROOT "" CACHE PATH "Existing extracted FFTW dependency bundle")
set(FFTW_ARCHIVE "" CACHE FILEPATH "Local FFTW bundle archive for offline builds")
set(FFTW_CHECKSUM_FILE "" CACHE FILEPATH
"SHA-256 sidecar for FFTW_ARCHIVE; defaults to <archive>.sha256")

if(FFTW_ROOT)
get_filename_component(bundle_root "${FFTW_ROOT}" ABSOLUTE)
else()
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SIZEOF_VOID_P EQUAL 8)
set(bundle_name "fftw-${FFTW_DEPENDENCY_VERSION}-linux-x86_64")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows" AND CMAKE_SIZEOF_VOID_P EQUAL 8)
set(bundle_name "fftw-${FFTW_DEPENDENCY_VERSION}-windows-x86_64")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(bundle_name "fftw-${FFTW_DEPENDENCY_VERSION}-macos-universal")
else()
message(FATAL_ERROR
"No released FFTW bundle supports ${CMAKE_SYSTEM_NAME}/${CMAKE_SIZEOF_VOID_P}-byte pointers. "
"Set FFTW_ROOT to a compatible extracted bundle.")
endif()
set(archive_name "${bundle_name}.tar.gz")

if(FFTW_ARCHIVE)
get_filename_component(archive_url "${FFTW_ARCHIVE}" ABSOLUTE)
if(FFTW_CHECKSUM_FILE)
get_filename_component(checksum_file "${FFTW_CHECKSUM_FILE}" ABSOLUTE)
else()
set(checksum_file "${archive_url}.sha256")
endif()
if(NOT EXISTS "${archive_url}" OR NOT EXISTS "${checksum_file}")
message(FATAL_ERROR
"FFTW_ARCHIVE and its checksum sidecar must both exist")
endif()
else()
set(release_url
"${FFTW_RELEASE_BASE_URL}/${FFTW_DEPENDENCY_TAG}")
set(archive_url "${release_url}/${archive_name}")
set(checksum_dir
"${CMAKE_BINARY_DIR}/_deps/openephys-fftw-checksums/${FFTW_DEPENDENCY_TAG}")
set(checksum_file "${checksum_dir}/${archive_name}.sha256")
if(NOT EXISTS "${checksum_file}")
file(MAKE_DIRECTORY "${checksum_dir}")
set(checksum_download "${checksum_file}.download")
file(REMOVE "${checksum_download}")
file(DOWNLOAD "${archive_url}.sha256" "${checksum_download}"
TLS_VERIFY ON STATUS checksum_status)
list(GET checksum_status 0 checksum_status_code)
if(NOT checksum_status_code EQUAL 0)
file(REMOVE "${checksum_download}")
list(GET checksum_status 1 checksum_status_message)
message(FATAL_ERROR
"Could not download FFTW checksum: ${checksum_status_message}")
endif()
file(RENAME "${checksum_download}" "${checksum_file}")
endif()
endif()

file(STRINGS "${checksum_file}" checksum_line LIMIT_COUNT 1)
string(REGEX MATCH "^([0-9A-Fa-f]+)[ \t]+\\*?([^ \t\r\n]+)$"
checksum_match "${checksum_line}")
set(expected_sha256 "${CMAKE_MATCH_1}")
set(checksum_archive_name "${CMAKE_MATCH_2}")
string(LENGTH "${expected_sha256}" checksum_length)
if(NOT checksum_match OR NOT checksum_length EQUAL 64 OR
NOT checksum_archive_name STREQUAL archive_name)
message(FATAL_ERROR
"Invalid FFTW checksum sidecar: ${checksum_file}")
endif()

if(POLICY CMP0135)
cmake_policy(SET CMP0135 NEW)
endif()
FetchContent_Declare(OpenEphysFFTWDependency
URL "${archive_url}"
URL_HASH "SHA256=${expected_sha256}"
TLS_VERIFY ON)
FetchContent_MakeAvailable(OpenEphysFFTWDependency)
FetchContent_GetProperties(OpenEphysFFTWDependency
SOURCE_DIR bundle_root)
endif()

if(NOT EXISTS "${bundle_root}/include/fftw3.h" OR
NOT IS_DIRECTORY "${bundle_root}/lib" OR
NOT IS_DIRECTORY "${bundle_root}/bin" OR
NOT EXISTS "${bundle_root}/share/fftw/COPYING")
message(FATAL_ERROR "FFTW_ROOT is not a complete dependency bundle: ${bundle_root}")
endif()

set(${OUT_ROOT} "${bundle_root}" PARENT_SCOPE)
endfunction()
Binary file removed libs/linux/bin/libfftw3.so.3
Binary file not shown.
Loading
Loading