On Sat, 2020-10-24 at 01:50 +0800, Amardeep Singh wrote:
> Hi All
> 
> I am a new joiner.Using macbook.
> Can someone please guide me how to debug numpy using clion?
> I am able to build not sure about debugging the c code.
> 
> ProductName: Mac OS X
> 
> ProductVersion: 10.15.7
> 
> BuildVersion: 19H2



Hi,

I have set up an bogus `CMakeLists.txt` (actually using `python
runtests.py` for compilation and running).  That should allow you to
use debugging tools in editors relying on cmake normally.

My current file is below. This is the opposite of polished or thought
out, so happy to learn of a better solution. And for example recently I
added `NULL=0` because I had issues without really digging into why and
I am sure it lists many files multiple times:



cmake_minimum_required(VERSION 3.13)

#cmake_policy(SET CMP0074 NEW)

project(NumPy-dummy)


AUX_SOURCE_DIRECTORY(numpy/core/src/multiarray/ MULTIARRAY)
AUX_SOURCE_DIRECTORY(numpy/core/src/umath/ UMATH)
AUX_SOURCE_DIRECTORY(numpy/core/src/common/ COMMON)
AUX_SOURCE_DIRECTORY(numpy/core/src/npymath/ NPYMATH)
AUX_SOURCE_DIRECTORY(numpy/core/src/npysort/ NPYSORT)

AUX_SOURCE_DIRECTORY(numpy/core/include/ NPYINCLUDE)
AUX_SOURCE_DIRECTORY(numpy/core/include/numpy/ NPYINCLUDEFULL)

AUX_SOURCE_DIRECTORY(build/testenv/lib/python3.8/site-packages/numpy/core/include/numpy/
 INSTALLED_NUMPY)
AUX_SOURCE_DIRECTORY(build/src.linux-x86_64-3.8/numpy/core/src/multiarray/ 
HELPER_FOR_C_SCR_FILES)

set(
        SOURCE_FILES
        ${MULTIARRAY}
        ${UMATH}
        ${COMMON}
        ${NPYMATH}
        ${NPYSORT}
        numpy/core/src/multiarray/
        build/src.linux-x86_64-3.8/numpy/core/include/
        build/src.linux-x86_64-3.8/numpy/core/include/numpy/
        build/src.linux-x86_64-3.8/numpy/core/include/numpy/__multiarray_api.c
        build/src.linux-x86_64-3.8/numpy/core/src/common/
        build/src.linux-x86_64-3.8/numpy/core/src/umath/
        build/src.linux-x86_64-3.8/numpy/core/src/multiarray/
        build/src.linux-x86_64-3.8/numpy/core/src/npymath/
        build/src.linux-x86_64-3.8/numpy/core/src/npysort/
        numpy/core/src/common/
        numpy/core/include/)

set(CMAKE_INCLUDE_PATH SOURCE_FILES)

add_compile_definitions(NPY_INTERNAL_BUILD)
add_compile_definitions([=[NPY_VISIBILITY_HIDDEN=__attribute__((visibility("hidden")))]=])
# add_compile_definitions(NPY_VISIBILITY_HIDDEN=)

add_compile_definitions(NULL=0)
#add_compile_definitions(NPY_SIZEOF_SHORT=2)
#add_compile_definitions(NPY_SIZEOF_INT=4)
#add_compile_definitions(NPY_SIZEOF_LONG=8)
#add_compile_definitions(NPY_SIZEOF_LONGLONG=8)
#add_compile_definitions(NPY_SIZEOF_PY_INTPTR_T=8)


# Find default python libraries and interpreter
#find_package(PythonInterp 3 REQUIRED)
#find_package(PythonLibs 3 REQUIRED)

#include_directories(${SOURCE_FILES} ${PYTHON_INCLUDE_DIRS})  # 
PYTHON_INCLUDE_DIRS also picks up the wrong numpy files...
# The "clean" version below is manually edited with numpy removed...
# I manuall deleted sudo rm -rf /usr/include/numpy, but I do not think it 
should have been there?!
#include_directories(${SOURCE_FILES} 
/home/sebastian/venvs/pydbg-clean/include/python3.8d)
include_directories(${SOURCE_FILES} /usr/include/python3.8)

add_executable(asdf 
build/src.linux-x86_64-3.8/numpy/core/include/numpy/__multiarray_api.c 
${SOURCE_FILES})




> 
> 
> thx
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion

Reply via email to