2022-12-30 11:25:28 +01:00
|
|
|
# FreeRDP: A Remote Desktop Protocol Implementation
|
|
|
|
|
# FreeRDP SDL Client
|
|
|
|
|
#
|
2024-05-16 19:15:03 +02:00
|
|
|
# Copyright 2024 Armin Novak <anovak@thincast.com>
|
|
|
|
|
# Copyright 2024 Thincast Technologies GmbH
|
2022-12-30 11:25:28 +01:00
|
|
|
#
|
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
|
#
|
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
#
|
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
|
# limitations under the License.
|
2023-03-06 16:04:05 +01:00
|
|
|
cmake_minimum_required(VERSION 3.13)
|
|
|
|
|
|
2024-02-13 15:48:33 +01:00
|
|
|
if(POLICY CMP0091)
|
2024-11-27 20:31:31 +01:00
|
|
|
cmake_policy(SET CMP0091 NEW)
|
2024-02-13 15:48:33 +01:00
|
|
|
endif()
|
2024-11-27 20:31:31 +01:00
|
|
|
if(NOT FREERDP_DEFAULT_PROJECT_VERSION)
|
|
|
|
|
set(FREERDP_DEFAULT_PROJECT_VERSION "1.0.0.0")
|
2023-12-21 17:24:43 +01:00
|
|
|
endif()
|
|
|
|
|
|
2024-11-27 20:31:31 +01:00
|
|
|
project(sdl-freerdp LANGUAGES CXX VERSION ${FREERDP_DEFAULT_PROJECT_VERSION})
|
2023-12-21 17:24:43 +01:00
|
|
|
|
|
|
|
|
message("project ${PROJECT_NAME} is using version ${PROJECT_VERSION}")
|
2023-03-06 16:04:05 +01:00
|
|
|
|
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
|
set(CMAKE_CXX_EXTENSIONS ON)
|
|
|
|
|
|
2023-05-25 15:25:06 +02:00
|
|
|
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/)
|
2023-12-21 09:27:19 +01:00
|
|
|
include(CommonConfigOptions)
|
2023-05-25 15:25:06 +02:00
|
|
|
|
|
|
|
|
include(ConfigureFreeRDP)
|
2024-09-18 10:11:45 +02:00
|
|
|
include(CXXCompilerFlags)
|
2023-03-06 16:04:05 +01:00
|
|
|
|
2024-02-13 16:52:51 +01:00
|
|
|
option(WITH_DEBUG_SDL_EVENTS "[dangerous, not for release builds!] Debug SDL events" ${DEFAULT_DEBUG_OPTION})
|
2024-11-27 20:31:31 +01:00
|
|
|
option(WITH_DEBUG_SDL_KBD_EVENTS "[dangerous, not for release builds!] Debug SDL keyboard events"
|
|
|
|
|
${DEFAULT_DEBUG_OPTION}
|
|
|
|
|
)
|
2023-07-19 16:43:28 +02:00
|
|
|
option(WITH_WIN_CONSOLE "Build ${PROJECT_NAME} with console support" ON)
|
2023-12-22 14:20:28 +01:00
|
|
|
option(WITH_SDL_LINK_SHARED "link SDL dynamic or static" ON)
|
2023-07-19 16:43:28 +02:00
|
|
|
|
|
|
|
|
if(WITH_WIN_CONSOLE)
|
2024-03-19 12:19:07 +01:00
|
|
|
set(WIN32_GUI_FLAG "TRUE")
|
2023-07-19 16:43:28 +02:00
|
|
|
else()
|
|
|
|
|
set(WIN32_GUI_FLAG "WIN32")
|
|
|
|
|
endif()
|
|
|
|
|
|
2024-11-27 20:31:31 +01:00
|
|
|
if(WITH_DEBUG_SDL_EVENTS)
|
2024-11-12 09:36:25 +01:00
|
|
|
add_compile_definitions(WITH_DEBUG_SDL_EVENTS)
|
2023-02-14 14:35:53 +01:00
|
|
|
endif()
|
2024-11-27 20:31:31 +01:00
|
|
|
if(WITH_DEBUG_SDL_KBD_EVENTS)
|
2024-11-12 09:36:25 +01:00
|
|
|
add_compile_definitions(WITH_DEBUG_SDL_KBD_EVENTS)
|
2023-02-14 14:35:53 +01:00
|
|
|
endif()
|
|
|
|
|
|
2024-05-16 19:15:03 +02:00
|
|
|
include(CMakeDependentOption)
|
2022-12-30 11:25:28 +01:00
|
|
|
|
2024-05-16 23:05:44 +02:00
|
|
|
find_package(SDL2)
|
|
|
|
|
find_package(SDL3)
|
|
|
|
|
|
2024-05-16 19:15:03 +02:00
|
|
|
cmake_dependent_option(WITH_CLIENT_SDL_VERSIONED "append sdl version to client binaries" OFF WITH_CLIENT_SDL OFF)
|
2024-11-27 20:31:31 +01:00
|
|
|
cmake_dependent_option(
|
|
|
|
|
WITH_CLIENT_SDL2 "[experimental] build experimental SDL2 client" ${SDL2_FOUND} WITH_CLIENT_SDL OFF
|
|
|
|
|
)
|
|
|
|
|
cmake_dependent_option(
|
|
|
|
|
WITH_CLIENT_SDL3 "[experimental] build experimental SDL3 client" ${SDL3_FOUND} WITH_CLIENT_SDL OFF
|
|
|
|
|
)
|
2024-04-26 10:36:24 +02:00
|
|
|
|
2024-11-27 20:31:31 +01:00
|
|
|
if(WITH_CLIENT_SDL2 AND WITH_CLIENT_SDL3)
|
|
|
|
|
message("Building both, SDL2 and SDL3 clients, forcing WITH_CLIENT_SDL_VERSIONED=ON")
|
|
|
|
|
set(WITH_CLIENT_SDL_VERSIONED ON)
|
2023-12-22 13:52:31 +01:00
|
|
|
endif()
|
|
|
|
|
|
2024-11-27 20:31:31 +01:00
|
|
|
if(NOT SDL2_FOUND AND NOT SDL3_FOUND)
|
|
|
|
|
message(FATAL_ERROR "No SDL library detected, giving up. Install SDL2 or SDL3 development package to fix")
|
2024-05-16 23:05:44 +02:00
|
|
|
endif()
|
|
|
|
|
|
2024-05-16 19:15:03 +02:00
|
|
|
add_subdirectory(common)
|
|
|
|
|
include_directories(common)
|
2022-12-30 11:25:28 +01:00
|
|
|
|
2024-11-27 20:31:31 +01:00
|
|
|
if(WITH_CLIENT_SDL2)
|
|
|
|
|
if(SDL2_FOUND)
|
|
|
|
|
add_subdirectory(SDL2)
|
|
|
|
|
else()
|
|
|
|
|
message(WARNING "SDL2 requested but not found, continuing build without SDL2 client")
|
|
|
|
|
endif()
|
2024-05-16 09:36:27 +02:00
|
|
|
endif()
|
2024-04-29 16:01:12 +02:00
|
|
|
|
2024-11-27 20:31:31 +01:00
|
|
|
if(WITH_CLIENT_SDL3)
|
|
|
|
|
if(SDL3_FOUND)
|
|
|
|
|
add_subdirectory(SDL3)
|
|
|
|
|
else()
|
|
|
|
|
message(WARNING "SDL3 requested but not found, continuing build without SDL3 client")
|
|
|
|
|
endif()
|
2024-04-29 16:01:12 +02:00
|
|
|
endif()
|