forked from meta-toolkit/meta
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request meta-toolkit#1 from meta-toolkit/master
update
- Loading branch information
Showing
38 changed files
with
609 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,6 @@ tester | |
.* | ||
data/ceeaus | ||
data/breast-cancer | ||
biicode.conf | ||
bii/ | ||
bin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# YouCompleteMe Integration | ||
This is an extra configuration file for use with the excellent | ||
[YouCompleteMe] plugin for vim. | ||
|
||
Do the following from the project's root directory to start using it: | ||
|
||
```bash | ||
ln -s contrib/YouCompleteMe/ycm_extra_conf.py .ycm_extra_conf.py | ||
``` | ||
|
||
[YouCompleteMe]: https://github.com/Valloric/YouCompleteMe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
# .ycm_extra_conf.py for MeTA source code. | ||
# Based on the provided ycm_extra_conf from YouCompleteMe as well as the | ||
# ycm_extra_conf.py from neovim. | ||
import os | ||
import ycm_core | ||
|
||
def DirectoryOfThisScript(): | ||
return os.path.dirname( os.path.abspath( __file__ ) ) | ||
|
||
def GetDatabase(): | ||
build_folder = os.path.join(DirectoryOfThisScript(), 'build') | ||
if (os.path.exists(build_folder)): | ||
return ycm_core.CompilationDatabase(build_folder) | ||
return None | ||
|
||
def MakeRelativePathsInFlagsAbsolute(flags, working_directory): | ||
if not working_directory: | ||
return flags | ||
new_flags = [] | ||
make_next_absolute = False | ||
path_flags = ['-isystem', '-I', '-iquote', '--sysroot='] | ||
for flag in flags: | ||
new_flag = flag | ||
|
||
if make_next_absolute: | ||
make_next_absolute = False | ||
if not flag.startswith('/'): | ||
new_flag = os.path.join(working_directory, flag) | ||
|
||
for path_flag in path_flags: | ||
if flag == path_flag: | ||
make_next_absolute = True | ||
break | ||
|
||
if flag.startswith(path_flag): | ||
path = flag[len(path_flag):] | ||
new_flag = path_flag + os.path.join(working_directory, path) | ||
break | ||
|
||
if new_flag: | ||
new_flags.append(new_flag) | ||
return new_flags | ||
|
||
def IsHeader(filename): | ||
headers = set(['.h', '.hpp', '.tcc']) | ||
return os.path.splitext(filename)[1] in headers | ||
|
||
def GetCompilationInfoForFile(filename): | ||
database = GetDatabase() | ||
if not database: | ||
return None | ||
|
||
if IsHeader(filename): | ||
# CMake doesn't generate flags for header files in its compilation | ||
# database, so we attempt to look up the corresponding cpp file in the | ||
# source directory and use its flags | ||
base_name = os.path.splitext(filename)[0] | ||
cpp_name = base_name.replace('/include', '/src') + '.cpp' | ||
|
||
# if we can't find the corresponding cpp, fall back to the flags for | ||
# profile.cpp | ||
if not os.path.exists(cpp_name): | ||
cpp_name = os.path.join(DirectoryOfThisScript(), 'src', 'tools', | ||
'profile.cpp') | ||
|
||
if not os.path.exists(cpp_name): | ||
return None | ||
|
||
compilation_info = database.GetCompilationInfoForFile(cpp_name) | ||
# fixes issues where .h files seemingly can't find c++ standard header | ||
# files | ||
if compilation_info.compiler_flags_: | ||
compilation_info.compiler_flags_.append('-x') | ||
compilation_info.compiler_flags_.append('c++') | ||
return compilation_info | ||
|
||
if not os.path.exists(filename): | ||
return None | ||
|
||
return database.GetCompilationInfoForFile(filename) | ||
|
||
|
||
def FlagsForFile( filename ): | ||
compilation_info = GetCompilationInfoForFile(filename) | ||
if not compilation_info: | ||
return None | ||
|
||
final_flags = MakeRelativePathsInFlagsAbsolute( | ||
compilation_info.compiler_flags_, | ||
compilation_info.compiler_working_dir_) | ||
|
||
return { | ||
'flags': final_flags, | ||
'do_cache': True | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
message(STATUS "Setting up biicode block...") | ||
set(UNIT_TEST_EXE skystrife_meta_src_test_tools_unit-test) | ||
include(src/test/unit_tests.cmake) | ||
ADD_BIICODE_TARGETS() | ||
target_link_libraries(${BII_LIB_TARGET} PUBLIC meta-definitions | ||
${ICU_LIBRARIES} | ||
${ZLIB_LIBRARIES} | ||
${CMAKE_THREAD_LIB_INIT}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Biicode Integration | ||
MeTA can be built using biicode. To do so, symlink the biicode.conf file to | ||
the project's root directory like so (from the project root): | ||
|
||
```bash | ||
ln -s contrib/biicode/biicode.conf . | ||
``` | ||
|
||
Then, configure and build with the following: | ||
|
||
```bash | ||
bii init -L | ||
bii configure | ||
bii build | ||
``` | ||
|
||
After placing the sample config.toml in the `bin/` directory, you can run | ||
the unit tests: | ||
|
||
```bash | ||
bii test | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Biicode configuration file | ||
|
||
[requirements] | ||
skystrife/cpptoml: 0 | ||
|
||
[parent] | ||
# The parent version of this block. Must match folder name. E.g. | ||
# user/block # No version number means not published yet | ||
# You can change it to publish to a different track, and change version, e.g. | ||
# user/block(track): 7 | ||
skystrife/meta: 0 | ||
|
||
[paths] | ||
# Local directories to look for headers (within block) | ||
# / | ||
include | ||
# should put porter2_stemmer on biicode as well... | ||
deps/porter2_stemmer | ||
|
||
[dependencies] | ||
# Manual adjust file implicit dependencies, add (+), remove (-), or overwrite (=) | ||
# hello.h + hello_imp.cpp hello_imp2.cpp | ||
# *.h + *.cpp | ||
include/analyzers/* + src/analyzers/* src/corpus/* | ||
include/classify/* + src/classify/* src/index/* | ||
include/corpus/* + src/corpus/* src/io/* | ||
include/index/* + src/index/* src/analyzers/* | ||
include/io/* + src/io/* src/util/* | ||
include/lm/* + src/lm/* src/corpus/* | ||
include/parser/* + src/parser/* src/io/* src/sequence/* src/util/* | ||
include/sequence/* + src/sequence/* src/io/* src/utf/* | ||
include/topics/* + src/topics/* src/index/* | ||
CMakeLists.txt + deps/findicu/FindICU.cmake src/test/unit_tests.cmake contrib/biicode/CMakeLists.txt | ||
|
||
[mains] | ||
# Manual adjust of files that define an executable | ||
# !main.cpp # Do not build executable from this file | ||
# main2.cpp # Build it (it doesnt have a main() function, but maybe it includes it) | ||
!deps/* | ||
|
||
[tests] | ||
# Manual adjust of files that define a CTest test | ||
# test/* pattern to evaluate this test/ folder sources like tests | ||
|
||
[hooks] | ||
# These are defined equal to [dependencies],files names matching bii*stage*hook.py | ||
# will be launched as python scripts at stage = {post_process, clean} | ||
# CMakeLists.txt + bii/my_post_process1_hook.py bii_clean_hook.py | ||
|
||
[includes] | ||
# Mapping of include patterns to external blocks | ||
# hello*.h: user3/depblock # includes will be processed as user3/depblock/hello*.h | ||
cpptoml.h: skystrife/cpptoml/include | ||
|
||
[data] | ||
# Manually define data files dependencies, that will be copied to bin for execution | ||
# By default they are copied to bin/user/block/... which should be taken into account | ||
# when loading from disk such data | ||
# image.cpp + image.jpg # code should write open("user/block/image.jpg") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FROM debian:jessie | ||
|
||
MAINTAINER Maciej Szymkiewicz "[email protected]" | ||
|
||
ENV METADIR /opt/meta | ||
RUN mkdir -p $METADIR | ||
|
||
RUN apt-get update && apt-get -y install cmake libicu-dev git g++ && apt-get clean | ||
|
||
WORKDIR $METADIR | ||
RUN git clone --depth 1 https://github.com/meta-toolkit/meta.git . | ||
RUN git submodule update --init --recursive | ||
RUN mkdir $METADIR/build | ||
|
||
WORKDIR $METADIR/build | ||
RUN cp $METADIR/config.toml . | ||
RUN cmake $METADIR -DCMAKE_BUILD_TYPE=Release && make | ||
RUN ctest --output-on-failure | ||
|
||
RUN apt-get -y purge git && apt-get -y autoremove |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Vagrant | ||
|
||
Build the latest version of the MeTA toolkit using [Vagrant](https://www.vagrantup.com/). Ubuntu 14.04 is used as a base Vagrant box. This project was initially made for [Text Retrieval and Search Engines](https://www.coursera.org/course/textretrieval) Coursera course. | ||
|
||
## Instructions | ||
|
||
1. Install Vagrant | ||
2. Run Vagrant | ||
``` | ||
vagrant up | ||
``` | ||
3. Check that everything is OK | ||
``` | ||
vagrant ssh | ||
cd meta/build | ||
ctest --output-on-failure | ||
``` | ||
## Notes | ||
Only VirtualBox provider was tested. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# -*- mode: ruby -*- | ||
# vi: set ft=ruby : | ||
|
||
Vagrant.configure(2) do |config| | ||
config.vm.box = "ubuntu/trusty64" | ||
config.vm.provision :shell, path: "bootstrap.sh", privileged: false | ||
|
||
config.vm.provider "virtualbox" do |v| | ||
v.cpus = 2 | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env bash | ||
|
||
# this might take a while | ||
sudo apt-get update | ||
sudo apt-get install -y software-properties-common | ||
|
||
# add the ppa for cmake | ||
sudo add-apt-repository -y ppa:george-edison55/cmake-3.x | ||
sudo apt-get update | ||
|
||
# install dependencies | ||
sudo apt-get install -y cmake libicu-dev git g++ g++-4.8 | ||
|
||
# clone the project | ||
git clone https://github.com/meta-toolkit/meta.git | ||
cd meta/ | ||
|
||
# uncomment to build exact version | ||
# git reset --hard v1.3.2 | ||
|
||
# set up submodules | ||
git submodule update --init --recursive | ||
|
||
# set up a build directory | ||
mkdir build | ||
cd build | ||
cp ../config.toml . | ||
|
||
# configure and build the project | ||
cmake ../ -DCMAKE_BUILD_TYPE=Release | ||
make |
Oops, something went wrong.