Commit fc99e002 authored by Steffen Vogel's avatar Steffen Vogel 🎅🏼
Browse files

build documentation now with CMake instead of Make

parent 8886beb4
......@@ -18,6 +18,8 @@ Examples/C++/DPsimExample
Source/libdpsim.dylib
Source/libdpsim.so*
Source/libdpsim.dll
Source/dpsim.so
Source/dpsim.pyd
# Mac
__MACOSX
......
......@@ -32,13 +32,11 @@ build:
docs:
stage: docs
script:
- mv Source/build/libdpsim.so Documentation/dpsim.so
- cd Documentation
- make html
- make docs
image: ${DOCKER_IMAGE}
artifacts:
paths:
- Documentation/_build
- Documentation/html
tags:
- docker
......
cmake_minimum_required(VERSION 3.9)
project(DPsim)
set(PROJECT_AUTHOR "Institute for Automation of Complex Power Systems, RWTH Aachen Univerity")
set(PROJECT_COPYRIGHT "2017, Institute for Automation of Complex Power Systems, RWTH Aachen Univerity")
set(DPSIM_MAJOR_VERSION 0)
set(DPSIM_MINOR_VERSION 1)
set(DPSIM_PATCH_VERSION 0)
set(DPSIM_VERSION ${DPSIM_MAJOR_VERSION}.${DPSIM_MINOR_VERSION}.${DPSIM_PATCH_VERSION})
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake")
add_subdirectory(Documentation)
add_subdirectory(Source)
add_subdirectory(Examples/C++)
# CPack configuration
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "My funky project")
SET(CPACK_PACKAGE_VENDOR ${PROJECT_AUTHOR})
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/ReadMe.txt")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
SET(CPACK_PACKAGE_VERSION_MAJOR "1")
SET(CPACK_PACKAGE_VERSION_MINOR "3")
SET(CPACK_PACKAGE_VERSION_PATCH "2")
find_package(Sphinx REQUIRED)
if(NOT DEFINED SPHINX_THEME)
set(SPHINX_THEME alabaster)
endif()
if(NOT DEFINED SPHINX_THEME_DIR)
set(SPHINX_THEME_DIR)
endif()
# configured documentation tools and intermediate build results
set(BINARY_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/_build")
# Sphinx cache with pickled ReST documents
set(SPHINX_CACHE_DIR "${CMAKE_CURRENT_BINARY_DIR}/_doctrees")
# HTML output directory
set(SPHINX_HTML_DIR "${CMAKE_CURRENT_BINARY_DIR}/html")
set(SPHINX_TITLE "${PROJECT_NAME} Documentation")
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in"
"${BINARY_BUILD_DIR}/conf.py"
@ONLY
)
add_custom_target(docs
${SPHINX_EXECUTABLE}
-q -b html
-c "${BINARY_BUILD_DIR}"
-d "${SPHINX_CACHE_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}"
"${SPHINX_HTML_DIR}"
COMMENT "Building HTML documentation with Sphinx"
DEPENDS dpsim)
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = python -msphinx
SPHINXPROJ = DPsim
SOURCEDIR = .
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
\ No newline at end of file
......@@ -46,16 +46,16 @@ source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
project = 'DPsim'
copyright = '2017, Institute for Automation of Complex Power Systems, RWTH Aachen'
author = 'Institute for Automation of Complex Power Systems, RWTH Aachen'
project = '@PROJECT_NAME@'
copyright = '@PROJECT_COPYRIGHT@'
author = '@PROJECT_AUTHOR@'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = ''
version = '@DPSIM_VERSION@'
# The full version, including alpha/beta/rc tags.
release = ''
......@@ -83,7 +83,7 @@ todo_include_todos = False
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'
html_theme = '@SPHINX_THEME@'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
......@@ -142,8 +142,8 @@ latex_elements = {
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'DPsim.tex', 'DPsim Documentation',
'Institute for Automation of Complex Power Systems, RWTH Aachen', 'manual'),
(master_doc, 'DPsim.tex', '@SPHINX_TITLE@',
'@PROJECT_AUTHOR@', 'manual'),
]
......@@ -152,7 +152,7 @@ latex_documents = [
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'dpsim', 'DPsim Documentation',
(master_doc, 'dpsim', '@SPHINX_TITLE@',
[author], 1)
]
......@@ -163,10 +163,14 @@ man_pages = [
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'DPsim', 'DPsim Documentation',
(master_doc, 'DPsim', '@SPHINX_TITLE@',
author, 'DPsim', 'One line description of project.',
'Miscellaneous'),
]
default_role = 'any'
# Add the CMake build directory to the path
import sys
sys.path.insert(0, '@CMAKE_BINARY_DIR@/Source')
@ECHO OFF
pushd %~dp0
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=python -msphinx
)
set SOURCEDIR=.
set BUILDDIR=_build
set SPHINXPROJ=DPsim
if "%1" == "" goto help
%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The Sphinx module was not found. Make sure you have Sphinx installed,
echo.then set the SPHINXBUILD environment variable to point to the full
echo.path of the 'sphinx-build' executable. Alternatively you may add the
echo.Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
goto end
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
:end
popd
cmake_minimum_required(VERSION 3.5)
project(DPsim)
if (NOT WIN32)
# needed so CIMParser and arabica (which are first compiled into static libs)
......@@ -11,7 +10,7 @@ if (NOT WIN32)
endif()
# enable C++11 support
set (CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 11)
# library configuration etc.
if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../Libraries/eigen)
......@@ -44,4 +43,6 @@ add_library(dpsim SHARED ${SOURCES})
target_link_libraries(dpsim CIMParser ${PYTHON_LIBRARIES} ${LIBS})
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import sysconfig; print(sysconfig.get_path('platlib'), end='')" OUTPUT_VARIABLE PYTHON_PKGPATH)
ADD_CUSTOM_TARGET(link_dpsim ALL DEPENDS dpsim COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE_NAME:dpsim> dpsim.${PYTHON_MODULE_SUFFIX})
install(FILES $<TARGET_FILE:dpsim> DESTINATION ${PYTHON_PKGPATH} RENAME dpsim.${PYTHON_MODULE_SUFFIX})
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment