Skip to content

Conversation

@MironAtHome
Copy link

@MironAtHome MironAtHome commented Oct 22, 2025

Changes:
subfolder callback, module cheese
Fix __declspec(dllexport) function decorator for the function find_cheeses
Modified cheesefinder.h and cheesefinder.c
subfolder libraries, module call_mymath
Fixes
1 same function decorator
Modified mymath.h and mymath.c
2 add #include directive for the file "mymath.c"
change #include directive for the file "math.h" to angle brackets to ensure proper C standard file included
3 modify file Setup.py
add check not sys.platform.startswith("win") prior call to gcc compiler
make call to cythonize conditional upon check for library file presence
add second variant of cythonize for windows without libraries and library_dirs parameters
Modify Setup.py under Demos subfolder
1 add to the list of exclusions callback and libraries subfolders and their respective modules
2 organize subset of custom extensions into array
3 ensure include_dirs for the extensions point to correct folders
4 ensure sources are correctly provided
Link issue #7233

subfolder callback, module cheese
Fix __declspec(dllexport) function decorator for the functionn find_cheeses
Modified cheesefinder.h and cheesefinder.c
subfolder libraries, module call_mymath
Fix
1 same function decorator
  Modifled mymath.h and mymath.c
2 file name in the #include directive
  file mymath.c
3 mofify file Setup.py
  add check not sys.platform.startswith("win") prior call to gcc compiler
  make call to cythonize conditional upon check for library file presence
  add second variant of cythonize for windows without libraries and
  library_dirs parameters
Modify Setup.py under Demos subfolder
1 add to  the list of exclusions callback and libraries
2 organize custom extensions into array
3 ensure include_dirs for the extensions point to correct folders
4 ensure sources are correctly provided
subfolder callback, module cheese
Fix __declspec(dllexport) function decorator for the functionn find_cheeses
Modified cheesefinder.h and cheesefinder.c
subfolder libraries, module call_mymath
Fix
1 same function decorator
  Modifled mymath.h and mymath.c
2 add #include directive for the file "mymath.c"
  change #include directove for the file "math.h" to angle brackets
  to ensure proper C standard file included
3 mofify file Setup.py
  add check not sys.platform.startswith("win") prior call to gcc compiler
  make call to cythonize conditional upon check for library file presence
  add second variant of cythonize for windows without libraries and
  library_dirs parameters
Modify Setup.py under Demos subfolder
1 add to  the list of exclusions callback and libraries
2 organize custom extensions into array
3 ensure include_dirs for the extensions point to correct folders
4 ensure sources are correctly provided
subfolder callback, module cheese
Fix __declspec(dllexport) function decorator for the functionn
find_cheeses
Modified cheesefinder.h and cheesefinder.c
subfolder libraries, module call_mymath
Fix
1 same function decorator
  Modifled mymath.h and mymath.c
2 add #include directive for the file "mymath.c"
  change #include directove for the file "math.h" to angle brackets
  to ensure proper C standard file included
3 mofify file Setup.py
  add check not sys.platform.startswith("win") prior call to gcc compiler
  make call to cythonize conditional upon check for library file
  presence
  add second variant of cythonize for windows without libraries and
  library_dirs parameters
Modify Setup.py under Demos subfolder
1 add to  the list of exclusions callback and libraries
2 organize custom extensions into array
3 ensure include_dirs for the extensions
4 ensure sources are correctly provided
- reduce the number of parameters in setup.py to just necessary
- remove superfluous call to get_include()
- remove specific directory to search for include files
- replace explicit module name(s) with *, as those match .pyx file name
- remove DLL_EXPORT directive from custom .c files in cheese and my_mathcall modules
@MironAtHome
Copy link
Author

Please review changes, as per above.
Most requests fixed.
Asking to document omission with regards to Windows for call_mymath into a separate PR ( to follow shortly ).
A through documentation would require covering 2 additional compilers, mingw and cygwin.
Potentially, I would like to add OneAPI Intel compiler into the fold, as it has some very nice features, so, it looks like a very - very nice opportunity to add this compiler to the fold of tools on the list of possible choices. In an ideal world to run a small code performance comparison. I do like racing :)

@da-woods
Copy link
Contributor

A through documentation would require covering 2 additional compilers, mingw and cygwin.

It's very difficult to use anything except MSVC on Windows. The most promising open-source option is clang-cl. This would probably work perfectly except that setuptools doesn't recognise it.

I really would not try to support or document mingw or cygwin.

@MironAtHome MironAtHome requested a review from da-woods October 25, 2025 22:03
for callback and libraries .h file replace custom define with Python standard exports.h define Py_EXPORTED_SYMBOL
for setup.py script under libraries module improve building library using distutil compile, create_static_lib ccompiler class methods for Microsoft Windows platform
Add python's include directory on command line to ensure correct build
Modify local setup.py under ./Demos/libraries to pick up its name from PYX file
Modify common setup.py under ./Demos so that no dependency on numpy to build callback
Retain common setup.py stopping on error immediatelly
Copy link
Contributor

@scoder scoder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it's really worth showing two ways to build the libraries. If setuptools can do it, that's probably enough. The intention here is not to show how to build an external library because users who want to integrate with an external library probably have it available or at least know how to build it.

modifying #include directive from <exports.h> to <Python.h> to deduce chance of name collision
Use variable for library name
Ensure plaform specific handling of include directories
Fix header line of setup.py under ./libraries
Apply python formatter to align code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants