aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt107
-rw-r--r--cmake/FindFFmpeg.cmake6
2 files changed, 64 insertions, 49 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 690ec37a..5de93610 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1438,54 +1438,62 @@ IF(ALSOFT_TESTS)
ENDIF()
IF(ALSOFT_EXAMPLES)
- IF(SDL2_FOUND AND SDL_SOUND_FOUND)
- ADD_LIBRARY(ex-common STATIC examples/common/alhelpers.c
- examples/common/sdl_sound.c)
- SET_PROPERTY(TARGET ex-common APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS})
- SET_PROPERTY(TARGET ex-common APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR}
- ${SDL_SOUND_INCLUDE_DIR})
-
- ADD_EXECUTABLE(alstream examples/alstream.c)
- TARGET_LINK_LIBRARIES(alstream ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY}
- common ${LIBNAME})
- SET_PROPERTY(TARGET alstream APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS})
- SET_PROPERTY(TARGET alstream APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR}
- ${SDL_SOUND_INCLUDE_DIR})
-
- ADD_EXECUTABLE(alreverb examples/alreverb.c)
- TARGET_LINK_LIBRARIES(alreverb ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY}
- common ${LIBNAME})
- SET_PROPERTY(TARGET alreverb APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS})
- SET_PROPERTY(TARGET alreverb APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR}
- ${SDL_SOUND_INCLUDE_DIR})
-
- ADD_EXECUTABLE(allatency examples/allatency.c)
- TARGET_LINK_LIBRARIES(allatency ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY}
- common ${LIBNAME})
- SET_PROPERTY(TARGET allatency APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS})
- SET_PROPERTY(TARGET allatency APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR}
- ${SDL_SOUND_INCLUDE_DIR})
-
- ADD_EXECUTABLE(alloopback examples/alloopback.c)
- TARGET_LINK_LIBRARIES(alloopback ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY}
+ IF(SDL2_FOUND)
+ IF(SDL_SOUND_FOUND)
+ ADD_LIBRARY(ex-common STATIC examples/common/alhelpers.c
+ examples/common/sdl_sound.c)
+ SET_PROPERTY(TARGET ex-common APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS})
+ SET_PROPERTY(TARGET ex-common APPEND PROPERTY
+ INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR}
+ )
+
+ ADD_EXECUTABLE(alstream examples/alstream.c)
+ TARGET_LINK_LIBRARIES(alstream ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY}
+ common ${LIBNAME})
+ SET_PROPERTY(TARGET alstream APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS})
+ SET_PROPERTY(TARGET alstream APPEND PROPERTY
+ INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR}
+ )
+
+ ADD_EXECUTABLE(alreverb examples/alreverb.c)
+ TARGET_LINK_LIBRARIES(alreverb ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY}
+ common ${LIBNAME})
+ SET_PROPERTY(TARGET alreverb APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS})
+ SET_PROPERTY(TARGET alreverb APPEND PROPERTY
+ INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR}
+ )
+
+ ADD_EXECUTABLE(allatency examples/allatency.c)
+ TARGET_LINK_LIBRARIES(allatency ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY}
+ common ${LIBNAME})
+ SET_PROPERTY(TARGET allatency APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS})
+ SET_PROPERTY(TARGET allatency APPEND PROPERTY
+ INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR}
+ )
+
+ ADD_EXECUTABLE(alloopback examples/alloopback.c)
+ TARGET_LINK_LIBRARIES(alloopback ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY}
+ common ${LIBNAME})
+ SET_PROPERTY(TARGET alloopback APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS})
+ SET_PROPERTY(TARGET alloopback APPEND PROPERTY
+ INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR}
+ )
+
+ ADD_EXECUTABLE(alhrtf examples/alhrtf.c)
+ TARGET_LINK_LIBRARIES(alhrtf ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY}
common ${LIBNAME})
- SET_PROPERTY(TARGET alloopback APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS})
- SET_PROPERTY(TARGET alloopback APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR}
- ${SDL_SOUND_INCLUDE_DIR})
-
- ADD_EXECUTABLE(alhrtf examples/alhrtf.c)
- TARGET_LINK_LIBRARIES(alhrtf ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY}
- common ${LIBNAME})
- SET_PROPERTY(TARGET alhrtf APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS})
- SET_PROPERTY(TARGET alhrtf APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR}
- ${SDL_SOUND_INCLUDE_DIR})
-
- IF(ALSOFT_INSTALL)
- INSTALL(TARGETS alstream alreverb allatency alloopback alhrtf
- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ SET_PROPERTY(TARGET alhrtf APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS})
+ SET_PROPERTY(TARGET alhrtf APPEND PROPERTY
+ INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR}
)
+
+ IF(ALSOFT_INSTALL)
+ INSTALL(TARGETS alstream alreverb allatency alloopback alhrtf
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ )
+ ENDIF()
ENDIF()
SET(FFVER_OK FALSE)
@@ -1514,10 +1522,11 @@ IF(ALSOFT_EXAMPLES)
ENDIF()
IF(FFVER_OK AND NOT MSVC)
ADD_EXECUTABLE(alffplay examples/alffplay.c)
- TARGET_LINK_LIBRARIES(alffplay common ex-common ${SDL2_LIBRARY} ${LIBNAME} ${FFMPEG_LIBRARIES})
+ TARGET_LINK_LIBRARIES(alffplay common ${SDL2_LIBRARY} ${LIBNAME} ${FFMPEG_LIBRARIES})
SET_PROPERTY(TARGET alffplay APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS})
- SET_PROPERTY(TARGET alffplay APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR}
- ${FFMPEG_INCLUDE_DIRS})
+ SET_PROPERTY(TARGET alffplay APPEND PROPERTY
+ INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR} ${FFMPEG_INCLUDE_DIRS}
+ )
IF(ALSOFT_INSTALL)
INSTALL(TARGETS alffplay
diff --git a/cmake/FindFFmpeg.cmake b/cmake/FindFFmpeg.cmake
index 96cbb6ed..c489c2c3 100644
--- a/cmake/FindFFmpeg.cmake
+++ b/cmake/FindFFmpeg.cmake
@@ -142,6 +142,12 @@ foreach(_component ${FFmpeg_FIND_COMPONENTS})
endif()
endforeach()
+# Add libz if it exists (needed for static ffmpeg builds)
+find_library(_FFmpeg_HAVE_LIBZ NAMES z)
+if(_FFmpeg_HAVE_LIBZ)
+ set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${_FFmpeg_HAVE_LIBZ})
+endif()
+
# Build the include path and library list with duplicates removed.
if(FFMPEG_INCLUDE_DIRS)
list(REMOVE_DUPLICATES FFMPEG_INCLUDE_DIRS)