def writeTopLevelFile(name): capName = name.upper() codeName = name + '-package.cmake' fileOut = open(codeName, 'w') fileHeaders.addCMakeFilename(fileOut, codeName, name) fileHeaders.addCMakeLicence(fileOut) fileOut.write('\n') fileOut.write( 'option(ENABLE_{0} "Enable libSBML support for the \'{1}\' package" OFF)\n\n\n' .format(capName, name)) fileOut.write('\n') fileOut.write( '# provide summary status =\n') fileOut.write( 'list(APPEND LIBSBML_PACKAGE_SUMMARY "SBML \'{0}\' package = $'. format(name)) fileOut.write('{') fileOut.write('ENABLE_{0}'.format(capName)) fileOut.write('}")\n') fileOut.write('\n') fileOut.write('if (ENABLE_{0} )\n'.format(capName)) fileOut.write(' add_definitions(-DUSE_{0})\n'.format(capName)) fileOut.write( ' set(LIBSBML_PACKAGE_INCLUDES ${LIBSBML_PACKAGE_INCLUDES} ') fileOut.write('"LIBSBML_HAS_PACKAGE_{0}")\n'.format(capName)) fileOut.write(' list(APPEND SWIG_EXTRA_ARGS -DUSE_{0})\n'.format(capName)) fileOut.write( ' list(APPEND SWIG_SWIGDOCDEFINES --define USE_{0})\n'.format( capName)) fileOut.write('endif()\n\n')
def writeSrcFile(name): capName = name.upper() codeName = name + '-package.cmake' fileOut = open(codeName, 'w') fileHeaders.addCMakeFilename(fileOut, codeName, name) fileHeaders.addCMakeLicence(fileOut) fileOut.write('\n') fileOut.write('if (ENABLE_{0} )\n\n'.format(capName)) fileOut.write('include(${LIBSBML_ROOT_SOURCE_DIR}/') fileOut.write('{0}-package.cmake)\n\n'.format(name)) fileOut.write('#build up sources\n') fileOut.write('set({0}_SOURCES)\n\n'.format(capName)) fileOut.write('# go through all directories: common, extension and sbml\n') fileOut.write('foreach(dir common extension sbml validator validator/constraints)\n\n') fileOut.write(' # add to include directory\n') fileOut.write(' include_directories(${CMAKE_CURRENT_SOURCE_DIR}/sbml/packages/') fileOut.write('{0}/$'.format(name)) fileOut.write('{dir})\n\n') fileOut.write(' # file sources\n') fileOut.write(' file(GLOB current ${CMAKE_CURRENT_SOURCE_DIR}/sbml/packages/') fileOut.write('{0}/$'.format(name)) fileOut.write('{dir}/*.cpp\n') fileOut.write(' ${CMAKE_CURRENT_SOURCE_DIR}/sbml/packages/') fileOut.write('{0}/$'.format(name)) fileOut.write('{dir}/*.c\n') fileOut.write(' ${CMAKE_CURRENT_SOURCE_DIR}/sbml/packages/') fileOut.write('{0}/$'.format(name)) fileOut.write('{dir}/*.h)\n\n') fileOut.write(' # add sources\n') fileOut.write(' set({0}_SOURCES $'.format(capName)) fileOut.write('{') fileOut.write('{0}_SOURCES'.format(capName)) fileOut.write('} ${current})\n\n') fileOut.write(' # mark header files for installation\n') fileOut.write(' file(GLOB {0}_headers\n'.format(name)) fileOut.write(' ${CMAKE_CURRENT_SOURCE_DIR}/sbml/packages/') fileOut.write('{0}/$'.format(name)) fileOut.write('{dir}/*.h)\n\n') fileOut.write(' install(FILES ${') fileOut.write('{0}_headers'.format(name)) fileOut.write('}\n DESTINATION include/sbml/packages/') fileOut.write('{0}/$'.format(name)) fileOut.write('{dir} )\n\n') fileOut.write('endforeach()\n\n') fileOut.write('# create source group for IDEs\n') fileOut.write('source_group({0}_package FILES $'.format(name)) fileOut.write('{') fileOut.write('{0}_SOURCES'.format(capName)) fileOut.write('})\n\n') fileOut.write('# add {0} sources to SBML sources\n'.format(name)) fileOut.write('SET(LIBSBML_SOURCES ${LIBSBML_SOURCES} ${') fileOut.write('{0}_SOURCES'.format(capName)) fileOut.write('})\n\n') fileOut.write('######################################################\n') fileOut.write('#\n# add test scripts\n#\n') fileOut.write('if(WITH_CHECK)\n\n\n') fileOut.write('endif()\n\n') fileOut.write('endif()\n\n')
def writeTopLevelFile(name): capName = name.upper() codeName = name + '-package.cmake' fileOut = open(codeName, 'w') fileHeaders.addCMakeFilename(fileOut, codeName, name) fileHeaders.addCMakeLicence(fileOut) fileOut.write('\n') fileOut.write('option(ENABLE_{0} "Enable libSBML support for the \'{1}\' package" OFF)\n\n\n'.format(capName, name)) fileOut.write('\n') fileOut.write('# provide summary status =\n') fileOut.write('list(APPEND LIBSBML_PACKAGE_SUMMARY "SBML \'{0}\' package = $'.format(name)) fileOut.write('{') fileOut.write('ENABLE_{0}'.format(capName)) fileOut.write('}")\n') fileOut.write('\n') fileOut.write('if (ENABLE_{0} )\n'.format(capName)) fileOut.write(' add_definitions(-DUSE_{0})\n'.format(capName)) fileOut.write(' set(LIBSBML_PACKAGE_INCLUDES ${LIBSBML_PACKAGE_INCLUDES} ') fileOut.write('"LIBSBML_HAS_PACKAGE_{0}")\n'.format(capName)) fileOut.write(' list(APPEND SWIG_EXTRA_ARGS -DUSE_{0})\n'.format(capName)) fileOut.write(' list(APPEND SWIG_SWIGDOCDEFINES --define USE_{0})\n'.format(capName)) fileOut.write('endif()\n\n')
def writeSrcFile(name): capName = name.upper() codeName = name + '-package.cmake' fileOut = open(codeName, 'w') fileHeaders.addCMakeFilename(fileOut, codeName, name) fileHeaders.addCMakeLicence(fileOut) fileOut.write('\n') fileOut.write('if (ENABLE_{0} )\n\n'.format(capName)) fileOut.write('include(${LIBSBML_ROOT_SOURCE_DIR}/') fileOut.write('{0}-package.cmake)\n\n'.format(name)) fileOut.write('#build up sources\n') fileOut.write('set({0}_SOURCES)\n\n'.format(capName)) fileOut.write('# go through all directories: common, extension and sbml\n') fileOut.write( 'foreach(dir common extension sbml validator validator/constraints)\n\n' ) fileOut.write(' # add to include directory\n') fileOut.write( ' include_directories(${CMAKE_CURRENT_SOURCE_DIR}/sbml/packages/') fileOut.write('{0}/$'.format(name)) fileOut.write('{dir})\n\n') fileOut.write(' # file sources\n') fileOut.write( ' file(GLOB current ${CMAKE_CURRENT_SOURCE_DIR}/sbml/packages/') fileOut.write('{0}/$'.format(name)) fileOut.write('{dir}/*.cpp\n') fileOut.write( ' ${CMAKE_CURRENT_SOURCE_DIR}/sbml/packages/') fileOut.write('{0}/$'.format(name)) fileOut.write('{dir}/*.c\n') fileOut.write( ' ${CMAKE_CURRENT_SOURCE_DIR}/sbml/packages/') fileOut.write('{0}/$'.format(name)) fileOut.write('{dir}/*.h)\n\n') fileOut.write(' # add sources\n') fileOut.write(' set({0}_SOURCES $'.format(capName)) fileOut.write('{') fileOut.write('{0}_SOURCES'.format(capName)) fileOut.write('} ${current})\n\n') fileOut.write(' # mark header files for installation\n') fileOut.write(' file(GLOB {0}_headers\n'.format(name)) fileOut.write( ' ${CMAKE_CURRENT_SOURCE_DIR}/sbml/packages/') fileOut.write('{0}/$'.format(name)) fileOut.write('{dir}/*.h)\n\n') fileOut.write(' install(FILES ${') fileOut.write('{0}_headers'.format(name)) fileOut.write('}\n DESTINATION include/sbml/packages/') fileOut.write('{0}/$'.format(name)) fileOut.write('{dir} )\n\n') fileOut.write('endforeach()\n\n') fileOut.write('# create source group for IDEs\n') fileOut.write('source_group({0}_package FILES $'.format(name)) fileOut.write('{') fileOut.write('{0}_SOURCES'.format(capName)) fileOut.write('})\n\n') fileOut.write('# add {0} sources to SBML sources\n'.format(name)) fileOut.write('SET(LIBSBML_SOURCES ${LIBSBML_SOURCES} ${') fileOut.write('{0}_SOURCES'.format(capName)) fileOut.write('})\n\n') fileOut.write('######################################################\n') fileOut.write('#\n# add test scripts\n#\n') fileOut.write('if(WITH_CHECK)\n\n\n') fileOut.write('endif()\n\n') fileOut.write('endif()\n\n')