cmake: add ecore_x

This commit is contained in:
Marcel Hollerbach 2017-02-03 19:23:47 +01:00
parent e34f36be12
commit bcdde959e6
3 changed files with 172 additions and 0 deletions

View File

@ -53,6 +53,7 @@ EFL_LIB(embryo)
EFL_LIB(ector)
EFL_LIB(eeze)
EFL_LIB(ecore_input)
EFL_LIB(ecore_x)
EFL_OPTIONS_SUMMARY()

110
cmake/config/ecore_x.cmake Normal file
View File

@ -0,0 +1,110 @@
include(FindX11)
EFL_OPTION(XGESTURE "Whenever you want ecore_x to use gesture" OFF)
EFL_OPTION(XPRESENT "Whenever you want ecore_x to use xpresent" OFF)
EFL_OPTION(XINPUT2 "Whenever you want ecore_x to use xinput2" ON)
EFL_OPTION(XINPUT22 "Whenever you want ecore_x to use xinput22" OFF)
#the rest is just statically enabled
CHECK_APPEND_DEFINE(HAVE_ECORE_X_XLIB ON)
CHECK_APPEND_DEFINE(ECORE_XKB ON)
CHECK_APPEND_DEFINE(ECORE_XCOMPOSITE ON)
CHECK_APPEND_DEFINE(ECORE_XDAMAGE ON)
CHECK_APPEND_DEFINE(ECORE_XDPMS ON)
CHECK_APPEND_DEFINE(ECORE_XFIXES ON)
CHECK_APPEND_DEFINE(ECORE_XINERAMA ON)
CHECK_APPEND_DEFINE(ECORE_XRANDR ON)
CHECK_APPEND_DEFINE(ECORE_XSS ON)
CHECK_APPEND_DEFINE(ECORE_XTEST ON)
#FindX11 does not cover all parts we need so here are the 4 extensions we need to check
#copied from https://github.com/Kitware/CMake/blob/master/Modules/FindX11.cmake#L65
set(X11_INC_SEARCH_PATH
/usr/pkg/xorg/include
/usr/X11R6/include
/usr/X11R7/include
/usr/include/X11
/usr/openwin/include
/usr/openwin/share/include
/opt/graphics/OpenGL/include
/opt/X11/include
)
set(X11_LIB_SEARCH_PATH
/usr/pkg/xorg/lib
/usr/X11R6/lib
/usr/X11R7/lib
/usr/openwin/lib
/opt/X11/lib
)
macro(find_lib_and_include name path lib)
string(TOUPPER ${name} ecore_name)
set(X11_${name}_FOUND OFF)
find_library(X11_${name}_LIB ${lib} ${X11_LIB_SEARCH_PATH})
find_path(X11_${name}_INCLUDE_PATH X11/extensions/${path} ${X11_INC_SEARCH_PATH})
if (X11_${name}_LIB AND X11_${name}_INCLUDE_PATH)
set(X11_${name}_FOUND ON)
endif()
CHECK_APPEND_DEFINE(ECORE_${ecore_name} ON)
endmacro()
if (${XGESTURE})
find_lib_and_include(XGesture gesture.h Xgesture)
endif()
if(${XPRESENT})
find_lib_and_include(Xpresent Xpresent.h Xpresent)
endif()
if(${XINPUT2})
find_lib_and_include(Xi2 XInput2.h Xi)
endif()
if(${XINPUT22})
find_lib_and_include(Xi2_2 Xpresent2.h Xi)
endif()
#build a list of all components we use
set(_X_EXTENSIONS
X11
X11_Xkb
X11_Xcomposite
X11_Xdamage
X11_dpms
X11_Xfixes
X11_Xinerama
X11_Xrandr
X11_Xrender
X11_XTest
X11_Xscreensaver
)
if(${XGESTURE})
list(APPEND _X_EXTENSIONS X11_Xgesture)
endif()
if(${XPRESENT})
list(APPEND _X_EXTENSIONS X11_Xpresent)
endif()
if(${XINPUT2})
list(APPEND _X_EXTENSIONS X11_Xi2)
endif()
if(${XINPUT22})
list(APPEND _X_EXTENSIONS X11_Xi2_2)
endif()
foreach(ext ${_X_EXTENSIONS})
if (NOT ${ext}_FOUND)
message(FATAL_ERROR "Xserver extension ${ext} not found")
endif()
list(APPEND X_EXTENSIONS find-${ext})
endforeach()
configure_file(
${PROJECT_SOURCE_DIR}/src/lib/ecore_x/ecore_x_version.h.cmake
${PROJECT_BINARY_DIR}/src/lib/ecore_x/ecore_x_version.h)

View File

@ -0,0 +1,61 @@
set(PUBLIC_LIBRARIES
eina
ecore
)
set(LIBRARIES
ecore
ecore_input
efl
eo
${X_EXTENSIONS}
)
message("${LIBRARIES}")
#todo XRANDR_GOOD
set(PUBLIC_HEADERS
Ecore_X.h
# ecore_x_version.h
Ecore_X_Atoms.h
Ecore_X_Cursor.h
)
set(SOURCES
ecore_x_atoms_decl.h
ecore_x.c
ecore_x_dnd.c
ecore_x_sync.c
ecore_x_randr.c
ecore_x_fixes.c
ecore_x_damage.c
ecore_x_composite.c
ecore_x_error.c
ecore_x_events.c
ecore_x_icccm.c
ecore_x_keygrab.c
ecore_x_netwm.c
ecore_x_mwm.c
ecore_x_e.c
ecore_x_selection.c
ecore_x_window.c
ecore_x_window_prop.c
ecore_x_window_shape.c
ecore_x_pixmap.c
ecore_x_present.c
ecore_x_gc.c
ecore_x_xinerama.c
ecore_x_screensaver.c
ecore_x_dpms.c
ecore_x_drawable.c
ecore_x_cursor.c
ecore_x_test.c
ecore_x_atoms.c
ecore_x_region.c
ecore_x_image.c
ecore_x_xi2.c
ecore_x_vsync.c
ecore_x_gesture.c
ecore_x_private.h
)