Skip to content

Commit

Permalink
Try with CMAKE_INSTALL_RPATH @loader_path on mac
Browse files Browse the repository at this point in the history
  • Loading branch information
jmarrec committed Jun 10, 2024
1 parent 18fb567 commit cf65688
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 19 deletions.
12 changes: 3 additions & 9 deletions .github/workflows/build_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: C++ CI

on:
push:
branches: [ python_linking ]
branches: [ python_workaround ]
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
Expand All @@ -20,7 +20,7 @@ jobs:
# fail-fast: Default is true, switch to false to allow one platform to fail and still run others
fail-fast: false
matrix:
os: [ubuntu-22.04, macos-13, macos-14, windows-latest]
os: [ubuntu-22.04, macos-13, macos-14]
include:
- os: ubuntu-22.04
arch: x86_64
Expand All @@ -31,9 +31,6 @@ jobs:
- os: macos-14
arch: arm64
python-arch: arm64
- os: windows-latest
arch: x86_64
python-arch: x64

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -135,7 +132,7 @@ jobs:
# fail-fast: Default is true, switch to false to allow one platform to fail and still run others
fail-fast: false
matrix:
os: [ubuntu-22.04, macos-13, macos-14, windows-latest]
os: [ubuntu-22.04, macos-13, macos-14]
include:
- os: ubuntu-22.04
arch: x86_64
Expand All @@ -146,9 +143,6 @@ jobs:
- os: macos-14
arch: arm64
python-arch: arm64
- os: windows-latest
arch: x86_64
python-arch: x64

steps:
- name: Set up Python ${{ env.Python_REQUIRED_VERSION }}
Expand Down
22 changes: 12 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ cmake_policy(SET CMP0048 NEW) # handling project_version_* variables

project(TestPython VERSION 0.0.1)

if(UNIX AND NOT APPLE)
if(APPLE)
set(CMAKE_INSTALL_RPATH "@loader_path")
elseif(UNIX)
set(CMAKE_INSTALL_RPATH "$ORIGIN")
endif()

Expand Down Expand Up @@ -53,15 +55,15 @@ install(
-P ${PROJECT_SOURCE_DIR}/cmake/PythonGetLibAndLinkUp.cmake
)")

if(APPLE)
install(
CODE "execute_process(
COMMAND ${CMAKE_COMMAND}
-DRESOLVED_PYTHON_LIB=${RESOLVED_PYTHON_LIBRARY}
-DEXECUTABLE_PATH=\${CMAKE_INSTALL_PREFIX}/test${CMAKE_EXECUTABLE_SUFFIX}
-P ${PROJECT_SOURCE_DIR}/cmake/PythonFixUpOnMac.cmake
)")
endif()
# if(APPLE)
# install(
# CODE "execute_process(
# COMMAND ${CMAKE_COMMAND}
# -DRESOLVED_PYTHON_LIB=${RESOLVED_PYTHON_LIBRARY}
# -DEXECUTABLE_PATH=\${CMAKE_INSTALL_PREFIX}/test${CMAKE_EXECUTABLE_SUFFIX}
# -P ${PROJECT_SOURCE_DIR}/cmake/PythonFixUpOnMac.cmake
# )")
# endif()

set(CPACK_GENERATOR "TGZ")
include(CPack)

0 comments on commit cf65688

Please sign in to comment.