1 |
ottxor 14/02/24 23:36:07 |
2 |
|
3 |
Added: voro++-0.4.6-cmake.patch |
4 |
Log: |
5 |
initial commit |
6 |
|
7 |
(Portage version: 2.2.7/cvs/Linux x86_64, signed Manifest commit with key C2000586) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 sci-libs/voro++/files/voro++-0.4.6-cmake.patch |
11 |
|
12 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sci-libs/voro++/files/voro++-0.4.6-cmake.patch?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sci-libs/voro++/files/voro++-0.4.6-cmake.patch?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: voro++-0.4.6-cmake.patch |
16 |
=================================================================== |
17 |
Index: CMakeLists.txt |
18 |
=================================================================== |
19 |
--- CMakeLists.txt (revision 0) |
20 |
+++ CMakeLists.txt (working copy) |
21 |
@@ -0,0 +1,109 @@ |
22 |
+cmake_minimum_required(VERSION 2.6) |
23 |
+ |
24 |
+project(voro++) |
25 |
+ |
26 |
+set(PROJECT_VERSION "0.4.6") |
27 |
+set(SOVERSION 0) |
28 |
+ |
29 |
+# Cmake modules/macros are in a subdirectory to keep this file cleaner |
30 |
+set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMakeModules) |
31 |
+ |
32 |
+if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CXX_FLAGS) |
33 |
+ #release comes with -O3 by default |
34 |
+ set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE) |
35 |
+endif(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CXX_FLAGS) |
36 |
+ |
37 |
+enable_language(CXX) |
38 |
+ |
39 |
+###################################################################### |
40 |
+# compiler tests |
41 |
+# these need ot be done early (before further tests). |
42 |
+##################################################################### |
43 |
+ |
44 |
+include(CheckCXXCompilerFlag) |
45 |
+ |
46 |
+######################################################################## |
47 |
+# User input options # |
48 |
+######################################################################## |
49 |
+option(BUILD_SHARED_LIBS "Build shared libs" ON) |
50 |
+if (NOT DEFINED LIB) |
51 |
+ set(LIB "lib") |
52 |
+endif(NOT DEFINED LIB) |
53 |
+if (NOT DEFINED MAN) |
54 |
+ set(MAN "share/man") |
55 |
+endif(NOT DEFINED MAN) |
56 |
+if (NOT DEFINED DATA) |
57 |
+ set(DATA "share/voro++") |
58 |
+endif(NOT DEFINED DATA) |
59 |
+ |
60 |
+######################################################################## |
61 |
+#Find external packages |
62 |
+######################################################################## |
63 |
+find_package(Doxygen) |
64 |
+ |
65 |
+######################################################################## |
66 |
+# Basic system tests (standard libraries, headers, functions, types) # |
67 |
+######################################################################## |
68 |
+include(CheckIncludeFileCXX) |
69 |
+foreach(HEADER cmath cstdio cstdlib cstring ctime fstream iostream queue vector) |
70 |
+ check_include_file_cxx(${HEADER} FOUND_${HEADER}) |
71 |
+ if(NOT FOUND_${HEADER}) |
72 |
+ message(FATAL_ERROR "Could not find needed header - ${HEADER}") |
73 |
+ endif(NOT FOUND_${HEADER}) |
74 |
+endforeach(HEADER) |
75 |
+ |
76 |
+set(MATH_LIBRARIES "m" CACHE STRING "math library") |
77 |
+mark_as_advanced( MATH_LIBRARIES ) |
78 |
+include(CheckLibraryExists) |
79 |
+foreach(FUNC sqrt) |
80 |
+ check_library_exists(${MATH_LIBRARIES} ${FUNC} "" FOUND_${FUNC}_${MATH_LIBRARIES}) |
81 |
+ if(NOT FOUND_${FUNC}_${MATH_LIBRARIES}) |
82 |
+ message(FATAL_ERROR "Could not find needed math function - ${FUNC}") |
83 |
+ endif(NOT FOUND_${FUNC}_${MATH_LIBRARIES}) |
84 |
+endforeach(FUNC) |
85 |
+ |
86 |
+###################################### |
87 |
+# Include the following subdirectory # |
88 |
+###################################### |
89 |
+ |
90 |
+file(GLOB VORO_SOURCES src/*.cc) |
91 |
+file(GLOB NOT_VORO_SOURCES src/v_base_wl.cc src/cmd_line.cc src/voro++.cc) |
92 |
+list(REMOVE_ITEM VORO_SOURCES ${NOT_VORO_SOURCES}) |
93 |
+add_library(voro++ ${VORO_SOURCES}) |
94 |
+set_target_properties(voro++ PROPERTIES |
95 |
+ LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/src" |
96 |
+ SOVERSION ${SOVERSION}) |
97 |
+install(TARGETS voro++ LIBRARY DESTINATION ${LIB} ARCHIVE DESTINATION ${LIB}) |
98 |
+ |
99 |
+add_executable(cmd_line src/cmd_line.cc) |
100 |
+target_link_libraries(cmd_line voro++) |
101 |
+#cannot have two target with the same name |
102 |
+set_target_properties(cmd_line PROPERTIES OUTPUT_NAME voro++ |
103 |
+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/src") |
104 |
+install(TARGETS cmd_line RUNTIME DESTINATION bin) |
105 |
+ |
106 |
+#for voto++.hh |
107 |
+include_directories(${CMAKE_SOURCE_DIR}/src) |
108 |
+file(GLOB EXAMPLE_SOURCES examples/*/*.cc) |
109 |
+foreach(SOURCE ${EXAMPLE_SOURCES}) |
110 |
+ string(REGEX REPLACE "^.*/([^/]*)\\.cc$" "\\1" PROGNAME "${SOURCE}") |
111 |
+ if (NOT PROGNAME STREQUAL ellipsoid) #ellipsoid is broken |
112 |
+ string(REGEX REPLACE "^.*/(examples/.*)/${PROGNAME}\\.cc$" "\\1" DIRNAME "${SOURCE}") |
113 |
+ add_executable(${PROGNAME} ${SOURCE}) |
114 |
+ target_link_libraries(${PROGNAME} voro++) |
115 |
+ set_target_properties(${PROGNAME} PROPERTIES |
116 |
+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${DIRNAME}" ) |
117 |
+ endif() |
118 |
+endforeach(SOURCE) |
119 |
+ |
120 |
+file(GLOB_RECURSE VORO_HEADERS src/voro++.hh) |
121 |
+install(FILES ${VORO_HEADERS} DESTINATION include) |
122 |
+install(FILES ${CMAKE_SOURCE_DIR}/man/voro++.1 DESTINATION ${MAN}/man1) |
123 |
+ |
124 |
+if (DOXYGEN_FOUND) |
125 |
+ add_custom_target(help COMMAND ${DOXYGEN_EXECUTABLE} src/Doxyfile |
126 |
+ COMMENT "Build doxygen documentation") |
127 |
+endif (DOXYGEN_FOUND) |
128 |
+ |
129 |
+configure_file(${CMAKE_MODULE_PATH}/cmake_uninstall.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake IMMEDIATE @ONLY) |
130 |
+add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) |
131 |
Index: CMakeModules/cmake_uninstall.cmake.in |
132 |
=================================================================== |
133 |
--- CMakeModules/cmake_uninstall.cmake.in (revision 0) |
134 |
+++ CMakeModules/cmake_uninstall.cmake.in (working copy) |
135 |
@@ -0,0 +1,22 @@ |
136 |
+IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") |
137 |
+ MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") |
138 |
+ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") |
139 |
+ |
140 |
+FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) |
141 |
+STRING(REGEX REPLACE "\n" ";" files "${files}") |
142 |
+FOREACH(file ${files}) |
143 |
+ MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") |
144 |
+ IF(EXISTS "$ENV{DESTDIR}${file}") |
145 |
+ EXEC_PROGRAM( |
146 |
+ "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" |
147 |
+ OUTPUT_VARIABLE rm_out |
148 |
+ RETURN_VALUE rm_retval |
149 |
+ ) |
150 |
+ IF(NOT "${rm_retval}" STREQUAL 0) |
151 |
+ MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") |
152 |
+ ENDIF(NOT "${rm_retval}" STREQUAL 0) |
153 |
+ ELSE(EXISTS "$ENV{DESTDIR}${file}") |
154 |
+ MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") |
155 |
+ ENDIF(EXISTS "$ENV{DESTDIR}${file}") |
156 |
+ENDFOREACH(file) |
157 |
+ |