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

Regenerate install_info.py on every build #705

Merged
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
13 changes: 6 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,24 +79,23 @@ endif()
if(CMAKE_GENERATOR STREQUAL "Ninja")
function(add_touch_cunumeric_ninja_build_target)
set(_suf )
set(_depends )
if(SKBUILD)
set(_suf "_python")
endif()
add_custom_target("touch_cunumeric${_suf}_ninja_build" ALL
COMMAND ${CMAKE_COMMAND} -E touch_nocreate "${CMAKE_CURRENT_BINARY_DIR}/build.ninja"
COMMENT "touch build.ninja so ninja doesn't re-run CMake on rebuild"
VERBATIM
)
foreach(_dep IN ITEMS cunumeric cunumeric_python
legion_core legion_core_python
Legion LegionRuntime
Realm RealmRuntime
Regent)
if(TARGET ${_dep})
list(APPEND _depends ${_dep})
add_dependencies("touch_cunumeric${_suf}_ninja_build" ${_dep})
endif()
endforeach()
add_custom_target("touch_cunumeric${_suf}_ninja_build" ALL
COMMAND ${CMAKE_COMMAND} -E touch_nocreate "${CMAKE_CURRENT_BINARY_DIR}/build.ninja"
COMMENT "touch build.ninja so ninja doesn't re-run CMake on rebuild"
VERBATIM DEPENDS ${_depends}
)
endfunction()
add_touch_cunumeric_ninja_build_target()
endif()
31 changes: 31 additions & 0 deletions cmake/generate_install_info_py.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#=============================================================================
# Copyright 2022 NVIDIA Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#=============================================================================

execute_process(
COMMAND ${CMAKE_C_COMPILER}
-E -DLEGATE_USE_PYTHON_CFFI
-I "${CMAKE_CURRENT_LIST_DIR}/../src/cunumeric"
-P "${CMAKE_CURRENT_LIST_DIR}/../src/cunumeric/cunumeric_c.h"
ECHO_ERROR_VARIABLE
OUTPUT_VARIABLE header
COMMAND_ERROR_IS_FATAL ANY
)

set(libpath "")
configure_file(
"${CMAKE_CURRENT_LIST_DIR}/../cunumeric/install_info.py.in"
"${CMAKE_CURRENT_LIST_DIR}/../cunumeric/install_info.py"
@ONLY)
20 changes: 6 additions & 14 deletions cunumeric_python.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,14 @@ if(NOT cunumeric_FOUND)
set(SKBUILD ON)
endif()

execute_process(
COMMAND ${CMAKE_C_COMPILER}
-E -DLEGATE_USE_PYTHON_CFFI
-I "${CMAKE_CURRENT_SOURCE_DIR}/src/cunumeric"
-P "${CMAKE_CURRENT_SOURCE_DIR}/src/cunumeric/cunumeric_c.h"
ECHO_ERROR_VARIABLE
OUTPUT_VARIABLE header
COMMAND_ERROR_IS_FATAL ANY
add_custom_target("generate_install_info_py" ALL
COMMAND ${CMAKE_COMMAND}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-P "${CMAKE_CURRENT_SOURCE_DIR}/cmake/generate_install_info_py.cmake"
COMMENT "Generate install_info.py"
VERBATIM
)

set(libpath "")
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cunumeric/install_info.py.in"
"${CMAKE_CURRENT_SOURCE_DIR}/cunumeric/install_info.py"
@ONLY)

add_library(cunumeric_python INTERFACE)
add_library(cunumeric::cunumeric_python ALIAS cunumeric_python)
target_link_libraries(cunumeric_python INTERFACE legate::core)
Expand Down
2 changes: 1 addition & 1 deletion scripts/build-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ rm -rf ./{build,_skbuild,dist,cunumeric.egg-info}
cmake_args="${CMAKE_ARGS:-}"

# Use ninja-build if installed
if [[ -n "$(which ninja)" ]]; then cmake_args+="-GNinja"; fi
if [[ -n "$(which ninja)" ]]; then cmake_args+=" -GNinja"; fi

# Add other build options here as desired
cmake_args+="
Expand Down
2 changes: 1 addition & 1 deletion scripts/build-no-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ rm -rf ./{build,_skbuild,dist,cunumeric.egg-info}
cmake_args="${CMAKE_ARGS:-}"

# Use ninja-build if installed
if [[ -n "$(which ninja)" ]]; then cmake_args+="-GNinja"; fi
if [[ -n "$(which ninja)" ]]; then cmake_args+=" -GNinja"; fi

# Add other build options here as desired
cmake_args+="
Expand Down
2 changes: 1 addition & 1 deletion scripts/build-separately-no-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ rm -rf ./{build,_skbuild,dist,cunumeric.egg-info}
cmake_args="${CMAKE_ARGS:-}"

# Use ninja-build if installed
if [[ -n "$(which ninja)" ]]; then cmake_args+="-GNinja"; fi
if [[ -n "$(which ninja)" ]]; then cmake_args+=" -GNinja"; fi

# Add other build options here as desired
cmake_args+="
Expand Down
2 changes: 1 addition & 1 deletion scripts/build-with-legate-no-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ rm -rf ./{build,_skbuild,dist,cunumeric.egg-info}
cmake_args="${CMAKE_ARGS:-}"

# Use ninja-build if installed
if [[ -n "$(which ninja)" ]]; then cmake_args+="-GNinja"; fi
if [[ -n "$(which ninja)" ]]; then cmake_args+=" -GNinja"; fi

# Add other build options here as desired
cmake_args+="
Expand Down
2 changes: 1 addition & 1 deletion scripts/build-with-legate-separately-no-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ rm -rf ./{build,_skbuild,dist,cunumeric.egg-info}
cmake_args="${CMAKE_ARGS:-}"

# Use ninja-build if installed
if [[ -n "$(which ninja)" ]]; then cmake_args+="-GNinja"; fi
if [[ -n "$(which ninja)" ]]; then cmake_args+=" -GNinja"; fi

# Add other build options here as desired
cmake_args+="
Expand Down