Add meson build infrastructure for pelican webpage

This commit is contained in:
Rob Taylor 2023-11-17 19:34:17 +00:00 committed by Rob Taylor
parent 95c0ca3d8d
commit 6ff5cf3e3c
7 changed files with 232 additions and 299 deletions

View File

@ -1,12 +1,10 @@
#!/usr/bin/env python #!/usr/bin/env python3
import re
import os import os
import os.path import os.path
import sys import sys
import time import time
import shutil import shutil
import socket
import subprocess import subprocess
import logging import logging
import optparse import optparse
@ -18,91 +16,11 @@ def log ( message ):
return 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 ): class Configuration ( object ):
def __init__ ( self ): def __init__ ( self ):
self.onSource = False self.pluginsDir = 'pelican-plugins'
self.onLepka = False self.logDir = 'logs'
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.target = 'coriolis-d' self.target = 'coriolis-d'
@ -133,45 +51,8 @@ class Command ( object ):
if len(self.errlog): logging.error( self.errlog.decode('utf-8')) if len(self.errlog): logging.error( self.errlog.decode('utf-8'))
status = child.returncode status = child.returncode
status >>= 8 status >>= 8
if status != 0:
ErrorMessage( status, "{} (status:{}).".format(error,status) ).terminate()
return status 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 ): class Document ( object ):
@ -182,38 +63,29 @@ class Document ( object ):
self.rdir = os.path.dirname ( document ) self.rdir = os.path.dirname ( document )
def toPdf ( self ): def toPdf ( self ):
pdfDir = '{}/content/pdfs' .format( self.conf.pelicanDir ) pdfDir = 'content/pdfs'
stylesheet = '{}/etc/SoC-ReST.tex'.format( self.conf.pelicanDir ) stylesheet = 'etc/SoC-ReST.tex'
documentPdf = '{}.pdf'.format( self.document ) documentPdf = '{}.pdf'.format( self.document )
documentRst = '{}.rst'.format( self.document ) documentRst = '{}.rst'.format( self.document )
documentTex = '{}.tex'.format( self.document ) documentTex = '{}.tex'.format( self.document )
documentRawTex = '{}-raw.tex'.format( self.document )
documentTmps = [ documentTex documentTmps = [ documentTex
, documentRawTex
, '{}.log'.format( self.document ) , '{}.log'.format( self.document )
, '{}.out'.format( self.document ) , '{}.out'.format( self.document )
, '{}.aux'.format( self.document ) , '{}.aux'.format( self.document )
, '{}.toc'.format( self.document ) , '{}.toc'.format( self.document )
] ]
targetPdf = os.path.join( pdfDir, documentPdf ) targetPdf = os.path.join( pdfDir, documentPdf )
cwd = os.getcwd() cwd = os.getcwd()
os.chdir( os.path.join(self.conf.pelicanDir,self.rdir) ) os.chdir(self.rdir)
os.environ[ 'TEXINPUTS' ] = '{}/etc/images//:./images//:'.format( self.conf.pelicanDir ) os.environ[ 'TEXINPUTS' ] = './etc/images//:./images//:'
Command( [ 'rst2latex', '--use-latex-toc' Command( [ 'rst2latex', '--use-latex-toc'
, '--stylesheet={}'.format( stylesheet ) , '--stylesheet={}'.format( stylesheet )
, documentRst , documentRst
, documentRawTex
] ).execute() ] ).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()
Command( [ 'pdflatex', '-halt-on-error', documentTex ] ).execute() Command( [ 'pdflatex', '-halt-on-error', documentTex ] ).execute()
os.chdir(cwd)
for file in documentTmps: for file in documentTmps:
if os.path.isfile( file ): if os.path.isfile( file ):
os.unlink( file ) os.unlink( file )
@ -226,77 +98,6 @@ class Document ( object ):
os.chdir( cwd ) 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__': if __name__ == '__main__':
usage = \ usage = \
'\n' \ '\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', '--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( '-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( '-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() (options, args) = parser.parse_args()
conf = Configuration() conf = Configuration()
if not os.path.isdir( conf.logDir ): 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/check-toolkit/CheckToolkit' )
, Document( conf, 'content/pages/rds/RDS' ) , Document( conf, 'content/pages/rds/RDS' )
] ]
coriolis = Site( conf )
if options.doPdfs: if options.doPdfs:
for document in documents: document.toPdf() for document in documents: document.toPdf()
if options.doCommit:
coriolis.gitCommitPdfs()
if options.doPelican: if options.doPelican:
coriolis.build() Command( [ 'pelican', '-vD', '--ignore-cache', 'content' ] ).execute()
if options.doCoriolis:
coriolis.gitPush()
coriolis.remoteBuild()
sys.exit( 0 ) sys.exit( 0 )

View File

@ -1,31 +1,18 @@
#!/bin/bash #!/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 \ rm -f ${document}.rst \
${document}-raw.tex \ ${document}-raw.tex \
${document}.tex \ ${document}.tex \

142
documentation/meson.build Normal file
View File

@ -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],
)

View File

@ -1,61 +1,44 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # # -*- coding: utf-8 -*- #
from __future__ import unicode_literals from __future__ import unicode_literals
import os
import os.path
import socket import socket
pelicanDir = os.path.abspath( os.getcwd() )
hostname = socket.gethostname() hostname = socket.gethostname()
if pelicanDir.endswith('coriolis/documentation'): OUTPUT_PATH = '@OUTPUT_PATH@'
pluginsDir = '/dsk/l1/pelican/pelican-plugins' PLUGIN_PATHS = [ '@SOURCEDIR@/pelican-plugins' ]
outputDir = 'output/' PLUGINS = [ 'bootstrap-rst']
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 = ''
PLUGIN_PATHS = [ pluginsDir ] STATIC_PATHS = [ 'pages/users-guide',
PLUGINS = [ 'bootstrap-rst' ] 'pages/python-tutorial',
'pages/python-cpp-new',
STATIC_PATHS = [ 'pages/users-guide' 'pages/python-cpp',
, 'pages/python-tutorial' 'pages/stratus',
, 'pages/python-cpp-new' 'pages/check-toolkit',
, 'pages/python-cpp' 'pages/design-flow',
, 'pages/stratus' 'pages/rds',
, 'pages/check-toolkit' 'images',
, 'pages/design-flow'
, 'pages/rds'
#, 'scripts'
, 'images'
, 'pdfs'
] ]
AUTHOR = u'Jean-Paul Chaput' AUTHOR ='Coriolis Developers'
SITENAME = u'Coriolis VLSI CAD Tools [offline]' SITENAME ='Coriolis VLSI CAD Tools'
SITEURL = siteUrl SITEURL = '@SITEURL@'
TIMEZONE = 'UTC'
THEME = './themes/nest-coriolis' THEME = '@SOURCEDIR@/themes/nest-coriolis'
#THEME = 'nest' #THEME = 'nest'
#THEME = 'dev-random' #THEME = 'dev-random'
#THEME = 'brutalist' #THEME = 'brutalist'
DELETE_OUTPUT_DIRECTORY = True
ARTICLE_EXCLUDES = [ ] ARTICLE_EXCLUDES = [ ]
PATH = 'content' PATH = '@SOURCEDIR@/content'
PAGE_PATHS = [ 'pages' ] PAGE_PATHS = [ 'pages' ]
TIMEZONE = 'Europe/Paris' TIMEZONE = 'Europe/Paris'
DEFAULT_LANG = u'en' DEFAULT_LANG ='en'
# Feed generation is usually not desired when developing # Feed generation is usually not desired when developing
FEED_ALL_ATOM = None 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 # Uncomment following line if you want document-relative URLs when developing
RELATIVE_URLS = True 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_LOGO = '/images/common/Coriolis-logo-white-4-small.png'
NEST_HEADER_IMAGES = 'common/layout-motif-faded-4.png' NEST_HEADER_IMAGES = 'common/layout-motif-faded-4.png'
NEST_LINKS_COLUMN_TITLE = u'Links' NEST_LINKS_COLUMN_TITLE ='Links'
NEST_SOCIAL_COLUMN_TITLE = u'Social' NEST_SOCIAL_COLUMN_TITLE ='Social'
NEST_SITEMAP_COLUMN_TITLE = u'Map' NEST_SITEMAP_COLUMN_TITLE ='Map'
NEST_COPYRIGHT = u'Copyright © 2020-2020 Sorbonne Universite' NEST_COPYRIGHT ='Copyright © 2020-2020 Sorbonne Universite'
MENUITEMS = [ ('Git' , '/pages/github.html' ) MENUITEMS = [ ('Git' , '/pages/github.html' )
, ('Documentation', '/pages/documentation.html' ) ] , ('Documentation', '/pages/documentation.html' ) ]

View File

@ -1,5 +1,5 @@
bzip2 = cc.find_library('bz2', required: true) bzip2 = cc.find_library('bz2', required: build)
rapidjson = dependency('RapidJSON', required: true) rapidjson = dependency('RapidJSON', required: build)
subdir('src') subdir('src')
subdir('doc/hurricane') subdir('doc/hurricane')
subdir('doc/viewer') subdir('doc/viewer')

View File

@ -30,6 +30,11 @@ if get_option('check-database')
add_project_arguments('-DCHECK_DATABASE') add_project_arguments('-DCHECK_DATABASE')
endif endif
build=true
if get_option('only-docs')
build = false
endif
py = import('python').find_installation(pure:false) py = import('python').find_installation(pure:false)
py_deps = dependency('python3-embed', required: false) py_deps = dependency('python3-embed', required: false)
if not py_deps.found() if not py_deps.found()
@ -38,25 +43,40 @@ endif
py_mod_deps = declare_dependency(dependencies: py_deps, compile_args: '-D__PYTHON_MODULE__=1') 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', qt_deps = dependency('qt5',
modules: ['Core', 'Gui', 'Widgets', 'PrintSupport', 'Svg'], modules: ['Core', 'Gui', 'Widgets', 'PrintSupport', 'Svg'],
required:true required: build,
disabler: true,
) )
cmake =import('cmake') cmake =import('cmake')
boost = dependency('boost', modules: ['program_options'], required: true) boost = dependency('boost', modules: ['program_options'], required: build, disabler: true)
libxml2 = dependency('libxml-2.0', required: true) libxml2 = dependency('libxml-2.0', required: build, disabler: true)
flex = find_program('flex', required: true) flex = find_program('flex', required: build, disabler: true)
bison = find_program('bison', required: true) bison = find_program('bison', required: build, disabler: true)
thread_dep = dependency('threads') thread_dep = dependency('threads', required: build, disabler: true)
sed = find_program('sed', required: build, disabler: true)
doxygen = find_program('doxygen', required: true)
dot = find_program('dot', required: true)
docdir = join_paths(get_option('datadir'), 'doc') docdir = join_paths(get_option('datadir'), 'doc')
htmldir = join_paths(docdir, 'html') 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' if build_machine.system() == 'darwin'
add_project_arguments('-mmacosx-version-min=13.0', language: ['c','cpp']) 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/', language: ['c','cpp'])
add_project_link_arguments('-Wl,-rpath,@loader_path/../lib/python' + py.language_version() + '/site-packages/coriolis', 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_framework = qt5qwt6.get_pkgconfig_variable('libdir') / 'qwt.framework/Versions/6/Headers/'
qwt = declare_dependency(include_directories: include_directories(qwt_framework), dependencies: qt5qwt6) qwt = declare_dependency(include_directories: include_directories(qwt_framework), dependencies: qt5qwt6)
else else
qwt = dependency('qwt', required: false) qwt = dependency('qwt', required: false)
if not qwt.found() if not qwt.found()
qwt = dependency('Qt5Qwt6', required: true) qwt = dependency('Qt5Qwt6', required: build, disabler: true)
endif endif
endif endif
#not ideal, hopefully coloquinte can switch to useing more modern targets, or to using meson! #not ideal, hopefully coloquinte can switch to useing more modern targets, or to using meson!
coloquinte_sub = subproject('coloquinte') if build
Coloquinte = coloquinte_sub.get_variable('coloquinte_dep') coloquinte_sub = subproject('coloquinte')
Coloquinte = coloquinte_sub.get_variable('coloquinte_dep')
else
Coloquinte = disabler()
endif
subdir('hurricane') subdir('hurricane')
subdir('lefdef') subdir('lefdef')
@ -94,4 +118,4 @@ subdir('oroshi')
subdir('bora') subdir('bora')
subdir('cumulus') subdir('cumulus')
subdir('tutorial') subdir('tutorial')
subdir('documentation')

View File

@ -1 +1,4 @@
option('check-database', type : 'boolean', value : false, description: 'Build with database checking enabled. Very slow!') 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')