Skip to content

Commit

Permalink
Minor update.
Browse files Browse the repository at this point in the history
  • Loading branch information
tatsy committed Jun 7, 2017
1 parent edbdbe4 commit aa3d3a1
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ script:
- docker exec lime-env make check

# Python execution
- python -c "import lime; lime.print_version()"
- docker exec lime-env python -c "import lime; lime.print_version()"

after_success:
# Collect coverage
Expand Down
16 changes: 9 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ENV BRANCH_NAME development
ENV PULL_REQUEST false
ENV CC gcc
ENV CXX g++
ENV PYTHON_VERSION 3.5
ENV PYTHON_VERSION 2.7

#
## update/upgrade
Expand Down Expand Up @@ -43,11 +43,11 @@ RUN \
#
## Install Python through Anaconda
#
RUN wget -q https://repo.continuum.io/archive/Anaconda3-4.4.0-Linux-x86_64.sh
RUN bash Anaconda3-4.4.0-Linux-x86_64.sh -b -p $HOME/anaconda
RUN wget -q https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
RUN bash miniconda.sh -b -p $HOME/anaconda
ENV PATH "$HOME/anaconda/bin:$PATH"
RUN conda update --yes conda
RUN conda install --yes python=$PYTHON_VERSION setuptools numpy scipy pillow six
RUN conda install --yes python=$PYTHON_VERSION setuptools numpy scipy pillow six libgcc

#
## Install Google test
Expand All @@ -62,7 +62,7 @@ RUN \
#
## Build lime
#
RUN git clone --depth 20 -b $BRANCH_NAME https://github.com/tatsy/lime.git
RUN git clone --depth 23 -b $BRANCH_NAME https://github.com/tatsy/lime.git
RUN \
if [ $PULL_REQUEST != "false" ]; then \
cd lime && \
Expand All @@ -74,14 +74,16 @@ RUN \
cd lime && \
git submodule update --init --recursive

RUN find $HOME/anaconda/lib -name libpython${PYTHON_VERSION}

RUN \
cd lime && \
cmake \
-D CMAKE_BUILD_TYPE=Release \
-D LIME_BUILD_TESTS=ON \
-D GTEST_ROOT=/usr/local \
-D PYTHON_INCLUDE_DIR="$HOME/anaconda/include/python$PYTHON_VERSIONm" \
-D PYTHON_LIBRARY="$HOME/anaconda/lib/libpython$PYTHON_VERSIONm.so" \
-D PYTHON_INCLUDE_DIR=`python -c "from __future__ import print_function; from distutils import sysconfig; print(sysconfig.get_python_inc())"` \
-D PYTHON_LIBRARY=`find $HOME/anaconda/lib -name python${PYTHON_VERSION}` \
-D LIME_BUILD_PYTHON_MODULE=ON . && \
cmake --build .

Expand Down
6 changes: 3 additions & 3 deletions sources/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
configure_file("${CMAKE_CURRENT_LIST_DIR}/core/version.h.in"
"${CMAKE_CURRENT_LIST_DIR}/core/version.h" @ONLY)

if (${LIME_BUILD_STATIC_LIB})
message(STATUS "[ LIME ] Build static library.")

Expand All @@ -14,9 +17,6 @@ if (${LIME_BUILD_STATIC_LIB})
source_group(${FOLDER_NAME} FILES ${LOCAL_FILES})
endfunction()

configure_file("${CMAKE_CURRENT_LIST_DIR}/core/version.h.in"
"${CMAKE_CURRENT_LIST_DIR}/core/version.h" @ONLY)

add_folder(core "*.cpp" "*.h" "*.hpp")
add_folder(misc "*.cpp" "*.h" "*.hpp")
add_folder(npr "*.cpp" "*.h" "*.hpp")
Expand Down
2 changes: 2 additions & 0 deletions sources/core/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include <iostream>
#include <sstream>

#include "version.h"

// -----------------------------------------------------------------------------
// API export macro
// -----------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions sources/core/core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#ifndef _LIME_CORE_HPP_
#define _LIME_CORE_HPP_

#include "common.h"
#include "point.h"
#include "array2d.h"
#include "random.h"
Expand Down
19 changes: 19 additions & 0 deletions sources/core/version.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#ifdef _MSC_VER
#pragma once
#endif

#ifndef _LIME_VERSION_H_
#define _LIME_VERSION_H_

namespace lime {

static const int VERSION_MAJOR = 0;
static const int VERSION_MINOR = 2;

static inline void print_version() {
printf("lime v%d.%d\n", VERSION_MAJOR, VERSION_MINOR);
}

} // namespace lime

#endif // _LIME_VERSION_H_
3 changes: 3 additions & 0 deletions sources/python/lime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,9 @@ BOOST_PYTHON_MODULE(lime) {
// Exception translator.
py::register_exception_translator<PyLimeException>(&translate);

// Version
py::def("print_version", py_print_verson);

// NPR methods.
py::def("randomNoise", py_randomNoise);
py::def("perlinNoise", py_perlinNoise);
Expand Down

0 comments on commit aa3d3a1

Please sign in to comment.