-
Notifications
You must be signed in to change notification settings - Fork 14
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
Showing
8 changed files
with
213 additions
and
3 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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: cmake | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
jobs: | ||
cmake: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Install Python prereqs | ||
run: | | ||
pip install \ | ||
numpy \ | ||
pybind11[global] \ | ||
pytest \ | ||
pytest-flake8 \ | ||
pyyaml | ||
- name: CMake configure | ||
run: | | ||
cmake \ | ||
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build/install \ | ||
-B ${{github.workspace}}/build | ||
- name: CMake build | ||
run: cmake --build ${{github.workspace}}/build --parallel `nproc` | ||
|
||
- name: CMake test | ||
working-directory: ${{github.workspace}}/build | ||
run: ctest | ||
|
||
- name: CMake install | ||
run: cmake --build ${{github.workspace}}/build --target install | ||
|
||
- name: Python tests | ||
env: | ||
PYTHONPATH: ${{github.workspace}}/build/install/python | ||
LD_LIBRARY_PATH: ${{github.workspace}}/build/install/lib | ||
run: pytest -r a -v |
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,8 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(sphgeom) | ||
|
||
enable_testing() | ||
|
||
add_subdirectory(python/lsst/sphgeom) | ||
add_subdirectory(src) | ||
add_subdirectory(tests) |
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
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
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,50 @@ | ||
find_package(pybind11 REQUIRED) | ||
|
||
pybind11_add_module(_sphgeom | ||
_angle.cc | ||
_angleInterval.cc | ||
_box3d.cc | ||
_box.cc | ||
_chunker.cc | ||
_circle.cc | ||
_convexPolygon.cc | ||
_curve.cc | ||
_ellipse.cc | ||
_htmPixelization.cc | ||
_interval1d.cc | ||
_lonLat.cc | ||
_matrix3d.cc | ||
_mq3cPixelization.cc | ||
_normalizedAngle.cc | ||
_normalizedAngleInterval.cc | ||
_orientation.cc | ||
_pixelization.cc | ||
_q3cPixelization.cc | ||
_rangeSet.cc | ||
_region.cc | ||
_relationship.cc | ||
_sphgeom.cc | ||
_unitVector3d.cc | ||
_utils.cc | ||
_vector3d.cc | ||
) | ||
|
||
target_link_libraries(_sphgeom PUBLIC sphgeom) | ||
|
||
install(TARGETS _sphgeom DESTINATION ${CMAKE_INSTALL_PREFIX}/python/lsst/sphgeom) | ||
|
||
install( | ||
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ | ||
DESTINATION ${CMAKE_INSTALL_PREFIX}/python/lsst/sphgeom | ||
FILES_MATCHING PATTERN "*.py" | ||
) | ||
|
||
add_custom_target(sphgeom_version ALL | ||
${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/version.cmake | ||
BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/version.py | ||
) | ||
|
||
install( | ||
FILES ${CMAKE_CURRENT_BINARY_DIR}/version.py | ||
DESTINATION ${CMAKE_INSTALL_PREFIX}/python/lsst/sphgeom | ||
) |
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,27 @@ | ||
execute_process( | ||
COMMAND git describe --all --always --dirty | ||
OUTPUT_VARIABLE GIT_REV | ||
ERROR_QUIET | ||
) | ||
|
||
if("${GIT_REV}" STREQUAL "") | ||
set(GIT_REV "unknown") | ||
endif() | ||
|
||
string(STRIP ${GIT_REV} GIT_REV) | ||
string(REGEX REPLACE "^(heads|tags)/" "" GIT_REV "${GIT_REV}") | ||
string(REPLACE "/" "_" GIT_REV "${GIT_REV}") | ||
|
||
set(VERSION_PY "__version__ = '${GIT_REV}' | ||
__all__ = ('__version__',) | ||
") | ||
|
||
if(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/version.py) | ||
file(READ ${CMAKE_CURRENT_BINARY_DIR}/version.py VERSION_PY_) | ||
else() | ||
set(VERSION_PY_ "") | ||
endif() | ||
|
||
if(NOT "${VERSION_PY}" STREQUAL "${VERSION_PY_}") | ||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/version.py "${VERSION_PY}") | ||
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
add_library(sphgeom SHARED) | ||
|
||
target_compile_features(sphgeom PRIVATE | ||
cxx_std_17 | ||
) | ||
|
||
set_target_properties(sphgeom PROPERTIES | ||
CXX_EXTENSIONS OFF | ||
POSITION_INDEPENDENT_CODE ON | ||
) | ||
|
||
target_include_directories(sphgeom PUBLIC | ||
${PROJECT_SOURCE_DIR}/include | ||
) | ||
|
||
target_sources(sphgeom PRIVATE | ||
Angle.cc | ||
AngleInterval.cc | ||
BigInteger.cc | ||
Box3d.cc | ||
Box.cc | ||
Chunker.cc | ||
Circle.cc | ||
ConvexPolygon.cc | ||
ConvexPolygonImpl.h | ||
Ellipse.cc | ||
HtmPixelization.cc | ||
Interval1d.cc | ||
LonLat.cc | ||
Matrix3d.cc | ||
Mq3cPixelization.cc | ||
NormalizedAngle.cc | ||
NormalizedAngleInterval.cc | ||
orientation.cc | ||
PixelFinder.h | ||
Q3cPixelization.cc | ||
Q3cPixelizationImpl.h | ||
RangeSet.cc | ||
Region.cc | ||
UnitVector3d.cc | ||
utils.cc | ||
Vector3d.cc | ||
) | ||
|
||
install(TARGETS sphgeom) |
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,31 @@ | ||
FUNCTION(sphgeom_tests) | ||
FOREACH(TEST IN ITEMS ${ARGV}) | ||
add_executable(${TEST} ${TEST}.cc) | ||
target_link_libraries(${TEST} PUBLIC sphgeom) | ||
add_test(NAME ${TEST} COMMAND ${TEST}) | ||
ENDFOREACH() | ||
ENDFUNCTION() | ||
|
||
sphgeom_tests( | ||
testAngle | ||
testAngleInterval | ||
testBigInteger | ||
testBox | ||
testChunker | ||
testCircle | ||
testConvexPolygon | ||
testCurve | ||
testEllipse | ||
testHtmPixelization | ||
testInterval1d | ||
testLonLat | ||
testMatrix3d | ||
testMq3cPixelization | ||
testNormalizedAngle | ||
testNormalizedAngleInterval | ||
testOrientation | ||
testQ3cPixelization | ||
testRangeSet | ||
testUnitVector3d | ||
testVector3d | ||
) |