Cleanup CMakeLists.txt a bit and add coverage builds (#493)

Add TSMUXER_COVERAGE which will result in building binaries with coverage information when set to true.
Move MSVC flag utf-8 from tsMuxerGUI to the general CMakeLists.txt as there is no reason not to enable it globally.
Replace NOT MSVC with checking if the build is for Linux : the effect is the same, but the intent is clearer.
Restructure the platform-specific conditions for building tsMuxerGUI.
Bind the XP build to windows-2019 hosts as windows-2022 includes Visual Studio 2022 which dropped XP support.
Don't install zlib via homebrew in macos in order to avoid conflicts with the system-provided one.
master
Daniel Kamil Kozar 2021-11-14 02:06:30 +01:00 committed by GitHub
parent c483756b42
commit 88316ec3e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 47 additions and 37 deletions

View File

@ -13,7 +13,7 @@ on:
jobs:
build-winxp-gui:
runs-on: windows-latest
runs-on: windows-2019
steps:
- uses: actions/checkout@master

View File

@ -23,18 +23,39 @@ else()
endif()
add_definitions("-DTSMUXER_VERSION=\"${TSMUXER_VERSION}\"")
if(NOT MSVC)
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
include(GNUInstallDirs)
mark_as_advanced(CLEAR
CMAKE_INSTALL_BINDIR
CMAKE_INSTALL_DATADIR
CMAKE_INSTALL_DATADIR
)
else(NOT MSVC)
else()
set(CMAKE_INSTALL_BINDIR bin)
endif(NOT MSVC)
add_subdirectory (libmediation)
add_subdirectory (tsMuxer)
if(TSMUXER_GUI)
add_subdirectory (tsMuxerGUI)
endif()
if(MSVC)
add_compile_options("/utf-8")
endif()
if(WIN32)
add_definitions(-DUNICODE -D_UNICODE)
endif()
set(TSMUXER_COVERAGE FALSE CACHE BOOL "Enable collecting coverage information")
if(${TSMUXER_COVERAGE})
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
add_compile_options("--coverage")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
add_compile_options("-fprofile-instr-generate" "-fcoverage-mapping")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-instr-generate")
else()
message(FATAL_ERROR "Coverage not supported for compiler ${CMAKE_CXX_COMPILER_ID}")
endif()
endif()
add_subdirectory(libmediation)
add_subdirectory(tsMuxer)
if(TSMUXER_GUI)
add_subdirectory(tsMuxerGUI)
endif()

View File

@ -7,7 +7,6 @@ export MACOSX_DEPLOYMENT_TARGET=10.15
brew install pkg-config
brew install freetype
brew install zlib
builddir=$PWD

View File

@ -7,7 +7,6 @@ add_library(mediation STATIC
)
IF(WIN32)
target_compile_definitions(mediation PRIVATE "-DUNICODE")
target_sources(mediation PRIVATE fs/osdep/file_win32.cpp fs/osdep/directory_win32.cpp)
ELSE()
target_compile_definitions(mediation PRIVATE "-D_FILE_OFFSET_BITS=64")

View File

@ -115,7 +115,6 @@ target_link_libraries(tsmuxer mediation ${THREADSLIB} ${ZLIB_LIBRARIES})
if (WIN32)
target_sources(tsmuxer PRIVATE osdep/textSubtitlesRenderWin32.cpp)
target_link_libraries(tsmuxer gdiplus)
target_compile_definitions(tsmuxer PRIVATE "-DUNICODE")
else()
target_sources(tsmuxer PRIVATE osdep/textSubtitlesRenderFT.cpp)
# on osxcross use the static freetype library explicitly

View File

@ -57,33 +57,22 @@ set(tsmuxer_gui_sources
${CMAKE_CURRENT_BINARY_DIR}/${lang_qrc}
)
add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
set(GUI_OPTIONS "")
if(WIN32)
set(GUI_OPTIONS WIN32)
elseif(APPLE)
set(GUI_OPTIONS MACOSX_BUNDLE)
endif()
add_executable(tsMuxerGUI ${GUI_OPTIONS} ${tsmuxer_gui_sources})
target_link_libraries(tsMuxerGUI ${tsmuxer_gui_libs})
if(NOT MSVC)
if (WIN32)
add_executable(tsMuxerGUI WIN32 ${tsmuxer_gui_sources} icon.rc)
elseif (APPLE)
set(MACOSX_BUNDLE_ICON_FILE tsMuxerGUI.icns)
set_source_files_properties(tsMuxerGUI.icns PROPERTIES
MACOSX_PACKAGE_LOCATION "Resources")
add_executable(tsMuxerGUI MACOSX_BUNDLE ${tsmuxer_gui_sources} tsMuxerGUI.icns)
# UNIX must be last here, as it's going to be true for APPLE and CYGWIN as well,
# but we want those to be handled by the code above.
elseif (UNIX)
add_executable(tsMuxerGUI ${tsmuxer_gui_sources})
install(TARGETS tsMuxerGUI DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES tsMuxerGUI.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
install(FILES images/icon.png
DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/128x128/apps/
RENAME tsMuxerGUI.png)
endif(NOT MSVC)
if (WIN32)
target_sources(tsMuxerGUI PRIVATE icon.rc)
elseif (APPLE)
set(MACOSX_BUNDLE_ICON_FILE tsMuxerGUI.icns)
set_source_files_properties(tsMuxerGUI.icns PROPERTIES
MACOSX_PACKAGE_LOCATION "Resources")
set_target_properties(tsMuxerGUI PROPERTIES MACOSX_BUNDLE TRUE)
target_sources(tsMuxerGUI PRIVATE tsMuxerGUI.icns)
endif()
target_link_libraries(tsMuxerGUI ${tsmuxer_gui_libs})

View File

@ -23,6 +23,9 @@ TRANSLATIONS = translations/tsmuxergui_en.ts translations/tsmuxergui_ru.ts trans
win32 {
RC_FILE += icon.rc
}
win32-msvc* {
QMAKE_CXXFLAGS += /utf-8
}
version_num = 2.6.16
tsmuxer_release = 0