forked from openalea/lpy
-
Notifications
You must be signed in to change notification settings - Fork 14
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 #31 from fredboudon/feature/fix-macos-build
Feature/fix macos build
- Loading branch information
Showing
7 changed files
with
221 additions
and
2 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
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,54 @@ | ||
#!/usr/local/bin/bash | ||
## Note: this script can also be run in ZSH if, for whatever reason, you want to run it in ZSH (the default shell for macOS 10.15+) | ||
#!/bin/zsh | ||
|
||
echo $1 | ||
if [[ -d build ]] && [[ "$1" == "clean" ]]; then | ||
echo "cleaning build directory" | ||
rm -rf build | ||
fi | ||
|
||
if ! [[ -d build ]]; then | ||
echo "creating build directory" | ||
mkdir build | ||
fi | ||
|
||
export ENV_NAME=lpydev | ||
if [[ ${CONDA_PREFIX} != ${ENV_NAME} ]] ; then | ||
echo "initialize CONDA" | ||
if [[ -d $HOME/miniconda3/ ]] ; then | ||
source ~/miniconda3/etc/profile.d/conda.sh | ||
fi | ||
if [[ -d $HOME/anaconda3/ ]] ; then | ||
source ~/anaconda3/etc/profile.d/conda.sh | ||
fi | ||
if [[ ${CONDA_EXE} == "" ]] ; then | ||
echo "error activating conda. Did you install it in the default directory? Exit." | ||
exit | ||
fi | ||
conda activate ${ENV_NAME} | ||
fi | ||
echo "Conda prefix: ${CONDA_PREFIX}" | ||
|
||
|
||
export PREFIX=${CONDA_PREFIX} | ||
export PYTHON=${CONDA_PREFIX}/bin/python | ||
|
||
|
||
cd build | ||
cmake \ | ||
-DPLANTGL_ROOT=../plantgl/build-cmake/ \ | ||
-DCMAKE_INSTALL_PREFIX=${PREFIX} \ | ||
-DCMAKE_PREFIX_PATH=${PREFIX} \ | ||
-DCMAKE_BUILD_TYPE=Debug \ | ||
-DPython3_EXECUTABLE=${PYTHON} \ | ||
.. | ||
|
||
# depending on the version of Boost, it might not be detected (I don't know why) in that case add: | ||
# -DBoost_INCLUDE_DIR=${CONDA_PREFIX}/include \ | ||
|
||
NBPROC=$(sysctl -a | grep machdep.cpu.thread_count | sed s/"machdep.cpu.thread_count: "//g) | ||
make -j $NBPROC | ||
make install | ||
cd .. | ||
python setup.py install |
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,58 @@ | ||
@echo off | ||
|
||
:: You must install Visual Studio 2019 (Community is fine) with Desktop Development C++ | ||
:: You must run this script in the Developer Command Prompt for Visual Studio (find the shortcut in your start menu) | ||
:: You should have installed your dependencies with | ||
:: ==> conda install -c conda-forge -c fredboudon --only-deps openalea.lpy | ||
:: CHECK THE VERSION IT PULLS. Sometimes Conda decides to pull an older version. In that case, specify openalea.lpy=3.8.0 | ||
:: You should adjust the path to your conda environment in the variable CONDA_PREFIX | ||
|
||
:: Initialize build tools | ||
IF "%VSINSTALLDIR%" == "" CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat" | ||
|
||
:: Initialize conda environment | ||
IF "%CONDA_PREFIX%" == "" CALL "%USERPROFILE%\miniconda3\Scripts\activate.bat" "%USERPROFILE%\miniconda3\envs\lpydev" | ||
|
||
echo %CONDA_PREFIX% | ||
|
||
set BUILDDIR=build | ||
|
||
:: using "clean" as an argument will delete the build directory | ||
if "%1"=="clean" echo "CLEANING BEFORE BUILD." | ||
if "%1"=="clean" rmdir /s /q %BUILDDIR% | ||
|
||
set PYTHON=%CONDA_PREFIX%\python.exe | ||
:: BUILD_CONFIG must be Release because conda does not provide debug symbols for Windows. | ||
set BUILD_CONFIG=Release | ||
set LIBRARY_LIB=%CONDA_PREFIX%\Library\lib | ||
set LIBRARY_PREFIX=%CONDA_PREFIX%\Library | ||
|
||
if not exist %BUILDDIR% mkdir %BUILDDIR% | ||
|
||
cd %BUILDDIR% | ||
cmake --version | ||
cmake .. -G "Visual Studio 16 2019" ^ | ||
-Wno-dev ^ | ||
-DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^ | ||
-DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX% ^ | ||
-DCMAKE_INSTALL_RPATH:STRING=%LIBRARY_LIB% ^ | ||
-DCMAKE_INSTALL_NAME_DIR=%LIBRARY_LIB% ^ | ||
-DPython3_EXECUTABLE=%PYTHON% | ||
|
||
|
||
if errorlevel 1 exit /b | ||
::echo "Can't generate CMake config" | ||
|
||
cd .. | ||
|
||
cd %BUILDDIR% | ||
cmake --build . --parallel %NUMBER_OF_PROCESSORS% --config %BUILD_CONFIG% --target install | ||
|
||
if errorlevel 1 exit /b | ||
:: echo "Can't build generated CMake config" | ||
|
||
cd .. | ||
%PYTHON% setup.py install | ||
|
||
:: You can run the IDE directly by de-commenting this line below. | ||
:: %PYTHON% %CONDA_PREFIX%\Scripts\lpy-script.pyw |