From 465dab6a820ff468aa53bb6e7db820a280e53792 Mon Sep 17 00:00:00 2001 From: Owen Green Date: Fri, 16 Aug 2019 09:58:32 +0100 Subject: [PATCH] CmakeLists / target_post.cmake: switch to using CMake Fetch for Fluid dependencies. Same syntax is possible, but will fall back to git clone in the absence of supplied cache args --- CMakeLists.txt | 77 +++++++++++++++++++++++---------------- scripts/target_post.cmake | 21 ++++++----- 2 files changed, 58 insertions(+), 40 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 71c94fb..ab86488 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,28 +29,60 @@ MACRO(SUBDIRLIST result curdir) SET(${result} ${dirlist}) ENDMACRO() -set(FLUID_PATH ~/fluid_decomposition CACHE PATH "The top level of the fluid_decomposition repo") -set(LOCAL_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/include") +include(FetchContent) + +set(FETCHCONTENT_QUIET FALSE) + +if(DEFINED FLUID_PATH) +get_filename_component(FLUID_PATH ${FLUID_PATH} ABSOLUTE) +message(${FLUID_PATH}) +FetchContent_Declare( + fluid_decomposition + # URL ${FLUID_PATH} + DOWNLOAD_COMMAND "" + SOURCE_DIR "${FLUID_PATH}/" +) +else() +FetchContent_Declare( + fluid_decomposition + GIT_REPOSITORY https://bitbucket.org/flucoma/fluid_decomposition.git + GIT_PROGRESS TRUE +) +endif() +if(DEFINED FLUID_M_PATH) +get_filename_component(FLUID_M_PATH ${FLUID_M_PATH} ABSOLUTE) +FetchContent_Declare( + fluid_manipulation + # URL ${FLUID_M_PATH} + DOWNLOAD_COMMAND "" + SOURCE_DIR "${FLUID_M_PATH}/" +) +else() +FetchContent_Declare( + fluid_manipulation + GIT_REPOSITORY https://bitbucket.org/flucoma/fluid_manipulation.git + GIT_PROGRESS TRUE +) +endif() -get_filename_component(FLUID_ABS_PATH "${FLUID_PATH}" ABSOLUTE) -message("${FLUID_ABS_PATH}") -# if (NOT DEFINED ${FLUID_DECOMP_PATH}) -# message(FATAL_ERROR "Please set the path to the fluid_decomposition sources with -DFLUID_DECOMP_PATH=") -# endif() +FetchContent_GetProperties(fluid_decomposition) +if(NOT fluid_decomposition_POPULATED) + FetchContent_Populate(fluid_decomposition) + add_subdirectory(${fluid_decomposition_SOURCE_DIR} ${fluid_decomposition_BINARY_DIR}) +endif() -if (NOT (EXISTS "${FLUID_ABS_PATH}/build/fluid_decomposition-exports.cmake")) - message(FATAL_ERROR "Can't find the fluid_decomposition CMake targets file at ${FLUID_ABS_PATH}/build/fluid_decomposition-exports.cmake. Please go to ${FLUID_ABS_PATH}/build and run CMake") +FetchContent_GetProperties(fluid_manipulation) +if(NOT fluid_manipulation_POPULATED) + FetchContent_Populate(fluid_manipulation) + add_subdirectory(${fluid_manipulation_SOURCE_DIR} ${fluid_manipulation_BINARY_DIR}) endif() if (NOT (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/release-packaging/AudioFiles/")) file(MAKE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/release-packaging/AudioFiles/") endif() -file(COPY "${FLUID_ABS_PATH}/AudioFiles/" DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/release-packaging/AudioFiles/") - - -include("${FLUID_ABS_PATH}/build/fluid_decomposition-exports.cmake") +file(COPY "${fluid_decomposition_SOURCE_DIR}/AudioFiles/" DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/release-packaging/AudioFiles/") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/release-packaging/plugins") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") @@ -61,26 +93,9 @@ if(APPLE OR WIN32) set(CMAKE_SHARED_MODULE_SUFFIX ".scx") endif() -get_property(FFT_SOURCES TARGET HISSTools_FFT PROPERTY INTERFACE_SOURCES) -get_property(FFT_LINK TARGET HISSTools_FFT PROPERTY INTERFACE_LINK_LIBRARIES) - -add_library(FFTLIB STATIC ${FFT_SOURCES}) -target_link_libraries( - FFTLIB PRIVATE ${FFT_LINK} -) -if(WIN32) - target_compile_options( - FFTLIB PRIVATE $<$>: /arch:AVX> - ) -else(WIN32) -target_compile_options( - FFTLIB PRIVATE $<$>: -mavx -msse -msse2 -msse3 -msse4> -) -endif(WIN32) - #needed for complaint-free static linking with GCC if(CMAKE_COMPILER_IS_GNUCXX) -target_compile_options( FFTLIB PUBLIC -fPIC ) +target_compile_options( HISSTools_FFT PUBLIC -fPIC ) ENDIF(CMAKE_COMPILER_IS_GNUCXX) add_library(FLUID_SC_WRAPPER INTERFACE) diff --git a/scripts/target_post.cmake b/scripts/target_post.cmake index 2ce587f..f6a4c44 100644 --- a/scripts/target_post.cmake +++ b/scripts/target_post.cmake @@ -17,9 +17,10 @@ target_link_libraries( ${PLUGIN} PUBLIC FLUID_DECOMPOSITION + FLUID_MANIP FLUID_SC_WRAPPER PRIVATE - FFTLIB + HISSTools_FFT ) @@ -39,8 +40,10 @@ target_include_directories( ) get_property(HEADERS TARGET FLUID_DECOMPOSITION PROPERTY INTERFACE_SOURCES) -source_group(TREE "${FLUID_PATH}/include" FILES ${HEADERS}) +source_group(TREE "${fluid_decomposition_SOURCE_DIR}/include" FILES ${HEADERS}) +get_property(HEADERS TARGET FLUID_MANIP PROPERTY INTERFACE_SOURCES) +source_group(TREE "${fluid_manipulation_SOURCE_DIR}/include" FILES ${HEADERS}) if (SUPERNOVA) target_include_directories( @@ -66,7 +69,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANG) target_compile_options( ${PLUGIN} PRIVATE - $<$>: -mavx -msse -msse2 -msse3 -msse4> + $<$>: -mavx> ) endif() @@ -81,14 +84,14 @@ if(MSVC) target_compile_options(${PLUGIN} PRIVATE /arch:AVX -D_USE_MATH_DEFINES) else(MSVC) target_compile_options( - ${PLUGIN} PRIVATE $<$>: -mavx -msse -msse2 -msse3 -msse4> + ${PLUGIN} PRIVATE $<$>: -mavx> ) endif(MSVC) ####### added the fluid_decomposition -if(SUPERNOVA) - add_library(${PLUGIN}_supernova MODULE ${FILENAME}) - set_property(TARGET ${PROJECT}_supernova - PROPERTY COMPILE_DEFINITIONS SUPERNOVA) -endif() +# if(SUPERNOVA) +# add_library(${PLUGIN}_supernova MODULE ${FILENAME}) +# set_property(TARGET ${PROJECT}_supernova +# PROPERTY COMPILE_DEFINITIONS SUPERNOVA) +# endif()