I’d like to present my module builder, which automates the whole process of distributing a C++ module for use in python, including interrogate and compilation.
Basically you just copy your .cpp files to a directory, run a single command, and you will get a ready-to-use .pyd / .so file, which you can use in your python code.
Excellent! Many thanks Tobias for this: I believe this is very useful.
I tried it with VS2015 (I know requirements were stating VS2010…) and CMake is generating an error (excerpt from CMakeError):
XXXX\P3DModuleBuilder-master\P3DModuleBuilder-master\win_amd64\CMakeFiles\3.4.1\CompilerIdC\CompilerIdC.vcxproj(18,3):
error MSB4019: the import project "D:\Microsoft.Cpp.Default.props" can't be found. Please check that the path in the <Import> declaration is correct and that the file exists.
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Output in the console is:
Process error:
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:5 (project):
No CMAKE_C_COMPILER could be found.
CMake Error at CMakeLists.txt:5 (project):
No CMAKE_CXX_COMPILER could be found.
I would assume that some parameters should be changed to fit with VS2015: if that is the case and if you don’t mind to adjust it, I would be happy to continue to test it.
[EDIT]
As a further comment, I have the same issue in the packaging of the pyd (“specified procedure can’t be found”) - see [url]Oh my god!]. I used the one generated with the sample class. Does it work for you?
Well I didn’t link to core.lib, since it it is not included in the official sdks. I added a check tho, so it should get linked if it exists, or got generated with the methods you described.
I haven’t test packaging yet, but I will as soon as I find some time.
EDIT: I get the same error (Using stock P3D 1.9.1, win 32 bit):
C:\Users\tspringe\Downloads\PackP3D>test.win_i386.p3d
:AppRunner: Total Panda3D disk space used: 122 MB
:AppRunner: Configured max usage is: 2048 MB
Mainfile loaded
Traceback (most recent call last):
File "C:\buildslave\rtdist-windows-i386\build\built\direct\showbase\Messenger.py", line 354, in __
taskChainDispatch
File "C:\buildslave\rtdist-windows-i386\build\built\direct\showbase\Messenger.py", line 412, in __
dispatch
File "C:\buildslave\rtdist-windows-i386\build\built\direct\p3d\AppRunner.py", line 716, in __start
IfReady
File "VFSImporter", line 148, in load_module
File "Test\main.py", line 5, in <module>
File "VFSImporter", line 122, in load_module
File "VFSImporter", line 223, in _import_extension_module
ImportError: DLL load failed: The specified procedure could not be found.
:task(error): Exception occurred in PythonTask Messenger-default
Traceback (most recent call last):
File "C:\buildslave\rtdist-windows-i386\build\built\direct\p3d\AppRunner.py", line 596, in run
File "C:\buildslave\rtdist-windows-i386\build\built\direct\task\Task.py", line 510, in run
File "C:\buildslave\rtdist-windows-i386\build\built\direct\task\Task.py", line 467, in step
File "C:\buildslave\rtdist-windows-i386\build\built\direct\showbase\Messenger.py", line 354, in __
taskChainDispatch
File "C:\buildslave\rtdist-windows-i386\build\built\direct\showbase\Messenger.py", line 412, in __
dispatch
File "C:\buildslave\rtdist-windows-i386\build\built\direct\p3d\AppRunner.py", line 716, in __start
IfReady
File "VFSImporter", line 148, in load_module
File "Test\main.py", line 5, in <module>
File "VFSImporter", line 122, in load_module
File "VFSImporter", line 223, in _import_extension_module
ImportError: DLL load failed: The specified procedure could not be found.
Failure on startup.
The linking is now working and I managed to re-generate my module.
One thing I noticed with the last update you made: it seems that the script is not asking anymore for the module name the first time you launch it. I manually added the "module_name.cfg file in the build.py dir and changed it with the target module name (“TestInterrogate”) but the script is still generating a ‘Test.pyd’ file.
Thank you for the packaging test: at least it seems not (only) caused by my lack of knowledge!!
Hello, I’m using a slightly modified version of this excellent tool, and it works good for me, but I noticed that in the interrogate step the “-nomangle” option is passed, if Panda3D has a newer version. I would like to ask why, because if you build inside the Panda3D code tree there isn’t that option?
Thank you
Without -nomangle, interrogate basically generates two versions of your functions: camelCase and under_score.
Thats why you can call nodepath.set_pos() and nodepath.setPos() for example.
Panda3D currently supports both versions, although the camelCase version is deprecated and will be removed in future versions. The problem is just that the whole direct/ source tree depends on camelCase, which is why its non-trivial to change.
The module builder has no such dependencies, and so I thought it’d be a good way to already encourage users to use the under_score versions of the functions.