diff plugins/CMakeLists.txt @ 0:1158cffe5a5e

Initial import
author David Demelier <markand@malikania.fr>
date Mon, 08 Feb 2016 16:43:14 +0100
parents
children 78a9c59de053
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/CMakeLists.txt	Mon Feb 08 16:43:14 2016 +0100
@@ -0,0 +1,70 @@
+#
+# CMakeLists.txt -- CMake build system for irccd
+#
+# Copyright (c) 2013-2016 David Demelier <markand@malikania.fr>
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+
+project(plugins)
+
+add_custom_target(
+	plugins ALL
+	COMMENT "Irccd plugins"
+)
+
+foreach (plugin ${IRCCD_PLUGINS})
+	string(TOUPPER ${plugin} optname)
+
+	if (WITH_PLUGIN_${optname})
+		# 1. Configure the plugin and install it.
+		irccd_define_plugin(${plugin}/${plugin}.js)
+
+		# 2. Build documentation.
+		if (WITH_HTML)
+			if (IRCCD_RELOCATABLE)
+				set(basedocdir ${CMAKE_BINARY_DIR}/fakeroot/${WITH_DOCDIR})
+			else ()
+				set(basedocdir ${CMAKE_BINARY_DIR}/docs)
+			endif ()
+
+			file(RELATIVE_PATH baseurl ${basedocdir}/plugin ${basedocdir})
+	
+			pandoc(
+				OUTPUT ${basedocdir}/plugin/${plugin}.html
+				SOURCES ${plugin}/${plugin}.md
+				TEMPLATE ${resources_SOURCE_DIR}/template.html
+				DEPENDS
+					${resources_SOURCE_DIR}/template.html
+					docs-resources
+				ARGS -Vguide
+				VARIABLE baseurl:${baseurl}
+				FROM markdown TO html5
+				STANTALONE MAKE_DIRECTORY TOC
+			)
+	
+			list(APPEND outputs ${basedocdir}/plugin/${plugin}.html)
+			install(FILES ${basedocdir}/plugin/${plugin}.html DESTINATION ${WITH_DOCDIR}/plugin)
+		endif ()
+
+		add_custom_target(
+			plugin-${plugin}
+			SOURCES
+				${outputs}
+				${plugin}/${plugin}.js
+				${plugin}/${plugin}.md
+		)
+
+		add_dependencies(plugins plugin-${plugin})
+	endif ()
+endforeach ()