From 2843974d284cb2046318d2da5fcedc95104e88d9 Mon Sep 17 00:00:00 2001 From: Tuomas Virtanen Date: Mon, 26 Mar 2018 15:15:19 +0300 Subject: Allow runtime loading of libass library. Previously libass could only be statically linked. Now we allow runtime loading of the library on request (just like other SDL libraries do). --- CMakeLists.txt | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index d70cfd1..a72d9f9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,14 +14,14 @@ add_definitions( ) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") -set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ggdb -pedantic -Werror -fno-omit-frame-pointer -Wno-deprecated-declarations") +set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ggdb -Werror -fno-omit-frame-pointer -Wno-deprecated-declarations") set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -ggdb -O2 -fno-omit-frame-pointer -DNDEBUG") set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2 -DNDEBUG") set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} -Os -DNDEBUG") option(BUILD_EXAMPLES "Build examples" OFF) option(BUILD_TESTS "Build unittests" OFF) -option(USE_ASS "Use libass" ON) +option(USE_DYNAMIC_LIBASS "Use dynamically loaded libass" ON) find_package(SDL2) find_package(ffmpeg COMPONENTS avcodec avformat avutil swscale swresample) @@ -40,9 +40,16 @@ if(BUILD_TESTS) add_subdirectory(tests) endif() -if(USE_ASS) +if(USE_DYNAMIC_LIBASS) + if(WIN32 OR MINGW OR MSYS) + set(DYNAMIC_LIBASS_NAME "\"libass-9.dll\"") + else() + set(DYNAMIC_LIBASS_NAME "\"libass.so\"") + endif() + add_definitions(-DUSE_DYNAMIC_LIBASS) + add_definitions(-DDYNAMIC_LIBASS_NAME=${DYNAMIC_LIBASS_NAME}) +else() find_package(ass) - add_definitions(-DUSE_ASS) set(LIBRARIES ${LIBRARIES} ${ASS_LIBRARIES}) set(INCLUDES ${INCLUDES} ${ASS_INCLUDE_DIRS}) endif() -- cgit v1.2.3