Skip to content

Commit

Permalink
(Script) Remove inference target from original CMakeLists.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
kdesnos committed Oct 29, 2024
1 parent e047419 commit eb748f2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion scripts/prepare_archives.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,15 @@ def zipFilesInDir(dirName, zipObj, regex, parentName="", withSubdirectories = Tr
mainFolder = "gegelati-tutorial/"
tutorialTemplateArchive = ZipFile("./docs/data/gegelati-tutorial.zip", "w")
zipFileAdd(tutorialTemplateArchive,"bin/", mainFolder)
zipFilesInDir("./",tutorialTemplateArchive, r'[^\.]+.*', mainFolder, False) # exclude .gitgnore
zipFilesInDir("./",tutorialTemplateArchive, r'^(?!.*_(empty|solution))[^\.]+.*', mainFolder, False) # exclude .gitgnore and files with '_empty', '_solution' in their names
zipFilesInDir("./dat/",tutorialTemplateArchive, r'.*', mainFolder)
zipFilesInDir("./lib/",tutorialTemplateArchive, r'.*', mainFolder)
zipFilesInDir("src/",tutorialTemplateArchive, r'.*', mainFolder, False)
zipFilesInDir("src/manual/",tutorialTemplateArchive, r'.*', mainFolder)
zipFilesInDir("src/training",tutorialTemplateArchive, r'^(?!.*(pendulum_wrapper))', mainFolder, False) # all files except pendulum_wrapper
tutorialTemplateArchive.write("src/training/pendulum_wrapper_empty.cpp", mainFolder + "src/training/pendulum_wrapper.cpp" ) # overwrite empty_file
tutorialTemplateArchive.write("src/training/pendulum_wrapper_empty.h", mainFolder + "src/training/pendulum_wrapper.h") # overwrite empty_file
tutorialTemplateArchive.write("CMakeLists_empty.txt", mainFolder + "CMakeLists.txt") # overwrite empty_file
tutorialTemplateArchive.close()

# Create the pendulum_wrapper_solution archive
Expand Down
9 changes: 8 additions & 1 deletion scripts/prepare_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,17 @@ def filterSolution(inputFile, outputEmptyFile, outputSolutionFile):
hInputFile = open("./src/training/pendulum_wrapper.h","r")
hEmptyOutputFile = open("./src/training/pendulum_wrapper_empty.h", "w")
hSolutionOutputFile = open("./src/training/pendulum_wrapper_solution.h", "w")
txtInputCMakeListsFile = open(".CMakeLists.txt", "r")
txtEmptyCMakeListsFile = open("./CMakeLists_empty.txt", "w")
txtSolutionCMakeListsFile = open("./CMakeLists_solution.txt", "w")

if(not cppInputFile or not cppEmptyOutputFile or not hInputFile or not hEmptyOutputFile):
if(not cppInputFile or not cppEmptyOutputFile or not hInputFile or not hEmptyOutputFile or not txtEmptyCMakeListsFile or not txtInputCMakeListsFile or not txtSolutionCMakeListsFile):
exit

## Filter cpp files
filterSolution(hInputFile, hEmptyOutputFile, hSolutionOutputFile)
filterSolution(cppInputFile, cppEmptyOutputFile, cppSolutionOutputFile)
filterSolution(txtInputCMakeListsFile, txtEmptyCMakeListsFile, txtSolutionCMakeListsFile)

# Close files
cppInputFile.close()
Expand All @@ -97,3 +101,6 @@ def filterSolution(inputFile, outputEmptyFile, outputSolutionFile):
hInputFile.close()
hEmptyOutputFile.close()
hSolutionOutputFile.close()
txtSolutionCMakeListsFile.close()
txtInputCMakeListsFile.close()
txtEmptyCMakeListsFile.close()

0 comments on commit eb748f2

Please sign in to comment.