Skip to content

Commit

Permalink
Merge pull request openalea#13 from fredboudon/master
Browse files Browse the repository at this point in the history
reimport master change on develop
  • Loading branch information
fredboudon authored Feb 11, 2020
2 parents fe3aded + a96c34a commit a3333f3
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 24 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ endmacro()
# --- (Win32) Multithreaded Compilation

if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /W0")
string(REGEX REPLACE "/W3" "/W0" ${CMAKE_CXX_FLAGS} "${${CMAKE_CXX_FLAGS}}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MD")
endif()

# --- Config Header File
Expand Down
5 changes: 4 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
platform:
- x86
- x64

environment:
Expand All @@ -9,6 +8,10 @@ environment:
CONDA_VERSION: 3

install:
- for /f %%d in ('dir /b "C:\Python*"') do rd /s /q "C:\%%d"
- call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64
- call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64
- if errorlevel 1 exit 1
- git clone https://github.com/OpenAlea/appveyor-ci.git appveyor-ci
- cd appveyor-ci
- call install.bat
Expand Down
6 changes: 5 additions & 1 deletion cmake/Anaconda.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ endif()
if (DEFINED ENV{CONDA_BUILD})
message(STATUS "Conda build detected. " $ENV{CONDA_BUILD})

if (WIN32)
set(Python_ROOT_DIR "${PREFIX}")
endif()

# specify the cross compiler
set(CMAKE_C_COMPILER $ENV{CC})
set(CMAKE_LINKER $ENV{LD})
Expand All @@ -53,7 +57,7 @@ if (DEFINED ENV{CONDA_BUILD})
set(CMAKE_FIND_ROOT_PATH $ENV{PREFIX} $ENV{BUILD_PREFIX} $ENV{BUILD_PREFIX}/$ENV{HOST}/sysroot $ENV{CONDA_BUILD_SYSROOT})

# search for programs in the build host directories
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
# for libraries and headers in the target directories
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
Expand Down
2 changes: 1 addition & 1 deletion conda/bld.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ mkdir build
cd build

:: Build
cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% -DCMAKE_BUILD_TYPE=Release ..
cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% -DCMAKE_BUILD_TYPE=Release -DPython_ROOT_DIR=%PREFIX% -LAH ..
if errorlevel 1 exit 1
nmake
if errorlevel 1 exit 1
Expand Down
12 changes: 7 additions & 5 deletions conda/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,14 @@ echo "****** CHECK PYTHON LIB"
# To check if Python lib is not in the dependencies with conda-forge distribution.
# See https://github.com/conda-forge/boost-feedstock/issues/81
if [ `uname` = "Darwin" ]; then
alias ldd='otool -L'
export LDD='otool -L'
else
export LDD='ldd'
fi

#ldd `python -c "import openalea.plantgl.math._pglmath as pm ; print(pm.__file__)"`
#ldd `python -c "import openalea.plantgl.scenegraph._pglsg as pm ; print(pm.__file__)"`
#ldd `python -c "import openalea.plantgl.algo._pglalgo as pm ; print(pm.__file__)"`
#ldd `python -c "import openalea.plantgl.gui._pglgui as pm ; print(pm.__file__)"`
${LDD} `${PYTHON} -c "import openalea.plantgl.math._pglmath as pm ; print(pm.__file__)"`
${LDD} `${PYTHON} -c "import openalea.plantgl.scenegraph._pglsg as pm ; print(pm.__file__)"`
${LDD} `${PYTHON} -c "import openalea.plantgl.algo._pglalgo as pm ; print(pm.__file__)"`
${LDD} `${PYTHON} -c "import openalea.plantgl.gui._pglgui as pm ; print(pm.__file__)"`

echo "****** END OF BUILD PROCESS"
5 changes: 3 additions & 2 deletions conda/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ about:
summary: An open-source graphic toolkit for the creation, simulation and analysis of 3D virtual plants.

build:
number: 0
number: 1
preserve_egg_dir: True

requirements:
Expand All @@ -35,6 +35,7 @@ requirements:
- xorg-libxfixes # [linux]

build:
- python {{PY_VER}} # [win]
- binutils_impl_linux-64<2.31.0 # [linux]
- {{ compiler('cxx') }}
- bison # [unix]
Expand Down Expand Up @@ -69,7 +70,7 @@ requirements:
- ipython
- setuptools
- pyopengl
- pyqglviewer
- pyqglviewer # [unix]
# - scipy
# - matplotlib
# - vs2015_runtime [win and py37]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def getMetaInfo():
# Setup script
#version = '3.0.1'
version = HexVersion.from_cpp_define('PGL_VERSION',pj('src','cpp','plantgl','version.h')).to_string()
print(pkg_name + ' : version = ' + version)
#print(pkg_name + ' : version = ' + version)

# Main setup
setup(
Expand Down
4 changes: 1 addition & 3 deletions src/cpp/plantgl/algo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,7 @@ else(APPLE)
target_link_libraries(pglalgo OpenGL::GL OpenGL::GLU)
endif(APPLE)

if (NOT MSVC)
target_link_libraries(pglalgo Boost::system Boost::thread)
endif()
target_link_libraries(pglalgo Boost::system Boost::thread)

# --- Dependencies

Expand Down
2 changes: 1 addition & 1 deletion src/cpp/plantgl/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ install(TARGETS pglgui LIBRARY DESTINATION "lib")
# --- Viewer Program

add_subdirectory("exe")
add_subdirectory("exe2")
#add_subdirectory("exe2")
16 changes: 8 additions & 8 deletions src/cpp/plantgl/python/pyseq_iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,22 @@ class PySeqIterator {
public:

PySeqIterator(boost::python::object seq, bool isiterator = false) :
__iter_obj( ), __valid(true)
__iter_obj( ), __isvaliditerator(true)
{
if (isiterator){
__iter_obj = seq;
__valid = (__iter_obj != boost::python::object());
__isvaliditerator = (__iter_obj != boost::python::object());
}
else {
PyObject * pyiter = PyObject_GetIter( seq.ptr() ) ;
__valid = (pyiter != NULL);
__isvaliditerator = (pyiter != NULL);
__iter_obj = boost::python::object(boost::python::handle<>( pyiter ) );

}
_next();
}

inline bool is_valid() const { return __valid;}
inline bool is_valid() const { return __isvaliditerator;}

inline boost::python::object next() ;

Expand All @@ -74,7 +74,7 @@ class PySeqIterator {

boost::python::object __iter_obj;
boost::python::object __next_obj;
bool __valid;
bool __isvaliditerator;

};

Expand All @@ -89,10 +89,10 @@ boost::python::object PySeqIterator::next()

void PySeqIterator::_next()
{
if (__valid) {
if (__isvaliditerator) {
PyObject * item = PyIter_Next(__iter_obj.ptr());
__valid = (item != NULL);
if (__valid)
__isvaliditerator = (item != NULL);
if (__isvaliditerator)
__next_obj = boost::python::object( boost::python::handle<PyObject>(item));
else
__next_obj = boost::python::object();
Expand Down

0 comments on commit a3333f3

Please sign in to comment.