Skip to content

Commit

Permalink
Merge pull request #3 from MarcusWalther/master
Browse files Browse the repository at this point in the history
Documentation for C++ Simulation Runtime
  • Loading branch information
sjoelund committed Aug 7, 2015
2 parents 826515e + 38d2767 commit 198ef81
Show file tree
Hide file tree
Showing 9 changed files with 4,005 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@
SimulationRuntime/cpp/CMakeFiles
SimulationRuntime/cpp/Doc
25 changes: 23 additions & 2 deletions Makefile
@@ -1,15 +1,32 @@
.PHONY: generated_pdfs/dyOptInitialGuess.pdf generated_pdfs/cruntimedraft.pdf usersguide
.PHONY: generated_pdfs/dyOptInitialGuess.pdf generated_pdfs/cruntimedraft.pdf usersguide cppruntime-doc clean
all: generated_pdfs/dyOptInitialGuess.pdf

generated_pdfs/cruntimedraft.pdf:
latexmk -outdir=generated_pdfs -pdf SimulationRuntime/c/src/cruntimedraft.tex

generated_pdfs/dyOptInitialGuess.pdf:
latexmk -outdir=generated_pdfs -pdf SimulationRuntime/DynamicOptimization/src/dyOptInitialGuess.tex

usersguide:
$(MAKE) -C UsersGuide html
@# OMPython sucks at cleaning up...
@killall omc >/dev/null 2>&1
BUILDDIR=openmodelica-doc_$(BUILDDIR_VER)
docs-internal: generated_pdfs/dyOptInitialGuess.pdf generated_pdfs/cruntimedraft.pdf usersguide

cppruntime-doc:
cp images/logo.svg SimulationRuntime/cpp/Images/OMLogo.svg
cd SimulationRuntime/cpp && cmake -DSOURCE_ROOT=../../../OMCompiler/SimulationRuntime/cpp && make Docs

cppruntime-doc-clean:
rm SimulationRuntime/cpp/Makefile -f
rm SimulationRuntime/cpp/CMakeCache.txt -f
rm SimulationRuntime/cpp/cmake_install.cmake -f
rm SimulationRuntime/cpp/CppRuntimeDoc.config -f
rm SimulationRuntime/cpp/CMakeFiles -rf
rm SimulationRuntime/cpp/Doc -rf
rm SimulationRuntime/cpp/Images/OMLogo.svg -f

docs-internal: generated_pdfs/dyOptInitialGuess.pdf generated_pdfs/cruntimedraft.pdf usersguide cppruntime-doc
@test ! -z "$(BUILDDIR_VER)" || (echo Call docs, not docs-internal directly; false)
@test ! -z "$(BUILDDIR)"
rm -rf ./$(BUILDDIR)
Expand All @@ -18,6 +35,10 @@ docs-internal: generated_pdfs/dyOptInitialGuess.pdf generated_pdfs/cruntimedraft
cp ModelicaTutorialFritzson.pdf "./$(BUILDDIR)/"
cp -a UsersGuide/build/html/* "./$(BUILDDIR)/OpenModelicaUsersGuide"
tar cJf "$(BUILDDIR).orig.tar.xz" "./$(BUILDDIR)"

docs:
test -f ../common/semver.sh
$(MAKE) docs-internal BUILDDIR_VER="`cd ../ && ./common/semver.sh | sed -e 's/-dev[.]/~dev-/' -e 's/^v//'`"

clean:

50 changes: 50 additions & 0 deletions SimulationRuntime/cpp/CMakeLists.txt
@@ -0,0 +1,50 @@
# This script will build the doxygen based documentation for the c++ simulation runtime
#
# The following variables are used to modify the configuration file of doxygen.
#
# TEMPLATE_ROOT_DIR the root folder for all html and css files that define the layout and style
# IMAGE_ROOT_DIR path to the root folder containing the images
# SOURCE_ROOT_DIR path to the folder of the simulation runtime code
# ADDITIONAL_DOC_ROOT_DIR path to the folder containing additional doxygen files
#
# The behaviour can be influenced by passing arguments to CMAKE
# if write output should be handled in parallel -DSOURCE_ROOT=PATH
# if ScoreP should be used for performance analysis -DTARGET_PATH=PATH
#

CMAKE_MINIMUM_REQUIRED (VERSION 2.8.6)
PROJECT(CppSolverInterface)
set(CMAKE_VERBOSE_MAKEFILE ON)
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMake")

MESSAGE(STATUS "CMake version ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}")

FIND_PACKAGE(Doxygen)

IF(NOT(SOURCE_ROOT))
MESSAGE(FATAL_ERROR "Please specify the root directory of the c++ sources.")
ENDIF(NOT(SOURCE_ROOT))
SET(SOURCE_ROOT_DIR ${SOURCE_ROOT})

IF(NOT(TARGET_PATH))
MESSAGE(STATUS "Target path was not set, so the current binary dir is used.")
SET(TARGET_PATH ${CMAKE_CURRENT_BINARY_DIR})
ENDIF(NOT(TARGET_PATH))

SET(TEMPLATE_ROOT_DIR "../../doxygen")
SET(IMAGE_ROOT_DIR "./Images")
SET(ADDITIONAL_DOC_ROOT_DIR "./")

if (NOT DOXYGEN_FOUND)
message(FATAL_ERROR "Doxygen is needed to build the documentation. Please install it correctly")
endif()
MESSAGE(STATUS "Build the documentation with Doxygen")
#-- Configure the Template Doxyfile for our specific project
configure_file(CppRuntimeDoc.config.in
${PROJECT_BINARY_DIR}/CppRuntimeDoc.config @ONLY IMMEDIATE)
#-- Add a custom target to run Doxygen when ever the project is built
add_custom_target (Docs ALL
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/CppRuntimeDoc.config
WORKING_DIRECTORY ${TARGET_PATH}
COMMENT "Generating API documentation with Doxygen" VERBATIM
)

0 comments on commit 198ef81

Please sign in to comment.