docs: Divorcing tools for the main and docs build
Change-Id: Ica15c40b54cde1cf0ae365ed80c38d2f086f6b2f
Signed-off-by: Anton Komlev <anton.komlev@arm.com>
diff --git a/docs/cmake/FindPlantUML.cmake b/docs/cmake/FindPlantUML.cmake
new file mode 100644
index 0000000..82df16c
--- /dev/null
+++ b/docs/cmake/FindPlantUML.cmake
@@ -0,0 +1,63 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2018-2019, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+#FindPlantuml
+#-----------
+#PlantUML is a diagram generation tool. It can generate various UML and non-UML
+#diagrams. See: http://plantuml.com/
+#
+#This module checks PlantUML availability and checks if the Java runtime is
+#available.
+#For Windows PlantUML is distributed as a jar archive and thus there is no
+#standard install location where it could be searched for.
+#Most Linux distributions come with a proper PlantUML package which installs
+#a shell script to easy starting PlantUML, but the location of the .jar file
+#is hidden.
+#Thus there is no standard location to search for the .jar file and this module
+#depends on user input.
+#
+#This module has the following parameters:
+# PLANTUML_JAR_PATH = variable specifying where the PlantUML java archive
+# (plantuml.jar) can be found. If it is not defined,
+# the environment variable with the same name is used.
+# If both is missing, that is an error.
+#
+#This module defines the following variables:
+# PLANTUML_VERSION = The version reported by "plantuml.jar -version"
+# PLANTUML_FOUND = Was the .jar file found and sucesfuly executed.
+#
+
+include(Utils)
+
+find_package(Java 1.8 COMPONENTS Runtime)
+if(Java_Runtime_FOUND)
+ #Check if the jar file is at the user defined location.
+ #Prefer the cmake variable to the environment setting.
+ if (NOT DEFINED PLANTUML_JAR_PATH)
+ if (DEFINED ENV{PLANTUML_JAR_PATH})
+ set(PLANTUML_JAR_PATH "$ENV{PLANTUML_JAR_PATH}" CACHE STRING "PLANTUML location." )
+ endif()
+ endif()
+
+ if (NOT DEFINED PLANTUML_JAR_PATH)
+ message(STATUS "PLANTUML_JAR_PATH variable is missing, PlantUML jar location is unknown.")
+ else()
+ win_fix_dir_sep(PATH PLANTUML_JAR_PATH)
+ #Get plantuml version
+ execute_process(COMMAND "${Java_JAVA_EXECUTABLE}" "-jar" "${PLANTUML_JAR_PATH}" "-version" OUTPUT_VARIABLE _PLANTUML_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
+ #Parse plantuml output
+ if(_PLANTUML_VERSION)
+ if(_PLANTUML_VERSION MATCHES ".*PlantUML version ([0-9.]+).*")
+ string(REGEX REPLACE ".*PlantUML version ([0-9.]+).*" "\\1" PLANTUML_VERSION "${_PLANTUML_VERSION}")
+ endif()
+ endif()
+ endif()
+endif()
+
+#Set "standard" find module return values
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Plantuml REQUIRED_VARS PLANTUML_JAR_PATH PLANTUML_VERSION VERSION_VAR PLANTUML_VERSION)