Skip to content

Commit

Permalink
Fix windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
ShirasawaSama committed Dec 11, 2023
1 parent eafe804 commit 712c805
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
26 changes: 16 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ set(CMAKE_CXX_STANDARD 23)
add_definitions(-DNO_TIMING)

set(BUILD_TESTING OFF CACHE BOOL "" FORCE)
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
set(SOUNDSTRETCH OFF CACHE BOOL "" FORCE)

if (WIN32)
add_definitions(-D_WIN32 -DNOMINMAX -D_USE_MATH_DEFINES -DHAVE_SLEEF -DHAVE_LIBSAMPLERATE -DGETOPT_API=0)
add_definitions(-D_WIN32 -DNOMINMAX -D_USE_MATH_DEFINES -DHAVE_SLEEF -DHAVE_LIBSAMPLERATE -DGETOPT_API=0 -DSLEEF_STATIC_LIBS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MD")
elseif (LINUX)
add_definitions(-DUSE_PTHREADS -DHAVE_LIBSAMPLERATE -DHAVE_SLEEF -DHAVE_POSIX_MEMALIGN)
add_definitions(-DUSE_PTHREADS -DHAVE_LIBSAMPLERATE -DHAVE_SLEEF -DHAVE_POSIX_MEMALIGN -DSLEEF_STATIC_LIBS)
elseif (APPLE)
add_definitions(-DHAVE_LIBSAMPLERATE -DHAVE_VDSP -DNO_THREAD_CHECKS -DUSE_PTHREADS -DMALLOC_IS_ALIGNED)
endif ()
Expand All @@ -21,6 +23,7 @@ if (WIN32 OR LINUX)
set(sleef_BINARY_DIR ${CMAKE_BINARY_DIR}/sleef)
set(BUILD_DFT ON CACHE BOOL "" FORCE)
set(BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(ENABLE_LTO ON CACHE BOOL "" FORCE)
add_subdirectory("sleef")
include_directories(${sleef_BINARY_DIR}/include)
include_directories(${sleef_SOURCE_DIR}/include)
Expand All @@ -41,24 +44,27 @@ add_subdirectory(libsamplerate)
add_subdirectory(soundtouch)
include_directories(stubs)

file(GLOB_RECURSE SRC_FILES lib/*.cpp lib/*.h)
file(GLOB_RECURSE RUBBERBAND_SRC_FILES
rubberband/src/common/*.cpp rubberband/src/common/*.h
rubberband/src/finer/*.cpp rubberband/src/finer/*.h
rubberband/src/faster/*.cpp rubberband/src/faster/*.h
rubberband/src/ext/*.cpp rubberband/src/ext/*.h
rubberband/rubberband/RubberBandStretcher.h rubberband/src/RubberBandStretcher.cpp
)
add_library(rubberband STATIC ${RUBBERBAND_SRC_FILES})
target_link_libraries(rubberband PRIVATE samplerate)

add_library(EIMTimeStretchers SHARED ${SRC_FILES} ${RUBBERBAND_SRC_FILES})
#add_executable(EIMTimeStretchers ${SRC_FILES} ${RUBBERBAND_SRC_FILES})
file(GLOB_RECURSE SRC_FILES lib/*.cpp lib/*.h)
add_library(EIMTimeStretchers SHARED ${SRC_FILES})
#add_executable(EIMTimeStretchers ${SRC_FILES})

if (WIN32)
add_dependencies(EIMTimeStretchers sleef)
target_link_libraries(EIMTimeStretchers PRIVATE SoundTouch sleef sleefdft samplerate)
add_dependencies(rubberband sleef)
target_link_libraries(rubberband PRIVATE sleef sleefdft)
target_link_libraries(EIMTimeStretchers PRIVATE SoundTouch rubberband)
elseif (APPLE)
target_link_libraries(EIMTimeStretchers PRIVATE "-framework Accelerate" SoundTouch pthread samplerate)
target_link_libraries(EIMTimeStretchers PRIVATE "-framework Accelerate" SoundTouch pthread rubberband)
elseif (LINUX)
add_dependencies(EIMTimeStretchers sleef)
target_link_libraries(EIMTimeStretchers PRIVATE SoundTouch sleef sleefdft samplerate)
add_dependencies(rubberband sleef)
target_link_libraries(EIMTimeStretchers PRIVATE SoundTouch rubberband)
endif ()
2 changes: 1 addition & 1 deletion sleef
Submodule sleef updated 1 files
+3 −1 src/common/misc.h

0 comments on commit 712c805

Please sign in to comment.