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 bd1bea0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ add_executable(tpg-training ${pendulum_files} ${training_files})
target_link_libraries(tpg-training ${GEGELATI_LIBRARIES} ${SDL2_LIBRARY} ${SDL2_IMAGE_LIBRARY} ${SDL2TTF_LIBRARY})
target_compile_definitions(tpg-training PRIVATE ROOT_DIR="${CMAKE_SOURCE_DIR}")

#ifdef SOLUTION
# Sub project for inference
file(GLOB
inference_files
Expand All @@ -110,3 +111,4 @@ include_directories(${GEGELATI_INCLUDE_DIRS} ${SDL2_INCLUDE_DIR} ${SDL2_IMAGE_IN
add_executable(tpg-inference ${pendulum_files} ${inference_files})
target_link_libraries(tpg-inference ${GEGELATI_LIBRARIES} ${SDL2_LIBRARY} ${SDL2_IMAGE_LIBRARY} ${SDL2TTF_LIBRARY})
target_compile_definitions(tpg-inference PRIVATE ROOT_DIR="${CMAKE_SOURCE_DIR}")
#endif // SOLUTION
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'^(?!.*(CMakeLists))[^\.]+.*', mainFolder, False) # exclude .gitgnore and CMakeLists files
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 bd1bea0

Please sign in to comment.