-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from darioizzo/pykep_structure
Structure for the python module
- Loading branch information
Showing
21 changed files
with
787 additions
and
29 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,4 +1,4 @@ | ||
name: GitHub CI | ||
name: C++ Library | ||
on: | ||
push: | ||
branches: | ||
|
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,17 @@ | ||
name: Python Module | ||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- 'v[0-9]+.[0-9]+.[0-9]+' | ||
pull_request: | ||
branches: | ||
- main | ||
jobs: | ||
linux_pykep: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Build | ||
run: bash tools/gha_linux_pykep.sh |
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 |
---|---|---|
|
@@ -9,3 +9,6 @@ build* | |
|
||
# config files | ||
include/kep3/config.hpp | ||
|
||
# python stuff | ||
*__pycache__* |
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
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,14 @@ | ||
# Mandatory public dependencies on Boost and fmt. | ||
find_package(Boost @_kep3_MIN_BOOST_VERSION@ REQUIRED serialization) | ||
find_package(fmt REQUIRED CONFIG) | ||
find_package(heyoka REQUIRED CONFIG) | ||
find_package(xtensor REQUIRED CONFIG) | ||
find_package(xtensor-blas REQUIRED CONFIG) | ||
|
||
# Get current dir. | ||
get_filename_component(_kep3_CONFIG_SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) | ||
|
||
include(${_kep3_CONFIG_SELF_DIR}/kep3_export.cmake) | ||
|
||
# Clean up. | ||
unset(_kep3_CONFIG_SELF_DIR) |
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 |
---|---|---|
|
@@ -12,4 +12,5 @@ dependencies: | |
- spdlog | ||
- xtensor | ||
- xtensor-blas | ||
- pybind11 | ||
|
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,61 @@ | ||
# Configure the version file. | ||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/_version.py.in" "${CMAKE_CURRENT_SOURCE_DIR}/_version.py" @ONLY) | ||
|
||
# The list of pydsyre's Python files. | ||
set(kep3_PYTHON_FILES __init__.py _version.py test.py) | ||
|
||
# Copy the python files in the current binary dir, | ||
# so that we can import pydesyre from the build dir. | ||
# NOTE: importing from the build dir will work | ||
# only on single-configuration generators. | ||
foreach(kep3_PYTHON_FILE ${kep3_PYTHON_FILES}) | ||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${kep3_PYTHON_FILE}" | ||
"${CMAKE_CURRENT_BINARY_DIR}/${kep3_PYTHON_FILE}" COPYONLY) | ||
endforeach() | ||
|
||
# Core module. | ||
Python3_add_library(core MODULE WITH_SOABI | ||
core.cpp | ||
docstrings.cpp | ||
) | ||
|
||
target_link_libraries(core PRIVATE kep3::kep3) | ||
target_link_libraries(core PRIVATE "${pybind11_LIBRARIES}") | ||
|
||
target_include_directories(core SYSTEM PRIVATE "${pybind11_INCLUDE_DIR}" "${Python3_INCLUDE_DIRS}") | ||
target_compile_definitions(core PRIVATE "${pybind11_DEFINITIONS}") | ||
target_compile_options(core PRIVATE | ||
"$<$<CONFIG:Debug>:${KEP3_CXX_FLAGS_DEBUG}>" | ||
"$<$<CONFIG:Release>:${KEP3_CXX_FLAGS_RELEASE}>" | ||
"$<$<CONFIG:RelWithDebInfo>:${KEP3_CXX_FLAGS_RELEASE}>" | ||
"$<$<CONFIG:MinSizeRel>:${KEP3_CXX_FLAGS_RELEASE}>" | ||
|
||
) | ||
target_include_directories(core PUBLIC | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include> | ||
$<INSTALL_INTERFACE:include>) | ||
set_target_properties(core PROPERTIES CXX_VISIBILITY_PRESET hidden) | ||
set_target_properties(core PROPERTIES VISIBILITY_INLINES_HIDDEN TRUE) | ||
target_compile_features(core PRIVATE cxx_std_17) | ||
set_property(TARGET core PROPERTY CXX_EXTENSIONS NO) | ||
|
||
# Installation setup. | ||
if(PYKEP_INSTALL_PATH STREQUAL "") | ||
message(STATUS "pykep will be installed in the default location: ${Python3_SITEARCH}") | ||
set(_PYKEP_INSTALL_DIR "${Python3_SITEARCH}/pykep") | ||
else() | ||
message(STATUS "pykep will be installed in the custom location: ${PYKEP_INSTALL_PATH}") | ||
set(_PYKEP_INSTALL_DIR "${PYKEP_INSTALL_PATH}/pykep") | ||
endif() | ||
|
||
# Install the core module. | ||
install(TARGETS core | ||
RUNTIME DESTINATION ${_PYKEP_INSTALL_DIR} | ||
LIBRARY DESTINATION ${_PYKEP_INSTALL_DIR} | ||
) | ||
|
||
# Install the Python files. | ||
install(FILES ${PYKEP_PYTHON_FILES} DESTINATION ${_PYKEP_INSTALL_DIR}) | ||
|
||
unset(_PYKEP_INSTALL_DIR) |
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,18 @@ | ||
"""Pykep is a coolbox for interplanetary trajectory design developed by ESA's Advanced Concepts Team. Its main | ||
purpose is fast prototyping of reseacrh ideas, and is not intended for operational usage. | ||
Some important conventions followed: | ||
1 - All units expected are S.I. (m,sec,kg,N) unless explicitly stated. | ||
2 - The default set of osculating orbital parameters is, in this order: [sma, ecc, incl, W, w, f], where f is the true anomaly | ||
3 - The default option to represent epochs as floats is the modified julian date 2000 (MJD2000).""" | ||
|
||
# Version setup. | ||
from ._version import __version__ | ||
del _version | ||
|
||
|
||
# Importing cpp functionalities | ||
from .core import * | ||
|
||
# We import the unit test submodule | ||
from . import test |
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 @@ | ||
__version__ = "0.0.1" |
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 @@ | ||
__version__ = "@kep3_VERSION@" |
Oops, something went wrong.