Skip to content

Commit

Permalink
chore: Add support for language servers (#1558)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimitry-ishenko authored Sep 10, 2024
1 parent 4dcd14a commit 6e2642e
Showing 1 changed file with 36 additions and 33 deletions.
69 changes: 36 additions & 33 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
cmake_minimum_required (VERSION 3.16)
cmake_minimum_required(VERSION 3.16)

# Project settings
PROJECT ("CasparCG Server")
SET (CONFIG_VERSION_MAJOR 2)
SET (CONFIG_VERSION_MINOR 5)
SET (CONFIG_VERSION_BUG 0)
SET (CONFIG_VERSION_TAG "Dev")
project("CasparCG Server")
set(CONFIG_VERSION_MAJOR 2)
set(CONFIG_VERSION_MINOR 5)
set(CONFIG_VERSION_BUG 0)
set(CONFIG_VERSION_TAG "Dev")

# support for language servers (eg, clangd or ccls)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

set(CASPARCG_DOWNLOAD_MIRROR https://github.com/CasparCG/dependencies/releases/download/ CACHE STRING "Source/mirror to use for external dependencies")
set(CASPARCG_DOWNLOAD_CACHE ${CMAKE_CURRENT_BINARY_DIR}/external CACHE STRING "Download cache directory for cmake ExternalProjects")
Expand All @@ -21,41 +24,41 @@ set(DIAG_FONT_PATH "LiberationMono-Regular.ttf" CACHE STRING
add_compile_definitions("DIAG_FONT_PATH=\"${DIAG_FONT_PATH}\"")

# Add custom cmake modules path
SET (CASPARCG_PATCH_DIR ${CMAKE_SOURCE_DIR}/CMakeModules/patches)
LIST (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMakeModules)
set(CASPARCG_PATCH_DIR ${CMAKE_SOURCE_DIR}/CMakeModules/patches)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMakeModules)

# Determine the git hash
FIND_PACKAGE (Git)
SET (CONFIG_VERSION_GIT_HASH "N/A")
IF (DEFINED ENV{GIT_HASH} AND NOT $ENV{GIT_HASH} STREQUAL "")
SET (CONFIG_VERSION_GIT_HASH "$ENV{GIT_HASH}")
ELSEIF (GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/../.git")
EXEC_PROGRAM ("${GIT_EXECUTABLE}" "${PROJECT_SOURCE_DIR}/../" ARGS rev-parse --verify --short HEAD OUTPUT_VARIABLE CONFIG_VERSION_GIT_HASH)
ENDIF ()
find_package(Git)
set(CONFIG_VERSION_GIT_HASH "N/A")
if(DEFINED ENV{GIT_HASH} AND NOT $ENV{GIT_HASH} STREQUAL "")
set(CONFIG_VERSION_GIT_HASH "$ENV{GIT_HASH}")
elseif(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/../.git")
exec_program("${GIT_EXECUTABLE}" "${PROJECT_SOURCE_DIR}/../" ARGS rev-parse --verify --short HEAD OUTPUT_VARIABLE CONFIG_VERSION_GIT_HASH)
endif()

cmake_host_system_information(RESULT CONFIG_CPU_COUNT QUERY NUMBER_OF_PHYSICAL_CORES)

INCLUDE (CasparCG_Util)
CONFIGURE_FILE ("${PROJECT_SOURCE_DIR}/version.tmpl" "${CMAKE_BINARY_DIR}/generated/version.h")
include(CasparCG_Util)
configure_file("${PROJECT_SOURCE_DIR}/version.tmpl" "${CMAKE_BINARY_DIR}/generated/version.h")

if (MSVC)
INCLUDE (Bootstrap_Windows)
if(MSVC)
include(Bootstrap_Windows)
else ()
INCLUDE (Bootstrap_Linux)
include(Bootstrap_Linux)

# Output build settings
MESSAGE (STATUS "Target architecture: ${CMAKE_SYSTEM_PROCESSOR}")
MESSAGE (STATUS "CPU Count: ${CONFIG_CPU_COUNT}")
MESSAGE (STATUS "Target build type: ${CMAKE_BUILD_TYPE}")
MESSAGE (STATUS "Build Version: ${CONFIG_VERSION_MAJOR}.${CONFIG_VERSION_MINOR}.${CONFIG_VERSION_BUG} ${CONFIG_VERSION_TAG} (Revision: ${CONFIG_VERSION_GIT_HASH})")
# Output build settings
message(STATUS "Target architecture: ${CMAKE_SYSTEM_PROCESSOR}")
message(STATUS "CPU Count: ${CONFIG_CPU_COUNT}")
message(STATUS "Target build type: ${CMAKE_BUILD_TYPE}")
message(STATUS "Build Version: ${CONFIG_VERSION_MAJOR}.${CONFIG_VERSION_MINOR}.${CONFIG_VERSION_BUG} ${CONFIG_VERSION_TAG} (Revision: ${CONFIG_VERSION_GIT_HASH})")
endif ()

INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}/generated")
include_directories("${CMAKE_BINARY_DIR}/generated")

ADD_SUBDIRECTORY (tools)
ADD_SUBDIRECTORY (accelerator)
ADD_SUBDIRECTORY (common)
ADD_SUBDIRECTORY (core)
ADD_SUBDIRECTORY (modules)
ADD_SUBDIRECTORY (protocol)
ADD_SUBDIRECTORY (shell)
add_subdirectory(tools)
add_subdirectory(accelerator)
add_subdirectory(common)
add_subdirectory(core)
add_subdirectory(modules)
add_subdirectory(protocol)
add_subdirectory(shell)

0 comments on commit 6e2642e

Please sign in to comment.