Skip to content

Commit

Permalink
redo cmake, to be squashed
Browse files Browse the repository at this point in the history
  • Loading branch information
dyfer committed Jan 7, 2020
1 parent e63a7ff commit ea652be
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 42 deletions.
58 changes: 29 additions & 29 deletions server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,35 @@ include_directories(${CMAKE_SOURCE_DIR}/external_libraries
include_directories(${boost_include_dirs})

# here we choose who provides us with the FFT lib
if (APPLE)
# we will add definition SC_FFT_VDSP inside scsynth's CMakeLists
# current implementation of vDSP is not thread-safe, so we have to use FFTW with Supernova
# we will add definition SC_FFT_FFTW inside supernova's CMakeLists
if (FFT_GREEN)
message(STATUS "Using green fft")
add_definitions("-DSC_FFT_GREEN")
elseif(SUPERNOVA)
find_package(FFTW3f 3.3)
if (FFTW3F_FOUND)
message(STATUS "Found fftw3f: ${FFTW3F_LIBRARY}")
endif()
endif()
else()
find_package(FFTW3f 3.3)

if (NOT FFTW3F_FOUND OR FFT_GREEN)
message(STATUS "Using green fft")
set(FFT_GREEN 1)
add_definitions("-DSC_FFT_GREEN")
else()
if(WIN32)
message(STATUS "Found fftw3f: ${FFTW3F_LIBRARY}")
else(WIN32)
message(STATUS "Using fftw3f")
endif(WIN32)
add_definitions("-DSC_FFT_FFTW")
endif()
endif()
# if (APPLE)
# # we will add definition SC_FFT_VDSP inside scsynth's CMakeLists
# # current implementation of vDSP is not thread-safe, so we have to use FFTW with Supernova
# # we will add definition SC_FFT_FFTW inside supernova's CMakeLists
# if (FFT_GREEN)
# message(STATUS "Using green fft")
# add_definitions("-DSC_FFT_GREEN")
# elseif(SUPERNOVA)
# find_package(FFTW3f 3.3)
# if (FFTW3F_FOUND)
# message(STATUS "Found fftw3f: ${FFTW3F_LIBRARY}")
# endif()
# endif()
# else()
# find_package(FFTW3f 3.3)
#
# if (NOT FFTW3F_FOUND OR FFT_GREEN)
# message(STATUS "Using green fft")
# set(FFT_GREEN 1)
# add_definitions("-DSC_FFT_GREEN")
# else()
# if(WIN32)
# message(STATUS "Found fftw3f: ${FFTW3F_LIBRARY}")
# else(WIN32)
# message(STATUS "Using fftw3f")
# endif(WIN32)
# add_definitions("-DSC_FFT_FFTW")
# endif()
# endif()

add_subdirectory(plugins)
add_subdirectory(scsynth)
Expand Down
29 changes: 24 additions & 5 deletions server/scsynth/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
find_package(Sndfile)

# here we choose who provides us with the FFT lib
# this is done independently for scsynth and supernova
# on macOS scsynth uses vDSP implementation for FFT
# which is not thread-safe

if (APPLE)
add_definitions("-DSC_FFT_VDSP")
message(STATUS "FFT library (scsynth): vDSP")
else()
find_package(FFTW3f 3.3)

if (NOT FFTW3F_FOUND OR FFT_GREEN)
message(STATUS "FFT library (scsynth): Green")
set(FFT_GREEN 1)
add_definitions("-DSC_FFT_GREEN")
else()
message(STATUS "Found fftw3f: ${FFTW3F_LIBRARY}")
message(STATUS "FFT library (scsynth): FFTW")
add_definitions("-DSC_FFT_FFTW")
endif()
endif()

# Here we work out which audio API to use, from system type and/or user option.
if(AUDIOAPI STREQUAL "default")
if(APPLE)
Expand Down Expand Up @@ -193,7 +215,8 @@ if (LIBSCSYNTH)
set_property(TARGET libscsynth PROPERTY SOVERSION 1)
endif()

if (FFTW3F_FOUND AND NOT APPLE)
if (FFTW3F_FOUND)
message(STATUS "scsynth: including and linking FFTW library")
target_include_directories(libscsynth PUBLIC ${FFTW3F_INCLUDE_DIR})
target_link_libraries(libscsynth ${FFTW3F_LIBRARY})
endif()
Expand Down Expand Up @@ -232,10 +255,6 @@ else()
endif()

if(APPLE)
if (NOT FFT_GREEN)
add_definitions("-DSC_FFT_VDSP") # scsynth uses vDSP
remove_definitions("-DSC_FFT_FFTW")
endif()
add_custom_command(TARGET scsynth POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:SuperCollider>/../Resources/
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:scsynth> $<TARGET_FILE_DIR:SuperCollider>/../Resources)
Expand Down
37 changes: 29 additions & 8 deletions server/supernova/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,26 @@ if(APPLE)
include_directories(${CMAKE_SOURCE_DIR}/external_libraries/libsndfile)
endif()

# here we choose who provides us with the FFT lib
# this is done independently for scsynth and supernova
# scsynth uses vDSP implementation for FFT on macOS
# however current implementation of vDSP is not thread-safe
# so we use FFTW with supernova on macOS
# once vDSP implementation becomes thread-safe
# this logic can be reworked to use vDSP on macOS

find_package(FFTW3f 3.3)

if (NOT FFTW3F_FOUND OR FFT_GREEN)
message(STATUS "FFT library (supernova): Green")
set(FFT_GREEN 1)
add_definitions("-DSC_FFT_GREEN")
else()
message(STATUS "Found fftw3f: ${FFTW3F_LIBRARY}")
message(STATUS "FFT library (supernova): FFTW")
add_definitions("-DSC_FFT_FFTW")
endif()

set(libsupernova_src
sc/sc_synth_definition.cpp
sc/sc_osc_handler.cpp
Expand Down Expand Up @@ -138,6 +158,7 @@ else()
endif()

if (FFTW3F_FOUND)
message(STATUS "supernova: including and linking FFTW library")
target_include_directories(libsupernova PUBLIC ${FFTW3F_INCLUDE_DIR})
target_link_libraries(libsupernova ${FFTW3F_LIBRARY})
endif()
Expand Down Expand Up @@ -226,14 +247,14 @@ if (APPLE)
target_link_libraries(libsupernova "-framework Accelerate -framework CoreAudio -framework CoreServices"
"-framework Foundation -framework ApplicationServices -framework AppKit")
# FFT
if ((NOT FFT_GREEN) AND FFTW3F_FOUND)
message(STATUS "supernova using FFTW")
add_definitions("-DSC_FFT_FFTW") # supernova uses FFTW
remove_definitions("-DSC_FFT_VDSP")
else()
message(STATUS "supernova using green fft")
add_definitions("-DSC_FFT_GREEN")
endif()
# if ((NOT FFT_GREEN) AND FFTW3F_FOUND)
# message(STATUS "supernova using FFTW")
# add_definitions("-DSC_FFT_FFTW") # supernova uses FFTW
# remove_definitions("-DSC_FFT_VDSP")
# else()
# message(STATUS "supernova using green fft")
# add_definitions("-DSC_FFT_GREEN")
# endif()
endif()

if(${JACK_USE_METADATA_API})
Expand Down

0 comments on commit ea652be

Please sign in to comment.