Skip to content

Commit

Permalink
Conda build fixes (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
JDuffeyBQ committed Aug 21, 2023
1 parent dc41bff commit 05609fc
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 30 deletions.
44 changes: 18 additions & 26 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,34 +52,26 @@ option(EbsdLib_ENABLE_HDF5 "Enable HDF5 Support in the EbsdLibProj" ON)
option(EbsdLib_BUILD_H5SUPPORT "Build H5Support Library" ON)

if(EbsdLib_ENABLE_HDF5)
if(EbsdLib_Anaconda_Install)
set(HDF5_USE_STATIC_LIBRARIES OFF)
set(HDF5_FIND_COMPONENTS OFF)
find_package(HDF5 1.10.6 EXACT MODULE REQUIRED)
set(HDF5_C_TARGET_NAME hdf5::hdf5)
else()
find_package(HDF5 NAMES hdf5 REQUIRED)
endif()

# If H5Support already exists no need to look for it (e.g. EbsdLib is added as a subdirectory in DREAM3D)
if(NOT TARGET H5Support::H5Support AND EbsdLib_BUILD_H5SUPPORT)
#------------------------------------------------------------------------------
# If the developer has set another H5Support directory then use that, otherwise look
# for the H5Support directory at the same level as the EBSDLib directory
if("${H5Support_SOURCE_DIR}" STREQUAL "")
if(EXISTS "${EbsdLib_PARENT}/H5Support")
set(H5Support_SOURCE_DIR "${EbsdLib_PARENT}/H5Support")
elseif(EXISTS "${EbsdLib_SOURCE_DIR}/H5Support")
set(H5Support_SOURCE_DIR "${EbsdLib_SOURCE_DIR}/H5Support")
else()
message(FATAL_ERROR "H5Support_SOURCE_DIR was not set. Where is the H5Support project directory. Please set the H5Support_SOURCE_DIR variable to the CMP directory.")
if(EbsdLib_BUILD_H5SUPPORT)
if(NOT TARGET H5Support::H5Support)
#------------------------------------------------------------------------------
# If the developer has set another H5Support directory then use that, otherwise look
# for the H5Support directory at the same level as the EBSDLib directory
if("${H5Support_SOURCE_DIR}" STREQUAL "")
if(EXISTS "${EbsdLib_PARENT}/H5Support")
set(H5Support_SOURCE_DIR "${EbsdLib_PARENT}/H5Support")
elseif(EXISTS "${EbsdLib_SOURCE_DIR}/H5Support")
set(H5Support_SOURCE_DIR "${EbsdLib_SOURCE_DIR}/H5Support")
else()
message(FATAL_ERROR "H5Support_SOURCE_DIR was not set. Where is the H5Support project directory. Please set the H5Support_SOURCE_DIR variable to the CMP directory.")
endif()
message(STATUS "H5Support_SOURCE_DIR: ${H5Support_SOURCE_DIR}")
endif()
message(STATUS "H5Support_SOURCE_DIR: ${H5Support_SOURCE_DIR}")
endif()
add_subdirectory("${H5Support_SOURCE_DIR}" "${EbsdLibProj_BINARY_DIR}/H5Support")
else()
find_package(H5Support NAMES H5Support)
add_subdirectory("${H5Support_SOURCE_DIR}" "${EbsdLibProj_BINARY_DIR}/H5Support")
endif()
else()
find_package(H5Support REQUIRED)
endif()
endif()
mark_as_advanced(EbsdLib_ENABLE_HDF5)

Expand Down
1 change: 1 addition & 0 deletions Source/EbsdLib/Core/EbsdLibConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

#pragma once

#include <cstdint>
#include <string>

/**
Expand Down
4 changes: 0 additions & 4 deletions Source/EbsdLib/SourceList.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,6 @@ add_library(${PROJECT_NAME} ${LIB_TYPE} ${EbsdLib_PROJECT_SRCS})
# Now add in the H5Support sources to the current target
if(EbsdLib_ENABLE_HDF5)
target_link_libraries(${PROJECT_NAME} PUBLIC H5Support::H5Support)
target_include_directories(${PROJECT_NAME}
PUBLIC
$<BUILD_INTERFACE:${H5Support_INCLUDE_DIRS}>
)
endif()

CMP_AddDefinitions(TARGET ${PROJECT_NAME})
Expand Down

0 comments on commit 05609fc

Please sign in to comment.