Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load data to atomspace #20

Merged
merged 8 commits into from
Jul 17, 2018
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,21 @@ ELSE (CXXTEST_FOUND)
MESSAGE(STATUS "CxxTest missing: needed for unit tests.")
ENDIF (CXXTEST_FOUND)

# This is required for Guile
FIND_LIBRARY(GMP_LIBRARY gmp)
FIND_PATH(GMP_INCLUDE_DIR gmp.h)

# Gnu Guile scheme interpreter
# Version 2.2.2 is needed for mrs io ports, compilation, atomics, nlp
FIND_PACKAGE(Guile 2.2.2)
IF (GUILE_FOUND AND GMP_LIBRARY AND GMP_INCLUDE_DIR)
ADD_DEFINITIONS(-DHAVE_GUILE)
SET(HAVE_GUILE 1)
INCLUDE_DIRECTORIES(${GUILE_INCLUDE_DIR})
ELSE (GUILE_FOUND AND GMP_LIBRARY AND GMP_INCLUDE_DIR)
SET(GUILE_DIR_MESSAGE "Guile was not found; the scheme shell will not be built.\nTo over-ride, make sure GUILE_LIBRARIES and GUILE_INCLUDE_DIRS are set.")
MESSAGE(FATAL_ERROR "${GUILE_DIR_MESSAGE}")
ENDIF (GUILE_FOUND AND GMP_LIBRARY AND GMP_INCLUDE_DIR)

# Look for Opencog Utils.
FIND_PACKAGE(CogUtil)
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,16 @@ few exceptions, most Linux distributions will provide these packages.
> It uses exactly the same build procedure as this package. Be sure
to `sudo make install` at the end.

###### atomspace
> OpenCog Atomspace database and reasoning engine
> http://github.com/opencog/atomspace
> It uses exactly the same build procedure as this package. Be sure
to `sudo make install` at the end.

###### guile
> Embedded scheme REPL (version 2.2.2 or newer is required).
> http://www.gnu.org/software/guile/guile.html

Optional Prerequisites
----------------------
The following packages are optional. If they are not installed, some
Expand Down
111 changes: 111 additions & 0 deletions lib/FindGuile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Copyright (c) 2008, 2014 OpenCog.org (http://opencog.org)
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.

# - Try to find Guile; Once done this will define
#
# GUILE_FOUND - system has the GUILE library
# GUILE_INCLUDE_DIRS - the GUILE include directory
# GUILE_LIBRARIES - The libraries needed to use GUILE


# Look for the header file
# Look for guile-2.2 first, then 2.0, then 1.8
# Macports for OSX puts things in /opt/local
FIND_PATH(GUILE_INCLUDE_DIR libguile.h
/usr/include/guile/2.2
/usr/local/include/guile/2.2
/opt/local/include/guile/2.2

/usr/include/guile/2.0
/usr/local/include/guile/2.0
/opt/local/include/guile/2.0

/usr/include/libguile
/usr/local/include/libguile
/opt/local/include/guile

/usr/include
/usr/local/include
)

# Look for the library
FIND_LIBRARY(GUILE_LIBRARY NAMES guile-2.2 guile-2.0 guile PATHS
/usr/lib
/usr/local/lib
/opt/local/lib
)

# Copy the results to the output variables.
IF(GUILE_INCLUDE_DIR AND GUILE_LIBRARY)
SET(GUILE_FOUND 1)
SET(GUILE_LIBRARIES ${GUILE_LIBRARY})
SET(GUILE_INCLUDE_DIRS ${GUILE_INCLUDE_DIR})
ELSE(GUILE_INCLUDE_DIR AND GUILE_LIBRARY)
SET(GUILE_FOUND 0)
SET(GUILE_LIBRARIES)
SET(GUILE_INCLUDE_DIRS)
ENDIF(GUILE_INCLUDE_DIR AND GUILE_LIBRARY)


# check guile's version if we're using cmake >= 2.6
IF(GUILE_INCLUDE_DIR)
SET(GUILE_VERSION_MAJOR 0)
SET(GUILE_VERSION_MINOR 0)
SET(GUILE_VERSION_PATCH 0)

IF(NOT EXISTS "${GUILE_INCLUDE_DIR}/libguile/version.h")
MESSAGE(FATAL_ERROR "Found ${GUILE_INCLUDE_DIR}/libguile.h but not version.h; check your guile installation!")
ENDIF(NOT EXISTS "${GUILE_INCLUDE_DIR}/libguile/version.h")

# Extract the libguile version from the 'version.h' file
SET(GUILE_MAJOR_VERSION 0)
FILE(READ "${GUILE_INCLUDE_DIR}/libguile/version.h" _GUILE_VERSION_H_CONTENTS)

STRING(REGEX MATCH "#define SCM_MAJOR_VERSION[ ]+([0-9])" _MATCH "${_GUILE_VERSION_H_CONTENTS}")
SET(GUILE_VERSION_MAJOR ${CMAKE_MATCH_1})
STRING(REGEX MATCH "#define SCM_MINOR_VERSION[ ]+([0-9]+)" _MATCH "${_GUILE_VERSION_H_CONTENTS}")
SET(GUILE_VERSION_MINOR ${CMAKE_MATCH_1})
STRING(REGEX MATCH "#define SCM_MICRO_VERSION[ ]+([0-9]+)" _MATCH "${_GUILE_VERSION_H_CONTENTS}")
SET(GUILE_VERSION_PATCH ${CMAKE_MATCH_1})

SET(GUILE_VERSION "${GUILE_VERSION_MAJOR}.${GUILE_VERSION_MINOR}.${GUILE_VERSION_PATCH}")

# Check found version against required one
IF (DEFINED Guile_FIND_VERSION AND ${GUILE_VERSION} VERSION_LESS Guile_FIND_VERSION)
SET(GUILE_FOUND FALSE)
ELSE ()
SET(GUILE_FOUND TRUE)
ENDIF ()

ENDIF(GUILE_INCLUDE_DIR)

IF (GUILE_FOUND AND GUILE_VERSION_MAJOR EQUAL 2)
ADD_DEFINITIONS(-DHAVE_GUILE2)
IF (GUILE_VERSION_MINOR GREATER 0)
ADD_DEFINITIONS(-DHAVE_GUILE_2_2)
ENDIF (GUILE_VERSION_MINOR GREATER 0)
ENDIF (GUILE_FOUND AND GUILE_VERSION_MAJOR EQUAL 2)

# Report the results.
IF (Guile_FIND_VERSION)
SET(_GUILE_VERSION_MESSAGE_STRING "(${GUILE_VERSION} >= ${Guile_FIND_VERSION})")
ENDIF (Guile_FIND_VERSION)

IF(GUILE_FOUND)
IF(NOT GUILE_FIND_QUIETLY)
MESSAGE(STATUS "Guile ${_GUILE_VERSION_MESSAGE_STRING} was found.")
ENDIF(NOT GUILE_FIND_QUIETLY)
ELSE(GUILE_FOUND)
SET(GUILE_DIR_MESSAGE "Guile ${_GUILE_VERSION_MESSAGE_STRING} was not found. Make sure GUILE_LIBRARY and GUILE_INCLUDE_DIR are set.")
IF(NOT GUILE_FIND_QUIETLY)
MESSAGE(STATUS "${GUILE_DIR_MESSAGE}")
ELSE(NOT GUILE_FIND_QUIETLY)
IF(GUILE_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "${GUILE_DIR_MESSAGE}")
ENDIF(GUILE_FIND_REQUIRED)
ENDIF(NOT GUILE_FIND_QUIETLY)
ENDIF(GUILE_FOUND)

MARK_AS_ADVANCED(GUILE_INCLUDE_DIR GUILE_LIBRARY)
1 change: 1 addition & 0 deletions moses/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
ADD_SUBDIRECTORY (comboreduct)
ADD_SUBDIRECTORY (moses)
ADD_SUBDIRECTORY (feature-selection)
ADD_SUBDIRECTORY (atomese)

# Currently, the pleasure code does not build, as it uses various
# obsolete combo types and routines and etc. It needs to be ported
Expand Down
20 changes: 20 additions & 0 deletions moses/atomese/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
ADD_SUBDIRECTORY(representation)

ADD_LIBRARY(atomese SHARED
representation/atomese_representation
)

TARGET_LINK_LIBRARIES (atomese
comboreduct
${COGUTIL_LIBRARY}
${ATOMSPACE_LIBRARIES}
)

#install library
IF (WIN32)
INSTALL(TARGETS atomese DESTINATION "lib${LIB_DIR_SUFFIX}/moses")
ELSE (WIN32)
INSTALL(TARGETS atomese
LIBRARY DESTINATION "lib${LIB_DIR_SUFFIX}" # lib*.so files
ARCHIVE DESTINATION "lib${LIB_DIR_SUFFIX}") # lib*.a files
ENDIF (WIN32)
9 changes: 9 additions & 0 deletions moses/atomese/representation/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#install header files
INSTALL(FILES

atomese_representation.h

DESTINATION

"include/${PROJECT_NAME}/atomese/representation"
)
Loading