Commit fdaede83 authored by Ryan Pavlik's avatar Ryan Pavlik Committed by Jakob Bornecrantz
Browse files

build: Make it possible to turn off the main compositor lib and runtime target.

parent 0619190d
......@@ -65,6 +65,11 @@ cmake_dependent_option(BUILD_WITH_XLIB "Enable xlib support" ON "X11_FOUND" OFF)
cmake_dependent_option(BUILD_WITH_XCB "Enable xcb support" ON "XCB_FOUND" OFF)
cmake_dependent_option(BUILD_WITH_OPENGL "Enable OpenGL Graphics API support" ON "OPENGL_FOUND" OFF)
cmake_dependent_option(BUILD_WITH_EGL "Enable OpenGL on EGL Graphics API support" ON "BUILD_WITH_OPENGL AND EGL_FOUND" OFF)
cmake_dependent_option(BUILD_COMPOSITOR_MAIN "Build main compositor host" ON "BUILD_WITH_WAYLAND OR BUILD_WITH_XCB" OFF)
cmake_dependent_option(BUILD_TARGET_OPENXR "Build OpenXR runtime target" ON "BUILD_COMPOSITOR_MAIN" OFF)
# Most users won't touch these.
mark_as_advanced(BUILD_COMPOSITOR_MAIN BUILD_TARGET_OPENXR)
set(BUILD_WITH_LIBUSB TRUE)
cmake_dependent_option(BUILD_WITH_JPEG "Enable jpeg code (used for some video drivers)" ON "JPEG_FOUND" OFF)
......
......@@ -82,60 +82,63 @@ add_library(comp_client OBJECT ${CLIENT_SOURCE_FILES})
# Main library
#
if(BUILD_WITH_XCB)
list(APPEND MAIN_SOURCE_FILES
main/comp_window_xcb.cpp
if(BUILD_COMPOSITOR_MAIN)
if(BUILD_WITH_XCB)
list(APPEND MAIN_SOURCE_FILES
main/comp_window_xcb.cpp
)
endif()
if(BUILD_WITH_XCB AND BUILD_WITH_XLIB)
list(APPEND MAIN_SOURCE_FILES
main/comp_window_direct_mode.cpp
)
endif()
# generate wayland protocols
if(BUILD_WITH_WAYLAND)
pkg_get_variable(WL_PROTOS_PKG_DIR wayland-protocols pkgdatadir)
pkg_get_variable(WL_SCANNER wayland-scanner wayland_scanner)
set(WL_PROTOS_DIR "${CMAKE_CURRENT_BINARY_DIR}/wayland-protocols/")
file(MAKE_DIRECTORY "${WL_PROTOS_DIR}")
set(WL_PROTOS_XML "${WL_PROTOS_PKG_DIR}/stable/xdg-shell/xdg-shell.xml")
set(WL_PROTOS_C "${WL_PROTOS_DIR}/xdg-shell.c")
set(WL_PROTOS_H "${WL_PROTOS_DIR}/xdg-shell-client-protocol.h")
add_custom_command(
COMMAND
${WL_SCANNER} private-code "${WL_PROTOS_XML}" "${WL_PROTOS_C}"
OUTPUT "${WL_PROTOS_C}" VERBATIM)
add_custom_command(
COMMAND
${WL_SCANNER} client-header "${WL_PROTOS_XML}" "${WL_PROTOS_H}"
OUTPUT "${WL_PROTOS_H}" VERBATIM)
set(WL_PROTOS_SRC ${WL_PROTOS_C} ${WL_PROTOS_H})
list(APPEND MAIN_SOURCE_FILES
main/comp_window_wayland.c
)
endif()
# Use OBJECT to not create a archive, since it just gets in the way.
add_library(comp_main OBJECT ${SHADER_HEADERS} ${MAIN_SOURCE_FILES} ${WL_PROTOS_SRC})
target_include_directories(comp_main SYSTEM PRIVATE
# Shaders - marked SYSTEM so we get no warnings
${CMAKE_CURRENT_BINARY_DIR}
)
endif()
if(BUILD_WITH_XCB AND BUILD_WITH_XLIB)
list(APPEND MAIN_SOURCE_FILES
main/comp_window_direct_mode.cpp
)
endif()
# generate wayland protocols
if(BUILD_WITH_WAYLAND)
pkg_get_variable(WL_PROTOS_PKG_DIR wayland-protocols pkgdatadir)
pkg_get_variable(WL_SCANNER wayland-scanner wayland_scanner)
set(WL_PROTOS_DIR "${CMAKE_CURRENT_BINARY_DIR}/wayland-protocols/")
file(MAKE_DIRECTORY "${WL_PROTOS_DIR}")
set(WL_PROTOS_XML "${WL_PROTOS_PKG_DIR}/stable/xdg-shell/xdg-shell.xml")
set(WL_PROTOS_C "${WL_PROTOS_DIR}/xdg-shell.c")
set(WL_PROTOS_H "${WL_PROTOS_DIR}/xdg-shell-client-protocol.h")
add_custom_command(
COMMAND
${WL_SCANNER} private-code "${WL_PROTOS_XML}" "${WL_PROTOS_C}"
OUTPUT "${WL_PROTOS_C}" VERBATIM)
add_custom_command(
COMMAND
${WL_SCANNER} client-header "${WL_PROTOS_XML}" "${WL_PROTOS_H}"
OUTPUT "${WL_PROTOS_H}" VERBATIM)
set(WL_PROTOS_SRC ${WL_PROTOS_C} ${WL_PROTOS_H})
list(APPEND MAIN_SOURCE_FILES
main/comp_window_wayland.c
)
if(BUILD_WITH_WAYLAND)
target_include_directories(comp_main SYSTEM PRIVATE ${WL_PROTOS_DIR})
endif()
if(BUILD_WITH_XCB)
target_include_directories(comp_main SYSTEM PRIVATE ${XCB_INCLUDE_DIRS})
endif()
if(BUILD_WITH_EGL)
target_include_directories(comp_main SYSTEM PRIVATE ${EGL_INCLUDE_DIRS})
endif()
add_subdirectory(shaders)
endif()
# Use OBJECT to not create a archive, since it just gets in the way.
add_library(comp_main OBJECT ${SHADER_HEADERS} ${MAIN_SOURCE_FILES} ${WL_PROTOS_SRC})
target_include_directories(comp_main SYSTEM PRIVATE
# Shaders - marked SYSTEM so we get no warnings
${CMAKE_CURRENT_BINARY_DIR}
)
if(BUILD_WITH_WAYLAND)
target_include_directories(comp_main SYSTEM PRIVATE ${WL_PROTOS_DIR})
endif()
if(BUILD_WITH_XCB)
target_include_directories(comp_main SYSTEM PRIVATE ${XCB_INCLUDE_DIRS})
endif()
if(BUILD_WITH_EGL)
target_include_directories(comp_main SYSTEM PRIVATE ${EGL_INCLUDE_DIRS})
endif()
add_subdirectory(shaders)
......@@ -72,7 +72,9 @@ if(BUILD_TRACKING)
endif()
add_subdirectory(common)
add_subdirectory(openxr)
if(BUILD_TARGET_OPENXR)
add_subdirectory(openxr)
endif()
add_subdirectory(cli)
if(BUILD_TARGET_GUI)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment