Commits
Marcus Calhoun-Lopez authored 393572db014
1 - | --- CMakeLists.txt.orig 2015-09-25 02:35:24.000000000 -0700 |
2 - | +++ CMakeLists.txt 2018-08-19 04:17:49.000000000 -0700 |
3 - | |
1 + | From eaca63aea72ed4db055514dfec2abc71a106aa70 Mon Sep 17 00:00:00 2001 |
2 + | From: Nigel Stewart <nigels@users.sourceforge.net> |
3 + | Date: Sun, 13 Nov 2016 16:04:00 +1000 |
4 + | Subject: [PATCH] Mac OSX needs to link OpenGL framework for libglui.dylib |
5 + | |
6 + | --- |
7 + | CMakeLists.txt | 2 +- |
8 + | 1 file changed, 1 insertion(+), 1 deletion(-) |
9 + | |
10 + | diff --git a/CMakeLists.txt b/CMakeLists.txt |
11 + | index 033cfd6..3b3aa2b 100644 |
12 + | --- CMakeLists.txt |
13 + | +++ CMakeLists.txt |
14 + | |
4 15 | set_property(TARGET glui_obj PROPERTY POSITION_INDEPENDENT_CODE 1) |
5 16 | |
6 17 | add_library(glui SHARED $<TARGET_OBJECTS:glui_obj>) |
7 18 | -target_link_libraries(glui ${GLUT_LIBRARIES}) |
8 19 | +target_link_libraries(glui ${GLUT_LIBRARIES} ${OPENGL_LIBRARIES}) |
9 - | +install(TARGETS glui DESTINATION lib) |
10 20 | |
11 21 | add_library(glui_static STATIC $<TARGET_OBJECTS:glui_obj>) |
12 22 | target_link_libraries(glui_static ${GLUT_LIBRARIES}) |
13 - | +install(TARGETS glui_static DESTINATION lib) |
23 + | From 4299e8fa43bb1e67370be36cad4b21115ab88af9 Mon Sep 17 00:00:00 2001 |
24 + | From: Simone Gasparini <simone.gasparini@gmail.com> |
25 + | Date: Sun, 14 May 2017 21:44:52 +0200 |
26 + | Subject: [PATCH] [cmake] added install targets |
27 + | |
28 + | --- |
29 + | CMakeLists.txt | 96 +++++++++++++++++++++++++++++++++++++++---- |
30 + | cmake/Config.cmake.in | 4 ++ |
31 + | 2 files changed, 93 insertions(+), 7 deletions(-) |
32 + | create mode 100644 cmake/Config.cmake.in |
33 + | |
34 + | diff --git a/CMakeLists.txt b/CMakeLists.txt |
35 + | index 3b3aa2b..a73e83a 100644 |
36 + | --- CMakeLists.txt |
37 + | +++ CMakeLists.txt |
38 + | |
39 + | -cmake_minimum_required(VERSION 2.8) |
40 + | +cmake_minimum_required(VERSION 2.8.12) |
41 + | |
42 + | project(glui) |
43 + | +set(PROJECT_VERSION 2.37) |
44 + | |
45 + | find_package(GLUT REQUIRED) |
46 + | find_package(OpenGL REQUIRED) |
47 + | |
48 + | -include_directories(${GLUT_INCLUDE_DIR}/include) |
49 + | -include_directories(${CMAKE_SOURCE_DIR}/include) |
50 + | - |
51 + | SET(GLUI_SRCS |
52 + | algebra3.cpp |
53 + | arcball.cpp |
54 + | |
55 + | viewmodel.cpp |
56 + | ) |
57 + | add_library(glui_obj OBJECT ${GLUI_SRCS}) |
58 + | +target_include_directories(glui_obj |
59 + | + PUBLIC |
60 + | + "$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>" |
61 + | + ${OPENGL_INCLUDE_DIR} |
62 + | + ${GLUT_INCLUDE_DIR}) |
63 + | # we need to enable -fPIC this so that the same object code can be used to |
64 + | # create static *and* shared libraries without double compilation |
65 + | -set_property(TARGET glui_obj PROPERTY POSITION_INDEPENDENT_CODE 1) |
66 + | +set_target_properties( glui_obj PROPERTIES POSITION_INDEPENDENT_CODE 1) |
67 + | |
68 + | add_library(glui SHARED $<TARGET_OBJECTS:glui_obj>) |
69 + | -target_link_libraries(glui ${GLUT_LIBRARIES} ${OPENGL_LIBRARIES}) |
70 + | +target_include_directories(glui |
71 + | + PUBLIC |
72 + | + "$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>" |
73 + | + "$<INSTALL_INTERFACE:include>" |
74 + | + ${OPENGL_INCLUDE_DIR} |
75 + | + ${GLUT_INCLUDE_DIR}) |
76 + | +target_link_libraries(glui PUBLIC ${GLUT_LIBRARIES} ${OPENGL_LIBRARIES}) |
77 + | +set_target_properties(glui PROPERTIES |
78 + | + DEBUG_POSTFIX "d" |
79 + | + VERSION ${PROJECT_VERSION} |
80 + | + SOVERSION ${PROJECT_VERSION}) |
81 + | |
82 + | add_library(glui_static STATIC $<TARGET_OBJECTS:glui_obj>) |
83 + | -target_link_libraries(glui_static ${GLUT_LIBRARIES}) |
84 + | +target_include_directories(glui_static |
85 + | + PUBLIC |
86 + | + "$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>" |
87 + | + "$<INSTALL_INTERFACE:include>" |
88 + | + ${OPENGL_INCLUDE_DIR} |
89 + | + ${GLUT_INCLUDE_DIR}) |
90 + | +target_link_libraries(glui_static PUBLIC ${GLUT_LIBRARIES} ${OPENGL_LIBRARIES}) |
91 + | +set_target_properties(glui_static PROPERTIES DEBUG_POSTFIX "d") |
92 + | |
93 + | add_executable(ppm2array tools/ppm.cpp tools/ppm2array.cpp) |
94 + | target_link_libraries(ppm2array) |
95 + | |
96 + | target_link_libraries(example5 glui_static ${GLUT_LIBRARIES} ${OPENGL_LIBRARIES}) |
97 + | add_executable(example6 example/example6.cpp) |
98 + | target_link_libraries(example6 glui_static ${GLUT_LIBRARIES} ${OPENGL_LIBRARIES}) |
99 + | + |
100 + | + |
101 + | + |
102 + | +#### |
103 + | +# Installation |
104 + | + |
105 + | +set(config_install_dir "lib/cmake/${PROJECT_NAME}") |
106 + | +set(include_install_dir "include") |
107 + | + |
108 + | +set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated") |
109 + | + |
110 + | +# Configuration |
111 + | +set(version_config "${generated_dir}/${PROJECT_NAME}ConfigVersion.cmake") |
112 + | +set(project_config "${generated_dir}/${PROJECT_NAME}Config.cmake") |
113 + | +set(targets_export_name "${PROJECT_NAME}Targets") |
114 + | +set(namespace "${PROJECT_NAME}::") |
115 + | + |
116 + | +# Include module with fuction 'write_basic_package_version_file' |
117 + | +include(CMakePackageConfigHelpers) |
118 + | + |
119 + | +# Configure '<PROJECT-NAME>ConfigVersion.cmake' |
120 + | +write_basic_package_version_file( |
121 + | + "${version_config}" VERSION ${PROJECT_VERSION} COMPATIBILITY SameMajorVersion |
122 + | +) |
123 + | + |
124 + | +# Configure '<PROJECT-NAME>Config.cmake' |
125 + | +configure_package_config_file( |
126 + | + "cmake/Config.cmake.in" |
127 + | + "${project_config}" |
128 + | + INSTALL_DESTINATION "${config_install_dir}" |
129 + | +) |
130 + | + |
131 + | +# Targets: |
132 + | +install( |
133 + | + TARGETS glui_static glui |
134 + | + EXPORT "${targets_export_name}" |
135 + | + LIBRARY DESTINATION "lib" |
136 + | + ARCHIVE DESTINATION "lib" |
137 + | + RUNTIME DESTINATION "bin" |
138 + | + INCLUDES DESTINATION "${include_install_dir}" |
139 + | +) |
140 + | + |
141 + | +# Headers: |
142 + | +install( |
143 + | + DIRECTORY "${CMAKE_SOURCE_DIR}/include/" |
144 + | + DESTINATION "${include_install_dir}" |
145 + | + FILES_MATCHING PATTERN "*.h" |
146 + | +) |
147 + | + |
148 + | + |
149 + | +# Config |
150 + | +install( |
151 + | + FILES "${project_config}" "${version_config}" |
152 + | + DESTINATION "${config_install_dir}" |
153 + | +) |
154 + | + |
155 + | +# Config |
156 + | +install( |
157 + | + EXPORT "${targets_export_name}" |
158 + | + NAMESPACE "${namespace}" |
159 + | + DESTINATION "${config_install_dir}" |
160 + | +) |
161 + | diff --git a/cmake/Config.cmake.in b/cmake/Config.cmake.in |
162 + | new file mode 100644 |
163 + | index 0000000..9b4c9ee |
164 + | --- /dev/null |
165 + | +++ cmake/Config.cmake.in |
166 + | |
167 + | +@PACKAGE_INIT@ |
168 + | + |
169 + | +include("${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake") |
170 + | +check_required_components("@PROJECT_NAME@") |
171 + | --- CMakeLists.txt.orig 2018-08-27 05:43:30.000000000 -0700 |
172 + | +++ CMakeLists.txt 2018-08-27 05:57:15.000000000 -0700 |
173 + | |
14 174 | |
15 175 | add_executable(ppm2array tools/ppm.cpp tools/ppm2array.cpp) |
16 176 | target_link_libraries(ppm2array) |
17 177 | +install(TARGETS ppm2array DESTINATION bin) |
18 178 | |
19 179 | add_executable(example1 example/example1.cpp) |
20 180 | target_link_libraries(example1 glui_static ${GLUT_LIBRARIES} ${OPENGL_LIBRARIES}) |
21 181 | +install(TARGETS example1 DESTINATION share/examples/glui) |
22 182 | add_executable(example2 example/example2.cpp) |
23 183 | target_link_libraries(example2 glui_static ${GLUT_LIBRARIES} ${OPENGL_LIBRARIES}) |
26 186 | target_link_libraries(example3 glui_static ${GLUT_LIBRARIES} ${OPENGL_LIBRARIES}) |
27 187 | +install(TARGETS example3 DESTINATION share/examples/glui) |
28 188 | add_executable(example4 example/example4.cpp) |
29 189 | target_link_libraries(example4 glui_static ${GLUT_LIBRARIES} ${OPENGL_LIBRARIES}) |
30 190 | +install(TARGETS example4 DESTINATION share/examples/glui) |
31 191 | add_executable(example5 example/example5.cpp) |
32 192 | target_link_libraries(example5 glui_static ${GLUT_LIBRARIES} ${OPENGL_LIBRARIES}) |
33 193 | +install(TARGETS example5 DESTINATION share/examples/glui) |
34 194 | add_executable(example6 example/example6.cpp) |
35 195 | target_link_libraries(example6 glui_static ${GLUT_LIBRARIES} ${OPENGL_LIBRARIES}) |
196 + | - |
36 197 | +install(TARGETS example6 DESTINATION share/examples/glui) |
198 + | |
199 + | |
200 + | #### |