tsMuxer/CMakeLists.txt
Daniel Kamil Kozar 88316ec3e9
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.
2021-11-14 02:06:30 +01:00

62 lines
1.6 KiB
CMake

cmake_minimum_required (VERSION 3.1)
project (tsmuxer_main CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
set(CMAKE_CXX_EXTENSIONS FALSE)
execute_process(
COMMAND git rev-parse --short HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE GIT_REV_SHORT_RV
OUTPUT_VARIABLE GIT_REV_SHORT
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set(TSMUXER_RELEASE FALSE)
set(VERSION_NUMBER "2.6.16")
if(${TSMUXER_RELEASE})
set(TSMUXER_VERSION ${VERSION_NUMBER})
elseif(${GIT_REV_SHORT_RV} EQUAL 0)
set(TSMUXER_VERSION "git-${GIT_REV_SHORT}")
else()
set(TSMUXER_VERSION "${VERSION_NUMBER}-dev")
endif()
add_definitions("-DTSMUXER_VERSION=\"${TSMUXER_VERSION}\"")
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
include(GNUInstallDirs)
mark_as_advanced(CLEAR
CMAKE_INSTALL_BINDIR
CMAKE_INSTALL_DATADIR
)
else()
set(CMAKE_INSTALL_BINDIR bin)
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()