cmake_minimum_required(VERSION 3.16)
cmake_policy(VERSION 3.16)

if(POLICY CMP0072)
	cmake_policy(SET CMP0072 NEW)
endif(POLICY CMP0072)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

project(winssr VERSION 0.4.5 LANGUAGES CXX RC)

if(NOT WIN32)
	message(FATAL_ERROR "This is the Windows port of SimpleScreenRecorder. It only builds on Windows.")
endif()

if(CMAKE_SIZEOF_VOID_P EQUAL 8)
	set(PROCESSOR_IS_X86 TRUE)
else()
	set(PROCESSOR_IS_X86 FALSE)
endif()

option(ENABLE_X86_ASM "Allow x86/x64 assembly or intrinsics." ${PROCESSOR_IS_X86})
option(ENABLE_FFMPEG_VERSIONS "Use FFmpeg version numbers for feature support tests. Enable when using FFmpeg, disable when using Libav." TRUE)
option(WITH_WINSSR "Build the 'winssr' executable." TRUE)
option(WITH_TRANSLATIONS "Build the translated versions of the GUI." TRUE)

set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)

include(FeatureSummary)
include(GNUInstallDirs)

if(WITH_WINSSR)

	add_subdirectory(src)
	if(WITH_TRANSLATIONS)
		add_subdirectory(src/translations)
	endif()

	install(
		DIRECTORY data/output-profiles
		DESTINATION ${CMAKE_INSTALL_BINDIR}
	)
	install(
		DIRECTORY data/icons/
		DESTINATION ${CMAKE_INSTALL_BINDIR}/icons
		FILES_MATCHING PATTERN "*.png" PATTERN "*.ico"
	)

endif()

feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
