def SetupTimeDelNetSim(): # get Current Script Directory CurrentScriptDir = getFrameDir() # Initialize Directories relevant to CMake CMakeModulesDir = os.path.join(CurrentScriptDir, 'CMakeModules') CurrentSourceDir = CurrentScriptDir BuildDir = os.path.join(os.getcwd(), 'TimeDelNetSim_build') # Add CMakeModulesDir to sys path to get relevant functions sys.path.insert(0, CMakeModulesDir) from CMakePyHelper import getDefaultPlatformGen from CMakePyHelper import CMakeGenCall, CMakeBuildCall DefaultGenerator = getDefaultPlatformGen() # generate and build if not os.path.isdir(BuildDir): os.mkdir(BuildDir) with changedDir(BuildDir): isCMakeGenSuccess = CMakeGenCall(CurrentSourceDir, Generator=DefaultGenerator, BuildConfig='Release', Silent=True) if isCMakeGenSuccess: CMakeBuildSuccess = CMakeBuildCall(BuildDir, Target='install', BuildConfig='Release') return CMakeBuildSuccess
def SetupExportFig(): # get Current Script Directory CurrentScriptDir = getFrameDir() # Initialize relevant directories BuildDir = os.path.join(os.getcwd(), 'ExportFig_build') # Create Path File if not os.path.isdir(BuildDir): os.mkdir(BuildDir) with changedDir(BuildDir): with open(os.path.join(BuildDir, 'ModulePath.txt'), 'w') as ModulePathFile: ModulePathFile.write(CurrentScriptDir) return True
def SetupDynSystem(DynSystemHPPPath=None): if not DynSystemHPPPath: DynSystemHPPPath = '' # get Current Script Directory CurrentScriptDir = getFrameDir() # Initialize Directories relevant to CMake CMakeModulesDir = os.path.join(CurrentScriptDir, 'CMakeModules') CurrentSourceDir = CurrentScriptDir BuildDir = os.path.join(os.getcwd(), 'GetAttBasin_build') # Add CMakeModulesDir to sys path to get relevant functions sys.path.insert(0, CMakeModulesDir) from CMakePyHelper import getDefaultPlatformGen from CMakePyHelper import CMakeGenCall, CMakeBuildCall DefaultGenerator = getDefaultPlatformGen() # Initialize Path to the HPP file correspondingto the dynamic system. DynSystemHPPPath = os.path.join(os.getcwd(), DynSystemHPPPath) # generate and build if not os.path.isdir(BuildDir): os.mkdir(BuildDir) with changedDir(BuildDir): isCMakeGenSuccess = CMakeGenCall(CurrentSourceDir, Generator=DefaultGenerator, BuildConfig='Release', Silent=True, DYN_SYSTEM_HPP_PATH=DynSystemHPPPath) if isCMakeGenSuccess: CMakeBuildSuccess = CMakeBuildCall(BuildDir, Target='install', BuildConfig='Release') return CMakeBuildSuccess
CurrentScriptDir = getFrameDir() CMakeModulesDir = os.path.abspath(os.path.join(CurrentScriptDir, '../CMakeModules')) CurrentSourceDir = os.path.abspath(os.path.join(CurrentScriptDir, '..')) # add above directory to sys path sys.path.insert(0, CMakeModulesDir) from CMakePyHelper import getDefaultPlatformGen DefaultGenerator = getDefaultPlatformGen() BuildDir = os.path.join(CurrentScriptDir, 'build') if not os.path.isdir(BuildDir): os.mkdir(BuildDir) with changedDir(BuildDir): CMakeCmd = ( 'cmake -G "{Generator}" '.format(Generator=DefaultGenerator) + '-D CMAKE_BUILD_TYPE=Release ' + '-D DYN_SYSTEM_HPP_PATH=../SimpleIzhikevichSpiking.hpp ' + '"{SourceDir}"'.format(SourceDir=CurrentSourceDir)) with open(os.devnull, 'w') as NullStream: CMakeOutput = subprocess.call(shlex.split(CMakeCmd), stdout=NullStream) print(CMakeOutput) if not CMakeOutput: print("\nCMake build files successfully generated") isCMakeGenSuccess = True else: print("\nErrors occurred in the execution of the following command:")
#!/usr/bin/env python3.5 import sys from RepoManagement.BasicUtils import changedDir, getFrameDir from RepoManagement import getRootDirectory from RepoManagement import SubModuleProcessing as SMP from git import Repo # get Current Script Directory CurrentScriptDir = getFrameDir() # initialize submodules SMP.UpdateSubModules(CurrentScriptDir) # Retrieve Relevant Directories GetAttractionBasinDir = Repo(getRootDirectory(CurrentScriptDir)).submodule('GetAttractionBasin').abspath # Include GetAttractionBasinDir in Paths sys.path.insert(0, GetAttractionBasinDir) # import SetupDynSys and call SetupDynSys from SetupDynSystem import SetupDynSystem with changedDir(CurrentScriptDir): SetupDynSystem('../NeuronDynSys/IzhikevichSilent.hpp')