use Python script to concatenate qch file
This commit is contained in:
@@ -7,23 +7,8 @@ add_subdirectory(Mod)
|
||||
add_subdirectory(Ext)
|
||||
add_subdirectory(Doc)
|
||||
|
||||
configure_file(Doc/ThirdPartyLibraries.html
|
||||
${CMAKE_BINARY_DIR}/doc/ThirdPartyLibraries.html COPYONLY)
|
||||
|
||||
|
||||
|
||||
if(BUILD_GUI)
|
||||
add_subdirectory(Gui)
|
||||
configure_file(Doc/freecad.qhc ${CMAKE_BINARY_DIR}/doc/freecad.qhc COPYONLY)
|
||||
#configure_file(${CMAKE_BINARY_DIR}/src/Doc/freecad.qch ${CMAKE_BINARY_DIR}/doc/freecad.qch COPYONLY)
|
||||
# join offline doc parts
|
||||
if(WIN32)
|
||||
EXECUTE_PROCESS(COMMAND powershell gc ${CMAKE_SOURCE_DIR}/src/Doc/freecad.qch.part* -Enc Byte -Read 1024 | sc ${CMAKE_BINARY_DIR}/doc/freecad.qch -Enc Byte -Force)
|
||||
# gc is an alias for Get-Content, sc is an alias for Set-Content,
|
||||
#-Read XXXX can be adjusted up for performance, if the user has insufficient RAM it might fail
|
||||
else(WIN32)
|
||||
EXECUTE_PROCESS(COMMAND sh -c "cat ${CMAKE_SOURCE_DIR}/src/Doc/freecad.qch.part* >> ${CMAKE_BINARY_DIR}/doc/freecad.qch" )
|
||||
endif(WIN32)
|
||||
endif(BUILD_GUI)
|
||||
|
||||
if(BUILD_TEMPLATE)
|
||||
@@ -31,18 +16,10 @@ if(BUILD_TEMPLATE)
|
||||
endif(BUILD_TEMPLATE)
|
||||
|
||||
|
||||
|
||||
if(FREECAD_MAINTAINERS_BUILD AND WIN32)
|
||||
#add_subdirectory(WindowsInstaller)
|
||||
endif(FREECAD_MAINTAINERS_BUILD AND WIN32)
|
||||
|
||||
INSTALL(FILES
|
||||
Doc/freecad.qhc
|
||||
${CMAKE_BINARY_DIR}/doc/freecad.qch
|
||||
Doc/ThirdPartyLibraries.html
|
||||
DESTINATION ${CMAKE_INSTALL_DOCDIR}
|
||||
)
|
||||
|
||||
if(FREECAD_CREATE_MAC_APP)
|
||||
add_subdirectory(MacAppBundle)
|
||||
endif(FREECAD_CREATE_MAC_APP)
|
||||
|
||||
@@ -1,3 +1,32 @@
|
||||
|
||||
configure_file(ThirdPartyLibraries.html
|
||||
${CMAKE_BINARY_DIR}/doc/ThirdPartyLibraries.html COPYONLY)
|
||||
|
||||
|
||||
|
||||
if(BUILD_GUI)
|
||||
FILE(GLOB QCH_FILES freecad.qch.part*)
|
||||
set (DEST_FILE ${CMAKE_BINARY_DIR}/doc/freecad.qch)
|
||||
foreach(SRC_FILE ${QCH_FILES})
|
||||
if(${SRC_FILE} IS_NEWER_THAN ${DEST_FILE})
|
||||
EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/Tools/catfiles.py
|
||||
--outputfile=${DEST_FILE} ${QCH_FILES}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
configure_file(freecad.qhc ${CMAKE_BINARY_DIR}/doc/freecad.qhc COPYONLY)
|
||||
endif(BUILD_GUI)
|
||||
|
||||
INSTALL(FILES
|
||||
freecad.qhc
|
||||
${CMAKE_BINARY_DIR}/doc/freecad.qch
|
||||
ThirdPartyLibraries.html
|
||||
DESTINATION ${CMAKE_INSTALL_DOCDIR}
|
||||
)
|
||||
|
||||
find_package(Doxygen)
|
||||
if(DOXYGEN_FOUND)
|
||||
|
||||
|
||||
39
src/Tools/catfiles.py
Normal file
39
src/Tools/catfiles.py
Normal file
@@ -0,0 +1,39 @@
|
||||
#! python
|
||||
# -*- coding: utf-8 -*-
|
||||
# (c) 2018 Werner Mayer LGPL
|
||||
#
|
||||
|
||||
import os,sys,getopt
|
||||
import shutil
|
||||
|
||||
def main():
|
||||
outputfile=""
|
||||
try:
|
||||
opts, args = getopt.getopt(sys.argv[1:], "o:", ["outputfile="])
|
||||
except getopt.GetoptError:
|
||||
pass
|
||||
|
||||
for o, a in opts:
|
||||
if o in ("-o", "--outputfile"):
|
||||
outputfile = a
|
||||
|
||||
#if os.path.exists(outputfile):
|
||||
# do_not_create = True
|
||||
# ts = os.path.getmtime(outputfile)
|
||||
# for f in args:
|
||||
# if os.path.getmtime(f) > ts:
|
||||
# do_not_create = False
|
||||
# break
|
||||
#
|
||||
# if do_not_create:
|
||||
# print ("Up-to-date file {0}".format(outputfile))
|
||||
# return
|
||||
|
||||
with open(outputfile,'wb') as wfd:
|
||||
for f in args:
|
||||
with open(f,'rb') as fd:
|
||||
shutil.copyfileobj(fd, wfd, 1024*1024*10)
|
||||
print ("Created file {0}".format(outputfile))
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user