Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Scientific Software
CrysFML
Commits
84fceb6e
Unverified
Commit
84fceb6e
authored
Jul 15, 2021
by
Simon Ward
Browse files
More changes, use FindPython3 fully
parent
72029502
Changes
2
Hide whitespace changes
Inline
Side-by-side
Python_API/Src/CMakeLists.txt
View file @
84fceb6e
...
...
@@ -37,12 +37,10 @@ set(PYTHON_INTERPRETER_PATH ${Python3_EXECUTABLE})
if
(
WIN32 OR MSYS
)
FIND_PACKAGE
(
PythonLibs REQUIRED
)
# FIND_PACKAGE(PythonLibs "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}" REQUIRED)
set
(
PYTHON_LIBRARY_PATH
${
PYTHON_LIBRARIES
}
)
message
(
STATUS
${
PYTHON_LIBRARY_PATH
}
)
add_library
(
Python3_LIB STATIC IMPORTED
)
set_property
(
TARGET Python3_LIB PROPERTY IMPORTED_LOCATION
${
PYTHON_LIBRARY
}
)
message
(
STATUS
"Linking Python extension with PYTHON_LIBRARY variable: "
${
PYTHON_LIBRARY
}
)
elseif
()
message
(
STATUS
"Not linking Python extension with PYTHON_LIBRARY variable"
)
set_property
(
TARGET Python3_LIB PROPERTY IMPORTED_LOCATION
${
PYTHON_LIBRARY_PATH
}
)
endif
()
# Set -Wl,-undefined,dynamic_lookup to OTHER_LDFLAGS
...
...
@@ -56,8 +54,6 @@ elseif(WIN32 OR MSYS)
target_link_libraries
(
${
LIBRARY_NAME
}
Python3_LIB
)
endif
()
# target_link_libraries(${LIBRARY_NAME} Python3_LIB)
# Set library extension
set_target_properties
(
${
LIBRARY_NAME
}
PROPERTIES PREFIX
""
OUTPUT_NAME
${
LIBRARY_NAME
}
)
set
(
LIBRARY_FILENAME
"crysfml_api.so"
)
...
...
setup.py
View file @
84fceb6e
...
...
@@ -111,7 +111,7 @@ class InstallCMakeLibs(install_lib):
os
.
listdir
(
bin_dir
)
if
os
.
path
.
isfile
(
os
.
path
.
join
(
bin_dir
,
_pyd
))
and
os
.
path
.
splitext
(
_pyd
)[
0
].
startswith
(
PACKAGE_NAME
)
and
os
.
path
.
splitext
(
_pyd
)[
1
]
in
[
".pyd"
,
".so"
,
'.dll'
]][
0
]
os
.
path
.
splitext
(
_pyd
)[
1
]
in
[
".pyd"
,
".so"
]][
0
]
shutil
.
move
(
pyd_path
,
os
.
path
.
join
(
os
.
path
.
split
(
pyd_path
)[
0
],
'CFML_api'
,
os
.
path
.
split
(
pyd_path
)[
1
]))
# Mark the libs for installation, adding them to
...
...
@@ -219,8 +219,8 @@ class BuildCMakeExt(build_ext):
'-H'
+
SOURCE_DIR
,
'-B'
+
self
.
build_temp
,
"-DPYTHON_EXECUTABLE:FILEPATH={}"
.
format
(
sys
.
executable
),
"-DPYTHON_LIBRARY={}"
.
format
(
sysconfig
.
get_config_var
(
'LIBDIR
'
)),
"-DPYTHON_INCLUDE_DIR={}"
.
format
(
sysconfig
.
get_python_inc
(
)),
"-DPYTHON_LIBRARY={}"
.
format
(
os
.
path
.
join
(
os
.
path
.
split
(
sys
.
executable
)[
0
],
'lib
'
)),
"-DPYTHON_INCLUDE_DIR={}"
.
format
(
os
.
path
.
join
(
os
.
path
.
split
(
sys
.
executable
)[
0
],
'include'
)),
"-DARCH32=OFF"
,
"-DCMAKE_Fortran_COMPILER={}"
.
format
(
COMPILER
),
"-DPYTHON_API=ON"
,
...
...
@@ -252,7 +252,7 @@ class BuildCMakeExt(build_ext):
os
.
listdir
(
bin_dir
)
if
os
.
path
.
isfile
(
os
.
path
.
join
(
bin_dir
,
_pyd
))
and
os
.
path
.
splitext
(
_pyd
)[
0
].
startswith
(
PACKAGE_NAME
)
and
os
.
path
.
splitext
(
_pyd
)[
1
]
in
[
".pyd"
,
".so"
,
'.dll'
]][
0
]
os
.
path
.
splitext
(
_pyd
)[
1
]
in
[
".pyd"
,
".so"
]][
0
]
shutil
.
move
(
pyd_path
,
extension_path
)
# After build_ext is run, the following commands will run:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment