-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aeee992
commit 48e5932
Showing
6 changed files
with
116 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,40 @@ | ||
cmake_minimum_required(VERSION 3.16) | ||
project(omnireader) | ||
project(omnireader LANGUAGES C CXX) | ||
|
||
set(CMAKE_CXX_STANDARD 11) | ||
|
||
if (${BUILD_PYTHON}) | ||
find_package(PythonExtensions REQUIRED) | ||
find_package(Cython REQUIRED) | ||
find_package(NumPy REQUIRED) | ||
include_directories(${NumPy_INCLUDE_DIRS}) | ||
endif () | ||
include_directories(${PROJECT_SOURCE_DIR}/libomnireader/include) | ||
|
||
add_subdirectory(cppsrc) | ||
# use, i.e. don't skip the full RPATH for the build tree | ||
set(CMAKE_SKIP_BUILD_RPATH FALSE) | ||
|
||
# use RPATH on MACOS | ||
set(CMAKE_MACOSX_RPATH ON) | ||
|
||
# when building, don't use the install RPATH already | ||
# (but later on when installing) | ||
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) | ||
|
||
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") | ||
|
||
# add the automatically determined parts of the RPATH | ||
# which point to directories outside the build tree to the install RPATH | ||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) | ||
|
||
# the RPATH to be used when installing, but only if it's not a system directory | ||
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) | ||
if("${isSystemDir}" STREQUAL "-1") | ||
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") | ||
endif("${isSystemDir}" STREQUAL "-1") | ||
|
||
add_subdirectory(libomnireader) | ||
# python layer | ||
if (${BUILD_PYTHON}) | ||
add_subdirectory(omnireader) | ||
endif () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
project(omnireader) | ||
|
||
cmake_minimum_required(VERSION 3.16) | ||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) | ||
|
||
find_package(ZLIB REQUIRED) | ||
find_package(BZip2 REQUIRED) | ||
|
||
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS_RELEASE}) | ||
|
||
add_library(omnireader SHARED omnireader.h omnireader.cpp) | ||
add_library(omnireader SHARED) | ||
target_sources(omnireader PRIVATE "src/omnireader.cpp") | ||
target_include_directories(omnireader PUBLIC | ||
${CMAKE_CURRENT_LIST_DIR} | ||
"${CMAKE_CURRENT_LIST_DIR}/include") | ||
|
||
target_link_libraries(omnireader ${BZIP2_LIBRARIES}) | ||
target_include_directories(omnireader PRIVATE ${BZIP2_INCLUDE_DIRS}) | ||
target_link_libraries(omnireader ${ZLIB_LIBRARIES}) | ||
target_include_directories(omnireader PRIVATE ${ZLIB_INCLUDE_DIRS}) | ||
|
||
set_target_properties(omnireader | ||
PROPERTIES PUBLIC_HEADER "omnireader.h") | ||
PROPERTIES PUBLIC_HEADER "include/omnireader.h") | ||
|
||
install(TARGETS omnireader | ||
DESTINATION lib | ||
PUBLIC_HEADER DESTINATION include | ||
) | ||
|
||
add_executable(test_lines test_lines.cpp) | ||
add_executable(test_lines test/test_lines.cpp) | ||
target_link_libraries(test_lines omnireader) | ||
|
||
add_executable(test_seekntell test_seekntell.cpp) | ||
add_executable(test_seekntell test/test_seekntell.cpp) | ||
target_link_libraries(test_seekntell omnireader) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
add_cython_target(groreader CXX PY3 groreader.pyx) | ||
|
||
add_library(groreader MODULE ${groreader}) | ||
python_extension_module(groreader) | ||
target_link_libraries(groreader omnireader) | ||
|
||
if(APPLE) | ||
set_target_properties(groreader PROPERTIES INSTALL_RPATH "@loader_path") | ||
else() | ||
set_target_properties(groreader PROPERTIES INSTALL_RPATH "\$ORIGIN") | ||
endif() | ||
|
||
# install(TARGETS groreader LIBRARY DESTINATION omnireader) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
[build-system] | ||
requires = [ | ||
"setuptools>=42", | ||
"wheel", | ||
# declaring numpy versions specifically to x86_64 | ||
# lowest NumPy we can use for a given Python, | ||
# except for more exotic platform (Mac Arm flavors) | ||
# Also don't allow PyPy builds | ||
"numpy==1.20.0; python_version=='3.8' and platform_machine=='x86_64' and platform_python_implementation != 'PyPy'", | ||
"numpy==1.20.0; python_version=='3.9' and platform_machine=='x86_64' and platform_python_implementation != 'PyPy'", | ||
# As per https://github.com/scipy/oldest-supported-numpy/blob/main/setup.cfg | ||
# safest to build at 1.21.6 for all platforms | ||
"numpy==1.21.6; python_version=='3.10' and platform_machine=='x86_64' and platform_python_implementation != 'PyPy'", | ||
"numpy==1.23.2; python_version=='3.11' and platform_machine=='x86_64' and platform_python_implementation != 'PyPy'", | ||
# default to just numpy for unknown versions of Python | ||
"numpy; python_version>='3.12'", | ||
"scikit-build", | ||
"cmake", | ||
"cython>=0.28,<3.0", | ||
"versioningit", | ||
"ninja; platform_system!='Windows'" | ||
] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "omnireader" | ||
dynamic = ["version"] | ||
description = "read stuff yo" | ||
dependencies = [ | ||
"cython", | ||
"numpy", | ||
] | ||
requires-python = ">=3.9" | ||
|
||
[tool.setuptools] | ||
zip-safe = false | ||
|
||
[tool.versioningit] | ||
default-version = "1+unknown" | ||
|
||
[tool.versioningit.format] | ||
distance = "{base_version}+{distance}.{vcs}{rev}" | ||
dirty = "{base_version}+{distance}.{vcs}{rev}.dirty" | ||
distance-dirty = "{base_version}+{distance}.{vcs}{rev}.dirty" | ||
|
||
[tool.versioningit.vcs] | ||
method = "git" | ||
match = ["*"] | ||
default-tag = "0.0.0" | ||
|
||
[tool.versioningit.write] | ||
file = "omnireader/_version.py" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,13 @@ | ||
import os | ||
from setuptools import setup, Extension, find_packages | ||
from Cython.Build import cythonize | ||
|
||
|
||
try: | ||
# TODO: something smart about lib detection | ||
BASEPATH = os.environ['CONDA_PREFIX'] | ||
except: | ||
raise ValueError("Install libomnireader into conda first") | ||
else: | ||
LIBPATH = os.path.join(BASEPATH, 'lib') | ||
INCPATH = os.path.join(BASEPATH, 'include') | ||
|
||
groreader = Extension( | ||
name='omnireader.groreader', | ||
sources=['omnireader/groreader.pyx'], | ||
include_dirs=[INCPATH], | ||
library_dirs=[LIBPATH], | ||
libraries=['omnireader'], | ||
language='c++', | ||
) | ||
from skbuild import setup | ||
|
||
|
||
setup( | ||
name='omnireader', | ||
ext_modules=cythonize([groreader]), | ||
packages=find_packages(), | ||
packages=['omnireader'], | ||
cmake_args=['-DBUILD_PYTHON=ON'], | ||
python_requires=">=3.9", | ||
install_requires=[ | ||
"numpy>=1.20.0", | ||
] | ||
) |