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
#!/usr/bin/python3 import sys import os from RepoManagement.BasicUtils import changedDir, getFrameDir import subprocess import shlex 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: