Skip to content

Commit 69b9446

Browse files
committed
Add CMake hints
1 parent 766e8c6 commit 69b9446

File tree

3 files changed

+59
-0
lines changed

3 files changed

+59
-0
lines changed

dist/setup/index.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63884,12 +63884,25 @@ function findPyPyVersion(versionSpec, architecture, updateEnvironment) {
6388463884
const binaryExtension = utils_1.IS_WINDOWS ? '.exe' : '';
6388563885
const pythonPath = path.join(utils_1.IS_WINDOWS ? installDir : _binDir, `python${binaryExtension}`);
6388663886
const pythonLocation = pypyInstall.getPyPyBinaryPath(installDir);
63887+
<<<<<<< HEAD
6388763888
if (updateEnvironment) {
6388863889
core.exportVariable('pythonLocation', installDir);
6388963890
core.exportVariable('PKG_CONFIG_PATH', pythonLocation + '/lib/pkgconfig');
6389063891
core.addPath(pythonLocation);
6389163892
core.addPath(_binDir);
6389263893
}
63894+
=======
63895+
core.exportVariable('pythonLocation', installDir);
63896+
// https://cmake.org/cmake/help/latest/module/FindPython.html#module:FindPython
63897+
core.exportVariable('Python_ROOT_DIR', installDir);
63898+
// https://cmake.org/cmake/help/latest/module/FindPython2.html#module:FindPython2
63899+
core.exportVariable('Python2_ROOT_DIR', installDir);
63900+
// https://cmake.org/cmake/help/latest/module/FindPython3.html#module:FindPython3
63901+
core.exportVariable('Python3_ROOT_DIR', installDir);
63902+
core.exportVariable('PKG_CONFIG_PATH', pythonLocation + '/lib/pkgconfig');
63903+
core.addPath(pythonLocation);
63904+
core.addPath(_binDir);
63905+
>>>>>>> 31fd3d4 (Add CMake hints)
6389363906
core.setOutput('python-version', 'pypy' + resolvedPyPyVersion.trim());
6389463907
core.setOutput('python-path', pythonPath);
6389563908
return { resolvedPyPyVersion, resolvedPythonVersion };
@@ -64042,6 +64055,26 @@ function useCpythonVersion(version, architecture, updateEnvironment) {
6404264055
`The list of all available versions can be found here: ${installer.MANIFEST_URL}`
6404364056
].join(os.EOL));
6404464057
}
64058+
<<<<<<< HEAD
64059+
=======
64060+
core.exportVariable('pythonLocation', installDir);
64061+
// https://cmake.org/cmake/help/latest/module/FindPython.html#module:FindPython
64062+
core.exportVariable('Python_ROOT_DIR', installDir);
64063+
// https://cmake.org/cmake/help/latest/module/FindPython2.html#module:FindPython2
64064+
core.exportVariable('Python2_ROOT_DIR', installDir);
64065+
// https://cmake.org/cmake/help/latest/module/FindPython3.html#module:FindPython3
64066+
core.exportVariable('Python3_ROOT_DIR', installDir);
64067+
core.exportVariable('PKG_CONFIG_PATH', installDir + '/lib/pkgconfig');
64068+
if (utils_1.IS_LINUX) {
64069+
const libPath = process.env.LD_LIBRARY_PATH
64070+
? `:${process.env.LD_LIBRARY_PATH}`
64071+
: '';
64072+
const pyLibPath = path.join(installDir, 'lib');
64073+
if (!libPath.split(':').includes(pyLibPath)) {
64074+
core.exportVariable('LD_LIBRARY_PATH', pyLibPath + libPath);
64075+
}
64076+
}
64077+
>>>>>>> 31fd3d4 (Add CMake hints)
6404564078
const _binDir = binDir(installDir);
6404664079
const binaryExtension = utils_1.IS_WINDOWS ? '.exe' : '';
6404764080
const pythonPath = path.join(utils_1.IS_WINDOWS ? installDir : _binDir, `python${binaryExtension}`);

src/find-pypy.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ export async function findPyPyVersion(
5757
const pythonLocation = pypyInstall.getPyPyBinaryPath(installDir);
5858
if (updateEnvironment) {
5959
core.exportVariable('pythonLocation', installDir);
60+
// https://cmake.org/cmake/help/latest/module/FindPython.html#module:FindPython
61+
core.exportVariable('Python_ROOT_DIR', installDir);
62+
// https://cmake.org/cmake/help/latest/module/FindPython2.html#module:FindPython2
63+
core.exportVariable('Python2_ROOT_DIR', installDir);
64+
// https://cmake.org/cmake/help/latest/module/FindPython3.html#module:FindPython3
65+
core.exportVariable('Python3_ROOT_DIR', installDir);
6066
core.exportVariable('PKG_CONFIG_PATH', pythonLocation + '/lib/pkgconfig');
6167
core.addPath(pythonLocation);
6268
core.addPath(_binDir);

src/find-python.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,26 @@ export async function useCpythonVersion(
7070
);
7171
}
7272

73+
core.exportVariable('pythonLocation', installDir);
74+
// https://cmake.org/cmake/help/latest/module/FindPython.html#module:FindPython
75+
core.exportVariable('Python_ROOT_DIR', installDir);
76+
// https://cmake.org/cmake/help/latest/module/FindPython2.html#module:FindPython2
77+
core.exportVariable('Python2_ROOT_DIR', installDir);
78+
// https://cmake.org/cmake/help/latest/module/FindPython3.html#module:FindPython3
79+
core.exportVariable('Python3_ROOT_DIR', installDir);
80+
core.exportVariable('PKG_CONFIG_PATH', installDir + '/lib/pkgconfig');
81+
82+
if (IS_LINUX) {
83+
const libPath = process.env.LD_LIBRARY_PATH
84+
? `:${process.env.LD_LIBRARY_PATH}`
85+
: '';
86+
const pyLibPath = path.join(installDir, 'lib');
87+
88+
if (!libPath.split(':').includes(pyLibPath)) {
89+
core.exportVariable('LD_LIBRARY_PATH', pyLibPath + libPath);
90+
}
91+
}
92+
7393
const _binDir = binDir(installDir);
7494
const binaryExtension = IS_WINDOWS ? '.exe' : '';
7595
const pythonPath = path.join(

0 commit comments

Comments
 (0)