FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
xtensor-python/python-module/CMakeLists.txt at module · tdegeus/xtensor-python · GitHub
tdegeus
xtensor-python
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
xtensor-python
/
python-module
/
CMakeLists.txt
Copy path
More file actions
More file actions
Latest commit
History
History
History
63 lines (50 loc) · 2.15 KB
Breadcrumbs
xtensor-python
/
python-module
/
CMakeLists.txt
Copy path
File metadata and controls
63 lines (50 loc) · 2.15 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
57
58
59
60
61
62
63
cmake_minimum_required
(
VERSION
3.18..3.21
)
project
(xt)
#
The C++ functions are build to a library with name "_${PROJECT_NAME}"
#
The Python library simply loads all functions
set
(PYPROJECT_NAME
"_
${
PROJECT_NAME
}
"
)
option
(
USE_WARNINGS
"
${
PROJECT_NAME
}
: Build with runtime warnings"
ON
)
option
(
USE_XSIMD
"
${
PROJECT_NAME
}
: Build with hardware optimization"
OFF
)
if
(
DEFINED
ENV{SETUPTOOLS_SCM_PRETEND_VERSION})
set
(
PROJECT_VERSION
$ENV{SETUPTOOLS_SCM_PRETEND_VERSION}
)
message
(
STATUS
"Building
${
PROJECT_NAME
}
${
PROJECT_VERSION
}
(read from SETUPTOOLS_SCM_PRETEND_VERSION)"
)
else
()
execute_process
(
COMMAND
python
-c
"from setuptools_scm import get_version; print(get_version(root='..'))"
WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
OUTPUT_VARIABLE
PROJECT_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message
(
STATUS
"Building
${
PROJECT_NAME
}
${
PROJECT_VERSION
}
"
)
endif
()
if
(
NOT
CMAKE_BUILD_TYPE
)
set
(
CMAKE_BUILD_TYPE
Release)
endif
()
find_package
(
xtensor
REQUIRED
)
find_package
(
pybind11
REQUIRED
CONFIG
)
if
(SKBUILD)
find_package
(
NumPy
REQUIRED
)
else
()
find_package
(
Python
REQUIRED
COMPONENTS
Interpreter
Development
NumPy
)
endif
()
pybind11_add_module
(
${PYPROJECT_NAME}
module/main.cpp
)
target_compile_definitions
(
${PYPROJECT_NAME}
PUBLIC
VERSION_INFO=${PROJECT_VERSION}
)
target_link_libraries
(
${PYPROJECT_NAME}
PUBLIC
xtensor
)
target_include_directories
(
${PYPROJECT_NAME}
PUBLIC
"../include"
)
if
(SKBUILD)
target_include_directories
(
${PYPROJECT_NAME}
PUBLIC
${NumPy_INCLUDE_DIRS}
)
else
()
target_link_libraries
(
${PYPROJECT_NAME}
PUBLIC
pybind11::module
Python::NumPy
)
endif
()
if
(USE_SIMD)
find_package
(
xsimd
REQUIRED
)
target_link_libraries
(
${PYPROJECT_NAME}
PUBLIC
xtensor::optimize
xtensor::use_xsimd
)
message
(
STATUS
"Compiling
${
PROJECT_NAME
}
-Python with hardware optimization"
)
endif
()
if
(SKBUILD)
if
(
APPLE
)
set_target_properties
(
${PYPROJECT_NAME}
PROPERTIES
INSTALL_RPATH
"@loader_path/
${CMAKE_INSTALL_LIBDIR}
"
)
else
()
set_target_properties
(
${PYPROJECT_NAME}
PROPERTIES
INSTALL_RPATH
"$ORIGIN/
${CMAKE_INSTALL_LIBDIR}
"
)
endif
()
install
(
TARGETS
${PYPROJECT_NAME}
DESTINATION
.)
endif
()
Back
|
FazBrowse Home
|
New Git URL