Skip to content

Commit ffabe29

Browse files
author
Bryan Bartley
committed
Merged development branch to master
2 parents 6ef68ce + 0e79ee7 commit ffabe29

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+6949
-0
lines changed

CMakeLists.txt

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
PROJECT( SBOL )
2+
CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
3+
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
4+
MESSAGE(64)
5+
else()
6+
MESSAGE(32)
7+
endif()
8+
9+
# set up folder structure
10+
SET( SBOL_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR} )
11+
SET( SBOL_SOURCE_DIR ${SBOL_ROOT_DIR}/source )
12+
SET( SBOL_EXAMPLE_DIR ${SBOL_ROOT_DIR}/examples )
13+
SET( SBOL_TEST_DIR ${SBOL_ROOT_DIR}/tests )
14+
SET( SBOL_MANUAL_DIR ${SBOL_ROOT_DIR}/manual )
15+
SET( SBOL_WRAPPER_DIR ${SBOL_ROOT_DIR}/wrapper )
16+
SET( SBOL_BUILD_DIR ${SBOL_ROOT_DIR}/build )
17+
SET( SBOL_RELEASE_DIR ${SBOL_ROOT_DIR}/release )
18+
SET( EXECUTABLE_OUTPUT_PATH ${SBOL_RELEASE_DIR} )
19+
SET( LIBRARY_OUTPUT_PATH ${SBOL_RELEASE_DIR}/library )
20+
SET( HEADER_OUTPUT_PATH ${LIBRARY_OUTPUT_PATH}/include )
21+
22+
# set build options
23+
OPTION( SBOL_BUILD_STATIC "Build statically linked library" FALSE )
24+
OPTION( SBOL_BUILD_COMBINED "Build libxml2 and libSBOL combined" FALSE )
25+
OPTION( SBOL_DEBUG_STATEMENTS "Add some print statements for debugging" FALSE )
26+
OPTION( SBOL_BUILD_EXAMPLES "Build the example programs" FALSE )
27+
OPTION( SBOL_BUILD_TESTS "Build the unit tests and example tests" FALSE )
28+
OPTION( SBOL_GENERATE_PYTHON "Generate Python wrapper using SWIG" FALSE )
29+
OPTION( SBOL_GENERATE_MANUAL "Generate SBOL documentation using Doxygen" FALSE )
30+
31+
# build libSBOLc
32+
#ADD_SUBDIRECTORY( schema )
33+
ADD_SUBDIRECTORY( source )
34+
35+
# build examples
36+
#IF( SBOL_BUILD_EXAMPLES )
37+
# ADD_SUBDIRECTORY( examples )
38+
#ENDIF()
39+
40+
# build tests
41+
#IF( SBOL_BUILD_TESTS )
42+
# ADD_SUBDIRECTORY( tests )
43+
#ENDIF()
44+
45+
# generate documentation
46+
#IF( SBOL_GENERATE_MANUAL )
47+
# ADD_SUBDIRECTORY( manual )
48+
#ENDIF()
49+
50+
# generate python wrapper
51+
#IF( SBOL_GENERATE_PYTHON )
52+
# ADD_SUBDIRECTORY( wrapper )
53+
#ENDIF()
54+

source/CMakeLists.txt

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
2+
ADD_SUBDIRECTORY( libxml2 )
3+
ADD_SUBDIRECTORY( raptor )
4+
5+
# gather headers
6+
INCLUDE_DIRECTORIES( ${HEADER_DIR} )
7+
INCLUDE_DIRECTORIES( ${XML2_HEADER_DIR})
8+
INCLUDE_DIRECTORIES( ${RAPTOR_HEADER_DIR})
9+
# gather source files
10+
FILE(GLOB SBOL_HEADER_FILES
11+
validation.h
12+
sbolerror.h
13+
property.h
14+
identified.h
15+
toplevel.h
16+
generictoplevel.h
17+
sequenceannotation.h
18+
component.h
19+
componentdefinition.h
20+
sequence.h
21+
document.h
22+
sequenceannotationextension.h
23+
interaction.h
24+
participation.h
25+
location.h
26+
sequenceconstraint.h
27+
moduledefinition.h
28+
module.h
29+
mapsto.h
30+
model.h
31+
sbol.h)
32+
FILE(GLOB SBOL_SOURCE_FILES
33+
validation.cpp
34+
sbolerror.cpp
35+
property.cpp
36+
identified.cpp
37+
toplevel.cpp
38+
componentdefinition.cpp
39+
document.cpp
40+
serializer.cpp)
41+
42+
43+
FILE(COPY ${SBOL_HEADER_FILES} DESTINATION ${HEADER_OUTPUT_PATH} )
44+
45+
46+
#ADD_EXECUTABLE(sbol ${SBOL_SOURCE_FILES})
47+
ADD_LIBRARY( sbol
48+
STATIC
49+
${SBOL_HEADER_FILES}
50+
${SBOL_SOURCE_FILES}
51+
)
52+
53+
54+
# build static library for release
55+
56+
# by default, GCC exports everything;
57+
# this tells it to stick to SBOLAPIEXPORTS functions
58+
IF(CMAKE_COMPILER_IS_GNUCC)
59+
SET_TARGET_PROPERTIES( sbol
60+
PROPERTIES COMPILE_FLAGS -fvisibility=hidden
61+
)
62+
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
63+
ENDIF()
64+
65+
# link against raptor
66+
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
67+
SET_TARGET_PROPERTIES(sbol PROPERTIES LINKER_LANGUAGE CXX)
68+
ADD_DEFINITIONS(-DLIBXML_STATIC -DRAPTOR_STATIC)
69+
70+
71+
72+
MESSAGE(${raptor2})
73+
74+
IF (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
75+
TARGET_LINK_LIBRARIES( sbol
76+
${raptor2}
77+
${xml2}
78+
${zlib}
79+
${iconv}
80+
Ws2_32.lib )
81+
ELSE ()
82+
TARGET_LINK_LIBRARIES( sbol
83+
${raptor2}
84+
${xml2}
85+
${zlib}
86+
${iconv} )
87+
ENDIF ()
88+
89+
# generate python wrapper
90+
IF( SBOL_GENERATE_PYTHON )
91+
ADD_SUBDIRECTORY( wrapper )
92+
ENDIF()
93+
94+
INSTALL(TARGETS sbol DESTINATION lib)
95+
INSTALL(DIRECTORY ${HEADER_OUTPUT_PATH} DESTINATION ${CMAKE_INSTALL_PREFIX})
96+

source/component.h

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#ifndef COMPONENT_INCLUDED
2+
#define COMPONENT_INCLUDED
3+
4+
#include "identified.h"
5+
#include "mapsto.h"
6+
7+
#include <string>
8+
9+
namespace sbol
10+
{
11+
class ComponentInstance : public Identified
12+
{
13+
14+
public:
15+
ReferencedObject definition;
16+
URIProperty access;
17+
List<OwnedObject<MapsTo>> mapsTos;
18+
19+
protected:
20+
ComponentInstance(sbol_type type = SBOL_COMPONENT, std::string uri_prefix = SBOL_URI "/Component", std::string id = "example", std::string access = SBOL_ACCESS_PRIVATE) :
21+
Identified(type, uri_prefix, id, "", "", ""),
22+
definition(SBOL_DEFINITION, this, UNDEFINED, {}),
23+
access(SBOL_ACCESS, this, access),
24+
mapsTos(SBOL_MAPS_TO, this)
25+
{
26+
};
27+
};
28+
29+
class Component : public ComponentInstance
30+
{
31+
public:
32+
Component(std::string uri_prefix = SBOL_URI "/Component", std::string id = "example", std::string access = SBOL_ACCESS_PRIVATE) :
33+
Component(SBOL_COMPONENT, uri_prefix, id, access)
34+
{
35+
};
36+
~Component();
37+
38+
protected:
39+
Component(sbol_type type, std::string uri_prefix, std::string id, std::string access) :
40+
ComponentInstance(type, uri_prefix, id, access)
41+
{
42+
};
43+
};
44+
45+
class FunctionalComponent : public ComponentInstance
46+
{
47+
public:
48+
URIProperty direction;
49+
FunctionalComponent(std::string uri_prefix = SBOL_URI "/FunctionalComponent", std::string id = "example") :
50+
FunctionalComponent(SBOL_FUNCTIONAL_COMPONENT, uri_prefix, id)
51+
{
52+
};
53+
~FunctionalComponent();
54+
55+
protected:
56+
FunctionalComponent(sbol_type type, std::string uri_prefix, std::string id) :
57+
ComponentInstance(type, uri_prefix, id),
58+
direction(SBOL_DIRECTION, this, SBOL_DIRECTION_NONE)
59+
{};
60+
61+
};
62+
}
63+
64+
#endif

source/componentdefinition.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#include "componentdefinition.h"
2+
3+
using namespace std;
4+
using namespace sbol;
5+
6+
//ComponentDefinition::ComponentDefinition(std::string uri_prefix, std::string display_id)
7+
//{
8+
// identity.set(uri_prefix + "/" + display_id + "/1.0.0");
9+
// persistentIdentity.set(uri_prefix + "/" + display_id + "/1.0.0");
10+
// displayID.set(display_id);
11+
// name.set("");
12+
// description.set("");
13+
//}

source/componentdefinition.h

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#include "toplevel.h"
2+
#include "component.h"
3+
#include "sequenceannotation.h"
4+
#include "sequenceconstraint.h"
5+
#include <string>
6+
7+
namespace sbol
8+
{
9+
class ComponentDefinition : public TopLevel
10+
{
11+
public:
12+
List<URIProperty> types;
13+
List<URIProperty> roles;
14+
ReferencedObject sequence;
15+
List<OwnedObject<SequenceAnnotation>> sequenceAnnotations;
16+
List<OwnedObject<Component>> components;
17+
List<OwnedObject<SequenceConstraint>> sequenceConstraints;
18+
19+
ComponentDefinition(std::string uri_prefix = SBOL_URI "/ComponentDefinition",
20+
std::string display_id = "example",
21+
std::string type = SO_UNDEFINED,
22+
std::string role = SO_UNDEFINED,
23+
std::string name = "",
24+
std::string description = "",
25+
std::string version = "1.0.0") :
26+
ComponentDefinition(SBOL_COMPONENT_DEFINITION, uri_prefix, display_id, type, role, name, description, version)
27+
{
28+
}
29+
~ComponentDefinition() { };
30+
protected:
31+
// This protected constructor is a delegate constructor. It initializes ComponentDefinitions with the corresponding sbol_type_uri
32+
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) :
33+
TopLevel(sbol_type_uri, uri_prefix, display_id, name, description, version),
34+
types(SBOL_TYPES, this, type),
35+
roles(SBOL_ROLES, this, role),
36+
sequence(SBOL_SEQUENCE_PROPERTY, this, ""),
37+
sequenceAnnotations(SBOL_SEQUENCE_ANNOTATIONS, this),
38+
components(SBOL_COMPONENTS, this),
39+
sequenceConstraints(SBOL_SEQUENCE_CONSTRAINTS, this)
40+
{
41+
}
42+
};
43+
}

0 commit comments

Comments
 (0)