mirror of
https://github.com/QuasarApp/LIEF.git
synced 2025-05-08 01:39:33 +00:00
Add doc option
This commit is contained in:
parent
7fc13786e8
commit
c93f428d04
21
setup.py
21
setup.py
@ -22,6 +22,7 @@ class LiefDistribution(setuptools.Distribution):
|
|||||||
('lief-test', None, 'Build and make tests'),
|
('lief-test', None, 'Build and make tests'),
|
||||||
('ninja', None, 'Use Ninja as build system'),
|
('ninja', None, 'Use Ninja as build system'),
|
||||||
('sdk', None, 'Build SDK package'),
|
('sdk', None, 'Build SDK package'),
|
||||||
|
('doc', None, 'Build LIEF documentation'),
|
||||||
|
|
||||||
('lief-no-json', None, 'Disable JSON module'),
|
('lief-no-json', None, 'Disable JSON module'),
|
||||||
('lief-no-logging', None, 'Disable logging module'),
|
('lief-no-logging', None, 'Disable logging module'),
|
||||||
@ -55,6 +56,7 @@ class LiefDistribution(setuptools.Distribution):
|
|||||||
self.lief_no_vdex = False
|
self.lief_no_vdex = False
|
||||||
|
|
||||||
self.lief_no_android = False
|
self.lief_no_android = False
|
||||||
|
self.doc = False
|
||||||
super().__init__(attrs)
|
super().__init__(attrs)
|
||||||
|
|
||||||
|
|
||||||
@ -126,6 +128,10 @@ class BuildLibrary(build_ext):
|
|||||||
log.info("LIEF logging module disabled")
|
log.info("LIEF logging module disabled")
|
||||||
cmake_args += ["-DLIEF_LOGGING=off"]
|
cmake_args += ["-DLIEF_LOGGING=off"]
|
||||||
|
|
||||||
|
if self.distribution.doc:
|
||||||
|
log.info("LIEF documentation enabled")
|
||||||
|
cmake_args += ["-DLIEF_DOC=on"]
|
||||||
|
|
||||||
# Main formats
|
# Main formats
|
||||||
# ============
|
# ============
|
||||||
if self.distribution.lief_no_elf:
|
if self.distribution.lief_no_elf:
|
||||||
@ -202,6 +208,9 @@ class BuildLibrary(build_ext):
|
|||||||
if self.distribution.sdk:
|
if self.distribution.sdk:
|
||||||
targets['sdk'] = "package"
|
targets['sdk'] = "package"
|
||||||
|
|
||||||
|
if self.distribution.doc:
|
||||||
|
targets['doc'] = "doc-lief"
|
||||||
|
|
||||||
if platform.system() == "Windows":
|
if platform.system() == "Windows":
|
||||||
build_cmd = ['cmake', '--build', '.', '--target', "lief_samples"] + build_args
|
build_cmd = ['cmake', '--build', '.', '--target', "lief_samples"] + build_args
|
||||||
#log.info(" ".join(build_cmd))
|
#log.info(" ".join(build_cmd))
|
||||||
@ -229,6 +238,12 @@ class BuildLibrary(build_ext):
|
|||||||
|
|
||||||
if 'sdk' in targets:
|
if 'sdk' in targets:
|
||||||
subprocess.check_call(['ninja', targets['sdk']], cwd=self.build_temp)
|
subprocess.check_call(['ninja', targets['sdk']], cwd=self.build_temp)
|
||||||
|
|
||||||
|
if 'doc' in targets:
|
||||||
|
try:
|
||||||
|
subprocess.check_call(['ninja', targets['doc']], cwd=self.build_temp)
|
||||||
|
except Exception as e:
|
||||||
|
log.error("Documentation failed: %s" % e)
|
||||||
else:
|
else:
|
||||||
log.info("Using {} jobs".format(jobs))
|
log.info("Using {} jobs".format(jobs))
|
||||||
if self.distribution.lief_test:
|
if self.distribution.lief_test:
|
||||||
@ -241,6 +256,12 @@ class BuildLibrary(build_ext):
|
|||||||
|
|
||||||
if 'sdk' in targets:
|
if 'sdk' in targets:
|
||||||
subprocess.check_call(['make', '-j', str(jobs), targets['sdk']], cwd=self.build_temp)
|
subprocess.check_call(['make', '-j', str(jobs), targets['sdk']], cwd=self.build_temp)
|
||||||
|
|
||||||
|
if 'doc' in targets:
|
||||||
|
try:
|
||||||
|
subprocess.check_call(['make', '-j', str(jobs), targets['doc']], cwd=self.build_temp)
|
||||||
|
except Exception as e:
|
||||||
|
log.error("Documentation failed: %s" % e)
|
||||||
pylief_dst = os.path.join(self.build_lib, self.get_ext_filename(self.get_ext_fullname(ext.name)))
|
pylief_dst = os.path.join(self.build_lib, self.get_ext_filename(self.get_ext_fullname(ext.name)))
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user