Skip to content

Commit

Permalink
Merged development branch to master
Browse files Browse the repository at this point in the history
  • Loading branch information
Bryan Bartley committed Jan 12, 2016
2 parents 6ef68ce + 0e79ee7 commit ffabe29
Show file tree
Hide file tree
Showing 57 changed files with 6,949 additions and 0 deletions.
54 changes: 54 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
PROJECT( SBOL )
CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
MESSAGE(64)
else()
MESSAGE(32)
endif()

# set up folder structure
SET( SBOL_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR} )
SET( SBOL_SOURCE_DIR ${SBOL_ROOT_DIR}/source )
SET( SBOL_EXAMPLE_DIR ${SBOL_ROOT_DIR}/examples )
SET( SBOL_TEST_DIR ${SBOL_ROOT_DIR}/tests )
SET( SBOL_MANUAL_DIR ${SBOL_ROOT_DIR}/manual )
SET( SBOL_WRAPPER_DIR ${SBOL_ROOT_DIR}/wrapper )
SET( SBOL_BUILD_DIR ${SBOL_ROOT_DIR}/build )
SET( SBOL_RELEASE_DIR ${SBOL_ROOT_DIR}/release )
SET( EXECUTABLE_OUTPUT_PATH ${SBOL_RELEASE_DIR} )
SET( LIBRARY_OUTPUT_PATH ${SBOL_RELEASE_DIR}/library )
SET( HEADER_OUTPUT_PATH ${LIBRARY_OUTPUT_PATH}/include )

# set build options
OPTION( SBOL_BUILD_STATIC "Build statically linked library" FALSE )
OPTION( SBOL_BUILD_COMBINED "Build libxml2 and libSBOL combined" FALSE )
OPTION( SBOL_DEBUG_STATEMENTS "Add some print statements for debugging" FALSE )
OPTION( SBOL_BUILD_EXAMPLES "Build the example programs" FALSE )
OPTION( SBOL_BUILD_TESTS "Build the unit tests and example tests" FALSE )
OPTION( SBOL_GENERATE_PYTHON "Generate Python wrapper using SWIG" FALSE )
OPTION( SBOL_GENERATE_MANUAL "Generate SBOL documentation using Doxygen" FALSE )

# build libSBOLc
#ADD_SUBDIRECTORY( schema )
ADD_SUBDIRECTORY( source )

# build examples
#IF( SBOL_BUILD_EXAMPLES )
# ADD_SUBDIRECTORY( examples )
#ENDIF()

# build tests
#IF( SBOL_BUILD_TESTS )
# ADD_SUBDIRECTORY( tests )
#ENDIF()

# generate documentation
#IF( SBOL_GENERATE_MANUAL )
# ADD_SUBDIRECTORY( manual )
#ENDIF()

# generate python wrapper
#IF( SBOL_GENERATE_PYTHON )
# ADD_SUBDIRECTORY( wrapper )
#ENDIF()

96 changes: 96 additions & 0 deletions source/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@

ADD_SUBDIRECTORY( libxml2 )
ADD_SUBDIRECTORY( raptor )

# gather headers
INCLUDE_DIRECTORIES( ${HEADER_DIR} )
INCLUDE_DIRECTORIES( ${XML2_HEADER_DIR})
INCLUDE_DIRECTORIES( ${RAPTOR_HEADER_DIR})
# gather source files
FILE(GLOB SBOL_HEADER_FILES
validation.h
sbolerror.h
property.h
identified.h
toplevel.h
generictoplevel.h
sequenceannotation.h
component.h
componentdefinition.h
sequence.h
document.h
sequenceannotationextension.h
interaction.h
participation.h
location.h
sequenceconstraint.h
moduledefinition.h
module.h
mapsto.h
model.h
sbol.h)
FILE(GLOB SBOL_SOURCE_FILES
validation.cpp
sbolerror.cpp
property.cpp
identified.cpp
toplevel.cpp
componentdefinition.cpp
document.cpp
serializer.cpp)


FILE(COPY ${SBOL_HEADER_FILES} DESTINATION ${HEADER_OUTPUT_PATH} )


#ADD_EXECUTABLE(sbol ${SBOL_SOURCE_FILES})
ADD_LIBRARY( sbol
STATIC
${SBOL_HEADER_FILES}
${SBOL_SOURCE_FILES}
)


# build static library for release

# by default, GCC exports everything;
# this tells it to stick to SBOLAPIEXPORTS functions
IF(CMAKE_COMPILER_IS_GNUCC)
SET_TARGET_PROPERTIES( sbol
PROPERTIES COMPILE_FLAGS -fvisibility=hidden
)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
ENDIF()

# link against raptor
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
SET_TARGET_PROPERTIES(sbol PROPERTIES LINKER_LANGUAGE CXX)
ADD_DEFINITIONS(-DLIBXML_STATIC -DRAPTOR_STATIC)



MESSAGE(${raptor2})

IF (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
TARGET_LINK_LIBRARIES( sbol
${raptor2}
${xml2}
${zlib}
${iconv}
Ws2_32.lib )
ELSE ()
TARGET_LINK_LIBRARIES( sbol
${raptor2}
${xml2}
${zlib}
${iconv} )
ENDIF ()

# generate python wrapper
IF( SBOL_GENERATE_PYTHON )
ADD_SUBDIRECTORY( wrapper )
ENDIF()

INSTALL(TARGETS sbol DESTINATION lib)
INSTALL(DIRECTORY ${HEADER_OUTPUT_PATH} DESTINATION ${CMAKE_INSTALL_PREFIX})

64 changes: 64 additions & 0 deletions source/component.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#ifndef COMPONENT_INCLUDED
#define COMPONENT_INCLUDED

#include "identified.h"
#include "mapsto.h"

#include <string>

namespace sbol
{
class ComponentInstance : public Identified
{

public:
ReferencedObject definition;
URIProperty access;
List<OwnedObject<MapsTo>> mapsTos;

protected:
ComponentInstance(sbol_type type = SBOL_COMPONENT, std::string uri_prefix = SBOL_URI "/Component", std::string id = "example", std::string access = SBOL_ACCESS_PRIVATE) :
Identified(type, uri_prefix, id, "", "", ""),
definition(SBOL_DEFINITION, this, UNDEFINED, {}),
access(SBOL_ACCESS, this, access),
mapsTos(SBOL_MAPS_TO, this)
{
};
};

class Component : public ComponentInstance
{
public:
Component(std::string uri_prefix = SBOL_URI "/Component", std::string id = "example", std::string access = SBOL_ACCESS_PRIVATE) :
Component(SBOL_COMPONENT, uri_prefix, id, access)
{
};
~Component();

protected:
Component(sbol_type type, std::string uri_prefix, std::string id, std::string access) :
ComponentInstance(type, uri_prefix, id, access)
{
};
};

class FunctionalComponent : public ComponentInstance
{
public:
URIProperty direction;
FunctionalComponent(std::string uri_prefix = SBOL_URI "/FunctionalComponent", std::string id = "example") :
FunctionalComponent(SBOL_FUNCTIONAL_COMPONENT, uri_prefix, id)
{
};
~FunctionalComponent();

protected:
FunctionalComponent(sbol_type type, std::string uri_prefix, std::string id) :
ComponentInstance(type, uri_prefix, id),
direction(SBOL_DIRECTION, this, SBOL_DIRECTION_NONE)
{};

};
}

#endif
13 changes: 13 additions & 0 deletions source/componentdefinition.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include "componentdefinition.h"

using namespace std;
using namespace sbol;

//ComponentDefinition::ComponentDefinition(std::string uri_prefix, std::string display_id)
//{
// identity.set(uri_prefix + "/" + display_id + "/1.0.0");
// persistentIdentity.set(uri_prefix + "/" + display_id + "/1.0.0");
// displayID.set(display_id);
// name.set("");
// description.set("");
//}
43 changes: 43 additions & 0 deletions source/componentdefinition.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#include "toplevel.h"
#include "component.h"
#include "sequenceannotation.h"
#include "sequenceconstraint.h"
#include <string>

namespace sbol
{
class ComponentDefinition : public TopLevel
{
public:
List<URIProperty> types;
List<URIProperty> roles;
ReferencedObject sequence;
List<OwnedObject<SequenceAnnotation>> sequenceAnnotations;
List<OwnedObject<Component>> components;
List<OwnedObject<SequenceConstraint>> sequenceConstraints;

ComponentDefinition(std::string uri_prefix = SBOL_URI "/ComponentDefinition",
std::string display_id = "example",
std::string type = SO_UNDEFINED,
std::string role = SO_UNDEFINED,
std::string name = "",
std::string description = "",
std::string version = "1.0.0") :
ComponentDefinition(SBOL_COMPONENT_DEFINITION, uri_prefix, display_id, type, role, name, description, version)
{
}
~ComponentDefinition() { };
protected:
// This protected constructor is a delegate constructor. It initializes ComponentDefinitions with the corresponding sbol_type_uri
ComponentDefinition(sbol_type sbol_type_uri, std::string uri_prefix, std::string display_id, std::string type, std::string role, std::string name, std::string description, std::string version) :
TopLevel(sbol_type_uri, uri_prefix, display_id, name, description, version),
types(SBOL_TYPES, this, type),
roles(SBOL_ROLES, this, role),
sequence(SBOL_SEQUENCE_PROPERTY, this, ""),
sequenceAnnotations(SBOL_SEQUENCE_ANNOTATIONS, this),
components(SBOL_COMPONENTS, this),
sequenceConstraints(SBOL_SEQUENCE_CONSTRAINTS, this)
{
}
};
}
Loading

0 comments on commit ffabe29

Please sign in to comment.