Conversation
Equidamoid
left a comment
There was a problem hiding this comment.
Thank you a lot for the contribution! I would've never fix it myself!
There are, however, some minor things worth changing IMO. Please see the comments.
| from pathlib import Path | ||
| import os | ||
| import sys | ||
| import pathlib |
There was a problem hiding this comment.
This pathlib. everywhere is nothing but redundant. In this context we don't have anything even coming close to have name Path ambiguous.
| bin_dir = os.path.join(build_dir, 'dltpy', 'native') | ||
| self.distribution.bin_dir = bin_dir | ||
|
|
||
| pyd_path = [os.path.join(bin_dir, _pyd) for _pyd in |
There was a problem hiding this comment.
Maybe use pathlib? It should make this part much shorter
| bin_dir = os.path.join(build_dir, 'dltpy', 'native') | ||
| self.distribution.bin_dir = bin_dir | ||
|
|
||
| pyd_path = [os.path.join(bin_dir, _pyd) for _pyd in |
There was a problem hiding this comment.
Also, pyd is a pretty weird name for a variable containing a path to a library.
There was a problem hiding this comment.
Its probably because the libraries have the ending .pyd on Windows.
| if not self.dry_run: | ||
| self.spawn(['cmake', '--build', '.'] + build_args) | ||
| os.chdir(str(cwd)) | ||
| self.spawn(['cmake', '-H'+str(pathlib.Path().absolute()), '-B'+self.build_temp, |
There was a problem hiding this comment.
This .Path() looks a bit weird. Why is it needed?
|
|
||
| # Now that the necessary directories are created, build | ||
|
|
||
| self.announce("Configuring cmake project", level=3) |
| pybind11::pybind11 | ||
| ) | ||
|
|
||
| if(WIN32) |
There was a problem hiding this comment.
Have you tried using the pybind11_add_module macro from pybind11? https://pybind11.readthedocs.io/en/master/compiling.html#pybind11-add-module
It could be that it will solve the problem without adding platform-specific code here (I'd try it myself, but can't test it for windows at all...).
|
|
||
| std::string DltReader::str(){ | ||
| return fmt::format("DltReader(buf={:p}, msg={:p}, data end={:p})", | ||
| iBuffer.begin(), |
There was a problem hiding this comment.
Oh man, indeed, the iterators are not guaranteed to be pointers. I wonder if some linter could've found this (it's not even a warning on linux&osx).
|
I took the code for the new Unfortunately, I have only limited time for this project at the moment. I will try to come back as soon as possible. If you want to fix things yourself, you can push to my repository to update this pull request. |
Prerequirements
MSVC (only Build Tools), CMake, Ninja
Steps to build
All commands have to be executed in a "MSVC Native Tools Command Prompt" to get the compiler settings.
Download or clone fmt
Create a build directory for fmt and go to the build directory
set CC=CL
set CXX=CL
cmake -G Ninja -DCMAKE_INSTALL_PREFIX=path\to\fmt\installation -DCMAKE_BUILD_TYPE=Release path\to\fmt\source
ninja install
set CMAKE_PREFIX_PATH=path\to\fmt\installation
set CMAKE_GENERATOR=Ninja
pip install --user -e path\to\dltpy\source
Notes
https://stackoverflow.com/questions/42585210/extending-setuptools-extension-to-use-cmake-in-setup-py