capnhook-ml 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,81 @@
1
+ cmake_minimum_required(VERSION 3.18)
2
+
3
+ set(CMAKE_C_COMPILER "clang")
4
+ set(CMAKE_CXX_COMPILER "clang++")
5
+
6
+ project(capnhook_ml LANGUAGES CXX)
7
+
8
+ include(${CMAKE_BINARY_DIR}/conan_toolchain.cmake)
9
+
10
+ # include(FetchContent)
11
+ # FetchContent_Declare(
12
+ # nanobind
13
+ # GIT_REPOSITORY https://github.com/wjakob/nanobind.git
14
+ # GIT_TAG v0.13.6
15
+ # )
16
+ # FetchContent_MakeAvailable(nanobind)
17
+
18
+ # get conan packages
19
+ find_package(highway REQUIRED CONFIG)
20
+ find_package(OpenBLAS REQUIRED CONFIG)
21
+
22
+ # nanobind- pybind binding
23
+ if (CMAKE_VERSION VERSION_LESS 3.18)
24
+ set(DEV_MODULE Development)
25
+ else()
26
+ set(DEV_MODULE Development.Module)
27
+ endif()
28
+ find_package(Python 3.8 COMPONENTS Interpreter ${DEV_MODULE} REQUIRED)
29
+
30
+ if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
31
+ set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
32
+ set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
33
+ endif()
34
+
35
+ execute_process(
36
+ COMMAND "${Python_EXECUTABLE}" -m nanobind --cmake_dir
37
+ OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE nanobind_ROOT)
38
+ find_package(nanobind CONFIG REQUIRED)
39
+
40
+ # nanobind_add_module(capnhook_ml
41
+ # src/capnhook_ml.cpp
42
+ # )
43
+
44
+ # target_sources(capnhook_ml PRIVATE
45
+ # src/ops.hpp
46
+ # )
47
+
48
+ nanobind_add_module(capnhook_ml
49
+ src/registry.cpp
50
+ )
51
+ target_sources(capnhook_ml PRIVATE
52
+ src/registry.hpp
53
+ src/simd/binary.hpp
54
+ src/simd/unary.hpp
55
+ src/simd/reduce.hpp
56
+ src/simd/linalg.hpp
57
+ )
58
+
59
+ target_include_directories(capnhook_ml PRIVATE
60
+ ${OpenBLAS_INCLUDE_DIRS}
61
+ )
62
+
63
+ if(APPLE AND LAPACKE_FOUND)
64
+ target_include_directories(capnhook_ml PRIVATE ${LAPACKE_INCLUDE_DIR})
65
+ endif()
66
+
67
+ target_link_libraries(capnhook_ml PRIVATE
68
+ highway::hwy
69
+ OpenBLAS::OpenBLAS
70
+ )
71
+
72
+ if(APPLE)
73
+ target_compile_definitions(capnhook_ml PRIVATE USE_ACCELERATE)
74
+ target_link_libraries(capnhook_ml PRIVATE "-framework Accelerate")
75
+
76
+ if(LAPACKE_FOUND)
77
+ target_link_libraries(capnhook_ml PRIVATE ${LAPACKE_LIBRARY})
78
+ endif()
79
+ endif()
80
+
81
+ add_compile_definitions(NO_LAPACKE)