2019-03-28 08:56:14 +00:00
|
|
|
cmake_minimum_required(VERSION 3.0)
|
|
|
|
project(clipboards LANGUAGES C)
|
|
|
|
|
|
|
|
set(CLIPBOARD_H "${CMAKE_BINARY_DIR}/include/dynamic/clipboards.h")
|
|
|
|
set(CLIPBOARD_C "${CMAKE_BINARY_DIR}/src/clipboards.c")
|
|
|
|
|
|
|
|
file(WRITE ${CLIPBOARD_H} "#include \"interface/clipboard.h\"\n\n")
|
|
|
|
file(APPEND ${CLIPBOARD_H} "extern LG_Clipboard * LG_Clipboards[];\n\n")
|
|
|
|
|
|
|
|
file(WRITE ${CLIPBOARD_C} "#include \"interface/clipboard.h\"\n\n")
|
|
|
|
file(APPEND ${CLIPBOARD_C} "#include <stddef.h>\n\n")
|
|
|
|
|
2019-03-28 09:12:18 +00:00
|
|
|
set(CLIPBOARDS "_")
|
|
|
|
set(CLIPBOARDS_LINK "_")
|
2019-03-28 08:56:14 +00:00
|
|
|
function(add_clipboard name)
|
|
|
|
set(CLIPBOARDS "${CLIPBOARDS};${name}" PARENT_SCOPE)
|
|
|
|
set(CLIPBOARDS_LINK "${CLIPBOARDS_LINK};clipboard_${name}" PARENT_SCOPE)
|
|
|
|
add_subdirectory(${name})
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
# Add/remove clipboards here!
|
2019-03-28 09:12:18 +00:00
|
|
|
if (ENABLE_CB_X11)
|
|
|
|
add_clipboard(X11)
|
|
|
|
endif()
|
2019-03-28 08:56:14 +00:00
|
|
|
|
2021-01-09 06:04:02 +00:00
|
|
|
if (ENABLE_CB_WAYLAND)
|
|
|
|
add_clipboard(Wayland)
|
|
|
|
endif()
|
|
|
|
|
2019-03-28 08:56:14 +00:00
|
|
|
list(REMOVE_AT CLIPBOARDS 0)
|
|
|
|
list(REMOVE_AT CLIPBOARDS_LINK 0)
|
|
|
|
|
|
|
|
list(LENGTH CLIPBOARDS CLIPBOARD_COUNT)
|
|
|
|
file(APPEND ${CLIPBOARD_H} "#define LG_CLIPBOARD_COUNT ${CLIPBOARD_COUNT}\n")
|
|
|
|
|
|
|
|
foreach(clipboard ${CLIPBOARDS})
|
|
|
|
file(APPEND ${CLIPBOARD_C} "extern LG_Clipboard LGC_${clipboard};\n")
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
file(APPEND ${CLIPBOARD_C} "\nconst LG_Clipboard * LG_Clipboards[] =\n{\n")
|
|
|
|
foreach(clipboard ${CLIPBOARDS})
|
|
|
|
file(APPEND ${CLIPBOARD_C} " &LGC_${clipboard},\n")
|
|
|
|
endforeach()
|
|
|
|
file(APPEND ${CLIPBOARD_C} " NULL\n};\n\n")
|
|
|
|
|
2019-03-28 09:15:13 +00:00
|
|
|
add_library(clipboards STATIC ${CLIPBOARD_C})
|
|
|
|
target_link_libraries(clipboards ${CLIPBOARDS_LINK})
|