diff --git a/documentation/build.py b/documentation/build.py index 67ea9af3..b9b5f77f 100755 --- a/documentation/build.py +++ b/documentation/build.py @@ -1,12 +1,10 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 -import re import os import os.path import sys import time import shutil -import socket import subprocess import logging import optparse @@ -18,91 +16,11 @@ def log ( message ): return -class ErrorMessage ( Exception ): - - def __init__ ( self, code, *arguments ): - self._code = code - self._errors = [ 'Malformed call to ErrorMessage()' - , '{}'.format(arguments) ] - text = None - if len(arguments) == 1: - if isinstance(arguments[0],Exception): text = str(arguments[0]).split('\n') - else: - self._errors = arguments[0] - elif len(arguments) > 1: - text = list(arguments) - if text: - self._errors = [] - while len(text[0]) == 0: del text[0] - lstrip = 0 - if text[0].startswith('[ERROR]'): lstrip = 8 - for line in text: - if line[0:lstrip ] == ' '*lstrip or \ - line[0:lstrip-1] == '[ERROR]': - self._errors += [ line[lstrip:] ] - else: - self._errors += [ line.lstrip() ] - - def __str__ ( self ): - if not isinstance(self._errors,list): - return "[ERROR] %s" % self._errors - formatted = "\n" - for i in range(len(self._errors)): - if i == 0: formatted += "[ERROR] {}".format( self._errors[i] ) - else: formatted += " {}".format( self._errors[i] ) - if i+1 < len(self._errors): formatted += "\n" - return formatted - - def addMessage ( self, message ): - if not isinstance(self._errors,list): - self._errors = [ self._errors ] - if isinstance(message,list): - for line in message: - self._errors += [ line ] - else: - self._errors += [ message ] - - def terminate ( self ): - print( self ) - sys.exit(self._code) - - def _getCode ( self ): return self._code - - code = property(_getCode) - - class Configuration ( object ): def __init__ ( self ): - self.onSource = False - self.onLepka = False - self.onDocker = False - hostname = socket.gethostname() - if hostname.startswith('lepka'): self.onLepka = False - else: self.onDocker = True - scriptDir = os.path.abspath(os.getcwd()) - if scriptDir.endswith( 'coriolis/documentation' ) and not self.onLepka: - self.onLepka = False - self.onSource = True - if self.onDocker: - log( 'Using *Docker* configuration.' ) - self.pelicanDir = '/data/git/coriolis.lip6.fr/pelican' - self.apacheDir = '/var/www/html' - if self.onLepka: - log( 'Using *Lepka* configuration.' ) - #self.pelicanDir = os.path.join( os.environ['HOME'], 'cms/coriolis.lip6.fr/pelican' ) - self.pelicanDir = scriptDir - self.apacheDir = '/dsk/l1/httpd/coriolis' - if self.onSource: - log( 'Using *Source* configuration.' ) - self.pelicanDir = scriptDir - self.apacheDir = None - self.localDocDir = '/dsk/l1/jpc/coriolis-2.x/Linux.el9/Release.Shared/install/share/doc/coriolis2/en/html/doc' - self.remoteDocDir = '/data' - self.remoteGitDir = '/data/git' - self.remotePelicanDir = os.path.join( self.remoteGitDir, 'coriolis.lip6.fr/pelican' ) - self.pluginsDir = os.path.join( self.remoteGitDir, 'pelican-plugins' ) - self.logDir = os.path.join( self.pelicanDir, 'logs' ) + self.pluginsDir = 'pelican-plugins' + self.logDir = 'logs' self.target = 'coriolis-d' @@ -133,45 +51,8 @@ class Command ( object ): if len(self.errlog): logging.error( self.errlog.decode('utf-8')) status = child.returncode status >>= 8 - if status != 0: - ErrorMessage( status, "{} (status:{}).".format(error,status) ).terminate() return status - @staticmethod - def rmtree ( path ): - command = 'rm -rf {}'.format( path ) - try: - log( command ) - shutil.rmtree( path ) - except shutil.Error as e: - logging.error( str(e) ) - return 1 - return 0 - - @staticmethod - def copytree ( src, dst ): - command = 'cp -r {} {}'.format( src, dst ) - try: - log( command ) - shutil.copytree( src, dst ) - except OSError as e: - logging.error( e ) - return 1 - except shutil.Error as errors: - for error in errors: - logging.error( 'cp {} {}: {}'.format(src,dst,error) ) - return 1 - return 0 - - -class SshCommand ( object ): - - def __init__ ( self, scriptlet ): - self.scriptlet = scriptlet - - def execute ( self, target ): - command = [ 'ssh', '-x', target, self.scriptlet ] - Command( command ).execute() class Document ( object ): @@ -182,38 +63,29 @@ class Document ( object ): self.rdir = os.path.dirname ( document ) def toPdf ( self ): - pdfDir = '{}/content/pdfs' .format( self.conf.pelicanDir ) - stylesheet = '{}/etc/SoC-ReST.tex'.format( self.conf.pelicanDir ) + pdfDir = 'content/pdfs' + stylesheet = 'etc/SoC-ReST.tex' documentPdf = '{}.pdf'.format( self.document ) documentRst = '{}.rst'.format( self.document ) documentTex = '{}.tex'.format( self.document ) - documentRawTex = '{}-raw.tex'.format( self.document ) documentTmps = [ documentTex - , documentRawTex , '{}.log'.format( self.document ) , '{}.out'.format( self.document ) , '{}.aux'.format( self.document ) , '{}.toc'.format( self.document ) ] targetPdf = os.path.join( pdfDir, documentPdf ) - + cwd = os.getcwd() - os.chdir( os.path.join(self.conf.pelicanDir,self.rdir) ) - os.environ[ 'TEXINPUTS' ] = '{}/etc/images//:./images//:'.format( self.conf.pelicanDir ) + os.chdir(self.rdir) + os.environ[ 'TEXINPUTS' ] = './etc/images//:./images//:' Command( [ 'rst2latex', '--use-latex-toc' , '--stylesheet={}'.format( stylesheet ) , documentRst - , documentRawTex ] ).execute() - pMulticol = re.compile( r' \\& \\\\multicolumn\{2\}\{l\|\}\{' ) - fdi = open( documentRawTex, 'r' ) - fdo = open( documentTex , 'w' ) - for line in fdi.readlines(): - fdo.write( pMulticol.sub(' \\& \\\\multicolumn{2}{p{0.6\\\\DUtablewidth}|}{',line) ) - fdi.close() - fdo.close() Command( [ 'pdflatex', '-halt-on-error', documentTex ] ).execute() Command( [ 'pdflatex', '-halt-on-error', documentTex ] ).execute() + os.chdir(cwd) for file in documentTmps: if os.path.isfile( file ): os.unlink( file ) @@ -226,77 +98,6 @@ class Document ( object ): os.chdir( cwd ) -class Site ( object ): - - def __init__ ( self, conf ): - self.conf = conf - - def build ( self ): - print( 'cd {}'.format( self.conf.pelicanDir )) - os.chdir( self.conf.pelicanDir ) - status = Command( [ 'pelican', '-vD', '--ignore-cache', 'content' ] ).execute() - if status: return status - if self.conf.onLepka: - Command.rmtree ( self.conf.apacheDir ) - Command.copytree( './output', self.conf.apacheDir ) - Command.copytree( self.conf.localDocDir, os.path.join(self.conf.apacheDir,'doc') ) - - def gitPush ( self ): - print( 'cd {}'.format( self.conf.pelicanDir )) - os.chdir( self.conf.pelicanDir ) - lines = '' - cmd = Command( ['git', 'status', 'content', 'common', 'theme'] ) - cmd.execute() - if cmd.outlog: lines = cmd.outlog.split('\n') - if lines[-2] != 'nothing to commit, working directory clean': - message = [ 'There are some uncommited changes in the site contents.' ] + lines - print( ErrorMessage( 1, message )) - Command( ['git', 'push'] ).execute() - return True - - def gitCommitPdfs ( self ): - print( 'cd {}'.format( self.conf.pelicanDir )) - os.chdir( self.conf.pelicanDir ) - lines = '' - cmd = Command( ['git', 'status', 'content/pdfs'] ) - cmd.execute() - if cmd.outlog: lines = cmd.outlog.decode('utf-8').split('\n') - if lines[-2] != 'nothing to commit, working directory clean': - message = 'Updated PDFs, %s.' % time.strftime( '%B %d, %Y (%H:%M)' ) - Command( ['git', 'add' , 'content/pdfs'] ).execute() - Command( ['git', 'commit', '-m', message ] ).execute() - return True - - def remoteBuild ( self ): - Command( [ 'ssh', '-x', '-o', 'StrictHostKeyChecking no' - , self.conf.target, "echo 'Force SSH key loading.'" ] ).execute() - Command( [ 'rsync', '--rsh=/usr/bin/ssh', '-avH' - , self.conf.localDocDir - , '{}:{}'.format(self.conf.target,self.conf.remoteDocDir) ] ).execute() - remoteScript = \ - ' if [ ! -d {remotePelicanDir} ]; then' \ - ' cd {remoteGitDir};' \ - ' git clone gitsoc@bop-t:coriolis.lip6.fr;' \ - ' sudo pelican-themes -s {remotePelicanDir}/themes/nest-coriolis;' \ - ' sudo chown -R pelican:pelican /var/www/html;' \ - ' fi;' \ - ' cd {remotePelicanDir};' \ - ' git pull;' \ - ' if [ ! -d {pluginsDir} ]; then' \ - ' cd {remoteGitDir};' \ - ' git clone https://github.com/getpelican/pelican-plugins;' \ - ' cd pelican-plugins;' \ - ' patch -p1 -i {remotePelicanDir}/patchs/0001-bootstrap-rst.no-math.patch;' \ - ' fi;' \ - ' cd {remotePelicanDir};' \ - ' ./build.py -p;' \ - .format( pluginsDir = self.conf.pluginsDir - , remoteGitDir = self.conf.remoteGitDir - , remotePelicanDir = self.conf.remotePelicanDir - ) - SshCommand( remoteScript ).execute( self.conf.target ) - - if __name__ == '__main__': usage = \ '\n' \ @@ -334,7 +135,6 @@ if __name__ == '__main__': parser.add_option( '-p', '--pelican' , action='store_true', dest='doPelican' , help='Run pelican.' ) parser.add_option( '-P', '--pdfs' , action='store_true', dest='doPdfs' , help='Generate the PDFs.' ) parser.add_option( '-C', '--coriolis', action='store_true', dest='doCoriolis', help='Build/update the web site on the server (docker).' ) - parser.add_option( '-g', '--git' , action='store_true', dest='doCommit' , help='Commit the PDFs.' ) (options, args) = parser.parse_args() conf = Configuration() if not os.path.isdir( conf.logDir ): @@ -353,14 +153,8 @@ if __name__ == '__main__': , Document( conf, 'content/pages/check-toolkit/CheckToolkit' ) , Document( conf, 'content/pages/rds/RDS' ) ] - coriolis = Site( conf ) if options.doPdfs: for document in documents: document.toPdf() - if options.doCommit: - coriolis.gitCommitPdfs() if options.doPelican: - coriolis.build() - if options.doCoriolis: - coriolis.gitPush() - coriolis.remoteBuild() + Command( [ 'pelican', '-vD', '--ignore-cache', 'content' ] ).execute() sys.exit( 0 ) diff --git a/documentation/etc/doPdf.sh b/documentation/etc/doPdf.sh index 953a9f38..c770bcbe 100755 --- a/documentation/etc/doPdf.sh +++ b/documentation/etc/doPdf.sh @@ -1,31 +1,18 @@ #!/bin/bash + document=`basename -s .rst $1` + current_source_dir=$2 + stylesheet=$3 + rst2latex=$4 + pdflatex=$5 + echo "Generating: ${document}.pdf from $current_source_dir with stylesheet $stylesheet" -#echo "Args: $*" + $rst2latex --use-latex-toc --stylesheet=$stylesheet ${document}.rst ${document}-raw.tex + sed "s%\(include.*\){\(\..*\)}%\1{$current_source_dir/\2}%" \ + 's, \\& \\\\multicolumn{2}{l|}{, \\& \\\\multicolumn{2}{p{0.6\\\\DUtablewidth}|}{,' \ + ${document}-raw.tex > ${document}.tex + $pdflatex ${document} - document=`basename -s .rst ${@:$#}` - sources=${@:1:$(($# -1))} - - echo "Document: ${document}.rst" - echo "Sources: ${sources}" - - rm -f ${document}.rst - for source in ${sources}; do - source=`basename ${source}` - if [ "${source}" != "pdfHeader.rst" ]; then - tail -n +4 ${source} | \ - sed 's,:ref:`\([^`]*\)`,`\1`_,' \ - >> ${document}.rst - else - cat ${source} >> ${document}.rst - fi - done - export TEXINPUTS=../etc/images//:./images//: - rst2latex --use-latex-toc --stylesheet=../etc/SoC-ReST.tex ${document}.rst ${document}-raw.tex - sed 's, \\& \\\\multicolumn{2}{l|}{, \\& \\\\multicolumn{2}{p{0.6\\\\DUtablewidth}|}{,' ${document}-raw.tex > ${document}.tex - pdflatex ${document} - pdflatex ${document} - rm -f ${document}.rst \ ${document}-raw.tex \ ${document}.tex \ diff --git a/documentation/meson.build b/documentation/meson.build new file mode 100644 index 00000000..73f37dfd --- /dev/null +++ b/documentation/meson.build @@ -0,0 +1,142 @@ +pdfcontent = files( + 'content/pages/users-guide/UsersGuide.rst', + 'content/pages/python-tutorial/PythonTutorial.rst', + 'content/pages/python-cpp/PythonCpp.rst', + 'content/pages/design-flow/DesignFlow.rst', + 'content/pages/stratus/Stratus.rst', + 'content/pages/check-toolkit/CheckToolkit.rst', + 'content/pages/rds/RDS.rst', +) + + +rstcontent = files( + 'content/pages/design-flow/DesignFlow_HTML.rst', + 'content/pages/design-flow/QuickStart.rst', + 'content/pages/documentation.rst', + 'content/pages/gitlab.rst', + 'content/pages/homepage.rst', + 'content/pages/python-cpp/Configuration.rst', + 'content/pages/python-cpp/DBoHierarchy.rst', + 'content/pages/python-cpp/DBoStandalone.rst', + 'content/pages/python-cpp/DbU.rst', + 'content/pages/python-cpp/Introduction.rst', + 'content/pages/python-cpp/Name.rst', + 'content/pages/python-cpp/NonDBo.rst', + 'content/pages/python-cpp/PythonCpp_HTML.rst', + 'content/pages/python-tutorial/AdvancedTopics.rst', + 'content/pages/python-tutorial/CellNetComponent.rst', + 'content/pages/python-tutorial/CgtScript.rst', + 'content/pages/python-tutorial/Collections.rst', + 'content/pages/python-tutorial/Environment.rst', + 'content/pages/python-tutorial/Introduction.rst', + 'content/pages/python-tutorial/Netlist.rst', + 'content/pages/python-tutorial/PythonTutorial_HTML.rst', + 'content/pages/python-tutorial/RealDesigns.rst', + 'content/pages/python-tutorial/ToolEngines.rst', + 'content/pages/rds/RDS_HTML.rst', + 'content/pages/rds/RDSpage.rst', + 'content/pages/stratus/Developper.rst', + 'content/pages/stratus/DpGen.rst', + 'content/pages/stratus/Language.rst', + 'content/pages/stratus/Patterns.rst', + 'content/pages/stratus/Stratus_HTML.rst', + 'content/pages/symbolic-layout.rst', + 'content/pages/users-guide/Configuration.rst', + 'content/pages/users-guide/DesignFlow.rst', + 'content/pages/users-guide/Installation.rst', + 'content/pages/users-guide/LicenseCredits.rst', + 'content/pages/users-guide/Releases.rst', + 'content/pages/users-guide/ScriptsPlugins.rst', + 'content/pages/users-guide/UsersGuide_HTML.rst', + 'content/pages/users-guide/ViewerTools.rst', +) + +css = files( + 'themes/nest-coriolis/static/css/nest.css', + 'themes/nest-coriolis/static/css/pygment.css', + 'themes/nest-coriolis/static/css/coriolis.css', +) + +plugins = files( + 'pelican-plugins/bootstrap-rst/140x140.png', + 'pelican-plugins/bootstrap-rst/171x180.png', + 'pelican-plugins/bootstrap-rst/300x200.png', + 'pelican-plugins/bootstrap-rst/__init__.py', + 'pelican-plugins/bootstrap-rst/bootstrap.py', + 'pelican-plugins/bootstrap-rst/custom.css', + 'pelican-plugins/bootstrap-rst/directives.py', + 'pelican-plugins/bootstrap-rst/docs-min.css', + 'pelican-plugins/bootstrap-rst/make-glyphicons.py', + 'pelican-plugins/bootstrap-rst/page.tmpl', + 'pelican-plugins/bootstrap-rst/pygments.css', + 'pelican-plugins/bootstrap-rst/roles.py', + 'pelican-plugins/bootstrap-rst/bootstrap/css/bootstrap-theme.css', + 'pelican-plugins/bootstrap-rst/bootstrap/css/bootstrap-theme.css.map', + 'pelican-plugins/bootstrap-rst/bootstrap/css/bootstrap-theme.min.css', + 'pelican-plugins/bootstrap-rst/bootstrap/css/bootstrap.css', + 'pelican-plugins/bootstrap-rst/bootstrap/css/bootstrap.css.map', + 'pelican-plugins/bootstrap-rst/bootstrap/css/bootstrap.min.css', + 'pelican-plugins/bootstrap-rst/bootstrap/fonts/glyphicons-halflings-regular.eot', + 'pelican-plugins/bootstrap-rst/bootstrap/fonts/glyphicons-halflings-regular.svg', + 'pelican-plugins/bootstrap-rst/bootstrap/fonts/glyphicons-halflings-regular.ttf', + 'pelican-plugins/bootstrap-rst/bootstrap/fonts/glyphicons-halflings-regular.woff', + 'pelican-plugins/bootstrap-rst/bootstrap/js/bootstrap.js', + 'pelican-plugins/bootstrap-rst/bootstrap/js/bootstrap.min.js', +) + +dopdf = find_program('etc/doPdf.sh') + +pdf_gen = generator( + dopdf, + output: '@BASENAME@.pdf', + arguments: ['@INPUT@', '@CURRENT_SOURCE_DIR@', rst2latex.full_path(), pdflatex.full_path()], +) + +pdfs_list = pdf_gen.process(pdfcontent) +pdfs_dep = declare_dependency(sources: pdfs_list) + +pdfs = build_target('pelican-pdfs', target_type: 'library', dependencies: pdfs_dep) + +cdata = configuration_data() +cdata.set('SOURCEDIR', meson.current_source_dir()) +cdata.set('OUTPUT_PATH', meson.current_build_dir()) +cdata.set('SITEURL', docsiteurl ) +pelicanconf = configure_file( + input: 'pelicanconf.py.in', + output: 'pelicanconf.py', + configuration: cdata, + install: false +) + + +htmldoc = custom_target( + 'htmldoc', + output: [ + 'archives.html', + 'authors.html', + 'categories.html', + 'images', + 'index.html', + 'pages', + 'pdfs', + 'tags.html', + 'theme', + ], + depend_files: [rstcontent, css, plugins, pelicanconf], + depends: pdfs, + command: [ + pelican, + '-vD', + '--ignore-cache', + '-s', + pelicanconf, + meson.current_source_dir()/'content'], + install: true, + install_dir: htmldir, +) + +docs = run_target( + 'docs', + command: 'true', + depends: [htmldoc, crlcore_docs, analog_docs, hurricane_docs, viewer_docs, oroshi_docs, unicorn_docs], + ) diff --git a/documentation/pelicanconf.py b/documentation/pelicanconf.py.in similarity index 68% rename from documentation/pelicanconf.py rename to documentation/pelicanconf.py.in index f23e526a..351a5d22 100644 --- a/documentation/pelicanconf.py +++ b/documentation/pelicanconf.py.in @@ -1,61 +1,44 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -from __future__ import unicode_literals -import os -import os.path +from __future__ import unicode_literals import socket -pelicanDir = os.path.abspath( os.getcwd() ) hostname = socket.gethostname() -if pelicanDir.endswith('coriolis/documentation'): - pluginsDir = '/dsk/l1/pelican/pelican-plugins' - outputDir = 'output/' - siteUrl = '' -elif hostname.startswith('lepka'): - pluginsDir = '/dsk/l1/pelican/pelican-plugins' - outputDir = '/dsk/l1/httpd/coriolis' - siteUrl = 'http://localhost/coriolis' -else: - pluginsDir = '/data/git/pelican-plugins' - outputDir = 'output/' - siteUrl = '' +OUTPUT_PATH = '@OUTPUT_PATH@' +PLUGIN_PATHS = [ '@SOURCEDIR@/pelican-plugins' ] +PLUGINS = [ 'bootstrap-rst'] -PLUGIN_PATHS = [ pluginsDir ] -PLUGINS = [ 'bootstrap-rst' ] - -STATIC_PATHS = [ 'pages/users-guide' - , 'pages/python-tutorial' - , 'pages/python-cpp-new' - , 'pages/python-cpp' - , 'pages/stratus' - , 'pages/check-toolkit' - , 'pages/design-flow' - , 'pages/rds' - #, 'scripts' - , 'images' - , 'pdfs' +STATIC_PATHS = [ 'pages/users-guide', + 'pages/python-tutorial', + 'pages/python-cpp-new', + 'pages/python-cpp', + 'pages/stratus', + 'pages/check-toolkit', + 'pages/design-flow', + 'pages/rds', + 'images', ] -AUTHOR = u'Jean-Paul Chaput' -SITENAME = u'Coriolis VLSI CAD Tools [offline]' -SITEURL = siteUrl +AUTHOR ='Coriolis Developers' +SITENAME ='Coriolis VLSI CAD Tools' +SITEURL = '@SITEURL@' +TIMEZONE = 'UTC' -THEME = './themes/nest-coriolis' +THEME = '@SOURCEDIR@/themes/nest-coriolis' #THEME = 'nest' #THEME = 'dev-random' #THEME = 'brutalist' -DELETE_OUTPUT_DIRECTORY = True ARTICLE_EXCLUDES = [ ] -PATH = 'content' +PATH = '@SOURCEDIR@/content' PAGE_PATHS = [ 'pages' ] TIMEZONE = 'Europe/Paris' -DEFAULT_LANG = u'en' +DEFAULT_LANG ='en' # Feed generation is usually not desired when developing FEED_ALL_ATOM = None @@ -132,13 +115,13 @@ IGNORE_FILES = [ 'UsersGuide.rst' # For User's Guide. # Uncomment following line if you want document-relative URLs when developing RELATIVE_URLS = True -NEST_INDEX_HEADER_TITLE = u'Alliance/Coriolis VLSI CAD Tools' +NEST_INDEX_HEADER_TITLE ='Alliance/Coriolis VLSI CAD Tools' NEST_HEADER_LOGO = '/images/common/Coriolis-logo-white-4-small.png' NEST_HEADER_IMAGES = 'common/layout-motif-faded-4.png' -NEST_LINKS_COLUMN_TITLE = u'Links' -NEST_SOCIAL_COLUMN_TITLE = u'Social' -NEST_SITEMAP_COLUMN_TITLE = u'Map' -NEST_COPYRIGHT = u'Copyright © 2020-2020 Sorbonne Universite' +NEST_LINKS_COLUMN_TITLE ='Links' +NEST_SOCIAL_COLUMN_TITLE ='Social' +NEST_SITEMAP_COLUMN_TITLE ='Map' +NEST_COPYRIGHT ='Copyright © 2020-2020 Sorbonne Universite' MENUITEMS = [ ('Git' , '/pages/github.html' ) , ('Documentation', '/pages/documentation.html' ) ] diff --git a/hurricane/meson.build b/hurricane/meson.build index d91b03c3..a5700239 100644 --- a/hurricane/meson.build +++ b/hurricane/meson.build @@ -1,5 +1,5 @@ -bzip2 = cc.find_library('bz2', required: true) -rapidjson = dependency('RapidJSON', required: true) +bzip2 = cc.find_library('bz2', required: build) +rapidjson = dependency('RapidJSON', required: build) subdir('src') subdir('doc/hurricane') subdir('doc/viewer') diff --git a/meson.build b/meson.build index eca31cc5..4b2dc589 100644 --- a/meson.build +++ b/meson.build @@ -30,6 +30,11 @@ if get_option('check-database') add_project_arguments('-DCHECK_DATABASE') endif +build=true +if get_option('only-docs') + build = false +endif + py = import('python').find_installation(pure:false) py_deps = dependency('python3-embed', required: false) if not py_deps.found() @@ -38,25 +43,40 @@ endif py_mod_deps = declare_dependency(dependencies: py_deps, compile_args: '-D__PYTHON_MODULE__=1') -qt = import('qt5') +qt = import('qt5', disabler: true) qt_deps = dependency('qt5', modules: ['Core', 'Gui', 'Widgets', 'PrintSupport', 'Svg'], - required:true + required: build, + disabler: true, ) cmake =import('cmake') -boost = dependency('boost', modules: ['program_options'], required: true) -libxml2 = dependency('libxml-2.0', required: true) -flex = find_program('flex', required: true) -bison = find_program('bison', required: true) -thread_dep = dependency('threads') - -doxygen = find_program('doxygen', required: true) -dot = find_program('dot', required: true) +boost = dependency('boost', modules: ['program_options'], required: build, disabler: true) +libxml2 = dependency('libxml-2.0', required: build, disabler: true) +flex = find_program('flex', required: build, disabler: true) +bison = find_program('bison', required: build, disabler: true) +thread_dep = dependency('threads', required: build, disabler: true) +sed = find_program('sed', required: build, disabler: true) docdir = join_paths(get_option('datadir'), 'doc') htmldir = join_paths(docdir, 'html') +docsiteurl = get_option('docs-siteurl') + +if get_option('docs') + doxygen = find_program('doxygen', required: true) + dot = find_program('dot', required: true) + pelican = find_program('pelican', required: true) + rst2latex = find_program('rst2latex', 'rst2latex.py', required: true) + pdflatex = find_program('pdflatex', required: true) +else + doxygen = disabler() + dot = disabler() + pelican = disabler() + rst2latex = disabler() + pdflatex = disabler() +endif + if build_machine.system() == 'darwin' add_project_arguments('-mmacosx-version-min=13.0', language: ['c','cpp']) @@ -64,20 +84,24 @@ if build_machine.system() == 'darwin' add_project_link_arguments('-Wl,-rpath,@loader_path/', language: ['c','cpp']) add_project_link_arguments('-Wl,-rpath,@loader_path/../lib/python' + py.language_version() + '/site-packages/coriolis', language: ['c','cpp']) - qt5qwt6 = dependency('Qt5Qwt6', required: true) + qt5qwt6 = dependency('Qt5Qwt6', required: build, disabler: true) qwt_framework = qt5qwt6.get_pkgconfig_variable('libdir') / 'qwt.framework/Versions/6/Headers/' qwt = declare_dependency(include_directories: include_directories(qwt_framework), dependencies: qt5qwt6) else qwt = dependency('qwt', required: false) if not qwt.found() - qwt = dependency('Qt5Qwt6', required: true) + qwt = dependency('Qt5Qwt6', required: build, disabler: true) endif endif #not ideal, hopefully coloquinte can switch to useing more modern targets, or to using meson! -coloquinte_sub = subproject('coloquinte') -Coloquinte = coloquinte_sub.get_variable('coloquinte_dep') +if build + coloquinte_sub = subproject('coloquinte') + Coloquinte = coloquinte_sub.get_variable('coloquinte_dep') +else + Coloquinte = disabler() +endif subdir('hurricane') subdir('lefdef') @@ -94,4 +118,4 @@ subdir('oroshi') subdir('bora') subdir('cumulus') subdir('tutorial') - +subdir('documentation') diff --git a/meson.options b/meson.options index 291d9c58..a626cefe 100644 --- a/meson.options +++ b/meson.options @@ -1 +1,4 @@ option('check-database', type : 'boolean', value : false, description: 'Build with database checking enabled. Very slow!') +option('docs', type: 'boolean', value: false, description: 'Build documentation') +option('docs-siteurl', type: 'string', value: 'https://coriolis-eda.org', description: 'Root URL for documentation') +option('only-docs', type: 'boolean', value: false, description: 'Skips checks for non-doc build dependencies')