Skip to content

Commit

Permalink
More build system changes to fix building external plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
hkaiser committed Aug 26, 2021
1 parent bc46fe6 commit 295b5f8
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 20 deletions.
9 changes: 0 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,6 @@ phylanx_setup_highfive()

phylanx_include(GitCommit)

###############################################################################
if(NOT HPX_WITH_CUDA)
set(HPX_TLL_PUBLIC "PUBLIC") # keywords for target_link_libraries
set(HPX_TLL_PRIVATE "PRIVATE")
endif()

set(PHYLANX_TLL_PUBLIC ${HPX_TLL_PUBLIC})
set(PHYLANX_TLL_PRIVATE ${HPX_TLL_PRIVATE})

################################################################################
# Set basic search paths for the generated Phylanx headers
################################################################################
Expand Down
4 changes: 2 additions & 2 deletions cmake/Phylanx_AddLibrary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,9 @@ function(add_phylanx_library name)
)

target_link_libraries(${name}
${HPX_TLL_PUBLIC} ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES})
PUBLIC ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES})
target_link_libraries(${name}
${HPX_TLL_PRIVATE} blaze::blaze BlazeTensor::BlazeTensor)
PRIVATE blaze::blaze BlazeTensor::BlazeTensor)

endfunction()

4 changes: 2 additions & 2 deletions cmake/Phylanx_AddPrimitivePlugin.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,9 @@ function(add_phylanx_primitive_plugin name)
)

target_link_libraries(${name}_primitive
${HPX_TLL_PUBLIC} ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES})
PUBLIC ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES})
target_link_libraries(${name}_primitive
${HPX_TLL_PRIVATE} blaze::blaze BlazeTensor::BlazeTensor)
PRIVATE blaze::blaze BlazeTensor::BlazeTensor)

endfunction()

4 changes: 4 additions & 0 deletions cmake/Phylanx_SetupHPX.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@ macro(phylanx_setup_hpx)
set(HPX_DIR $ENV{HPX_DIR})
endif()
if(EXISTS "${HPX_DIR}")
set(__hpx_dir ${HPX_DIR})
find_package(HPX REQUIRED NO_CMAKE_PACKAGE_REGISTRY)

if(NOT HPX_FOUND)
phylanx_error("HPX could not be found, please set HPX_DIR to help locating it.")
endif()

# HPX_DIR is being reset by find_packe *sigh*
set(HPX_DIR ${__hpx_dir})

# make sure that configured build type for Phylanx matches the one used for HPX
get_property(_GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if (NOT _GENERATOR_IS_MULTI_CONFIG AND
Expand Down
4 changes: 2 additions & 2 deletions cmake/Phylanx_SetupTarget.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ function(phylanx_setup_target target)
string(STRIP "${phylanx_libs}" __phylanx_libs)
endif()
phylanx_debug("phylanx_setup_target.${target}: phylanx_libs:" ${__phylanx_libs})
target_link_libraries(${target} ${PHYLANX_TLL_PUBLIC} ${__phylanx_libs} ${target_DEPENDENCIES})
target_link_libraries(${target} PUBLIC ${__phylanx_libs} ${target_DEPENDENCIES})

get_target_property(target_EXCLUDE_FROM_ALL ${target} EXCLUDE_FROM_ALL)

Expand Down Expand Up @@ -232,7 +232,7 @@ function(phylanx_setup_target target)
endforeach()

target_compile_definitions(
${target} ${PHYLANX_TLL_PUBLIC} $<$<CONFIG:Debug>:PHYLANX_DEBUG>)
${target} PUBLIC $<$<CONFIG:Debug>:PHYLANX_DEBUG>)

hpx_setup_target(
${target}
Expand Down
3 changes: 2 additions & 1 deletion cmake/templates/PhylanxConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
# include exported targets if not already defined
if (NOT TARGET blaze::blaze)
include("@BLAZE_CONF_DIR@/blaze-targets.cmake")
include("@BLAZE_TENSOR_CONF_DIR@/BlazeTensorTargets.cmake")
endif()
if (NOT TARGET hpx)
include("@HPX_CONF_DIR@/HPXTargets.cmake")
find_package(HPX REQUIRED)
endif()
if (NOT TARGET phylanx)
include("${CMAKE_CURRENT_LIST_DIR}/PhylanxTargets.cmake")
Expand Down
2 changes: 1 addition & 1 deletion python/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ include_directories(${pybind11_INCLUDE_DIR})

# this makes sure CMake uses the proper HPX library dependencies
target_link_libraries(phylanx_py
${HPX_TLL_PRIVATE}
PRIVATE
HPX::hpx
HPX::iostreams_component
phylanx_component
Expand Down
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ else()
endif()

target_link_libraries(phylanx_component
${HPX_TLL_PUBLIC} ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES})
PUBLIC ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES})
target_link_libraries(phylanx_component
${HPX_TLL_PRIVATE} blaze::blaze BlazeTensor::BlazeTensor)
PRIVATE blaze::blaze BlazeTensor::BlazeTensor)

set_target_properties(
phylanx_component PROPERTIES
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/fileio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ add_phylanx_primitive_plugin(fileio

if(PHYLANX_WITH_HIGHFIVE)
target_link_libraries(fileio_primitive
${HPX_TLL_PRIVATE}
PRIVATE
HighFive
${PHYLANX_HDF5_LIBRARIES})
endif()
Expand Down

0 comments on commit 295b5f8

Please sign in to comment.