├── .github ├── dependabot.yml └── workflows │ └── build_wheel.yml ├── .gitignore ├── CMakeLists.txt ├── External_OpenSSL.cmake.in ├── External_libsodium.cmake.in ├── External_libuuid.cmake.in ├── LICENSE ├── README.md ├── bcryptgen.patch.in ├── cmake ├── FindOpenSSL.cmake └── wheelConfig.cmake.in ├── commoncrypto.patch.in ├── kernels ├── xpython-raw │ ├── kernel.json.in │ ├── logo-32x32.png │ └── logo-64x64.png └── xpython │ ├── kernel.json.in │ ├── logo-32x32.png │ └── logo-64x64.png ├── pyproject.toml ├── pytest.ini ├── setup.py ├── test ├── test_notebook.ipynb └── test_notebook_raw.ipynb ├── xpython └── __init__.py └── xpython_launcher.py /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | # Set update schedule for GitHub Actions 4 | - package-ecosystem: "github-actions" 5 | directory: "/" 6 | schedule: 7 | # Check for updates to GitHub Actions every weekday 8 | interval: "weekly" 9 | -------------------------------------------------------------------------------- /.github/workflows/build_wheel.yml: -------------------------------------------------------------------------------- 1 | name: Build Wheel 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | pull_request: 8 | branches: 9 | - main 10 | create: 11 | tags: 12 | - '*' 13 | 14 | jobs: 15 | osx: 16 | runs-on: macos-11 17 | 18 | strategy: 19 | fail-fast: false 20 | matrix: 21 | PYTHON_VERSION: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] 22 | ARCH: ["x86_64", "arm64"] 23 | 24 | env: 25 | PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }} 26 | CXX: clang++ 27 | CC: clang 28 | 29 | steps: 30 | - name: Checkout 31 | uses: actions/checkout@v3 32 | 33 | - name: Install Python 34 | uses: actions/setup-python@v4 35 | with: 36 | python-version: ${{ matrix.PYTHON_VERSION }} 37 | 38 | - name: Setup xcode 39 | uses: maxim-lobanov/setup-xcode@v1 40 | with: 41 | xcode-version: '13.1.0' 42 | 43 | - name: Build wheel 44 | run: | 45 | set -eux 46 | pip install delocate 47 | export SDKROOT=$(xcrun --sdk macosx --show-sdk-path) 48 | if [ ${{ matrix.ARCH }} == "arm64" ]; then 49 | export _PYTHON_HOST_PLATFORM=macosx-11.0-arm64 50 | export ARCHFLAGS="-arch arm64" 51 | export LIBSODIUM_CONFIG_COMMAND="./configure --host=arm64-apple-darwin" 52 | export OPENSSL_CONFIG_COMMAND="perl Configure darwin64-arm64-cc" 53 | export DCMAKE_OSX_ARCHITECTURES="arm64" 54 | fi 55 | python -m pip wheel . --verbose -w wheelhouse_dirty 56 | delocate-wheel -w wheelhouse --require-archs=${{ matrix.arch }} -v wheelhouse_dirty/xeus_python-*.whl 57 | 58 | - name: List wheels 59 | run: ls wheelhouse 60 | 61 | - uses: actions/upload-artifact@v3 62 | with: 63 | name: wheelhouse 64 | path: wheelhouse/xeus_python-*.whl 65 | if-no-files-found: error 66 | 67 | linux: 68 | runs-on: ubuntu-20.04 69 | 70 | strategy: 71 | fail-fast: false 72 | matrix: 73 | PYTHON_VERSION: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] 74 | 75 | container: 76 | image: "quay.io/pypa/manylinux2014_x86_64" 77 | 78 | steps: 79 | - name: Checkout 80 | uses: actions/checkout@v3 81 | 82 | - name: Build wheel 83 | run: | 84 | set -eux 85 | pyver=`echo '${{ matrix.PYTHON_VERSION }}' | tr -d '.'` 86 | pypath=`echo /opt/python/cp${pyver}-cp${pyver}*/bin` 87 | export PATH=$pypath:$PATH 88 | python -m pip wheel --verbose . -w wheelhouse_dirty 89 | auditwheel repair wheelhouse_dirty/xeus_python-*.whl --plat manylinux2014_x86_64 -w wheelhouse 90 | 91 | - name: List wheels 92 | run: ls wheelhouse 93 | 94 | - name: Get wheel name 95 | run: echo "WHEEL=$(find wheelhouse -type f -iname 'xeus_python-*.whl')" >> $GITHUB_ENV 96 | 97 | - uses: actions/upload-artifact@v3 98 | with: 99 | name: wheelhouse 100 | path: ${{ env.WHEEL }} 101 | 102 | windows: 103 | runs-on: windows-2022 104 | 105 | strategy: 106 | fail-fast: false 107 | matrix: 108 | PYTHON_VERSION: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] 109 | 110 | steps: 111 | - name: Checkout 112 | uses: actions/checkout@v3 113 | 114 | - name: Install Python 115 | uses: actions/setup-python@v4 116 | with: 117 | python-version: ${{ matrix.PYTHON_VERSION }} 118 | 119 | - name: Setup NASM 120 | uses: ilammy/setup-nasm@v1 121 | 122 | - name: Build wheel 123 | shell: cmd 124 | run: | 125 | call "c:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" 126 | pip wheel --verbose . -w wheelhouse 127 | 128 | - name: List wheels 129 | run: ls wheelhouse 130 | 131 | - uses: actions/upload-artifact@v3 132 | with: 133 | name: wheelhouse 134 | path: wheelhouse/xeus_python-*.whl 135 | if-no-files-found: error 136 | 137 | test-wheels: 138 | runs-on: ${{ matrix.os }}-latest 139 | needs: [linux, osx, windows] 140 | 141 | strategy: 142 | fail-fast: false 143 | matrix: 144 | os: [ubuntu, macos, windows] 145 | PYTHON_VERSION: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] 146 | include: 147 | - PYTHON_VERSION: "3.7" 148 | os: ubuntu 149 | whl: 'xeus_python-*-cp37*linux*.whl' 150 | - PYTHON_VERSION: "3.8" 151 | os: ubuntu 152 | whl: 'xeus_python-*-cp38*linux*.whl' 153 | - PYTHON_VERSION: "3.9" 154 | os: ubuntu 155 | whl: 'xeus_python-*-cp39*linux*.whl' 156 | - PYTHON_VERSION: "3.10" 157 | os: ubuntu 158 | whl: 'xeus_python-*-cp310*linux*.whl' 159 | - PYTHON_VERSION: "3.11" 160 | os: ubuntu 161 | whl: 'xeus_python-*-cp311*linux*.whl' 162 | - PYTHON_VERSION: "3.12" 163 | os: ubuntu 164 | whl: 'xeus_python-*-cp312*linux*.whl' 165 | - PYTHON_VERSION: "3.7" 166 | os: macos 167 | whl: 'xeus_python-*-cp37*macos*x86_64.whl' 168 | - PYTHON_VERSION: "3.8" 169 | os: macos 170 | whl: 'xeus_python-*-cp38*macos*x86_64.whl' 171 | - PYTHON_VERSION: "3.9" 172 | os: macos 173 | whl: 'xeus_python-*-cp39*macos*x86_64.whl' 174 | - PYTHON_VERSION: "3.10" 175 | os: macos 176 | whl: 'xeus_python-*-cp310*macos*x86_64.whl' 177 | - PYTHON_VERSION: "3.11" 178 | os: macos 179 | whl: 'xeus_python-*-cp311*macos*x86_64.whl' 180 | - PYTHON_VERSION: "3.12" 181 | os: macos 182 | whl: 'xeus_python-*-cp312*macos*x86_64.whl' 183 | - PYTHON_VERSION: "3.7" 184 | os: windows 185 | whl: 'xeus_python-*-cp37*win*.whl' 186 | - PYTHON_VERSION: "3.8" 187 | os: windows 188 | whl: 'xeus_python-*-cp38*win*.whl' 189 | - PYTHON_VERSION: "3.9" 190 | os: windows 191 | whl: 'xeus_python-*-cp39*win*.whl' 192 | - PYTHON_VERSION: "3.10" 193 | os: windows 194 | whl: 'xeus_python-*-cp310*win*.whl' 195 | - PYTHON_VERSION: "3.11" 196 | os: windows 197 | whl: 'xeus_python-*-cp311*win*.whl' 198 | - PYTHON_VERSION: "3.12" 199 | os: windows 200 | whl: 'xeus_python-*-cp312*win*.whl' 201 | 202 | steps: 203 | - name: Checkout 204 | uses: actions/checkout@v3 205 | 206 | - uses: actions/download-artifact@v3 207 | with: 208 | name: wheelhouse 209 | path: ./wheelhouse 210 | 211 | - name: Install Python 212 | uses: actions/setup-python@v4 213 | with: 214 | python-version: ${{ matrix.PYTHON_VERSION }} 215 | 216 | - name: Install deps 217 | run: python -m pip install pytest nbval 218 | 219 | - name: List wheels 220 | run: ls wheelhouse 221 | 222 | - name: Install wheel 223 | shell: bash 224 | run: | 225 | WHEEL=$(find . -type f -iname ${{ matrix.whl }}) 226 | python -m pip install -vv ${WHEEL} 227 | working-directory: wheelhouse 228 | 229 | - name: Run test 230 | run: pytest test -vv 231 | 232 | publish-wheels: 233 | runs-on: ubuntu-latest 234 | needs: [test-wheels] 235 | if: ${{ github.event_name == 'create' }} 236 | 237 | strategy: 238 | fail-fast: false 239 | 240 | steps: 241 | 242 | - uses: actions/download-artifact@v3 243 | with: 244 | name: wheelhouse 245 | path: ./wheelhouse 246 | 247 | - name: Install Python 248 | uses: actions/setup-python@v4 249 | with: 250 | python-version: 3.9 251 | 252 | - name: Install deps 253 | run: python -m pip install twine 254 | 255 | - name: Publish wheels 256 | env: 257 | TWINE_USERNAME: __token__ 258 | TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} 259 | run: twine upload wheelhouse/xeus_python-*.whl 260 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.py[cod] 2 | 3 | # C extensions 4 | *.so 5 | 6 | # Packages 7 | *.egg 8 | *.egg-info 9 | dist 10 | build 11 | _skbuild 12 | eggs 13 | parts 14 | bin 15 | var 16 | sdist 17 | develop-eggs 18 | .installed.cfg 19 | lib 20 | lib64 21 | 22 | # Installer logs 23 | pip-log.txt 24 | 25 | # Unit test / coverage reports 26 | htmlcov/ 27 | .tox/ 28 | .coverage 29 | .coverage.* 30 | .cache 31 | nosetests.xml 32 | coverage.xml 33 | *.cover 34 | .hypothesis/ 35 | .pytest_cache/ 36 | 37 | # Translations 38 | *.mo 39 | 40 | # IDE junk 41 | .idea/* 42 | *.swp 43 | 44 | # build output (testing) 45 | skbuild/cmake_test_compile/* 46 | 47 | # Generated kernelspec 48 | kernels/xpython/kernel.json 49 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.4.0) 2 | 3 | project(wheel) 4 | set(WHEEL_VERSION 0.1.0) 5 | 6 | # To use cmake modules/functions or FindXXX files: 7 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") 8 | include(GNUInstallDirs) # Define CMAKE_INSTALL_xxx: LIBDIR, INCLUDEDIR 9 | set(wheel_export_file "${PROJECT_BINARY_DIR}/wheelTargets.cmake") 10 | 11 | set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}") 12 | set(CMAKE_POSITION_INDEPENDENT_CODE ON CACHE BOOL "Enable position independent code" FORCE) 13 | 14 | # Default to static build 15 | set(BUILD_STATIC_LIBS ON CACHE BOOL "enable static build of xeus" FORCE) 16 | set(BUILD_SHARED_LIBS OFF CACHE BOOL "disable shared build of xeus" FORCE) 17 | 18 | message(STATUS "PYTHON_EXECUTABLE is ${PYTHON_EXECUTABLE}") 19 | message(STATUS "CMAKE_LIBRARY_PATH is ${CMAKE_LIBRARY_PATH}") 20 | message(STATUS "OPENSSL_CONFIG is ${OPENSSL_CONFIG}") 21 | message(STATUS "LIBSODIUM CONFIG is ${LIBSODIUM_CONFIG}") 22 | 23 | # Dependencies 24 | # ============ 25 | 26 | set(ZEROMQ_GIT_TAG v4.3.2) 27 | set(CPPZMQ_GIT_TAG v4.7.1) 28 | set(XTL_GIT_TAG 0.7.2) 29 | set(JSON_GIT_TAG v3.7.3) 30 | set(XEUS_GIT_TAG 3.0.3) 31 | set(XEUS_ZMQ_GIT_TAG 1.0.2) 32 | set(PYBIND11_GIT_TAG v2.10.0) 33 | set(PYBIND11_JSON_GIT_TAG 0.2.11) 34 | set(XEUS_PYTHON_GIT_TAG 0.15.12) 35 | 36 | # pre-build non-cmake dependencies 37 | # ================================ 38 | 39 | configure_file(External_OpenSSL.cmake.in OpenSSL-download/CMakeLists.txt @ONLY) 40 | configure_file(bcryptgen.patch.in OpenSSL-download/bcryptgen.patch @ONLY) 41 | configure_file(commoncrypto.patch.in OpenSSL-download/commoncrypto.patch @ONLY) 42 | execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} 43 | -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} . 44 | RESULT_VARIABLE result 45 | WORKING_DIRECTORY 46 | ${CMAKE_CURRENT_BINARY_DIR}/OpenSSL-download) 47 | execute_process(COMMAND ${CMAKE_COMMAND} --build . 48 | RESULT_VARIABLE result 49 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/OpenSSL-download ) 50 | if(result) 51 | message(FATAL_ERROR "CMake step for OpenSSL failed: ${result}") 52 | endif() 53 | 54 | # This makes sure that find_package(OpenSSL) finds the version we built 55 | set(OPENSSL_ROOT_DIR "${CMAKE_INSTALL_PREFIX}") 56 | 57 | if(UNIX AND NOT APPLE) 58 | configure_file(External_libuuid.cmake.in libuuid-download/CMakeLists.txt @ONLY) 59 | execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} 60 | -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} . 61 | RESULT_VARIABLE result 62 | WORKING_DIRECTORY 63 | ${CMAKE_CURRENT_BINARY_DIR}/libuuid-download) 64 | execute_process(COMMAND ${CMAKE_COMMAND} --build . 65 | RESULT_VARIABLE result 66 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/libuuid-download ) 67 | if(result) 68 | message(FATAL_ERROR "CMake step for libuuid failed: ${result}") 69 | endif() 70 | endif() 71 | 72 | if(UNIX) 73 | configure_file(External_libsodium.cmake.in libsodium-download/CMakeLists.txt @ONLY) 74 | execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} 75 | -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} . 76 | RESULT_VARIABLE result 77 | WORKING_DIRECTORY 78 | ${CMAKE_CURRENT_BINARY_DIR}/libsodium-download) 79 | execute_process(COMMAND ${CMAKE_COMMAND} --build . 80 | RESULT_VARIABLE result 81 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/libsodium-download ) 82 | endif() 83 | 84 | # Fetch and build cmake dependencies 85 | # ================================== 86 | 87 | include(FetchContent) 88 | 89 | 90 | # LibZMQ 91 | # ------ 92 | 93 | message(STATUS "Libzmq") 94 | 95 | set(BUILD_SHARED OFF CACHE BOOL "enable libzmq shared build" FORCE) 96 | set(BUILD_STATIC ON CACHE BOOL "enable libzmq static build" FORCE) 97 | set(WITH_DOC OFF CACHE BOOL "do not generate libzmq documentation" FORCE) 98 | set(BUILD_TESTS OFF CACHE BOOL "do not build libzmq tests" FORCE) 99 | set(ENABLE_CPACK OFF CACHE BOOL "disable cpack rules" FORCE) 100 | 101 | if(WIN32) 102 | set(WITH_LIBSODIUM OFF CACHE BOOL "do not use libsodium in zeromq" FORCE) 103 | endif() 104 | 105 | FetchContent_Declare( 106 | libzmq 107 | GIT_REPOSITORY https://github.com/zeromq/libzmq 108 | GIT_TAG ${ZEROMQ_GIT_TAG} 109 | ) 110 | 111 | FetchContent_GetProperties(libzmq) 112 | 113 | if(NOT libzmq_POPULATED) 114 | FetchContent_Populate(libzmq) 115 | add_subdirectory(${libzmq_SOURCE_DIR} ${libzmq_BINARY_DIR}) 116 | endif() 117 | 118 | # CppZMQ 119 | # ------ 120 | 121 | message(STATUS "Fetching cppzmq") 122 | 123 | set(CPPZMQ_BUILD_TESTS OFF CACHE BOOL "Don't build cppzmq tests" FORCE) 124 | 125 | FetchContent_Declare( 126 | cppzmq 127 | GIT_REPOSITORY https://github.com/zeromq/cppzmq 128 | GIT_TAG ${CPPZMQ_GIT_TAG} 129 | ) 130 | 131 | FetchContent_GetProperties(cppzmq) 132 | 133 | if(NOT cppzmq_POPULATED) 134 | FetchContent_Populate(cppzmq) 135 | add_subdirectory(${cppzmq_SOURCE_DIR} ${cppzmq_BINARY_DIR}) 136 | endif() 137 | 138 | # Nlohmann_JSON 139 | # ------------- 140 | 141 | message(STATUS "Fetching nlohmann_json") 142 | 143 | set(BUILD_TESTING OFF CACHE BOOL "do not build nlohmann_json tests" FORCE) 144 | 145 | FetchContent_Declare( 146 | nlohmann_json 147 | GIT_REPOSITORY https://github.com/nlohmann/json 148 | GIT_TAG ${JSON_GIT_TAG} 149 | ) 150 | 151 | FetchContent_GetProperties(nlohmann_json) 152 | 153 | if(NOT nlohmann_json_POPULATED) 154 | FetchContent_Populate(nlohmann_json) 155 | add_subdirectory(${nlohmann_json_SOURCE_DIR} ${nlohmann_json_BINARY_DIR}) 156 | endif() 157 | 158 | # Xtl 159 | # --- 160 | 161 | message(STATUS "Fetching xtl") 162 | 163 | set(BUILD_TESTS OFF CACHE BOOL "do not build xtl tests" FORCE) 164 | 165 | FetchContent_Declare( 166 | xtl 167 | GIT_REPOSITORY https://github.com/xtensor-stack/xtl 168 | GIT_TAG ${XTL_GIT_TAG} 169 | ) 170 | 171 | FetchContent_GetProperties(xtl) 172 | 173 | if(NOT xtl_POPULATED) 174 | FetchContent_Populate(xtl) 175 | add_subdirectory(${xtl_SOURCE_DIR} ${xtl_BINARY_DIR}) 176 | endif() 177 | 178 | 179 | # Xeus 180 | # ---- 181 | 182 | message(STATUS "Fetching xeus") 183 | 184 | set(XEUS_STATIC_DEPENDENCIES ON CACHE BOOL "links with static libraries" FORCE) 185 | set(XEUS_BUILD_SHARED_LIBS OFF CACHE BOOL "Do not build xeus shared object" FORCE) 186 | set(XEUS_BUILD_STATIC_LIBS ON CACHE BOOL "Build xeus static library" FORCE) 187 | 188 | FetchContent_Declare( 189 | xeus 190 | GIT_REPOSITORY https://github.com/jupyter-xeus/xeus 191 | GIT_TAG ${XEUS_GIT_TAG} 192 | ) 193 | 194 | FetchContent_GetProperties(xeus) 195 | 196 | if(NOT xeus_POPULATED) 197 | FetchContent_Populate(xeus) 198 | add_subdirectory(${xeus_SOURCE_DIR} ${xeus_BINARY_DIR}) 199 | endif() 200 | 201 | 202 | # Xeus Zmq 203 | # -------- 204 | 205 | message(STATUS "Fetching xeus zmq") 206 | 207 | set(XEUS_ZMQ_STATIC_DEPENDENCIES ON CACHE BOOL "links with static libraries" FORCE) 208 | set(XEUS_ZMQ_BUILD_SHARED_LIBS OFF CACHE BOOL "Do not build xeus shared object" FORCE) 209 | set(XEUS_ZMQ_BUILD_STATIC_LIBS ON CACHE BOOL "Build xeus static library" FORCE) 210 | 211 | FetchContent_Declare( 212 | xeus_zmq 213 | GIT_REPOSITORY https://github.com/jupyter-xeus/xeus-zmq 214 | GIT_TAG ${XEUS_ZMQ_GIT_TAG} 215 | ) 216 | 217 | FetchContent_GetProperties(xeus_zmq) 218 | 219 | if(NOT xeus_zmq_POPULATED) 220 | FetchContent_Populate(xeus_zmq) 221 | add_subdirectory(${xeus_zmq_SOURCE_DIR} ${xeus_zmq_BINARY_DIR}) 222 | endif() 223 | 224 | # Pybind11 225 | # -------- 226 | 227 | message(STATUS "Fetching pybind11") 228 | 229 | set(PYBIND11_TEST OFF) 230 | 231 | FetchContent_Declare( 232 | pybind11 233 | GIT_REPOSITORY https://github.com/pybind/pybind11 234 | GIT_TAG ${PYBIND11_GIT_TAG} 235 | ) 236 | 237 | FetchContent_GetProperties(pybind11) 238 | 239 | if(NOT pybind11_POPULATED) 240 | FetchContent_Populate(pybind11) 241 | add_subdirectory(${pybind11_SOURCE_DIR} ${pybind11_BINARY_DIR}) 242 | endif() 243 | 244 | # Pybind11_JSON 245 | # ------------- 246 | 247 | message(STATUS "Fetching pybind11_json") 248 | 249 | FetchContent_Declare( 250 | pybind11_json 251 | GIT_REPOSITORY https://github.com/pybind/pybind11_json 252 | GIT_TAG ${PYBIND11_JSON_GIT_TAG} 253 | ) 254 | 255 | FetchContent_GetProperties(pybind11_json) 256 | 257 | if(NOT pybind11_json_POPULATED) 258 | FetchContent_Populate(pybind11_json) 259 | add_subdirectory(${pybind11_json_SOURCE_DIR} ${pybind11_json_BINARY_DIR}) 260 | endif() 261 | 262 | # Xeus-Python 263 | # ----------- 264 | 265 | message(STATUS "Fetching xeus-python") 266 | 267 | set(XPYTHON_KERNELSPEC_PATH "") 268 | 269 | set(XPYT_DISABLE_ARCH_NATIVE ON CACHE BOOL "remove -march=native flag" FORCE) 270 | set(XPYT_ENABLE_PYPI_WARNING ON CACHE BOOL "Enable PyPI warning for xeus-python" FORCE) 271 | set(XPYT_BUILD_SHARED OFF CACHE BOOL "Do not build xeus-python shared object" FORCE) 272 | set(XPYT_BUILD_STATIC ON CACHE BOOL "Build xeus-python static library" FORCE) 273 | set(XPYT_USE_SHARED_XEUS OFF CACHE BOOL "Link statically with libxeus.a" FORCE) 274 | set(XPYT_USE_SHARED_XEUS_PYTHON OFF CACHE BOOL "Link statically with libxeus-python.a" FORCE) 275 | set(XPYT_BUILD_XPYTHON_EXECUTABLE OFF CACHE BOOL "Do not build xpython executable" FORCE) 276 | set(XPYT_BUILD_XPYTHON_EXTENSION ON CACHE BOOL "Build xpython extension module" FORCE) 277 | 278 | FetchContent_Declare( 279 | xeus-python 280 | GIT_REPOSITORY https://github.com/jupyter-xeus/xeus-python 281 | GIT_TAG ${XEUS_PYTHON_GIT_TAG} 282 | ) 283 | 284 | FetchContent_GetProperties(xeus-python) 285 | if(NOT xeus-python_POPULATED) 286 | FetchContent_Populate(xeus-python) 287 | add_subdirectory(${xeus-python_SOURCE_DIR} ${xeus-python_BINARY_DIR}) 288 | endif() 289 | 290 | # Manually install xpython_extension library in the xpython directory 291 | install(TARGETS xpython_extension 292 | LIBRARY DESTINATION xpython) 293 | 294 | # Kernelspec 295 | # ---------- 296 | 297 | get_filename_component(XPYT_PYTHON_EXECUTABLE_PATH ${PYTHON_EXECUTABLE} REALPATH) 298 | get_filename_component(XPYT_PYTHON_EXECUTABLE_NAME ${XPYT_PYTHON_EXECUTABLE_PATH} NAME) 299 | message(STATUS "Python executable name: " ${XPYT_PYTHON_EXECUTABLE_NAME}) 300 | 301 | configure_file ( 302 | "${CMAKE_CURRENT_SOURCE_DIR}/kernels/xpython/kernel.json.in" 303 | "${CMAKE_CURRENT_SOURCE_DIR}/kernels/xpython/kernel.json" 304 | ) 305 | 306 | configure_file ( 307 | "${CMAKE_CURRENT_SOURCE_DIR}/kernels/xpython-raw/kernel.json.in" 308 | "${CMAKE_CURRENT_SOURCE_DIR}/kernels/xpython-raw/kernel.json" 309 | ) 310 | 311 | # Configuration and data directories for jupyter and xeus-python 312 | set(XJUPYTER_DATA_DIR "share/jupyter" CACHE STRING "Jupyter data directory") 313 | 314 | # Install xpython Jupyter kernelspec 315 | set(XPYT_KERNELSPEC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/kernels) 316 | install(DIRECTORY ${XPYT_KERNELSPEC_DIR} 317 | DESTINATION ${XJUPYTER_DATA_DIR} 318 | PATTERN "*.in" EXCLUDE) 319 | -------------------------------------------------------------------------------- /External_OpenSSL.cmake.in: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.2) 2 | 3 | project(OpenSSL-download NONE) 4 | include(ExternalProject) 5 | 6 | set(EP_SOURCE_DIR ${CMAKE_BINARY_DIR}/openssl-src) 7 | set(EP_BINARY_DIR ${CMAKE_BINARY_DIR}/openssl-src) 8 | set(EP_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}) 9 | 10 | set(openssl_TAG 1.1.1l) 11 | set(openssl_SHA256 0b7a3e5e59c34827fe0c3a74b7ec8baef302b98fa80088d7f9153aa16fa76bd1) 12 | set(openssl_URL "http://www.openssl.org/source/openssl-${openssl_TAG}.tar.gz") 13 | 14 | include(ProcessorCount) 15 | ProcessorCount(CPU_COUNT) 16 | if(CPU_COUNT EQUAL 0) 17 | set(CPU_COUNT 2) 18 | endif() 19 | 20 | if (WIN32) 21 | set(OPENSSL_PATCH_COMMAND git apply --ignore-space-change --ignore-whitespace ${CMAKE_SOURCE_DIR}/bcryptgen.patch) 22 | set(OPENSSL_CONFIG_COMMAND perl configure VC-WIN64A CC=cl RC=rc --prefix=${EP_INSTALL_DIR} --openssldir=${EP_INSTALL_DIR}) 23 | set(OPENSSL_BUILD_COMMAND nmake) 24 | set(OPENSSL_INSTALL_COMMAND nmake install) 25 | # OpenSSL's Makefile fails to install the static builds of libcrypto and libssl on Windows 26 | # These library names are only valid from OpenSSL 1.1 and higher. 27 | set(OPENSSL_POSTINSTALL_CRYPTO_COMMAND ${CMAKE_COMMAND} -E copy libcrypto_static.lib ${EP_INSTALL_DIR}/lib/libcrypto_static.lib) 28 | set(OPENSSL_POSTINSTALL_SSL_COMMAND ${CMAKE_COMMAND} -E copy libssl_static.lib ${EP_INSTALL_DIR}/lib/libssl_static.lib) 29 | else() 30 | set(OPENSSL_PATCH_COMMAND git apply --ignore-space-change --ignore-whitespace ${CMAKE_SOURCE_DIR}/commoncrypto.patch) 31 | set(OPENSSL_CONFIG_COMMAND @OPENSSL_CONFIG@ CFLAGS=-fPIC --prefix=${EP_INSTALL_DIR}) 32 | set(OPENSSL_BUILD_COMMAND make -j ${CPU_COUNT}) 33 | if(APPLE) 34 | set(OPENSSL_INSTALL_COMMAND make install_sw install_ssldirs) 35 | else() 36 | set(OPENSSL_INSTALL_COMMAND make install_sw) 37 | endif() 38 | set(OPENSSL_POSTINSTALL_CRYPTO_COMMAND "") 39 | set(OPENSSL_POSTINSTALL_SSL_COMMAND "") 40 | endif() 41 | 42 | ExternalProject_Add(openssl 43 | URL ${openssl_URL} 44 | URL_HASH SHA256=${openssl_SHA256} 45 | SOURCE_DIR ${EP_SOURCE_DIR} 46 | BINARY_DIR ${EP_BINARY_DIR} 47 | INSTALL_DIR ${EP_INSTALL_DIR} 48 | PATCH_COMMAND ${OPENSSL_PATCH_COMMAND} 49 | CONFIGURE_COMMAND ${OPENSSL_CONFIG_COMMAND} 50 | BUILD_COMMAND ${OPENSSL_BUILD_COMMAND} 51 | INSTALL_COMMAND ${OPENSSL_INSTALL_COMMAND} 52 | COMMAND ${OPENSSL_POSTINSTALL_CRYPTO_COMMAND} 53 | COMMAND ${OPENSSL_POSTINSTALL_SSL_COMMAND} 54 | ) 55 | 56 | -------------------------------------------------------------------------------- /External_libsodium.cmake.in: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.2) 2 | 3 | project(libsodium-download NONE) 4 | include(ExternalProject) 5 | 6 | set(EP_SOURCE_DIR ${CMAKE_BINARY_DIR}/libsodium-src) 7 | set(EP_BINARY_DIR ${CMAKE_BINARY_DIR}/libsodium-src) 8 | set(EP_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}) 9 | 10 | set(libsodium_TAG 1.0.18) 11 | set(libsodium_SHA256 6f504490b342a4f8a4c4a02fc9b866cbef8622d5df4e5452b46be121e46636c1) 12 | set(libsodium_URL "https://download.libsodium.org/libsodium/releases/libsodium-${libsodium_TAG}.tar.gz") 13 | 14 | include(ProcessorCount) 15 | ProcessorCount(CPU_COUNT) 16 | if(CPU_COUNT EQUAL 0) 17 | set(CPU_COUNT 2) 18 | endif() 19 | 20 | if (WIN32) 21 | else () 22 | set(LIBSODIUM_CONFIG_COMMAND CFLAGS=-fPIC @LIBSODIUM_CONFIG@ --prefix=${EP_INSTALL_DIR}) 23 | set(LIBSODIUM_BUILD_COMMAND make -j ${CPU_COUNT}) 24 | set(LIBSODIUM_INSTALL_COMMAND make install) 25 | endif () 26 | 27 | ExternalProject_Add(libsodium 28 | URL ${libsodium_URL} 29 | URL_HASH SHA256=${libsodium_SHA256} 30 | SOURCE_DIR ${EP_SOURCE_DIR} 31 | BINARY_DIR ${EP_BINARY_DIR} 32 | INSTALL_DIR ${EP_INSTALL_DIR} 33 | PATCH_COMMAND ${LIBSODIUM_PATCH_COMMAND} 34 | CONFIGURE_COMMAND ${LIBSODIUM_CONFIG_COMMAND} 35 | BUILD_COMMAND ${LIBSODIUM_BUILD_COMMAND} 36 | INSTALL_COMMAND ${LIBSODIUM_INSTALL_COMMAND} 37 | ) 38 | -------------------------------------------------------------------------------- /External_libuuid.cmake.in: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.2) 2 | 3 | project(libuuid-download NONE) 4 | include(ExternalProject) 5 | 6 | set(EP_SOURCE_DIR ${CMAKE_BINARY_DIR}/libuuid-src) 7 | set(EP_BINARY_DIR ${CMAKE_BINARY_DIR}/libuuid-src) 8 | set(EP_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}) 9 | 10 | set(libuuid_major_minor 2.32) 11 | set(libuuid_version "${libuuid_major_minor}.1") 12 | set(libuuid_URL "https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v${libuuid_major_minor}/util-linux-${libuuid_version}.tar.gz") 13 | set(libuuid_SHA256 3bbf9f3d4a33d6653cf0f7e4fc422091b6a38c3b1195c0ee716c67148a1a7122) 14 | 15 | include(ProcessorCount) 16 | ProcessorCount(CPU_COUNT) 17 | if(CPU_COUNT EQUAL 0) 18 | set(CPU_COUNT 2) 19 | endif() 20 | 21 | ExternalProject_Add(libuuid 22 | URL ${libuuid_URL} 23 | URL_HASH SHA256=${libuuid_SHA256} 24 | SOURCE_DIR ${EP_SOURCE_DIR} 25 | BINARY_DIR ${EP_BINARY_DIR} 26 | INSTALL_DIR ${EP_INSTALL_DIR} 27 | CONFIGURE_COMMAND CFLAGS=-fPIC bash configure --disable-all-programs --enable-libuuid 28 | BUILD_COMMAND make -j ${CPU_COUNT} 29 | # On some platforms: 30 | # - If `DESTDIR` is not specified with the install command, libuuid will be 31 | # installed in a system prefix. 32 | # - If `DESTDIR` is specified and `prefix` is not, the makefile inserts a 33 | # `usr` in the library install path. 34 | # - If `DESTDIR` and `prefix` are both set to the installation prefix, the 35 | # header install path is a concatenation of `DESTDIR` and `prefix`, 36 | # repeating the installation prefix. 37 | # 38 | # The solution appears to set `prefix` to an empty string and `DESTDIR` to 39 | # the installation prefix. 40 | INSTALL_COMMAND make install prefix="" DESTDIR=${EP_INSTALL_DIR} 41 | ) 42 | 43 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016, Johan Mabille, Sylvain Corlay, Martin Renou 2 | Copyright (c) 2016, QuantStack 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | * Neither the name of the copyright holder nor the names of its 16 | contributors may be used to endorse or promote products derived from 17 | this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 23 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 26 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 27 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Xeus-python-wheel 2 | 3 | This project holds the recipe for building PyPI wheels for the [xeus-python](https://github.com/jupyter-xeus/xeus-python) project. 4 | 5 | The continuous integration builds and tests wheels for 6 | 7 | - Linux (`manylinux2014_x86_64`), 8 | - OS X (`Xcode 13.1.0`), 9 | - and Windows (x64). 10 | 11 | ## Building the manylinux wheels 12 | 13 | Building the manylinux wheels requires `docker`. To build manylinux2010 wheels, clone the repository, and run: 14 | 15 | ```bash 16 | docker run --rm -e PLAT=manylinux2014_x86_64 -v `pwd`:/io quay.io/pypa/manylinux2014_x86_64 /io/scripts/build-wheels.sh 17 | ``` 18 | 19 | from the root of the source directory. 20 | 21 | Built manylinux wheels for Python 3.7, 3.8, and 3.9 are placed into the `wheelhouse` directory. 22 | 23 | ## Building the Windows wheels 24 | 25 | The following packages must be installed in the environment to build the xeus-python wheel on windows: 26 | 27 | - `perl` (required to build `OpenSSL` on Windows) 28 | - `nasm` (required to build `OpenSSL` on Windows) 29 | 30 | To build the wheel in your local environment, clone the repository and run 31 | 32 | ``` 33 | pip wheel . --verbose 34 | ``` 35 | 36 | from the root of the source directory. 37 | 38 | -------------------------------------------------------------------------------- /bcryptgen.patch.in: -------------------------------------------------------------------------------- 1 | Index: work/crypto/rand/rand_win.c 2 | =================================================================== 3 | --- work.orig/crypto/rand/rand_win.c 4 | +++ work/crypto/rand/rand_win.c 5 | @@ -19,7 +19,7 @@ 6 | 7 | # include 8 | /* On Windows Vista or higher use BCrypt instead of the legacy CryptoAPI */ 9 | -# if defined(_MSC_VER) && _MSC_VER > 1500 /* 1500 = Visual Studio 2008 */ \ 10 | +# if defined(_MSC_VER) && _MSC_VER >= 19000 /* 19000 = Visual Studio 2015 */ \ 11 | && defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0600 12 | # define USE_BCRYPTGENRANDOM 13 | # endif 14 | -------------------------------------------------------------------------------- /cmake/FindOpenSSL.cmake: -------------------------------------------------------------------------------- 1 | # Distributed under the OSI-approved BSD 3-Clause License. See accompanying 2 | # file Copyright.txt or https://cmake.org/licensing for details. 3 | 4 | #[=======================================================================[.rst: 5 | FindOpenSSL 6 | ----------- 7 | 8 | Find the OpenSSL encryption library. 9 | 10 | Optional COMPONENTS 11 | ^^^^^^^^^^^^^^^^^^^ 12 | 13 | This module supports two optional COMPONENTS: ``Crypto`` and ``SSL``. Both 14 | components have associated imported targets, as described below. 15 | 16 | Imported Targets 17 | ^^^^^^^^^^^^^^^^ 18 | 19 | This module defines the following :prop_tgt:`IMPORTED` targets: 20 | 21 | ``OpenSSL::SSL`` 22 | The OpenSSL ``ssl`` library, if found. 23 | ``OpenSSL::Crypto`` 24 | The OpenSSL ``crypto`` library, if found. 25 | ``OpenSSL::applink`` 26 | The OpenSSL ``applink`` components that might be need to be compiled into 27 | projects under MSVC. This target is available only if found OpenSSL version 28 | is not less than 0.9.8. By linking this target the above OpenSSL targets can 29 | be linked even if the project has different MSVC runtime configurations with 30 | the above OpenSSL targets. This target has no effect on plaforms other than 31 | MSVC. 32 | 33 | NOTE: Due to how ``INTERFACE_SOURCES`` are consumed by the consuming target, 34 | unless you certainly know what you are doing, it is always prefered to link 35 | ``OpenSSL::applink`` target as ``PRIVATE`` and to make sure that this target is 36 | linked at most once for the whole dependency graph of any library or 37 | executable: 38 | 39 | .. code-block:: cmake 40 | 41 | target_link_libraries(myTarget PRIVATE OpenSSL::applink) 42 | 43 | Otherwise you would probably encounter unexpected random problems when building 44 | and linking, as both the ISO C and the ISO C++ standard claims almost nothing 45 | about what a link process should be. 46 | 47 | Result Variables 48 | ^^^^^^^^^^^^^^^^ 49 | 50 | This module will set the following variables in your project: 51 | 52 | ``OPENSSL_FOUND`` 53 | System has the OpenSSL library. If no components are requested it only 54 | requires the crypto library. 55 | ``OPENSSL_INCLUDE_DIR`` 56 | The OpenSSL include directory. 57 | ``OPENSSL_CRYPTO_LIBRARY`` 58 | The OpenSSL crypto library. 59 | ``OPENSSL_CRYPTO_LIBRARIES`` 60 | The OpenSSL crypto library and its dependencies. 61 | ``OPENSSL_SSL_LIBRARY`` 62 | The OpenSSL SSL library. 63 | ``OPENSSL_SSL_LIBRARIES`` 64 | The OpenSSL SSL library and its dependencies. 65 | ``OPENSSL_LIBRARIES`` 66 | All OpenSSL libraries and their dependencies. 67 | ``OPENSSL_VERSION`` 68 | This is set to ``$major.$minor.$revision$patch`` (e.g. ``0.9.8s``). 69 | ``OPENSSL_APPLINK_SOURCE`` 70 | The sources in the target ``OpenSSL::applink`` that is mentioned above. This 71 | variable shall always be undefined if found openssl version is less than 72 | 0.9.8 or if platform is not MSVC. 73 | 74 | Hints 75 | ^^^^^ 76 | 77 | Set ``OPENSSL_ROOT_DIR`` to the root directory of an OpenSSL installation. 78 | Set ``OPENSSL_USE_STATIC_LIBS`` to ``TRUE`` to look for static libraries. 79 | Set ``OPENSSL_MSVC_STATIC_RT`` set ``TRUE`` to choose the MT version of the lib. 80 | #]=======================================================================] 81 | 82 | macro(_OpenSSL_test_and_find_dependencies ssl_library crypto_library) 83 | if((CMAKE_SYSTEM_NAME STREQUAL "Linux") AND 84 | (("${ssl_library}" MATCHES "\\${CMAKE_STATIC_LIBRARY_SUFFIX}$") OR 85 | ("${crypto_library}" MATCHES "\\${CMAKE_STATIC_LIBRARY_SUFFIX}$"))) 86 | set(_OpenSSL_has_dependencies TRUE) 87 | find_package(Threads) 88 | else() 89 | set(_OpenSSL_has_dependencies FALSE) 90 | endif() 91 | endmacro() 92 | 93 | function(_OpenSSL_add_dependencies libraries_var) 94 | if(CMAKE_THREAD_LIBS_INIT) 95 | list(APPEND ${libraries_var} ${CMAKE_THREAD_LIBS_INIT}) 96 | endif() 97 | list(APPEND ${libraries_var} ${CMAKE_DL_LIBS}) 98 | set(${libraries_var} ${${libraries_var}} PARENT_SCOPE) 99 | endfunction() 100 | 101 | function(_OpenSSL_target_add_dependencies target) 102 | if(_OpenSSL_has_dependencies) 103 | set_property( TARGET ${target} APPEND PROPERTY INTERFACE_LINK_LIBRARIES Threads::Threads ) 104 | set_property( TARGET ${target} APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${CMAKE_DL_LIBS} ) 105 | endif() 106 | endfunction() 107 | 108 | if (UNIX) 109 | find_package(PkgConfig QUIET) 110 | pkg_check_modules(_OPENSSL QUIET openssl) 111 | endif () 112 | 113 | # Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES 114 | if(OPENSSL_USE_STATIC_LIBS) 115 | set(_openssl_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) 116 | if(WIN32) 117 | set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) 118 | else() 119 | set(CMAKE_FIND_LIBRARY_SUFFIXES .a ) 120 | endif() 121 | endif() 122 | 123 | if (WIN32) 124 | # http://www.slproweb.com/products/Win32OpenSSL.html 125 | set(_OPENSSL_ROOT_HINTS 126 | ${OPENSSL_ROOT_DIR} 127 | "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]" 128 | "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (64-bit)_is1;Inno Setup: App Path]" 129 | ENV OPENSSL_ROOT_DIR 130 | ) 131 | file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _programfiles) 132 | set(_OPENSSL_ROOT_PATHS 133 | "${_programfiles}/OpenSSL" 134 | "${_programfiles}/OpenSSL-Win32" 135 | "${_programfiles}/OpenSSL-Win64" 136 | "C:/OpenSSL/" 137 | "C:/OpenSSL-Win32/" 138 | "C:/OpenSSL-Win64/" 139 | ) 140 | unset(_programfiles) 141 | else () 142 | set(_OPENSSL_ROOT_HINTS 143 | ${OPENSSL_ROOT_DIR} 144 | ENV OPENSSL_ROOT_DIR 145 | ) 146 | endif () 147 | 148 | set(_OPENSSL_ROOT_HINTS_AND_PATHS 149 | HINTS ${_OPENSSL_ROOT_HINTS} 150 | PATHS ${_OPENSSL_ROOT_PATHS} 151 | ) 152 | 153 | find_path(OPENSSL_INCLUDE_DIR 154 | NAMES 155 | openssl/ssl.h 156 | ${_OPENSSL_ROOT_HINTS_AND_PATHS} 157 | HINTS 158 | ${_OPENSSL_INCLUDEDIR} 159 | ${_OPENSSL_INCLUDE_DIRS} 160 | PATH_SUFFIXES 161 | include 162 | ) 163 | 164 | if(WIN32 AND NOT CYGWIN) 165 | if(MSVC) 166 | # /MD and /MDd are the standard values - if someone wants to use 167 | # others, the libnames have to change here too 168 | # use also ssl and ssleay32 in debug as fallback for openssl < 0.9.8b 169 | # enable OPENSSL_MSVC_STATIC_RT to get the libs build /MT (Multithreaded no-DLL) 170 | # In Visual C++ naming convention each of these four kinds of Windows libraries has it's standard suffix: 171 | # * MD for dynamic-release 172 | # * MDd for dynamic-debug 173 | # * MT for static-release 174 | # * MTd for static-debug 175 | 176 | # Implementation details: 177 | # We are using the libraries located in the VC subdir instead of the parent directory even though : 178 | # libeay32MD.lib is identical to ../libeay32.lib, and 179 | # ssleay32MD.lib is identical to ../ssleay32.lib 180 | # enable OPENSSL_USE_STATIC_LIBS to use the static libs located in lib/VC/static 181 | 182 | if (OPENSSL_MSVC_STATIC_RT) 183 | set(_OPENSSL_MSVC_RT_MODE "MT") 184 | else () 185 | set(_OPENSSL_MSVC_RT_MODE "MD") 186 | endif () 187 | 188 | # Since OpenSSL 1.1, lib names are like libcrypto32MTd.lib and libssl32MTd.lib 189 | if( "${CMAKE_SIZEOF_VOID_P}" STREQUAL "8" ) 190 | set(_OPENSSL_MSVC_ARCH_SUFFIX "64") 191 | else() 192 | set(_OPENSSL_MSVC_ARCH_SUFFIX "32") 193 | endif() 194 | 195 | if(OPENSSL_USE_STATIC_LIBS) 196 | set(_OPENSSL_STATIC_SUFFIX 197 | "_static" 198 | ) 199 | set(_OPENSSL_PATH_SUFFIXES 200 | "lib/VC/static" 201 | "VC/static" 202 | "lib" 203 | ) 204 | else() 205 | set(_OPENSSL_STATIC_SUFFIX 206 | "" 207 | ) 208 | set(_OPENSSL_PATH_SUFFIXES 209 | "lib/VC" 210 | "VC" 211 | "lib" 212 | ) 213 | endif () 214 | 215 | find_library(LIB_EAY_DEBUG 216 | NAMES 217 | # When OpenSSL is built with default options, the static library name is suffixed with "_static". 218 | # Looking the "libcrypto_static.lib" with a higher priority than "libcrypto.lib" which is the 219 | # import library of "libcrypto.dll". 220 | libcrypto${_OPENSSL_STATIC_SUFFIX}${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE}d 221 | libcrypto${_OPENSSL_STATIC_SUFFIX}${_OPENSSL_MSVC_RT_MODE}d 222 | libcrypto${_OPENSSL_STATIC_SUFFIX}d 223 | libeay32${_OPENSSL_STATIC_SUFFIX}${_OPENSSL_MSVC_RT_MODE}d 224 | libeay32${_OPENSSL_STATIC_SUFFIX}d 225 | crypto${_OPENSSL_STATIC_SUFFIX}d 226 | # When OpenSSL is built with the "-static" option, only the static build is produced, 227 | # and it is not suffixed with "_static". 228 | libcrypto${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE}d 229 | libcrypto${_OPENSSL_MSVC_RT_MODE}d 230 | libcryptod 231 | libeay32${_OPENSSL_MSVC_RT_MODE}d 232 | libeay32d 233 | cryptod 234 | NAMES_PER_DIR 235 | ${_OPENSSL_ROOT_HINTS_AND_PATHS} 236 | PATH_SUFFIXES 237 | ${_OPENSSL_PATH_SUFFIXES} 238 | ) 239 | 240 | find_library(LIB_EAY_RELEASE 241 | NAMES 242 | # When OpenSSL is built with default options, the static library name is suffixed with "_static". 243 | # Looking the "libcrypto_static.lib" with a higher priority than "libcrypto.lib" which is the 244 | # import library of "libcrypto.dll". 245 | libcrypto${_OPENSSL_STATIC_SUFFIX}${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE} 246 | libcrypto${_OPENSSL_STATIC_SUFFIX}${_OPENSSL_MSVC_RT_MODE} 247 | libcrypto${_OPENSSL_STATIC_SUFFIX} 248 | libeay32${_OPENSSL_STATIC_SUFFIX}${_OPENSSL_MSVC_RT_MODE} 249 | libeay32${_OPENSSL_STATIC_SUFFIX} 250 | crypto${_OPENSSL_STATIC_SUFFIX} 251 | # When OpenSSL is built with the "-static" option, only the static build is produced, 252 | # and it is not suffixed with "_static". 253 | libcrypto${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE} 254 | libcrypto${_OPENSSL_MSVC_RT_MODE} 255 | libcrypto 256 | libeay32${_OPENSSL_MSVC_RT_MODE} 257 | libeay32 258 | crypto 259 | NAMES_PER_DIR 260 | ${_OPENSSL_ROOT_HINTS_AND_PATHS} 261 | PATH_SUFFIXES 262 | ${_OPENSSL_PATH_SUFFIXES} 263 | ) 264 | 265 | find_library(SSL_EAY_DEBUG 266 | NAMES 267 | # When OpenSSL is built with default options, the static library name is suffixed with "_static". 268 | # Looking the "libssl_static.lib" with a higher priority than "libssl.lib" which is the 269 | # import library of "libssl.dll". 270 | libssl${_OPENSSL_STATIC_SUFFIX}${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE}d 271 | libssl${_OPENSSL_STATIC_SUFFIX}${_OPENSSL_MSVC_RT_MODE}d 272 | libssl${_OPENSSL_STATIC_SUFFIX}d 273 | ssleay32${_OPENSSL_STATIC_SUFFIX}${_OPENSSL_MSVC_RT_MODE}d 274 | ssleay32${_OPENSSL_STATIC_SUFFIX}d 275 | ssl${_OPENSSL_STATIC_SUFFIX}d 276 | # When OpenSSL is built with the "-static" option, only the static build is produced, 277 | # and it is not suffixed with "_static". 278 | libssl${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE}d 279 | libssl${_OPENSSL_MSVC_RT_MODE}d 280 | libssld 281 | ssleay32${_OPENSSL_MSVC_RT_MODE}d 282 | ssleay32d 283 | ssld 284 | NAMES_PER_DIR 285 | ${_OPENSSL_ROOT_HINTS_AND_PATHS} 286 | PATH_SUFFIXES 287 | ${_OPENSSL_PATH_SUFFIXES} 288 | ) 289 | 290 | find_library(SSL_EAY_RELEASE 291 | NAMES 292 | # When OpenSSL is built with default options, the static library name is suffixed with "_static". 293 | # Looking the "libssl_static.lib" with a higher priority than "libssl.lib" which is the 294 | # import library of "libssl.dll". 295 | libssl${_OPENSSL_STATIC_SUFFIX}${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE} 296 | libssl${_OPENSSL_STATIC_SUFFIX}${_OPENSSL_MSVC_RT_MODE} 297 | libssl${_OPENSSL_STATIC_SUFFIX} 298 | ssleay32${_OPENSSL_STATIC_SUFFIX}${_OPENSSL_MSVC_RT_MODE} 299 | ssleay32${_OPENSSL_STATIC_SUFFIX} 300 | ssl${_OPENSSL_STATIC_SUFFIX} 301 | # When OpenSSL is built with the "-static" option, only the static build is produced, 302 | # and it is not suffixed with "_static". 303 | libssl${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE} 304 | libssl${_OPENSSL_MSVC_RT_MODE} 305 | libssl 306 | ssleay32${_OPENSSL_MSVC_RT_MODE} 307 | ssleay32 308 | ssl 309 | NAMES_PER_DIR 310 | ${_OPENSSL_ROOT_HINTS_AND_PATHS} 311 | PATH_SUFFIXES 312 | ${_OPENSSL_PATH_SUFFIXES} 313 | ) 314 | 315 | set(LIB_EAY_LIBRARY_DEBUG "${LIB_EAY_DEBUG}") 316 | set(LIB_EAY_LIBRARY_RELEASE "${LIB_EAY_RELEASE}") 317 | set(SSL_EAY_LIBRARY_DEBUG "${SSL_EAY_DEBUG}") 318 | set(SSL_EAY_LIBRARY_RELEASE "${SSL_EAY_RELEASE}") 319 | 320 | include(${CMAKE_ROOT}/Modules/SelectLibraryConfigurations.cmake) 321 | select_library_configurations(LIB_EAY) 322 | select_library_configurations(SSL_EAY) 323 | 324 | mark_as_advanced(LIB_EAY_LIBRARY_DEBUG LIB_EAY_LIBRARY_RELEASE 325 | SSL_EAY_LIBRARY_DEBUG SSL_EAY_LIBRARY_RELEASE) 326 | set(OPENSSL_SSL_LIBRARY ${SSL_EAY_LIBRARY} ) 327 | set(OPENSSL_CRYPTO_LIBRARY ${LIB_EAY_LIBRARY} ) 328 | elseif(MINGW) 329 | # same player, for MinGW 330 | set(LIB_EAY_NAMES crypto libeay32) 331 | set(SSL_EAY_NAMES ssl ssleay32) 332 | find_library(LIB_EAY 333 | NAMES 334 | ${LIB_EAY_NAMES} 335 | NAMES_PER_DIR 336 | ${_OPENSSL_ROOT_HINTS_AND_PATHS} 337 | PATH_SUFFIXES 338 | "lib/MinGW" 339 | "lib" 340 | ) 341 | 342 | find_library(SSL_EAY 343 | NAMES 344 | ${SSL_EAY_NAMES} 345 | NAMES_PER_DIR 346 | ${_OPENSSL_ROOT_HINTS_AND_PATHS} 347 | PATH_SUFFIXES 348 | "lib/MinGW" 349 | "lib" 350 | ) 351 | 352 | mark_as_advanced(SSL_EAY LIB_EAY) 353 | set(OPENSSL_SSL_LIBRARY ${SSL_EAY} ) 354 | set(OPENSSL_CRYPTO_LIBRARY ${LIB_EAY} ) 355 | unset(LIB_EAY_NAMES) 356 | unset(SSL_EAY_NAMES) 357 | else() 358 | # Not sure what to pick for -say- intel, let's use the toplevel ones and hope someone report issues: 359 | find_library(LIB_EAY 360 | NAMES 361 | libcrypto 362 | libeay32 363 | NAMES_PER_DIR 364 | ${_OPENSSL_ROOT_HINTS_AND_PATHS} 365 | HINTS 366 | ${_OPENSSL_LIBDIR} 367 | PATH_SUFFIXES 368 | lib 369 | ) 370 | 371 | find_library(SSL_EAY 372 | NAMES 373 | libssl 374 | ssleay32 375 | NAMES_PER_DIR 376 | ${_OPENSSL_ROOT_HINTS_AND_PATHS} 377 | HINTS 378 | ${_OPENSSL_LIBDIR} 379 | PATH_SUFFIXES 380 | lib 381 | ) 382 | 383 | mark_as_advanced(SSL_EAY LIB_EAY) 384 | set(OPENSSL_SSL_LIBRARY ${SSL_EAY} ) 385 | set(OPENSSL_CRYPTO_LIBRARY ${LIB_EAY} ) 386 | endif() 387 | else() 388 | 389 | find_library(OPENSSL_SSL_LIBRARY 390 | NAMES 391 | ssl 392 | ssleay32 393 | ssleay32MD 394 | NAMES_PER_DIR 395 | ${_OPENSSL_ROOT_HINTS_AND_PATHS} 396 | HINTS 397 | ${_OPENSSL_LIBDIR} 398 | ${_OPENSSL_LIBRARY_DIRS} 399 | PATH_SUFFIXES 400 | lib 401 | ) 402 | 403 | find_library(OPENSSL_CRYPTO_LIBRARY 404 | NAMES 405 | crypto 406 | NAMES_PER_DIR 407 | ${_OPENSSL_ROOT_HINTS_AND_PATHS} 408 | HINTS 409 | ${_OPENSSL_LIBDIR} 410 | ${_OPENSSL_LIBRARY_DIRS} 411 | PATH_SUFFIXES 412 | lib 413 | ) 414 | 415 | mark_as_advanced(OPENSSL_CRYPTO_LIBRARY OPENSSL_SSL_LIBRARY) 416 | 417 | endif() 418 | 419 | set(OPENSSL_SSL_LIBRARIES ${OPENSSL_SSL_LIBRARY}) 420 | set(OPENSSL_CRYPTO_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY}) 421 | set(OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARIES} ${OPENSSL_CRYPTO_LIBRARIES} ) 422 | _OpenSSL_test_and_find_dependencies("${OPENSSL_SSL_LIBRARY}" "${OPENSSL_CRYPTO_LIBRARY}") 423 | if(_OpenSSL_has_dependencies) 424 | _OpenSSL_add_dependencies( OPENSSL_SSL_LIBRARIES ) 425 | _OpenSSL_add_dependencies( OPENSSL_CRYPTO_LIBRARIES ) 426 | _OpenSSL_add_dependencies( OPENSSL_LIBRARIES ) 427 | endif() 428 | 429 | function(from_hex HEX DEC) 430 | string(TOUPPER "${HEX}" HEX) 431 | set(_res 0) 432 | string(LENGTH "${HEX}" _strlen) 433 | 434 | while (_strlen GREATER 0) 435 | math(EXPR _res "${_res} * 16") 436 | string(SUBSTRING "${HEX}" 0 1 NIBBLE) 437 | string(SUBSTRING "${HEX}" 1 -1 HEX) 438 | if (NIBBLE STREQUAL "A") 439 | math(EXPR _res "${_res} + 10") 440 | elseif (NIBBLE STREQUAL "B") 441 | math(EXPR _res "${_res} + 11") 442 | elseif (NIBBLE STREQUAL "C") 443 | math(EXPR _res "${_res} + 12") 444 | elseif (NIBBLE STREQUAL "D") 445 | math(EXPR _res "${_res} + 13") 446 | elseif (NIBBLE STREQUAL "E") 447 | math(EXPR _res "${_res} + 14") 448 | elseif (NIBBLE STREQUAL "F") 449 | math(EXPR _res "${_res} + 15") 450 | else() 451 | math(EXPR _res "${_res} + ${NIBBLE}") 452 | endif() 453 | 454 | string(LENGTH "${HEX}" _strlen) 455 | endwhile() 456 | 457 | set(${DEC} ${_res} PARENT_SCOPE) 458 | endfunction() 459 | 460 | if(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h") 461 | file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" openssl_version_str 462 | REGEX "^#[\t ]*define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*") 463 | 464 | if(openssl_version_str) 465 | # The version number is encoded as 0xMNNFFPPS: major minor fix patch status 466 | # The status gives if this is a developer or prerelease and is ignored here. 467 | # Major, minor, and fix directly translate into the version numbers shown in 468 | # the string. The patch field translates to the single character suffix that 469 | # indicates the bug fix state, which 00 -> nothing, 01 -> a, 02 -> b and so 470 | # on. 471 | 472 | string(REGEX REPLACE "^.*OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F]).*$" 473 | "\\1;\\2;\\3;\\4;\\5" OPENSSL_VERSION_LIST "${openssl_version_str}") 474 | list(GET OPENSSL_VERSION_LIST 0 OPENSSL_VERSION_MAJOR) 475 | list(GET OPENSSL_VERSION_LIST 1 OPENSSL_VERSION_MINOR) 476 | from_hex("${OPENSSL_VERSION_MINOR}" OPENSSL_VERSION_MINOR) 477 | list(GET OPENSSL_VERSION_LIST 2 OPENSSL_VERSION_FIX) 478 | from_hex("${OPENSSL_VERSION_FIX}" OPENSSL_VERSION_FIX) 479 | list(GET OPENSSL_VERSION_LIST 3 OPENSSL_VERSION_PATCH) 480 | 481 | if (NOT OPENSSL_VERSION_PATCH STREQUAL "00") 482 | from_hex("${OPENSSL_VERSION_PATCH}" _tmp) 483 | # 96 is the ASCII code of 'a' minus 1 484 | math(EXPR OPENSSL_VERSION_PATCH_ASCII "${_tmp} + 96") 485 | unset(_tmp) 486 | # Once anyone knows how OpenSSL would call the patch versions beyond 'z' 487 | # this should be updated to handle that, too. This has not happened yet 488 | # so it is simply ignored here for now. 489 | string(ASCII "${OPENSSL_VERSION_PATCH_ASCII}" OPENSSL_VERSION_PATCH_STRING) 490 | endif () 491 | 492 | set(OPENSSL_VERSION "${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_MINOR}.${OPENSSL_VERSION_FIX}${OPENSSL_VERSION_PATCH_STRING}") 493 | else () 494 | # Since OpenSSL 3.0.0, the new version format is MAJOR.MINOR.PATCH and 495 | # a new OPENSSL_VERSION_STR macro contains exactly that 496 | file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" OPENSSL_VERSION_STR 497 | REGEX "^#[\t ]*define[\t ]+OPENSSL_VERSION_STR[\t ]+\"([0-9])+\\.([0-9])+\\.([0-9])+\".*") 498 | string(REGEX REPLACE "^.*OPENSSL_VERSION_STR[\t ]+\"([0-9]+\\.[0-9]+\\.[0-9]+)\".*$" 499 | "\\1" OPENSSL_VERSION_STR "${OPENSSL_VERSION_STR}") 500 | 501 | set(OPENSSL_VERSION "${OPENSSL_VERSION_STR}") 502 | 503 | unset(OPENSSL_VERSION_STR) 504 | endif () 505 | endif () 506 | 507 | foreach(_comp IN LISTS OpenSSL_FIND_COMPONENTS) 508 | if(_comp STREQUAL "Crypto") 509 | if(EXISTS "${OPENSSL_INCLUDE_DIR}" AND 510 | (EXISTS "${OPENSSL_CRYPTO_LIBRARY}" OR 511 | EXISTS "${LIB_EAY_LIBRARY_DEBUG}" OR 512 | EXISTS "${LIB_EAY_LIBRARY_RELEASE}") 513 | ) 514 | set(OpenSSL_${_comp}_FOUND TRUE) 515 | else() 516 | set(OpenSSL_${_comp}_FOUND FALSE) 517 | endif() 518 | elseif(_comp STREQUAL "SSL") 519 | if(EXISTS "${OPENSSL_INCLUDE_DIR}" AND 520 | (EXISTS "${OPENSSL_SSL_LIBRARY}" OR 521 | EXISTS "${SSL_EAY_LIBRARY_DEBUG}" OR 522 | EXISTS "${SSL_EAY_LIBRARY_RELEASE}") 523 | ) 524 | set(OpenSSL_${_comp}_FOUND TRUE) 525 | else() 526 | set(OpenSSL_${_comp}_FOUND FALSE) 527 | endif() 528 | else() 529 | message(WARNING "${_comp} is not a valid OpenSSL component") 530 | set(OpenSSL_${_comp}_FOUND FALSE) 531 | endif() 532 | endforeach() 533 | unset(_comp) 534 | 535 | include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) 536 | find_package_handle_standard_args(OpenSSL 537 | REQUIRED_VARS 538 | OPENSSL_CRYPTO_LIBRARY 539 | OPENSSL_INCLUDE_DIR 540 | VERSION_VAR 541 | OPENSSL_VERSION 542 | HANDLE_COMPONENTS 543 | FAIL_MESSAGE 544 | "Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR" 545 | ) 546 | 547 | mark_as_advanced(OPENSSL_INCLUDE_DIR) 548 | 549 | if(OPENSSL_FOUND) 550 | if(NOT TARGET OpenSSL::Crypto AND 551 | (EXISTS "${OPENSSL_CRYPTO_LIBRARY}" OR 552 | EXISTS "${LIB_EAY_LIBRARY_DEBUG}" OR 553 | EXISTS "${LIB_EAY_LIBRARY_RELEASE}") 554 | ) 555 | add_library(OpenSSL::Crypto UNKNOWN IMPORTED) 556 | set_target_properties(OpenSSL::Crypto PROPERTIES 557 | INTERFACE_INCLUDE_DIRECTORIES "${OPENSSL_INCLUDE_DIR}") 558 | if(EXISTS "${OPENSSL_CRYPTO_LIBRARY}") 559 | set_target_properties(OpenSSL::Crypto PROPERTIES 560 | IMPORTED_LINK_INTERFACE_LANGUAGES "C" 561 | IMPORTED_LOCATION "${OPENSSL_CRYPTO_LIBRARY}") 562 | endif() 563 | if(EXISTS "${LIB_EAY_LIBRARY_RELEASE}") 564 | set_property(TARGET OpenSSL::Crypto APPEND PROPERTY 565 | IMPORTED_CONFIGURATIONS RELEASE) 566 | set_target_properties(OpenSSL::Crypto PROPERTIES 567 | IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C" 568 | IMPORTED_LOCATION_RELEASE "${LIB_EAY_LIBRARY_RELEASE}") 569 | endif() 570 | if(EXISTS "${LIB_EAY_LIBRARY_DEBUG}") 571 | set_property(TARGET OpenSSL::Crypto APPEND PROPERTY 572 | IMPORTED_CONFIGURATIONS DEBUG) 573 | set_target_properties(OpenSSL::Crypto PROPERTIES 574 | IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C" 575 | IMPORTED_LOCATION_DEBUG "${LIB_EAY_LIBRARY_DEBUG}") 576 | endif() 577 | _OpenSSL_target_add_dependencies(OpenSSL::Crypto) 578 | endif() 579 | 580 | if(NOT TARGET OpenSSL::SSL AND 581 | (EXISTS "${OPENSSL_SSL_LIBRARY}" OR 582 | EXISTS "${SSL_EAY_LIBRARY_DEBUG}" OR 583 | EXISTS "${SSL_EAY_LIBRARY_RELEASE}") 584 | ) 585 | add_library(OpenSSL::SSL UNKNOWN IMPORTED) 586 | set_target_properties(OpenSSL::SSL PROPERTIES 587 | INTERFACE_INCLUDE_DIRECTORIES "${OPENSSL_INCLUDE_DIR}") 588 | if(EXISTS "${OPENSSL_SSL_LIBRARY}") 589 | set_target_properties(OpenSSL::SSL PROPERTIES 590 | IMPORTED_LINK_INTERFACE_LANGUAGES "C" 591 | IMPORTED_LOCATION "${OPENSSL_SSL_LIBRARY}") 592 | endif() 593 | if(EXISTS "${SSL_EAY_LIBRARY_RELEASE}") 594 | set_property(TARGET OpenSSL::SSL APPEND PROPERTY 595 | IMPORTED_CONFIGURATIONS RELEASE) 596 | set_target_properties(OpenSSL::SSL PROPERTIES 597 | IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C" 598 | IMPORTED_LOCATION_RELEASE "${SSL_EAY_LIBRARY_RELEASE}") 599 | endif() 600 | if(EXISTS "${SSL_EAY_LIBRARY_DEBUG}") 601 | set_property(TARGET OpenSSL::SSL APPEND PROPERTY 602 | IMPORTED_CONFIGURATIONS DEBUG) 603 | set_target_properties(OpenSSL::SSL PROPERTIES 604 | IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C" 605 | IMPORTED_LOCATION_DEBUG "${SSL_EAY_LIBRARY_DEBUG}") 606 | endif() 607 | if(TARGET OpenSSL::Crypto) 608 | set_target_properties(OpenSSL::SSL PROPERTIES 609 | INTERFACE_LINK_LIBRARIES OpenSSL::Crypto) 610 | endif() 611 | _OpenSSL_target_add_dependencies(OpenSSL::SSL) 612 | endif() 613 | 614 | if("${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_FIX}" VERSION_GREATER_EQUAL "0.9.8") 615 | if(MSVC) 616 | if(EXISTS "${OPENSSL_INCLUDE_DIR}") 617 | set(_OPENSSL_applink_paths PATHS ${OPENSSL_INCLUDE_DIR}) 618 | endif() 619 | find_file(OPENSSL_APPLINK_SOURCE 620 | NAMES 621 | openssl/applink.c 622 | ${_OPENSSL_applink_paths} 623 | NO_DEFAULT_PATH) 624 | if(OPENSSL_APPLINK_SOURCE) 625 | set(_OPENSSL_applink_interface_srcs ${OPENSSL_APPLINK_SOURCE}) 626 | endif() 627 | endif() 628 | if(NOT TARGET OpenSSL::applink) 629 | add_library(OpenSSL::applink INTERFACE IMPORTED) 630 | set_property(TARGET OpenSSL::applink APPEND 631 | PROPERTY INTERFACE_SOURCES 632 | ${_OPENSSL_applink_interface_srcs}) 633 | endif() 634 | endif() 635 | endif() 636 | 637 | # Restore the original find library ordering 638 | if(OPENSSL_USE_STATIC_LIBS) 639 | set(CMAKE_FIND_LIBRARY_SUFFIXES ${_openssl_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) 640 | endif() 641 | -------------------------------------------------------------------------------- /cmake/wheelConfig.cmake.in: -------------------------------------------------------------------------------- 1 | @PACKAGE_INIT@ 2 | 3 | include(CMakeFindDependencyMacro) 4 | 5 | get_filename_component(WHEEL_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) 6 | if(NOT TARGET wheel) 7 | include ("${WHEEL_CMAKE_DIR}/wheelTargets.cmake") 8 | endif() 9 | -------------------------------------------------------------------------------- /commoncrypto.patch.in: -------------------------------------------------------------------------------- 1 | From 96ac8f13f4d0ee96baf5724d9f96c44c34b8606c Mon Sep 17 00:00:00 2001 2 | From: David Carlier 3 | Date: Tue, 24 Aug 2021 22:40:14 +0100 4 | Subject: [PATCH] Darwin platform allows to build on releases before 5 | Yosemite/ios 8. 6 | 7 | issue #16407 #16408 8 | 9 | Reviewed-by: Paul Dale 10 | Reviewed-by: Tomas Mraz 11 | (Merged from https://github.com/openssl/openssl/pull/16409) 12 | --- 13 | crypto/rand/rand_unix.c | 5 +---- 14 | include/crypto/rand.h | 10 ++++++++++ 15 | 2 files changed, 11 insertions(+), 4 deletions(-) 16 | 17 | diff --git a/crypto/rand/rand_unix.c b/crypto/rand/rand_unix.c 18 | index 43f1069d151d..0f4525106af7 100644 19 | --- a/crypto/rand/rand_unix.c 20 | +++ b/crypto/rand/rand_unix.c 21 | @@ -34,9 +34,6 @@ 22 | #if defined(__OpenBSD__) 23 | # include 24 | #endif 25 | -#if defined(__APPLE__) 26 | -# include 27 | -#endif 28 | 29 | #if defined(OPENSSL_SYS_UNIX) || defined(__DJGPP__) 30 | # include 31 | @@ -381,7 +378,7 @@ static ssize_t syscall_random(void *buf, size_t buflen) 32 | if (errno != ENOSYS) 33 | return -1; 34 | } 35 | -# elif defined(__APPLE__) 36 | +# elif defined(OPENSSL_APPLE_CRYPTO_RANDOM) 37 | if (CCRandomGenerateBytes(buf, buflen) == kCCSuccess) 38 | return (ssize_t)buflen; 39 | 40 | diff --git a/include/crypto/rand.h b/include/crypto/rand.h 41 | index 5350d3a93119..674f840fd13c 100644 42 | --- a/include/crypto/rand.h 43 | +++ b/include/crypto/rand.h 44 | @@ -20,6 +20,16 @@ 45 | 46 | # include 47 | 48 | +# if defined(__APPLE__) && !defined(OPENSSL_NO_APPLE_CRYPTO_RANDOM) 49 | +# include 50 | +# if (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000) || \ 51 | + (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) 52 | +# define OPENSSL_APPLE_CRYPTO_RANDOM 1 53 | +# include 54 | +# include 55 | +# endif 56 | +# endif 57 | + 58 | /* forward declaration */ 59 | typedef struct rand_pool_st RAND_POOL; 60 | 61 | -------------------------------------------------------------------------------- /kernels/xpython-raw/kernel.json.in: -------------------------------------------------------------------------------- 1 | { 2 | "display_name": "Python @PYTHON_VERSION_MAJOR@.@PYTHON_VERSION_MINOR@ (XPython Raw)", 3 | "argv": [ 4 | "@XPYT_PYTHON_EXECUTABLE_NAME@", 5 | "-m", 6 | "xpython_launcher", 7 | "-f", 8 | "{connection_file}", 9 | "--raw" 10 | ], 11 | "language": "python", 12 | "metadata": { "debugger": false } 13 | } 14 | -------------------------------------------------------------------------------- /kernels/xpython-raw/logo-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jupyter-xeus/xeus-python-wheel/51ab017d74d091246b246033f30b271b81d664fc/kernels/xpython-raw/logo-32x32.png -------------------------------------------------------------------------------- /kernels/xpython-raw/logo-64x64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jupyter-xeus/xeus-python-wheel/51ab017d74d091246b246033f30b271b81d664fc/kernels/xpython-raw/logo-64x64.png -------------------------------------------------------------------------------- /kernels/xpython/kernel.json.in: -------------------------------------------------------------------------------- 1 | { 2 | "display_name": "Python @PYTHON_VERSION_MAJOR@.@PYTHON_VERSION_MINOR@ (XPython)", 3 | "argv": [ 4 | "@XPYT_PYTHON_EXECUTABLE_NAME@", 5 | "-m", 6 | "xpython_launcher", 7 | "-f", 8 | "{connection_file}" 9 | ], 10 | "language": "python", 11 | "metadata": { "debugger": true } 12 | } 13 | -------------------------------------------------------------------------------- /kernels/xpython/logo-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jupyter-xeus/xeus-python-wheel/51ab017d74d091246b246033f30b271b81d664fc/kernels/xpython/logo-32x32.png -------------------------------------------------------------------------------- /kernels/xpython/logo-64x64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jupyter-xeus/xeus-python-wheel/51ab017d74d091246b246033f30b271b81d664fc/kernels/xpython/logo-64x64.png -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = [ 3 | "setuptools", 4 | "wheel", 5 | "scikit-build>=0.11.0,<0.14", 6 | "cmake>=3.4", 7 | "ninja", 8 | "packaging<22" 9 | ] 10 | -------------------------------------------------------------------------------- /pytest.ini: -------------------------------------------------------------------------------- 1 | [pytest] 2 | testpaths = test 3 | addopts = --nbval 4 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | 4 | try: 5 | from skbuild import setup 6 | from skbuild.exceptions import SKBuildError 7 | from skbuild.cmaker import get_cmake_version 8 | from packaging.version import LegacyVersion 9 | 10 | setup_requires = [] 11 | try: 12 | if LegacyVersion(get_cmake_version()) < LegacyVersion("3.15"): 13 | setup_requires.append('cmake') 14 | except SKBuildError: 15 | setup_requires.append('cmake') 16 | except ImportError: 17 | print('scikit-build is required to build from source.', file=sys.stderr) 18 | print('Please run:', file=sys.stderr) 19 | print('', file=sys.stderr) 20 | print(' python -m pip install scikit-build') 21 | sys.exit(1) 22 | 23 | python_path = sys.executable 24 | 25 | try: 26 | import pathlib 27 | import re 28 | cmake = pathlib.Path(__file__).parent / 'CMakeLists.txt' 29 | xeus_version = None 30 | with open(str(cmake)) as f: 31 | for line in f: 32 | m = re.search(r'XEUS_PYTHON_GIT_TAG\s+([^\s)]+)', line) 33 | if m is not None: 34 | xeus_version = m.group(1) 35 | 36 | if xeus_version is None: 37 | raise ValueError("Couldn't find the version in CMakeLists.txt") 38 | except Exception as e: 39 | print('Could not determine the version of xeus_python') 40 | print(e) 41 | sys.exit(1) 42 | 43 | 44 | def accept_file(name): 45 | return not ( 46 | name.endswith('.a') or # static libraries 47 | name.endswith('.lib') or # lib files 48 | name.endswith('.hpp') or # headers 49 | name.endswith('.h') or # headers 50 | name.endswith('.cmake') or # cmake files 51 | name.endswith('.pc') or # package-config files 52 | name.endswith('.txt') # text files 53 | ) 54 | 55 | 56 | def cmake_process_manifest_hook(cmake_manifest): 57 | print(cmake_manifest) 58 | print('\n\n') 59 | cmake_manifest = list(filter(accept_file, cmake_manifest)) 60 | print(cmake_manifest) 61 | return cmake_manifest 62 | 63 | 64 | openssl_config = os.environ.get('OPENSSL_CONFIG_COMMAND', './config') 65 | libsodium_config = os.environ.get('LIBSODIUM_CONFIG_COMMAND', './configure') 66 | 67 | setup( 68 | name="xeus-python", 69 | version=xeus_version, 70 | description='A wheel for xeus-python', 71 | author='Sylvain Corlay, Johan Mabille, Martin Renou', 72 | license='', 73 | packages=['xpython'], 74 | py_modules=['xpython_launcher'], 75 | install_requires=[ 76 | 'pygments>=2.3.1,<3', 77 | 'xeus-python-shell[ipython]>=0.5,<0.6' 78 | ], 79 | setup_requires=setup_requires, 80 | cmake_args=['-DCMAKE_INSTALL_LIBDIR=lib', '-DPYTHON_EXECUTABLE:FILEPATH=' + python_path, f'-DOPENSSL_CONFIG:INTERNAL={openssl_config}', 81 | f'-DLIBSODIUM_CONFIG:INTERNAL="{libsodium_config}"'], 82 | cmake_process_manifest_hook=cmake_process_manifest_hook 83 | ) 84 | -------------------------------------------------------------------------------- /test/test_notebook.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "id": "extensive-oxide", 7 | "metadata": {}, 8 | "outputs": [], 9 | "source": [ 10 | "from math import sqrt" 11 | ] 12 | }, 13 | { 14 | "cell_type": "code", 15 | "execution_count": 2, 16 | "id": "embedded-software", 17 | "metadata": {}, 18 | "outputs": [ 19 | { 20 | "data": { 21 | "text/plain": [ 22 | "5.0" 23 | ] 24 | }, 25 | "execution_count": 2, 26 | "metadata": {}, 27 | "output_type": "execute_result" 28 | } 29 | ], 30 | "source": [ 31 | "sqrt(25)" 32 | ] 33 | } 34 | ], 35 | "metadata": { 36 | "kernelspec": { 37 | "display_name": "Python 3.9 (XPython)", 38 | "language": "python", 39 | "name": "xpython" 40 | }, 41 | "language_info": { 42 | "file_extension": ".py", 43 | "mimetype": "text/x-python", 44 | "name": "python", 45 | "version": "3.9.7" 46 | } 47 | }, 48 | "nbformat": 4, 49 | "nbformat_minor": 5 50 | } 51 | -------------------------------------------------------------------------------- /test/test_notebook_raw.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "id": "extensive-oxide", 7 | "metadata": {}, 8 | "outputs": [], 9 | "source": [ 10 | "from math import sqrt" 11 | ] 12 | }, 13 | { 14 | "cell_type": "code", 15 | "execution_count": 2, 16 | "id": "8e8328f3-5467-48ac-8584-aac5453e3461", 17 | "metadata": {}, 18 | "outputs": [ 19 | { 20 | "data": { 21 | "text/plain": [ 22 | "5.0" 23 | ] 24 | }, 25 | "execution_count": 2, 26 | "metadata": {}, 27 | "output_type": "execute_result" 28 | } 29 | ], 30 | "source": [ 31 | "sqrt(25)" 32 | ] 33 | } 34 | ], 35 | "metadata": { 36 | "kernelspec": { 37 | "display_name": "Python 3.9 (XPython Raw)", 38 | "language": "python", 39 | "name": "xpython-raw" 40 | }, 41 | "language_info": { 42 | "file_extension": ".py", 43 | "mimetype": "text/x-python", 44 | "name": "python", 45 | "version": "3.9.7" 46 | } 47 | }, 48 | "nbformat": 4, 49 | "nbformat_minor": 5 50 | } 51 | -------------------------------------------------------------------------------- /xpython/__init__.py: -------------------------------------------------------------------------------- 1 | from .xpython_extension import launch 2 | 3 | -------------------------------------------------------------------------------- /xpython_launcher.py: -------------------------------------------------------------------------------- 1 | if __name__ == '__main__': 2 | import sys 3 | from xpython import launch as _xpython_launch 4 | args_list = sys.argv[:] 5 | sys.argv = sys.argv[:1] # Remove unnecessary arguments 6 | _xpython_launch(args_list) 7 | --------------------------------------------------------------------------------