# Copyright (C) 2020 Uniontech Technology Co., Ltd.
#
# Author:     xinbo wang <wangxinbo@uniontech.com>
#
# Maintainer: xinbo wang <wangxinbo@uniontech.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

set(BIN_NAME dtkscreenace)
set(SECURITY_INCLUDE ${CMAKE_SOURCE_DIR}/include/screen-ace)

include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${SECURITY_INCLUDE})
include_directories(${COMMON_PATH})
include_directories(../uace/src/ext/)

set(SCREEN_LIB_SRCS
    dtk_screen_ace.c
    dtk_screenace_wayland.c
    dtk_screenace_x11.c
    ${COMMON_PATH}/log.c
    ${SECURITY_INCLUDE}/dtk_screen_ace.h
    ${CMAKE_CURRENT_BINARY_DIR}/wayland-dde-restrict-client-protocol.h
    )

set(SCREEN_LIB_HEADERS
    ${SECURITY_INCLUDE}/dtk_screen_ace.h
    )

ecm_add_wayland_client_protocol(SCREEN_LIB_SRCS
    PROTOCOL ${PROTOCOLS_PATH}/dde-restrict.xml
    BASENAME dde-restrict
)

add_library(${BIN_NAME} SHARED
    ${SCREEN_LIB_SRCS}
    ${SCREEN_LIB_HEADERS}
)

target_link_libraries(${BIN_NAME} uaceExt)

set_target_properties(${BIN_NAME} PROPERTIES
    VERSION ${CMAKE_PROJECT_VERSION}
    SOVERSION ${CMAKE_PROJECT_VERSION_MAJOR})

target_compile_definitions(${BIN_NAME} PRIVATE VERSION="${CMAKE_PROJECT_VERSION}")

install(FILES ${SCREEN_LIB_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${BIN_NAME})
install(TARGETS ${BIN_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})
