File: CMakeLists.txt

package info (click to toggle)
libsbml 5.10.0+dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 141,800 kB
  • ctags: 98,793
  • sloc: cpp: 804,405; xml: 206,907; ansic: 66,144; cs: 52,916; java: 25,093; python: 23,449; sh: 9,847; perl: 8,414; makefile: 7,580; ruby: 4,760; csh: 3
file content (304 lines) | stat: -rw-r--r-- 10,424 bytes parent folder | download
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
###############################################################################
#
# Description       : CMake build script for libSBML
# Original author(s): Frank Bergmann <fbergman@caltech.edu>
# Organization      : California Institute of Technology
#
# This file is part of libSBML.  Please visit http://sbml.org for more
# information about SBML, and the latest version of libSBML.
#
# Copyright (C) 2013-2014 jointly by the following organizations:
#     1. California Institute of Technology, Pasadena, CA, USA
#     2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK
#     3. University of Heidelberg, Heidelberg, Germany
#
# Copyright (C) 2009-2013 jointly by the following organizations:
#     1. California Institute of Technology, Pasadena, CA, USA
#     2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK
#
# Copyright (C) 2006-2008 by the California Institute of Technology,
#     Pasadena, CA, USA
#
# Copyright (C) 2002-2005 jointly by the following organizations:
#     1. California Institute of Technology, Pasadena, CA, USA
#     2. Japan Science and Technology Agency, Japan
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation.  A copy of the license agreement is provided
# in the file named "LICENSE.txt" included with this software distribution
# and also available online as http://sbml.org/software/libsbml/license.html
#
###############################################################################

if (WITH_DOXYGEN)
find_package(Doxygen)

if (NOT EXISTS "${DOXYGEN_EXECUTABLE}")
		message(FATAL_ERROR "Cannot generate documentation, please install doxygen / specify the DOXYGEN_EXECUTABLE.")
else()
		message(WARNING "Creating Documentation with CMake is experimental. Please consider configuring with gnumake, to generate documentation.")
endif()

# determine doxygen version
IF(DOXYGEN_EXECUTABLE)
  EXECUTE_PROCESS(COMMAND ${DOXYGEN_EXECUTABLE} "--version" OUTPUT_VARIABLE DOXYGEN_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
ENDIF()

# write specific file
if (DOXYGEN_VERSION VERSION_GREATER 1.7)
file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/src/doxygen-version-specific.txt "MARKDOWN_SUPPORT = NO")
else()
file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/src/doxygen-version-specific.txt "")
endif()

# configure installation html file
configure_file(
	${CMAKE_CURRENT_SOURCE_DIR}/src/libsbml-installation.html.in
	${CMAKE_CURRENT_SOURCE_DIR}/src/libsbml-installation.html
)

# configure java documentation file
configure_file(
	${CMAKE_CURRENT_SOURCE_DIR}/src/java-substitutions/libsbmlConstants.java.in
	${CMAKE_CURRENT_SOURCE_DIR}/src/java-substitutions/libsbmlConstants.java
)


# disable dot if we don't have it
set(HAVE_DOT)
set(DOT_PATH)
if (EXISTS "${DOXYGEN_DOT_PATH}")
	set(HAVE_DOT "YES")
	file(TO_NATIVE_PATH ${DOXYGEN_DOT_PATH} DOT_PATH)
else()
	set(HAVE_DOT "NO")
	set(DOT_PATH "")
endif()

set(PACKAGE_NAME "libSBML")

# replace variables as needed
foreach( lang "common" "c" "cpp" "perl" "python" "csharp")
configure_file(
	${CMAKE_CURRENT_SOURCE_DIR}/src/doxygen-config-${lang}.txt.cmake
	${CMAKE_CURRENT_SOURCE_DIR}/src/doxygen-config-${lang}.txt
)
endforeach()




# create C-api manuals
macro(createManual lang)
	make_directory(${CMAKE_CURRENT_SOURCE_DIR}/formatted/${lang}-api)
	make_directory(${CMAKE_CURRENT_SOURCE_DIR}/formatted/${lang}-api/search)

	file(GLOB graphics_files ${CMAKE_CURRENT_SOURCE_DIR}/src/common-graphics/*.jpg)
	foreach(graphic ${graphics_files})
		file(COPY ${graphic} DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/formatted/${lang}-api)
	endforeach()

	file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/formatted/${lang}-api output_path)
	file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/formatted/${lang}-api/search search_path)
	file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src/common-graphics/official-sbml-supported-40.jpg logo_file)
	file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src/common-graphics/right-arrow.gif right_arrow)
	file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src/sbml.js sbml_js)
	file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src/css/libsbml-doxygen-tabs.css tabs_css)
	file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src/css/search.png search_png)
	file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src/css/search.css search_css)

	file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src/doxygen-config-${lang}.txt api_doc)

	ADD_CUSTOM_COMMAND(
		OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/formatted/${lang}-api/index.html
		#COMMAND "${CMAKE_COMMAND}"
		#ARGS -E remove_directory ${output_path}
		COMMAND ${DOXYGEN_EXECUTABLE}
		ARGS   ${api_doc}
		WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src
		COMMAND "${CMAKE_COMMAND}"
		ARGS -E copy
			${logo_file}
			${output_path}
		COMMAND "${CMAKE_COMMAND}"
		ARGS -E copy
			${right_arrow}
			${output_path}
		COMMAND "${CMAKE_COMMAND}"
		ARGS -E copy
			${sbml_js}
			${output_path}
		COMMAND "${CMAKE_COMMAND}"
		ARGS -E copy
			${tabs_css}
			${output_path}
		COMMAND "${CMAKE_COMMAND}"
		ARGS -E copy
			${search_png}
			${search_path}
		COMMAND "${CMAKE_COMMAND}"
		ARGS -E copy
			${search_css}
			${search_path}
		COMMENT "Generate ${lang}-API Documentation"
		DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt

	)

	add_custom_target(api_docs_${lang} ALL DEPENDS
		${CMAKE_CURRENT_SOURCE_DIR}/formatted/${lang}-api/index.html
		${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt)

	if (${lang} STREQUAL "python")
		add_dependencies(api_docs_${lang} api_docs_python_py)
	endif()
	

	install(DIRECTORY ${output_path} DESTINATION ${MISC_PREFIX}docs )

endmacro()

createManual(c)
createManual(cpp)

# create python-api manuals
if (WITH_PYTHON)
	file(GLOB PYTHON_SUBSTITUTIONS ${CMAKE_CURRENT_SOURCE_DIR}/src/python-substitutions/*.py)
	ADD_CUSTOM_COMMAND(
		OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/src/libsbml.py
		COMMAND ${PYTHON_EXECUTABLE}
		ARGS    utilities/pythondocpreprocessor.py
				${CMAKE_CURRENT_BINARY_DIR}/../src/bindings/python/libsbml-doxygen.py  
				libsbml.py
				${PYTHON_SUBSTITUTIONS}
		WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src
		COMMENT "Generate libsbml.py"
		DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
	)	
	add_custom_target(api_docs_python_py ALL DEPENDS
		${CMAKE_CURRENT_SOURCE_DIR}/src/libsbml.py)
	createManual(python)
endif()

# create perl-api manuals
if (WITH_PERL)
	createManual(perl)
endif()

# create C#-api manuals
if (WITH_CSHARP)
	createManual(csharp)
endif()

# create java-api manuals
if (WITH_JAVA)
	# find java doc jar
	if (NOT EXISTS "${Java_JAVADOC_JAR}")
		get_filename_component(JDK_PATH ${Java_JAVA_EXECUTABLE} PATH )
		file(TO_NATIVE_PATH "${JDK_PATH}/../lib/tools.jar" Java_JAVADOC_JAR)
		if (NOT EXISTS "${Java_JAVADOC_JAR}")
			if (UNIX)
				if (APPLE)
					set(Java_JAVADOC_JAR "/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Classes/classes.jar")
				else()
					set(Java_JAVADOC_JAR ${JAVA_INCLUDE_PATH}/../lib/tools.jar)
				endif()
			endif()
		endif()
	endif()
	set(Java_JAVADOC_JAR ${Java_JAVADOC_JAR} CACHE FILEPATH "Location of javadoc jar")

	if (NOT EXISTS "${Java_JAVADOC_JAR}")
		message(FATAL_ERROR "Cannot generate java documentation, please specify the Java_JAVADOC_JAR.")
	endif()

	set(LIBSBML_JAVA_DIR "${CMAKE_CURRENT_BINARY_DIR}/../src/bindings/java/java-files")
	set(LIBSBML_JAVADOC_DOCTITLE "${PACKAGE_NAME} ${PACKAGE_VERSION} Java API Reference")
	set(LIBSBML_JAVADOC_HEADER "<B>${PACKAGE_NAME}<BR>${PACKAGE_VERSION}</B>")
	set(LIBSBML_JAVADOC_WINDOWTITLE "LibSBML Java API")
	file(READ "${CMAKE_CURRENT_SOURCE_DIR}/src/libsbml-java-footer.html"  LIBSBML_JAVADOC_FOOTER)
	string(STRIP 	${LIBSBML_JAVADOC_FOOTER} LIBSBML_JAVADOC_FOOTER)
	string(REGEX REPLACE "\n" "" LIBSBML_JAVADOC_FOOTER "${LIBSBML_JAVADOC_FOOTER}")


	file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src/doxygen-config-perl.txt api_doc)
	file(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR} current_dir)
	file(TO_NATIVE_PATH ${LIBSBML_JAVA_DIR} java_dir)
	file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/formatted/java-api output_dir)
	file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/formatted/java-api/org/sbml/libsbml/ java_output_dir)
	file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src/common-graphics/* graphics_files)

	file(GLOB graphics_files ${CMAKE_CURRENT_SOURCE_DIR}/src/common-graphics/*.jpg)
	foreach(graphic ${graphics_files})
		file(COPY ${graphic} DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/formatted/java-api/org/sbml/libsbml/)
	endforeach()


	ADD_CUSTOM_COMMAND(
		OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/formatted/java-api/index.html
		COMMAND ${Java_JAVAC_EXECUTABLE}
		ARGS -nowarn
			 -cp "${Java_JAVADOC_JAR}"
			 ${CMAKE_CURRENT_SOURCE_DIR}/src/SBMLDoclet.java
			  -d "${current_dir}"
		COMMAND ${Java_JAVA_EXECUTABLE}
		ARGS  -cp "${Java_JAVADOC_JAR}${FILE_SEP}${current_dir}"
		      SBMLDoclet
			  -excludefile java-skip.txt
			  -use -public -version -author -sourcetab 4 -keywords
			  -link http://java.sun.com/j2se/1.5.0/docs/api
			  -nodeprecated
			  -header "${LIBSBML_JAVADOC_HEADER}"
			  -bottom "${LIBSBML_JAVADOC_FOOTER}"
			  -windowtitle ${LIBSBML_JAVADOC_WINDOWTITLE}
			  -doctitle ${LIBSBML_JAVADOC_DOCTITLE}
			  -overview libsbml-java-fake-overview.html
			  -stylesheetfile doxygen-base-stylesheet.css
			  -d ${output_dir}
			  -tag note:a:"Note:"
	          -tag warning:a:"Warning:"
	          -tag docnote:a:"Documentation note:"
	          -sourcepath ${java_dir} org.sbml.libsbml
		COMMENT "Generate Java-API Documentation"
		VERBATIM
		WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src

		COMMAND "${CMAKE_COMMAND}"
		ARGS -E copy
			"${logo_file}"
			"${output_dir}"

		COMMAND "${CMAKE_COMMAND}"
		ARGS -E copy
			"${sbml_js}"
			"${output_dir}"

		COMMAND "${CMAKE_COMMAND}"
		ARGS -E copy
			"${tabs_css}"
			"${output_dir}"

#		COMMAND "${CMAKE_COMMAND}"
#		ARGS -E copy
#			${logo_file}
#			${java_output_dir}
#
		COMMAND "${CMAKE_COMMAND}"
		ARGS -DPACKAGE_VERSION=\"${PACKAGE_VERSION}\"
			-Djava_manual=${CMAKE_CURRENT_SOURCE_DIR}/formatted/java-api
			-P ${CMAKE_CURRENT_SOURCE_DIR}/process-java-doc.cmake

		DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
				${CMAKE_CURRENT_SOURCE_DIR}/process-java-doc.cmake

		)

	add_custom_target(api_docs_java ALL DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/formatted/java-api/index.html)

	install(DIRECTORY ${output_dir} DESTINATION ${MISC_PREFIX}docs )

endif()


endif()