-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathCMakeLists.txt
69 lines (53 loc) · 2.2 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
cmake_minimum_required (VERSION 3.10)
project ("grx" VERSION 3.2.0 LANGUAGES C)
set (ABI_VERSION 3)
set (GIR_NAME "Grx")
set (GIR_VERSION "3.0")
set (PACKAGE_NAME ${PROJECT_NAME}-${GIR_VERSION})
# Configuration settings
set (GRX_DEBUG "OFF" CACHE STRING "Debug message flags")
if (CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
set (GRX_PLUGIN_LINUXFB "Yes" CACHE BOOL "Enable Linux framebuffer video driver plugin")
else ()
set (GRX_PLUGIN_LINUXFB "No")
endif ()
set (GRX_PLUGIN_GTK3 "Yes" CACHE BOOL "Enable GTK+ 3 video driver plugin")
set (GRX_ENABLE_DOC "Yes" CACHE BOOL "Enable building docs")
# we have local cmake modules
list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
# macOS/brew stuff
if (APPLE)
# see `brew info gettext` caveats
link_directories (/usr/local/opt/gettext/lib)
include_directories (/usr/local/opt/gettext/include)
# .typelib does not work without this
set (CMAKE_MACOSX_RPATH No)
endif (APPLE)
# global stuff
find_package (PkgConfig REQUIRED)
include(GNUInstallDirs)
set (CMAKE_INSTALL_PKGDATADIR ${CMAKE_INSTALL_DATAROOTDIR}/${PACKAGE_NAME})
set (CMAKE_INSTALL_PKGLIBDIR ${CMAKE_INSTALL_LIBDIR}/${PACKAGE_NAME})
set (CMAKE_INSTALL_PKGPLUGINDIR ${CMAKE_INSTALL_PKGLIBDIR}/plugins/${ABI_VERSION})
set (SHARED_LIBRARY_TARGET ${PACKAGE_NAME}-shared)
set (STATIC_LIBRARY_TARGET ${PACKAGE_NAME}-static)
set (GIR_TARGET ${PACKAGE_NAME}-gir)
set (TYPELIB_TARGET ${PACKAGE_NAME}-typelib)
# subdirectories
# src goes first for depedency reasons
add_subdirectory (src)
add_subdirectory (doc)
add_subdirectory (plugins)
add_subdirectory (tools)
add_subdirectory (example)
add_subdirectory (test)
# these should probably be move do subdirectories too
install (FILES bindings/vala/grx-3.0.vapi
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/vala/vapi/)
install (FILES include/grx-3.0.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install (DIRECTORY include/grx DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
# exports for locally including this proejct in another cmake project
configure_file (${PACKAGE_NAME}Config.cmake.in ${PACKAGE_NAME}Config.cmake @ONLY)
export (TARGETS ${SHARED_LIBRARY_TARGET} ${STATIC_LIBRARY_TARGET}
APPEND FILE ${PACKAGE_NAME}Config.cmake)
export (PACKAGE ${PACKAGE_NAME})