Coder Social home page Coder Social logo

cookiecutter-cppyy-cmake's Issues

cmake of cookiecutter-cppyy-cmake project fails on Windows 10

First of all thank you for creating this project. I've used cookiecutter-cppyy-cmake to create Python bindings for our C++ project successfully on Linux (Ubuntu and CentOS). I found it very easy to use and maintain the Python bindings as our C++ code evolves.

However, we now need to create Python bindings for Windows 10 deployments.
Issue: After successfully running this command ...

    $ conda install -c conda-forge cookiecutter

... the cmake command fails because it can't find *.so files.

It appears that these files list *.so files instead of DLLs:
FindCppyy.cmake, ROOTConfig-targets-release.cmake, and modules\RootNewMacros.cmake

I believe the following DLLs correspond to the *.so files listed in ROOTConfig-targets-release.cmake. However, I couldn't find a DLL to match the libMathCore.so:

    libCling.so    -> <my_venv home>\Lib\site-packages\cppyy_backend\bin\libCling.dll
    libThread.so   -> <my_venv home>\Lib\site-packages\cppyy_backend\bin\libThreadLegacy.dll
    libCore.so     -> <my_venv home>\Lib\site-packages\cppyy_backend\bin\libCoreLegacy.dll
    libRIO.so      -> <my_venv home>\Lib\site-packages\cppyy_backend\bin\libRIOLegacy.dll
    libMathCore.so -> ??? **Can't find a corresponding DLL for this *.so file** ???

Can you provide a version of cookiecutter-cppyy-cmake that works on Windows? If not, can you provide guidance on what steps are needed to build it on Windows? If I can't get this to work on Windows I have to scrap all the work I did using this project on Linux and find an alternate solution that works on both Linux and Windows.

Installed Software

  • Microsoft Windows 10 [Version 20H2]
  • Anaconda3-2021.11-Windows-x86_64.exe
  • Microsoft Visual Studio 2019
  • CMake 3.22.2

Detailed steps:

    (base) $ conda create --name my_venv python=3.8

    (base) $ conda activate my_venv

	NOTE: must be administrator for the following command
    (my_venv) $ conda update -n base -c defaults conda

	NOTE: running the following as adminstrator fails, so run as regular user
    (my_venv) $ pip3 install cppyy
                    ...
                    Successfully built cppyy CPyCppyy
                    Installing collected packages: cppyy-cling, cppyy-backend, CPyCppyy, cppyy
                    Successfully installed CPyCppyy-1.12.8 cppyy-2.2.0 cppyy-backend-1.14.7 cppyy-cling-6.25.2

    (my_venv) $ pip3 install cookiecutter

    (my_venv) $ cookiecutter gh:camillescott/cookiecutter-cppyy-cmake
                    full_name [Your name]: Tom Jordan
                    email [Your address email (eq. [email protected])]: [email protected]
                    github_username [Your github username]: tjorda01
                    project_name [cppyy test bindings]: project_name
                    repo_name [project_name]: repo_name
                    pkg_name [repo_name]: pkg_name
                    cpp_lib_name [cppproject]: cpp_lib_name
                    cpp_namespace [cpp_lib_name]: cpp_namespace
                    project_short_description [cppyy-generated bindings for cpp_lib_name]: A cookiecutter template for using cppyy
                    project_url [https://github.com/tjorda01/repo_name]:
                    release_date [2022-02-04]:
                    version [0.1.0]:
                    cpp_version [14]: 17
                    Select year_from:
                    1 - 2019
                    2 - 2018
                    3 - 2017
                    4 - 2016
                    5 - 2015
                    6 - 2014
                    7 - 2013
                    8 - 2012
                    9 - 2011
                    10 - 2010
                    11 - 2009
                    12 - 2008
                    13 - 2007
                    14 - 2006
                    15 - 2005
                    Choose from 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 [1]: 1
                    year_to [2022]:
                    Select license:
                    1 - MIT license
                    2 - BSD 2-Clause License
                    3 - BSD 3-Clause License
                    4 - ISC license
                    5 - Apache Software License 2.0
                    Choose from 1, 2, 3, 4, 5 [1]:

    (my_venv) $ cd repo_name
    (my_venv) $ mkdir build
    (my_venv) $ cd build

    (my_venv) $ pip3 install clang libclang

    (my_venv) $ cmake ..    <----- This fails!

Thanks in advance for your help.

Question on python modules

First, thank you for this cookiecutter recipe. It has been a very helpful starting point for our project.

I think we have most things working well. However, I was wondering if you could help with a specific "issue". It's not a serious one, it just creates unnecessary code.

If you try to import a class from the namespace in Python, you cannot. You always have to namespace-qualify your reference. So, if I have a class in cpp namespace cppproject called foo, I may want to:

from cppproject import LogLevels

and then use LogLevels instead of cppproject.LogLevels in my Python code.

However, if I try the import, I get this:

`In [1]: import cppyy_test_bindings

Module cppyy_test_bindings.libcppyy_test_bindingsCppyy not importable in path ['/home/mbohan/source/cppyy-test-bindings/build', '/home/mbohan/anaconda3/bin', '/home/afrancis/source/common', '/home/afrancis/source/battery/common', '/home/mbohan/anaconda3/lib/python37.zip', '/home/mbohan/anaconda3/lib/python3.7', '/home/mbohan/anaconda3/lib/python3.7/lib-dynload', '/home/mbohan/.local/lib/python3.7/site-packages', '/home/mbohan/anaconda3/lib/python3.7/site-packages', '/home/mbohan/anaconda3/lib/python3.7/site-packages/IPython/extensions', '/home/mbohan/.ipython'].
In [2]: from cppyy_test_bindings import cppproject

In [3]: from cppproject import LogLevels

ModuleNotFoundError Traceback (most recent call last)
in
----> 1 from cppproject import LogLevels

ModuleNotFoundError: No module named 'cppproject'`

Python doesn't see cppproject as a module, so I can't import members from it.

Is there any way to do this? If not, we can continue to cppproject.x for every member we want to access.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.