Further cmake changes for SoundTouchDLL compilation

- enable "-Ofast" compilation flags for cmake build
- adjust compiler flags for the SoundTouchDLL compilation
- add cmake-generated "SoundTouchDLL_EXPORTS" as alias for "DLL_EXPORT"
- hide cmake temporary files in gitignore

Signed-off-by: Olli <oparviai'at'iki.fi>
This commit is contained in:
Olli 2021-08-17 19:47:56 +03:00
parent 220eb7857c
commit f974b28682
3 changed files with 10 additions and 1 deletions

3
.gitignore vendored
View File

@ -49,3 +49,6 @@ source/android-lib/.externalNativeBuild
# CMake build directory # CMake build directory
build* build*
CMakeFiles
CMakeCache.txt
*.cmake

View File

@ -30,7 +30,12 @@ if(SOUNDTOUCH_DLL)
source/SoundTouchDLL/SoundTouchDLL.cpp source/SoundTouchDLL/SoundTouchDLL.cpp
source/SoundTouchDLL/SoundTouchDLL.rc source/SoundTouchDLL/SoundTouchDLL.rc
) )
target_compile_options(SoundTouch PRIVATE -fPIC)
set_target_properties(SoundTouchDLL PROPERTIES CXX_VISIBILITY_PRESET hidden)
target_compile_options(SoundTouchDLL PRIVATE -Ofast)
target_compile_definitions(SoundTouchDLL PRIVATE CMAKE)
target_include_directories(SoundTouchDLL PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>) target_include_directories(SoundTouchDLL PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
target_link_libraries(SoundTouchDLL PRIVATE SoundTouch)
install(FILES source/SoundTouchDLL/SoundTouchDLL.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/soundtouch") install(FILES source/SoundTouchDLL/SoundTouchDLL.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/soundtouch")
install(TARGETS SoundTouchDLL EXPORT SoundTouchTargets) install(TARGETS SoundTouchDLL EXPORT SoundTouchTargets)
endif() endif()
@ -42,6 +47,7 @@ if(WIN32 AND BUILD_SHARED_LIBS)
endif() endif()
endif() endif()
target_compile_options(SoundTouch PRIVATE -Ofast)
target_compile_definitions(SoundTouch PRIVATE CMAKE) target_compile_definitions(SoundTouch PRIVATE CMAKE)
option(INTEGER_SAMPLES "Use integers instead of floats for samples" OFF) option(INTEGER_SAMPLES "Use integers instead of floats for samples" OFF)

View File

@ -48,7 +48,7 @@
#else #else
// GNU version // GNU version
#ifdef DLL_EXPORTS #if defined(DLL_EXPORTS) || defined(SoundTouchDLL_EXPORTS)
// GCC declaration for exporting functions // GCC declaration for exporting functions
#define SOUNDTOUCHDLL_API extern "C" __attribute__((__visibility__("default"))) #define SOUNDTOUCHDLL_API extern "C" __attribute__((__visibility__("default")))
#else #else