File: CMakeLists.txt

package info (click to toggle)
python-gsd 2.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 904 kB
  • sloc: python: 2,742; ansic: 1,881; makefile: 157; cpp: 109
file content (56 lines) | stat: -rw-r--r-- 1,733 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
############### cython based modules

add_custom_command (
    OUTPUT fl.c
    DEPENDS fl.pyx libgsd.pxd
    COMMAND    ${CYTHON_EXECUTABLE}
    ARGS       -${PYTHON_VERSION_MAJOR} -I ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/fl.pyx -o ${CMAKE_CURRENT_BINARY_DIR}/fl.c
    COMMENT    "Cythonizing fl.pyx"
)

set_source_files_properties(gsd.c PROPERTIES COMPILE_DEFINITIONS NO_IMPORT_ARRAY)

add_library(gsd_objects OBJECT gsd.c)
set_target_properties(gsd_objects PROPERTIES POSITION_INDEPENDENT_CODE TRUE)

if (CLANG_TIDY_EXE)
    set_target_properties(gsd_objects PROPERTIES C_CLANG_TIDY "${DO_CLANG_TIDY}")
endif()

add_library(fl SHARED fl.c gsd.c)
target_compile_definitions(fl PRIVATE NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION)

set_target_properties(fl PROPERTIES PREFIX "" OUTPUT_NAME "fl" MACOSX_RPATH "On")
if(APPLE)
    set_target_properties(fl PROPERTIES SUFFIX ".so")
    target_link_libraries(fl ${PYTHON_LIBRARY})
    fix_conda_python(fl)
endif(APPLE)

if (WIN32)
    target_link_libraries(fl ${PYTHON_LIBRARY})
    set_target_properties(fl PROPERTIES SUFFIX ".pyd")
endif()

################ Python only modules
# copy python modules to the build directory to make it a working python package
MACRO(copy_file file)
    add_custom_command (
        OUTPUT ${file}
        DEPENDS ${file}
        POST_BUILD
        COMMAND    ${CMAKE_COMMAND}
        ARGS       -E copy ${CMAKE_CURRENT_SOURCE_DIR}/${file} ${CMAKE_CURRENT_BINARY_DIR}/${file}
        COMMENT    "Copy gsd/${file}"
    )
ENDMACRO(copy_file)

set(files __init__.py __main__.py hoomd.py pygsd.py version.py)

foreach(file ${files})
    copy_file(${file})
endforeach()

add_custom_target(copy_gsd ALL DEPENDS ${files})

add_subdirectory(test)