Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 20:11
    bstaletic opened #2816
  • 19:46
    rwgk synchronize #2672
  • 19:10
    rwgk synchronize #2672
  • 18:09
    rwgk synchronize #2672
  • 17:46
    YannickJadoul synchronize #2801
  • 17:44
    YannickJadoul synchronize #2801
  • 16:50
    rwgk synchronize #2672
  • 16:04
    rwgk commented #2751
  • 16:02
    rwgk commented #2751
  • 11:14
    t-vi commented #2751
  • 11:13
    t-vi commented #2751
  • 11:08
    t-vi commented #2751
  • 08:34
    kumaraditya303 commented #2812
  • 08:34
    kumaraditya303 commented #2812
  • 08:27
    kumaraditya303 commented #2812
  • 04:34
    rwgk synchronize #2672
  • 03:20
    rwgk synchronize #2672
  • 03:12
    dpilger26 opened #2815
  • 01:29
    YannickJadoul commented #2801
  • Jan 22 23:17
    henryiii milestoned #2814
Yannick Jadoul
@YannickJadoul
There's a macro, somewhere
crimsoncor
@crimsoncor
in python?
Boris Staletic
@bstaletic
It still needs some sort of check. I thought we could do it without any checks.
Yannick Jadoul
@YannickJadoul
No
#define PYBIND11_BUILTINS_MODULE "__builtin__"
(that's Python 2)
Python 3:
#define PYBIND11_BUILTINS_MODULE "builtins"
Boris Staletic
@bstaletic
Yannick, you can't use PYBIND11_BUILTINS_MODULE in test_modules.py.
Or do you want to pass the python tests through the C preprocessor?
Yannick Jadoul
@YannickJadoul
Nvm
I'm seeing it's on the Python side of the tests indeed
Boris Staletic
@bstaletic
cpp -include include/pybind11/detail/common.h tests/test_modules.pypp -o tests/test_modules.py
Yannick Jadoul
@YannickJadoul
Hey, it's 15 to 2
cpp -include include/pybind11/detail/common.h tests/test_modules.pypp -o tests/test_modules.py
No
Boris Staletic
@bstaletic
Hey, I was doing that with my linker scripts!
Yannick Jadoul
@YannickJadoul
Nonono
Very no
Super no
Let's not?
Boris Staletic
@bstaletic
I had #defines for amount of RAM and FLASH on the chip, so I could recycle the linker script across MCUs.
Yannick Jadoul
@YannickJadoul
Auwtch
Is there nothing better?
Well, let's rephrase that
Isn't anything better than the C preprocessor?
Boris Staletic
@bstaletic
Are you suggesting m4, the autotools macro processor?
Yannick Jadoul
@YannickJadoul
Anything
jinja?
Boris Staletic
@bstaletic
But that would make my project depend on python.
Yannick Jadoul
@YannickJadoul
Yes
Boris Staletic
@bstaletic
cpp is part of the toolchain.
Yannick Jadoul
@YannickJadoul
sed
Anything
(OK, yes, it's fine, probably ;-) )
Boris Staletic
@bstaletic
Also, the linker script with the macros was generated, not written by hand.
Yannick Jadoul
@YannickJadoul
So, if you're generating something already, why not ... ?
Boris Staletic
@bstaletic
cpp -include include/pybind11/detail/common.h tests/test_modules.pypp -o tests/test_modules.py
That should have been -imacros, not -include.
Yannick Jadoul
@YannickJadoul
Ok, right
Boris Staletic
@bstaletic

So, if you're generating something already, why not ... ?

Because a 3rd party generated the thing. I was just passing it through cpp.

What's the purpose of
       -undef
           Do not predefine any system-specific or GCC-specific macros.  The standard predefined macros remain defined.
Yannick Jadoul
@YannickJadoul
Ugh
Sorry, I've never been a fan of the preprocessor
Boris Staletic
@bstaletic
Hey, it was constexpr decades before constexpr!
Yannick Jadoul
@YannickJadoul
Well, kind of
Boris Staletic
@bstaletic
int add(int a, int b) { return a + b; }
const int x = add(a, b); // Not a constant expression, initialized at run time
int arr[x]; // variable-length array
#define add(a, b) ((a) + (b))
const int x = add(a, b); // Constant expression
int arr[x]; // Static array
conseval int add(int a, int b) { return a + b; } // C++20
const int x = add(a, b); // Constant expression
int arr[x]; // Static array
Shikhar Jaiswal
@ShikharJ
Hey everyone, new user here. I was able to hookup pybind with my CMakeLists.txt file, and was able to (make) compile my code as follows:
set(CMAKE_CXX_STANDARD 14)

add_subdirectory(pybind11)
pybind11_add_module(vamanapy src/vamana_bindings.cpp)
I'm able to obtain a vamanapy.cpython-38-x86_64-linux-gnu.so file. How can I link this to my setup.py in order to install it?
Boris Staletic
@bstaletic
Shikhar Jaiswal
@ShikharJ
Umm, yes, but the instructions are a bit confusing (I guess I'm a bit new to this build process). In principle, I just need to write a setup.py file and do a pip install correct?
Grégory Starck
@gst
the setup.py in the cmake_example seems legit/good. have you tried ?