Skip to content

Commit

Permalink
fix problem causing cmake file in thrust dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
schuhmaj committed Jun 30, 2022
1 parent 9cbc852 commit 62f43ba
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 8 deletions.
52 changes: 45 additions & 7 deletions cmake/thrust.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,51 @@ else()
GIT_TAG 1.16.0
)

# Disable stuff not needed
set(THRUST_ENABLE_HEADER_TESTING "OFF")
set(THRUST_ENABLE_TESTING "OFF")
set(THRUST_ENABLE_EXAMPLES "OFF")
FetchContent_GetProperties(thrust)
if(NOT thrust_POPULATED)
# Fetch the content using previously declared details
FetchContent_Populate(thrust)

# Set standard CPP Dialect to 17 (default of thrust would be 14)
set(THRUST_CPP_DIALECT 17)
# Set custom variables, policies, etc.
# Disable stuff not needed
set(THRUST_ENABLE_HEADER_TESTING "OFF")
set(THRUST_ENABLE_TESTING "OFF")
set(THRUST_ENABLE_EXAMPLES "OFF")

FetchContent_MakeAvailable(thrust)
# Set standard CPP Dialect to 17 (default of thrust would be 14)
set(THRUST_CPP_DIALECT 17)

# Original Content of the problematic file
## Parse version information from version.h:
##unset(_THRUST_VERSION_INCLUDE_DIR CACHE) # Clear old result to force search
##find_path(_THRUST_VERSION_INCLUDE_DIR thrust/version.h
## NO_DEFAULT_PATH # Only search explicit paths below:
## PATHS
## "${CMAKE_CURRENT_LIST_DIR}/../.." # Source tree
##)
##set_property(CACHE _THRUST_VERSION_INCLUDE_DIR PROPERTY TYPE INTERNAL)

if(EXISTS ${thrust_SOURCE_DIR}/thrust/cmake/thrust-header-search.cmake)
message(STATUS "Found problem causing thrust file!")

file(WRITE ${thrust_SOURCE_DIR}/thrust/cmake/thrust-header-search.cmake
"
# Parse version information from version.h:
unset(_THRUST_VERSION_INCLUDE_DIR CACHE) # Clear old result to force search
find_path(_THRUST_VERSION_INCLUDE_DIR thrust/version.h
# NO_DEFAULT_PATH # Only search explicit paths below: COMMENTED BY POLYHEDRAL_GRAVITY_CMAKE
PATHS
\"\${CMAKE_CURRENT_LIST_DIR}/../..\" # Source tree
)
set_property(CACHE _THRUST_VERSION_INCLUDE_DIR PROPERTY TYPE INTERNAL)
")
message(STATUS "Modified the the problem causing file!")
else()
message(STATUS "Problem causing thrust file not found!")
endif()

# Bring the populated content into the build
add_subdirectory(${thrust_SOURCE_DIR} ${thrust_BINARY_DIR})

endif()
endif()
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def build_extension(self, ext):
# --------------------------------------------------------------------------------
setup(
name="polyhedral_gravity",
version="1.0.9",
version="1.0.10",
author="Jonas Schuhmacher",
author_email="[email protected]",
description="Package to compute full gravity tensor of a given constant density polyhedron for arbitrary points",
Expand Down

0 comments on commit 62f43ba

Please sign in to comment.