|
@@ -1,10 +1,19 @@
|
1
|
1
|
cmake_minimum_required(VERSION 3.1.3)
|
2
|
2
|
|
3
|
3
|
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build (Debug or Release)")
|
|
4
|
+
|
4
|
5
|
if ( NOT CMAKE_INSTALL_PREFIX )
|
5
|
6
|
set(CMAKE_INSTALL_PREFIX "/usr")
|
6
|
7
|
endif()
|
7
|
8
|
|
|
9
|
+# This should really never be disabled. The pure-X mode of slop is very expensive and buggy.
|
|
10
|
+# It also doesn't work on Wayland. Though if a system is never running a compositor, or
|
|
11
|
+# doesn't have OpenGL, this could remove some linking dependencies I suppose.
|
|
12
|
+set( SLOP_OPENGL TRUE CACHE BOOL "To enable or disable OpenGL support." )
|
|
13
|
+if ( SLOP_OPENGL )
|
|
14
|
+ add_definitions(-DSLOP_OPENGL="True")
|
|
15
|
+endif()
|
|
16
|
+
|
8
|
17
|
project(slop)
|
9
|
18
|
|
10
|
19
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/")
|
|
@@ -21,24 +30,36 @@ endif()
|
21
|
30
|
|
22
|
31
|
include_directories("${PROJECT_BINARY_DIR}")
|
23
|
32
|
|
24
|
|
-add_definitions(-DSLOP_VERSION="v7.3.48")
|
|
33
|
+add_definitions(-DSLOP_VERSION="v7.3.49")
|
25
|
34
|
|
26
|
35
|
# The names have to be unique unfortunately.
|
27
|
36
|
set(EXECUTABLE_NAME "slop")
|
28
|
37
|
set(LIBRARY_NAME "slopy")
|
29
|
38
|
|
30
|
|
-add_library(${LIBRARY_NAME} SHARED src/mouse.cpp
|
31
|
|
- src/keyboard.cpp
|
32
|
|
- src/x.cpp
|
33
|
|
- src/slopstates.cpp
|
34
|
|
- src/framebuffer.cpp
|
35
|
|
- src/resource.cpp
|
36
|
|
- src/shader.cpp
|
37
|
|
- src/window.cpp
|
38
|
|
- src/slop.cpp
|
39
|
|
- src/rectangle.cpp
|
40
|
|
- src/xshaperectangle.cpp
|
41
|
|
- src/glrectangle.cpp)
|
|
39
|
+
|
|
40
|
+if ( SLOP_OPENGL )
|
|
41
|
+ add_library(${LIBRARY_NAME} SHARED src/mouse.cpp
|
|
42
|
+ src/keyboard.cpp
|
|
43
|
+ src/x.cpp
|
|
44
|
+ src/slopstates.cpp
|
|
45
|
+ src/resource.cpp
|
|
46
|
+ src/slop.cpp
|
|
47
|
+ src/rectangle.cpp
|
|
48
|
+ src/xshaperectangle.cpp
|
|
49
|
+ src/shader.cpp
|
|
50
|
+ src/window.cpp
|
|
51
|
+ src/framebuffer.cpp
|
|
52
|
+ src/glrectangle.cpp)
|
|
53
|
+else()
|
|
54
|
+ add_library(${LIBRARY_NAME} SHARED src/mouse.cpp
|
|
55
|
+ src/keyboard.cpp
|
|
56
|
+ src/x.cpp
|
|
57
|
+ src/slopstates.cpp
|
|
58
|
+ src/resource.cpp
|
|
59
|
+ src/slop.cpp
|
|
60
|
+ src/rectangle.cpp
|
|
61
|
+ src/xshaperectangle.cpp)
|
|
62
|
+endif()
|
42
|
63
|
|
43
|
64
|
set_property(TARGET ${LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
|
44
|
65
|
set_property(TARGET ${LIBRARY_NAME} PROPERTY CXX_STANDARD 11)
|
|
@@ -50,42 +71,51 @@ set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_STANDARD 11)
|
50
|
71
|
|
51
|
72
|
set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/modules" )
|
52
|
73
|
|
53
|
|
-find_package(GLEW REQUIRED)
|
54
|
74
|
find_package(GLM REQUIRED)
|
55
|
75
|
find_package(X11 REQUIRED)
|
56
|
76
|
find_package(XExt REQUIRED)
|
57
|
|
-find_package(GLX REQUIRED)
|
58
|
|
-find_package(OpenGL REQUIRED)
|
59
|
|
-find_package(XRender REQUIRED)
|
60
|
|
-# Ahhhh, finally this eliminates the segfault on preload.
|
61
|
|
-find_package(Threads REQUIRED)
|
|
77
|
+
|
|
78
|
+if ( SLOP_OPENGL )
|
|
79
|
+ find_package(GLEW REQUIRED)
|
|
80
|
+ find_package(OpenGL REQUIRED)
|
|
81
|
+ find_package(GLX REQUIRED)
|
|
82
|
+ find_package(XRender REQUIRED)
|
|
83
|
+ # Ahhhh, finally this eliminates the segfault on preload.
|
|
84
|
+ find_package(Threads REQUIRED)
|
|
85
|
+endif()
|
62
|
86
|
|
63
|
87
|
include_directories(${X11_INCLUDE_DIR}
|
64
|
|
- ${GLEW_INCLUDE_DIR}
|
65
|
88
|
${GLM_INCLUDE_DIR}
|
66
|
|
- ${XEXT_INCLUDE_DIR}
|
67
|
|
- ${GLX_INCLUDE_DIR}
|
68
|
|
- ${XRENDER_INCLUDE_DIR}
|
69
|
|
- ${OPENGL_INCLUDE_DIR})
|
|
89
|
+ ${GLX_INCLUDE_DIR})
|
70
|
90
|
|
71
|
91
|
target_link_libraries(${LIBRARY_NAME} ${X11_LIBRARIES}
|
72
|
|
- ${CMAKE_THREAD_LIBS_INIT}
|
73
|
92
|
${GLM_LIBRARIES}
|
74
|
|
- ${OPENGL_LIBRARIES}
|
75
|
|
- ${GLX_LIBRARY}
|
76
|
|
- ${XRENDER_LIBRARY}
|
77
|
|
- ${XEXT_LIBRARIES}
|
78
|
|
- ${GLEW_LIBRARIES})
|
|
93
|
+ ${XEXT_LIBRARIES})
|
|
94
|
+
|
|
95
|
+if ( SLOP_OPENGL )
|
|
96
|
+ include_directories( ${XEXT_INCLUDE_DIR}
|
|
97
|
+ ${GLEW_INCLUDE_DIR}
|
|
98
|
+ ${XRENDER_INCLUDE_DIR}
|
|
99
|
+ ${OPENGL_INCLUDE_DIR} )
|
|
100
|
+ target_link_libraries(${LIBRARY_NAME} ${OPENGL_LIBRARIES}
|
|
101
|
+ ${XRENDER_LIBRARY}
|
|
102
|
+ ${CMAKE_THREAD_LIBS_INIT}
|
|
103
|
+ ${GLX_LIBRARY}
|
|
104
|
+ ${GLEW_LIBRARIES})
|
|
105
|
+endif()
|
79
|
106
|
|
80
|
107
|
target_link_libraries(${EXECUTABLE_NAME} ${LIBRARY_NAME} )
|
81
|
108
|
|
82
|
|
-find_package(ICU COMPONENTS uc)
|
83
|
|
-set( SLOP_UNICODE TRUE CACHE BOOL "To enable or disable unicode support." )
|
84
|
|
-if ( SLOP_UNICODE AND ICU_FOUND )
|
85
|
|
- # ICU is required for old nvidia drivers to work for whatever reason.
|
|
109
|
+if( CMAKE<3.7 )
|
|
110
|
+ message( WARNING "CMake version is below 3.7, CMake version >= 3.7 is required for unicode support." )
|
|
111
|
+else()
|
|
112
|
+ find_package(ICU COMPONENTS uc)
|
|
113
|
+ set( SLOP_UNICODE TRUE CACHE BOOL "To enable or disable unicode support." )
|
|
114
|
+ if ( SLOP_UNICODE AND ICU_FOUND )
|
86
|
115
|
add_definitions(-DCXXOPTS_USE_UNICODE)
|
87
|
116
|
include_directories( ${ICU_INCLUDE_DIR} )
|
88
|
117
|
target_link_libraries(${EXECUTABLE_NAME} ${ICU_UC_LIBRARIES} )
|
|
118
|
+ endif()
|
89
|
119
|
endif()
|
90
|
120
|
|
91
|
121
|
install( TARGETS ${EXECUTABLE_NAME} DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" )
|