Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: address cmake policy 148 #3013

Merged
merged 2 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ mark_as_advanced(OPAE_BUILD_TESTS)
############################################################################
set(OPAE_PYTHON_VERSION 3 CACHE STRING "Python version to use for building/distributing pyopae")
set_property(CACHE OPAE_PYTHON_VERSION PROPERTY STRINGS 3 3.6 3.7 3.8 3.9 3.10 3.11)
find_package(PythonInterp ${OPAE_PYTHON_VERSION})
find_package(PythonLibs ${OPAE_PYTHON_VERSION})
find_package(Python3 COMPONENTS Interpreter Development)

################################################################################
# util-linux/libuuid
Expand Down Expand Up @@ -419,7 +418,7 @@ set(PYBIND11_URL
https://github.com/pybind/pybind11.git
CACHE STRING "URL for pybind11")

if(${CMAKE_VERSION} VERSION_LESS "3.4.0" AND ${PYTHONLIBS_VERSION_STRING} VERSION_LESS "3.9.0")
if(${CMAKE_VERSION} VERSION_LESS "3.4.0" AND ${Python3_VERSION} VERSION_LESS "3.9.0")
set(PYBIND11_VERSION
2.4.3
CACHE STRING "Version for pybind11")
Expand Down
2 changes: 1 addition & 1 deletion binaries/fpgadiag/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ if (OPAE_WITH_PYBIND11)

add_custom_command(
OUTPUT ${OUTPUT}
COMMAND ${PYTHON_EXECUTABLE} -m pip install --root=${PYDIST_STAGE_DIR}/build --no-warn-script-location .
COMMAND ${Python3_EXECUTABLE} -m pip install --root=${PYDIST_STAGE_DIR}/build --no-warn-script-location .
COMMAND ${CMAKE_COMMAND} -E touch ${OUTPUT}
WORKING_DIRECTORY ${PYDIST_STAGE_DIR}
DEPENDS pyproject.toml setup.py ${PKG_FILES}
Expand Down
2 changes: 1 addition & 1 deletion binaries/hssi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ file(GLOB_RECURSE PKG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/ethernet/*.py)

add_custom_command(
OUTPUT ${OUTPUT}
COMMAND ${PYTHON_EXECUTABLE} -m pip install --root=${CMAKE_CURRENT_SOURCE_DIR}/build --no-warn-script-location .
COMMAND ${Python3_EXECUTABLE} -m pip install --root=${CMAKE_CURRENT_SOURCE_DIR}/build --no-warn-script-location .
COMMAND ${CMAKE_COMMAND} -E touch ${OUTPUT}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS pyproject.toml ${PKG_FILES}
Expand Down
2 changes: 1 addition & 1 deletion binaries/ofs.uio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ set(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/timestamp)

add_custom_command(
OUTPUT ${OUTPUT}
COMMAND ${PYTHON_EXECUTABLE} -m pip install --root=${CMAKE_CURRENT_SOURCE_DIR}/build --no-warn-script-location .
COMMAND ${Python3_EXECUTABLE} -m pip install --root=${CMAKE_CURRENT_SOURCE_DIR}/build --no-warn-script-location .
COMMAND ${CMAKE_COMMAND} -E touch ${OUTPUT}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS pyproject.toml ${PKG_FILES}
Expand Down
6 changes: 3 additions & 3 deletions binaries/opae.io/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ if (PLATFORM_SUPPORTS_VFIO AND OPAE_WITH_PYBIND11 AND OPAE_WITH_LIBEDIT)
if (NOT (CMAKE_VERSION VERSION_LESS 3.0))
target_link_libraries(opae.io PRIVATE pybind11::embed dl util ${libedit_LIBRARIES} opaevfio)
else()
target_link_libraries(opae.io PRIVATE ${PYTHON_LIBRARIES} dl util ${libedit_LIBRARIES} opaevfio)
target_link_libraries(opae.io PRIVATE ${Python3_LIBRARIES} dl util ${libedit_LIBRARIES} opaevfio)
endif()

if (libedit_IMPORTED)
Expand All @@ -43,7 +43,7 @@ if (PLATFORM_SUPPORTS_VFIO AND OPAE_WITH_PYBIND11 AND OPAE_WITH_LIBEDIT)

target_include_directories(opae.io
PUBLIC ${OPAE_INCLUDE_DIR}
PRIVATE ${PYTHON_INCLUDE_DIRS}
PRIVATE ${Python3_INCLUDE_DIRS}
PRIVATE ${pybind11_ROOT}/include
PRIVATE ${libedit_INCLUDE_DIRS}
)
Expand Down Expand Up @@ -80,7 +80,7 @@ if (PLATFORM_SUPPORTS_VFIO AND OPAE_WITH_PYBIND11 AND OPAE_WITH_LIBEDIT)

add_custom_command(
OUTPUT ${OUTPUT}
COMMAND ${PYTHON_EXECUTABLE} -m pip install --root=${PYDIST_STAGE_DIR}/build .
COMMAND ${Python3_EXECUTABLE} -m pip install --root=${PYDIST_STAGE_DIR}/build .
COMMAND ${CMAKE_COMMAND} -E touch ${OUTPUT}
WORKING_DIRECTORY ${PYDIST_STAGE_DIR}
DEPENDS ${PYFILES} ${PKG_FILES}
Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/OFS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
macro(ofs_add_driver yml_file driver)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${driver}.h
COMMAND ${PYTHON_EXECUTABLE} ${OPAE_LIB_SOURCE}/scripts/ofs/ofs_parse.py
COMMAND ${Python3_EXECUTABLE} ${OPAE_LIB_SOURCE}/scripts/ofs/ofs_parse.py
${CMAKE_CURRENT_LIST_DIR}/${yml_file} --use-local-refs headers c ${CMAKE_CURRENT_BINARY_DIR} --driver ${driver}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS
Expand Down
4 changes: 2 additions & 2 deletions cmake/modules/OPAEPackaging.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ function(opae_python_install)
# set(ENV{DESTDIR} /)
# endif()
# execute_process(
# COMMAND ${PYTHON_EXECUTABLE} setup.py install -O1 \
# COMMAND ${Python3_EXECUTABLE} setup.py install -O1 \
# --single-version-externally-managed \
# --root=\$ENV{DESTDIR} \
# --prefix=${CMAKE_INSTALL_PREFIX} \
Expand All @@ -169,7 +169,7 @@ function(opae_python_install)
set(ENV{DESTDIR} /)
endif()
execute_process(
COMMAND ${PYTHON_EXECUTABLE} -m pip install \
COMMAND ${Python3_EXECUTABLE} -m pip install \
--root=\$ENV{DESTDIR} \
--prefix=${CMAKE_INSTALL_PREFIX} \
--no-warn-script-location .
Expand Down
4 changes: 2 additions & 2 deletions libraries/pyopae/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ opae_add_module_library(TARGET _opae

target_include_directories(_opae
PRIVATE ${pybind11_INCLUDE_DIRS}
PRIVATE ${PYTHON_INCLUDE_DIRS})
PRIVATE ${Python3_INCLUDE_DIRS})

set_target_properties(_opae
PROPERTIES PREFIX ""
Expand Down Expand Up @@ -100,7 +100,7 @@ if (OPAE_BUILD_PYTHON_DIST)
endforeach(cppfile ${PYOPAE_SRC})

add_custom_target(pyopae-dist
COMMAND ${PYTHON_EXECUTABLE} -m pip install --root=${PYDIST_STAGE_DIR}/build .
COMMAND ${Python3_EXECUTABLE} -m pip install --root=${PYDIST_STAGE_DIR}/build .
DEPENDS ${PYFILES} ${PYOPAE_SRC}
WORKING_DIRECTORY ${PYDIST_STAGE_DIR}
COMMENT "Building Python distrubutions")
Expand Down
2 changes: 1 addition & 1 deletion libraries/pyopaeuio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ if (OPAE_WITH_PYBIND11)

add_custom_command(
OUTPUT ${OUTPUT}
COMMAND ${PYTHON_EXECUTABLE} -m pip install --root=${PYDIST_STAGE_DIR}/build .
COMMAND ${Python3_EXECUTABLE} -m pip install --root=${PYDIST_STAGE_DIR}/build .
COMMAND ${CMAKE_COMMAND} -E touch ${OUTPUT}
WORKING_DIRECTORY ${PYDIST_STAGE_DIR}
DEPENDS ${PYFILES} pyopaeuio.cpp pyopaeuio.h
Expand Down
5 changes: 0 additions & 5 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ project(python)
############################################################################
## Find Python by version ##############################################
############################################################################
set(OPAE_PYTHON_VERSION 3.6 CACHE STRING "Python version to use for building/distributing pyopae")
set_property(CACHE OPAE_PYTHON_VERSION PROPERTY STRINGS 2.7 3.6 3.5 3.4 3.3)

find_package(PythonInterp ${OPAE_PYTHON_VERSION})
find_package(PythonLibs ${OPAE_PYTHON_VERSION})

add_subdirectory(opae.admin)
add_subdirectory(pacsign)
Expand Down
6 changes: 3 additions & 3 deletions python/opae.admin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,17 @@ add_custom_command(TARGET opae.admin PRE_BUILD


add_custom_target(opae.admin.src
COMMAND ${PYTHON_EXECUTABLE} setup.py sdist
COMMAND ${Python3_EXECUTABLE} setup.py sdist
WORKING_DIRECTORY ${ADMIN_STAGE_DIR}
COMMENT "Building opae.admin Python source distribution"
)
add_custom_target(opae.admin.wheel
COMMAND ${PYTHON_EXECUTABLE} setup.py bdist_wheel --universal
COMMAND ${Python3_EXECUTABLE} setup.py bdist_wheel --universal
WORKING_DIRECTORY ${ADMIN_STAGE_DIR}
COMMENT "Building opae.admin Python wheel distribution"
)
add_custom_target(opae.admin.tox
COMMAND ${PYTHON_EXECUTABLE} -m tox opae
COMMAND ${Python3_EXECUTABLE} -m tox opae
DEPENDS opae.admin
WORKING_DIRECTORY ${ADMIN_STAGE_DIR}
COMMENT "Running tox on opae.admin"
Expand Down
8 changes: 4 additions & 4 deletions tests/pyopae/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
try_compile(SUPPORTS_EMBEDDED_PYTHON
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/test_embed.cpp
CMAKE_FLAGS
"-DINCLUDE_DIRECTORIES=${PYTHON_INCLUDE_DIRS};${pybind11_INCLUDE_DIRS}"
LINK_LIBRARIES ${PYTHON_LIBRARIES}
"-DINCLUDE_DIRECTORIES=${Python3_INCLUDE_DIRS};${pybind11_INCLUDE_DIRS}"
LINK_LIBRARIES ${Python3_LIBRARIES}
OUTPUT_VARIABLE TRY_COMPILE_OUTPUT
)

Expand Down Expand Up @@ -64,7 +64,7 @@ if (SUPPORTS_EMBEDDED_PYTHON)
OPAE_EMBEDDED)
target_include_directories(test_pyopae
PRIVATE ${pybind11_INCLUDE_DIRS}
PRIVATE ${PYTHON_INCLUDE_DIRS}
PRIVATE ${Python3_INCLUDE_DIRS}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE ${opae-test_ROOT}/framework)

Expand All @@ -74,7 +74,7 @@ if (SUPPORTS_EMBEDDED_PYTHON)
opae-cxx-core
${OPAE_TEST_LIBRARIES}
${json-c_LIBRARIES}
${PYTHON_LIBRARIES})
${Python3_LIBRARIES})

macro(add_pyopae_test pytest)
add_custom_command(TARGET test_pyopae
Expand Down