Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
corpus2
Manage
Activity
Members
Labels
Plan
Issues
4
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Analysers
corpus2
Commits
7d162733
Commit
7d162733
authored
13 years ago
by
Paweł Kędzia
Browse files
Options
Downloads
Patches
Plain Diff
added swig wrappers to CMake
parent
96a5ca4d
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
CMakeLists.txt
+1
-0
1 addition, 0 deletions
CMakeLists.txt
CMakeScripts/FindCorpus2.cmake
+49
-0
49 additions, 0 deletions
CMakeScripts/FindCorpus2.cmake
CMakeScripts/FindPwrUtils.cmake
+49
-0
49 additions, 0 deletions
CMakeScripts/FindPwrUtils.cmake
swig/CMakeLists.txt
+236
-0
236 additions, 0 deletions
swig/CMakeLists.txt
with
335 additions
and
0 deletions
CMakeLists.txt
+
1
−
0
View file @
7d162733
...
...
@@ -63,4 +63,5 @@ add_subdirectory(libpwrutils)
add_subdirectory
(
libcorpus2
)
add_subdirectory
(
tagset-tool
)
add_subdirectory
(
tests
)
add_subdirectory
(
swig
)
This diff is collapsed.
Click to expand it.
CMakeScripts/FindCorpus2.cmake
0 → 100644
+
49
−
0
View file @
7d162733
IF
(
Corpus2_INCLUDE_DIR AND Corpus2_LIBRARY
)
#Already in cache
SET
(
Corpus2_FOUND TRUE
)
ELSE
(
Corpus2_INCLUDE_DIR AND Corpus2_LIBRARY
)
FIND_PATH
(
Corpus2_INCLUDE_DIR libcorpus2/token.h /usr/include /usr/local/include
)
FIND_LIBRARY
(
Corpus2_LIBRARY corpus2 /usr/lib /usr/local/lib
)
MARK_AS_ADVANCED
(
Corpus2_LIBRARY
)
MARK_AS_ADVANCED
(
Corpus2_INCLUDE_DIR
)
IF
(
Corpus2_INCLUDE_DIR AND Corpus2_LIBRARY
)
SET
(
Corpus2_FOUND TRUE
)
ENDIF
(
Corpus2_INCLUDE_DIR AND Corpus2_LIBRARY
)
ENDIF
(
Corpus2_INCLUDE_DIR AND Corpus2_LIBRARY
)
IF
(
Corpus2_FOUND
)
set
(
Corpus2_VERSION 0.0.0
)
FIND_FILE
(
_Corpus2_VERSION_FILE libcorpus2/version.h
${
Corpus2_INCLUDE_DIR
}
)
MARK_AS_ADVANCED
(
_Corpus2_VERSION_FILE
)
IF
(
_Corpus2_VERSION_FILE
)
FILE
(
READ
${
_Corpus2_VERSION_FILE
}
_Corpus2_VERSION_CONENTS
)
STRING
(
REGEX REPLACE
".*#define LIBCORPUS2_VERSION
\\\"
([0-9.]+)
\\\"
.*"
"
\\
1"
Corpus2_VERSION
"
${
_Corpus2_VERSION_CONENTS
}
"
)
ENDIF
(
_Corpus2_VERSION_FILE
)
IF
(
Corpus2_FIND_VERSION
)
IF
(
Corpus2_VERSION VERSION_LESS Corpus2_FIND_VERSION
)
IF
(
Corpus2_FIND_REQUIRED
)
MESSAGE
(
${
_Corpus2_VERSION_FILE
}
)
MESSAGE
(
FATAL_ERROR
"Corpus2 version too old:
${
Corpus2_VERSION
}
, requested >=
${
Corpus2_FIND_VERSION
}
"
)
ELSE
(
Corpus2_FIND_REQUIRED
)
IF
(
NOT Corpus2_FIND_QUIETLY
)
MESSAGE
(
STATUS
"Corpus2 version too old:
${
Corpus2_VERSION
}
, requested >=
${
Corpus2_FIND_VERSION
}
"
)
ENDIF
(
NOT Corpus2_FIND_QUIETLY
)
ENDIF
(
Corpus2_FIND_REQUIRED
)
set
(
Corpus2_FOUND False
)
ENDIF
(
Corpus2_VERSION VERSION_LESS Corpus2_FIND_VERSION
)
ENDIF
(
Corpus2_FIND_VERSION
)
IF
(
NOT Corpus2_FIND_QUIETLY
)
MESSAGE
(
STATUS
"Found libcorpus2
${
Corpus2_VERSION
}
:
${
Corpus2_LIBRARY
}
"
)
ENDIF
(
NOT Corpus2_FIND_QUIETLY
)
ELSE
(
Corpus2_FOUND
)
IF
(
Corpus2_FIND_REQUIRED
)
MESSAGE
(
FATAL_ERROR
"Could not find libcorpus2"
)
ELSE
(
Corpus2_FIND_REQUIRED
)
MESSAGE
(
STATUS
"libcorpus2 not found"
)
ENDIF
(
Corpus2_FIND_REQUIRED
)
ENDIF
(
Corpus2_FOUND
)
This diff is collapsed.
Click to expand it.
CMakeScripts/FindPwrUtils.cmake
0 → 100644
+
49
−
0
View file @
7d162733
IF
(
PwrUtils_INCLUDE_DIR AND PwrUtils_LIBRARY
)
#already in cache
SET
(
PwrUtils_FOUND TRUE
)
ELSE
(
PwrUtils_INCLUDE_DIR AND PwrUtils_LIBRARY
)
FIND_PATH
(
PwrUtils_INCLUDE_DIR libpwrutils/foreach.h /usr/include /usr/local/include
)
FIND_LIBRARY
(
PwrUtils_LIBRARY pwrutils /usr/lib /usr/local/lib
)
MARK_AS_ADVANCED
(
PwrUtils_LIBRARY
)
MARK_AS_ADVANCED
(
PwrUtils_INCLUDE_DIR
)
IF
(
PwrUtils_INCLUDE_DIR AND PwrUtils_LIBRARY
)
SET
(
PwrUtils_FOUND TRUE
)
ENDIF
(
PwrUtils_INCLUDE_DIR AND PwrUtils_LIBRARY
)
ENDIF
(
PwrUtils_INCLUDE_DIR AND PwrUtils_LIBRARY
)
IF
(
PwrUtils_FOUND
)
set
(
PwrUtils_VERSION 0.0.0
)
FIND_FILE
(
_PwrUtils_VERSION_FILE libpwrutils/version.h
${
PwrUtils_INCLUDE_DIR
}
)
MARK_AS_ADVANCED
(
_PwrUtils_VERSION_FILE
)
IF
(
_PwrUtils_VERSION_FILE
)
FILE
(
READ
${
_PwrUtils_VERSION_FILE
}
_PwrUtils_VERSION_CONENTS
)
STRING
(
REGEX REPLACE
".*#define LIBPWRUTILS_VERSION
\\\"
([0-9.]+)
\\\"
.*"
"
\\
1"
PwrUtils_VERSION
"
${
_PwrUtils_VERSION_CONENTS
}
"
)
ENDIF
(
_PwrUtils_VERSION_FILE
)
IF
(
PwrUtils_FIND_VERSION
)
IF
(
PwrUtils_VERSION VERSION_LESS PwrUtils_FIND_VERSION
)
IF
(
PwrUtils_FIND_REQUIRED
)
MESSAGE
(
${
_PwrUtils_VERSION_FILE
}
)
MESSAGE
(
FATAL_ERROR
"PwrUtils version too old:
${
PwrUtils_VERSION
}
, requested >=
${
PwrUtils_FIND_VERSION
}
"
)
ELSE
(
PwrUtils_FIND_REQUIRED
)
IF
(
NOT PwrUtils_FIND_QUIETLY
)
MESSAGE
(
STATUS
"PwrUtils version too old:
${
PwrUtils_VERSION
}
, requested >=
${
PwrUtils_FIND_VERSION
}
"
)
ENDIF
(
NOT PwrUtils_FIND_QUIETLY
)
ENDIF
(
PwrUtils_FIND_REQUIRED
)
set
(
PwrUtils_FOUND False
)
ENDIF
(
PwrUtils_VERSION VERSION_LESS PwrUtils_FIND_VERSION
)
ENDIF
(
PwrUtils_FIND_VERSION
)
IF
(
NOT PwrUtils_FIND_QUIETLY
)
MESSAGE
(
STATUS
"Found libpwrutils
${
PwrUtils_VERSION
}
:
${
PwrUtils_LIBRARY
}
"
)
ENDIF
(
NOT PwrUtils_FIND_QUIETLY
)
ELSE
(
PwrUtils_FOUND
)
IF
(
PwrUtils_FIND_REQUIRED
)
MESSAGE
(
FATAL_ERROR
"Could not find libpwrutils"
)
ELSE
(
PwrUtils_FIND_REQUIRED
)
MESSAGE
(
STATUS
"libpwrutils not found"
)
ENDIF
(
PwrUtils_FIND_REQUIRED
)
ENDIF
(
PwrUtils_FOUND
)
This diff is collapsed.
Click to expand it.
swig/CMakeLists.txt
0 → 100644
+
236
−
0
View file @
7d162733
########## corpus2 wrappers -- SWIG ###############
PROJECT
(
corpus2SwigWrap
)
find_package
(
Corpus2 1.0.8 REQUIRED
)
set
(
CORPUS2_LIBS
${
Corpus2_LIBRARY
}
)
find_package
(
PwrUtils 1.0.1 REQUIRED
)
set
(
PWRUTILS_LIBS
${
PwrUtils_LIBRARY
}
)
set
(
CORPUS2_PWR_LIBS
${
CORPUS2_LIBS
}
${
PWRUTILS_LIBS
}
)
include_directories
(
${
Libcorpus2_SOURCE_DIR
}
"../libcorpus2"
)
include_directories
(
${
Libpwrutils_SOURCE_DIR
}
"../libpwrutils"
)
link_directories
(
${
Libcorpus2_BINARY_DIR
}
)
FIND_PACKAGE
(
SWIG REQUIRED
)
INCLUDE
(
${
SWIG_USE_FILE
}
)
find_package
(
PythonLibs
)
find_package
(
PythonInterp
)
# idea taken from pyplot build system
execute_process
(
COMMAND
${
PYTHON_EXECUTABLE
}
-c
"from distutils import sysconfig; print sysconfig.get_python_lib(1,0,prefix='
${
CMAKE_INSTALL_EXEC_PREFIX
}
')"
OUTPUT_VARIABLE PYTHON_INSTDIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message
(
STATUS
"INFO: "
"python lib:
${
PYTHON_INSTDIR
}
"
)
INCLUDE_DIRECTORIES
(
${
PYTHON_INCLUDE_PATH
}
)
INCLUDE_DIRECTORIES
(
${
CMAKE_CURRENT_SOURCE_DIR
}
)
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
SET
(
CMAKE_SWIG_FLAGS
""
)
SET
(
SWIG_SRC_DIR
${
SWIG_DIR
}
/libcorpus
)
# -----------------------------------------------------------------------------
# libpwrnlperror
SET_SOURCE_FILES_PROPERTIES
(
libpwrnlperror.i PROPERTIES CPLUSPLUS ON
)
SET_SOURCE_FILES_PROPERTIES
(
libpwrnlperror.i PROPERTIES SWIG_FLAGS
"-includeall"
)
SWIG_ADD_MODULE
(
libpwrnlperror python libpwrnlperror.i
)
SWIG_LINK_LIBRARIES
(
libpwrnlperror
${
PYTHON_LIBRARIES
}
${
PWRUTILS_LIBS
}
)
# -----------------------------------------------------------------------------
# libcorpus2exception
SET_SOURCE_FILES_PROPERTIES
(
libcorpus2exception.i PROPERTIES CPLUSPLUS ON
)
SET_SOURCE_FILES_PROPERTIES
(
libcorpus2exception.i PROPERTIES SWIG_FLAGS
"-includeall"
)
SWIG_ADD_MODULE
(
libcorpus2exception python libcorpus2exception.i
)
SWIG_LINK_LIBRARIES
(
libcorpus2exception
${
PYTHON_LIBRARIES
}
${
CORPUS2_PWR_LIBS
}
)
# -----------------------------------------------------------------------------
# libcorpustag
SET_SOURCE_FILES_PROPERTIES
(
libcorpustag.i PROPERTIES CPLUSPLUS ON
)
SET_SOURCE_FILES_PROPERTIES
(
libcorpustag.i PROPERTIES SWIG_FLAGS
"-includeall"
)
SWIG_ADD_MODULE
(
libcorpustag python libcorpustag.i
)
SWIG_LINK_LIBRARIES
(
libcorpustag
${
PYTHON_LIBRARIES
}
${
CORPUS2_PWR_LIBS
}
)
# -----------------------------------------------------------------------------
# libcorpustagset
SET_SOURCE_FILES_PROPERTIES
(
libcorpustagset.i PROPERTIES CPLUSPLUS ON
)
SET_SOURCE_FILES_PROPERTIES
(
libcorpustagset.i PROPERTIES SWIG_FLAGS
"-includeall"
)
SWIG_ADD_MODULE
(
libcorpustagset python libcorpustagset.i
)
SWIG_LINK_LIBRARIES
(
libcorpustagset
${
PYTHON_LIBRARIES
}
${
CORPUS2_PWR_LIBS
}
)
# -----------------------------------------------------------------------------
# libcorpustagsetmanager
SET_SOURCE_FILES_PROPERTIES
(
libcorpustagsetmanager.i PROPERTIES CPLUSPLUS ON
)
SET_SOURCE_FILES_PROPERTIES
(
libcorpustagsetmanager.i PROPERTIES SWIG_FLAGS
"-includeall"
)
SWIG_ADD_MODULE
(
libcorpustagsetmanager python libcorpustagsetmanager.i
)
SWIG_LINK_LIBRARIES
(
libcorpustagsetmanager
${
PYTHON_LIBRARIES
}
${
CORPUS2_PWR_LIBS
}
)
# -----------------------------------------------------------------------------
# libcorpuslexeme
SET_SOURCE_FILES_PROPERTIES
(
libcorpuslexeme.i PROPERTIES CPLUSPLUS ON
)
SET_SOURCE_FILES_PROPERTIES
(
libcorpuslexeme.i PROPERTIES SWIG_FLAGS
"-includeall"
)
SWIG_ADD_MODULE
(
libcorpuslexeme python libcorpuslexeme.i
)
SWIG_LINK_LIBRARIES
(
libcorpuslexeme
${
PYTHON_LIBRARIES
}
${
CORPUS2_PWR_LIBS
}
)
# -----------------------------------------------------------------------------
# libcorpussentence
SET_SOURCE_FILES_PROPERTIES
(
libcorpussentence.i PROPERTIES CPLUSPLUS ON
)
SET_SOURCE_FILES_PROPERTIES
(
libcorpussentence.i PROPERTIES SWIG_FLAGS
"-includeall"
)
SWIG_ADD_MODULE
(
libcorpussentence python libcorpussentence.i
)
SWIG_LINK_LIBRARIES
(
libcorpussentence
${
PYTHON_LIBRARIES
}
${
CORPUS2_PWR_LIBS
}
)
# -----------------------------------------------------------------------------
# libcorpuschunk
SET_SOURCE_FILES_PROPERTIES
(
libcorpuschunk.i PROPERTIES CPLUSPLUS ON
)
SET_SOURCE_FILES_PROPERTIES
(
libcorpuschunk.i PROPERTIES SWIG_FLAGS
"-includeall"
)
SWIG_ADD_MODULE
(
libcorpuschunk python libcorpuschunk.i
)
SWIG_LINK_LIBRARIES
(
libcorpuschunk
${
PYTHON_LIBRARIES
}
${
CORPUS2_PWR_LIBS
}
)
# -----------------------------------------------------------------------------
# libcorpustoken
SET_SOURCE_FILES_PROPERTIES
(
libcorpustoken.i PROPERTIES CPLUSPLUS ON
)
SET_SOURCE_FILES_PROPERTIES
(
libcorpustoken.i PROPERTIES SWIG_FLAGS
"-includeall"
)
SWIG_ADD_MODULE
(
libcorpustoken python libcorpustoken.i
)
SWIG_LINK_LIBRARIES
(
libcorpustoken
${
PYTHON_LIBRARIES
}
${
CORPUS2_PWR_LIBS
}
)
# -----------------------------------------------------------------------------
# libcorpustokenwriter
SET_SOURCE_FILES_PROPERTIES
(
libcorpustokenwriter.i PROPERTIES CPLUSPLUS ON
)
SET_SOURCE_FILES_PROPERTIES
(
libcorpustokenwriter.i PROPERTIES SWIG_FLAGS
"-includeall"
)
SWIG_ADD_MODULE
(
libcorpustokenwriter python libcorpustokenwriter.i
)
SWIG_LINK_LIBRARIES
(
libcorpustokenwriter
${
PYTHON_LIBRARIES
}
${
CORPUS2_PWR_LIBS
}
)
# -----------------------------------------------------------------------------
# libcorpustokenwriter
SET_SOURCE_FILES_PROPERTIES
(
libcorpustokenreader.i PROPERTIES CPLUSPLUS ON
)
SET_SOURCE_FILES_PROPERTIES
(
libcorpustokenreader.i PROPERTIES SWIG_FLAGS
"-includeall"
)
SWIG_ADD_MODULE
(
libcorpustokenreader python libcorpustokenreader.i
)
SWIG_LINK_LIBRARIES
(
libcorpustokenreader
${
PYTHON_LIBRARIES
}
${
CORPUS2_PWR_LIBS
}
)
# -----------------------------------------------------------------------------
# libcorpusiob
SET_SOURCE_FILES_PROPERTIES
(
libcorpusiob.i PROPERTIES CPLUSPLUS ON
)
SET_SOURCE_FILES_PROPERTIES
(
libcorpusiob.i PROPERTIES SWIG_FLAGS
"-includeall"
)
SWIG_ADD_MODULE
(
libcorpusiob python libcorpusiob.i
)
SWIG_LINK_LIBRARIES
(
libcorpusiob
${
PYTHON_LIBRARIES
}
${
CORPUS2_PWR_LIBS
}
)
# -----------------------------------------------------------------------------
# libcorpusannotationchannel
SET_SOURCE_FILES_PROPERTIES
(
libcorpusannotationchannel.i PROPERTIES CPLUSPLUS ON
)
SET_SOURCE_FILES_PROPERTIES
(
libcorpusannotationchannel.i PROPERTIES SWIG_FLAGS
"-includeall"
)
SWIG_ADD_MODULE
(
libcorpusannotationchannel python libcorpusannotationchannel.i
)
SWIG_LINK_LIBRARIES
(
libcorpusannotationchannel
${
PYTHON_LIBRARIES
}
${
CORPUS2_PWR_LIBS
}
)
# -----------------------------------------------------------------------------
# libcorpusannotationchannel
SET_SOURCE_FILES_PROPERTIES
(
libcorpusannotatedsentence.i PROPERTIES CPLUSPLUS ON
)
SET_SOURCE_FILES_PROPERTIES
(
libcorpusannotatedsentence.i PROPERTIES SWIG_FLAGS
"-includeall"
)
SWIG_ADD_MODULE
(
libcorpusannotatedsentence python libcorpusannotatedsentence.i
)
SWIG_LINK_LIBRARIES
(
libcorpusannotatedsentence
${
PYTHON_LIBRARIES
}
${
CORPUS2_PWR_LIBS
}
)
# -----------------------------------------------------------------------------
# libcorpusannotationchannel
SET_SOURCE_FILES_PROPERTIES
(
libcorpusannotationview.i PROPERTIES CPLUSPLUS ON
)
SET_SOURCE_FILES_PROPERTIES
(
libcorpusannotationview.i PROPERTIES SWIG_FLAGS
"-includeall"
)
SWIG_ADD_MODULE
(
libcorpusannotationview python libcorpusannotationview.i
)
SWIG_LINK_LIBRARIES
(
libcorpusannotationview
${
PYTHON_LIBRARIES
}
${
CORPUS2_PWR_LIBS
}
)
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
set_target_properties
(
_libpwrnlperror
_libcorpus2exception
_libcorpustag
_libcorpustagset
_libcorpustagsetmanager
_libcorpuslexeme
_libcorpustoken
_libcorpussentence
_libcorpuschunk
_libcorpustokenwriter
_libcorpustokenreader
_libcorpusiob
_libcorpusannotationchannel
_libcorpusannotatedsentence
_libcorpusannotationview
PROPERTIES
INSTALL_NAME_DIR
"
${
PYTHON_INSTDIR
}
"
)
set
(
PERM_SCRIPTS
OWNER_READ
OWNER_WRITE
OWNER_EXECUTE
GROUP_READ
GROUP_EXECUTE
WORLD_READ
WORLD_EXECUTE
)
# -----------------------------------------------------------------------------
# Install python modules
# -----------------------------------------------------------------------------
install
(
TARGETS _libpwrnlperror _libcorpus2exception _libcorpustag _libcorpustagset
_libcorpustagsetmanager _libcorpuslexeme _libcorpustoken
_libcorpussentence _libcorpuschunk _libcorpustokenwriter
_libcorpustokenreader _libcorpusiob _libcorpusannotationchannel
_libcorpusannotatedsentence _libcorpusannotationview
LIBRARY
DESTINATION
${
PYTHON_INSTDIR
}
PERMISSIONS
${
PERM_SCRIPTS
}
)
install
(
FILES
${
CMAKE_CURRENT_BINARY_DIR
}
/libcorpus2exception.py
${
CMAKE_CURRENT_BINARY_DIR
}
/libcorpus2exception.py
${
CMAKE_CURRENT_BINARY_DIR
}
/libcorpustag.py
${
CMAKE_CURRENT_BINARY_DIR
}
/libcorpustagset.py
${
CMAKE_CURRENT_BINARY_DIR
}
/libcorpustagsetmanager.py
${
CMAKE_CURRENT_BINARY_DIR
}
/libcorpuslexeme.py
${
CMAKE_CURRENT_BINARY_DIR
}
/libcorpustoken.py
${
CMAKE_CURRENT_BINARY_DIR
}
/libcorpussentence.py
${
CMAKE_CURRENT_BINARY_DIR
}
/libcorpuschunk.py
${
CMAKE_CURRENT_BINARY_DIR
}
/libcorpustokenwriter.py
${
CMAKE_CURRENT_BINARY_DIR
}
/libcorpustokenreader.py
${
CMAKE_CURRENT_BINARY_DIR
}
/libcorpusiob.py
${
CMAKE_CURRENT_BINARY_DIR
}
/libcorpusannotationchannel.py
${
CMAKE_CURRENT_BINARY_DIR
}
/libcorpusannotatedsentence.py
${
CMAKE_CURRENT_BINARY_DIR
}
/libcorpusannotationview.py
DESTINATION
${
PYTHON_INSTDIR
}
PERMISSIONS
${
PERM_SCRIPTS
}
)
# -----------------------------------------------------------------------------
# Install SWIG files
# -----------------------------------------------------------------------------
install
(
FILES libcorpus2exception.i
libcorpus2exception.i
libcorpustag.i
libcorpustagset.i
libcorpustagsetmanager.i
libcorpuslexeme.i
libcorpustoken.i
libcorpussentence.i
libcorpuschunk.i
libcorpustokenwriter.i
libcorpustokenreader.i
libcorpusiob.i
libcorpusannotationchannel.i
libcorpusannotatedsentence.i
libcorpusannotationview.i
DESTINATION
${
SWIG_SRC_DIR
}
PERMISSIONS
${
PERM_SCRIPTS
}
)
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment