Last active
March 6, 2019 16:10
-
-
Save saravanabalagi/57ae41a7d743a55de40b0c83c5f6f8c2 to your computer and use it in GitHub Desktop.
cmake with python conda env
This file contains hidden or 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
| cd myAwesomeLibrary | |
| mkdir build | |
| cd build | |
| cmake -DPYTHON_LIBRARY=/home/saravanabalagi/.conda/envs/dev/lib/libpython3.6m.so -DPYTHON_EXECUTABLE=/home/saravanabalagi/.conda/envs/dev/bin/python .. | |
| cmake --build .. |
Author
Author
Usually devs create these variables with prefix PYTHON_, so it is important that you replace other python variables if they include the system python interpreter's path.
Commonly used variables include
PYTHON_EXECUTABLE:FILEPATH=/home/saravanabalagi/.conda/envs/dev/bin/pythonPYTHON_LIBRARY:FILEPATH=/home/saravanabalagi/.conda/envs/dev/lib/libpython3.6m.soPYTHON_INCLUDE_DIR:FILEPATH=/home/saravanabalagi/.conda/envs/dev/include/python3.6m
If you include variables that are not needed, it would appear in CMakeCache.txt as
//No help, variable specified on the command line.
PYTHON_INCLUDE_DIR:UNINITIALIZED=/home/saravanabalagi/.conda/envs/dev/include/python3.6m
Author
This was used to compile pypangolin python module from Pangolin, where cmake will by default use the system interpreter. Further to make pypangolin work, I had to rename pypangolin.cpython-36m-x86_64-linux-gnu.so inside build/src to pypangolin.so
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Make sure you also find in
build/CMakeCache.txtsomething likewhere you find your conda env python's path overwritten on variables.