From 9b6eb2c909be535e4c8765af97b4121579ab90ff Mon Sep 17 00:00:00 2001 From: Lisanna Date: Thu, 2 Feb 2023 18:38:36 -0500 Subject: FindPNG: Add default install locations on Windows Add the default install locations when PNG is built and installed from source on Windows. --- Modules/FindPNG.cmake | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/Modules/FindPNG.cmake b/Modules/FindPNG.cmake index 94d15db..043b69c 100644 --- a/Modules/FindPNG.cmake +++ b/Modules/FindPNG.cmake @@ -48,18 +48,35 @@ Since PNG depends on the ZLib compression library, none of the above will be defined unless ZLib can be found. #]=======================================================================] +# Default install location on windows when installing from included cmake build +# From FindZLIB.cmake +set(_PNG_x86 "(x86)") +set(_PNG_INCLUDE_SEARCH_NORMAL + "$ENV{ProgramFiles}/libpng" + "$ENV{ProgramFiles${_PNG_x86}}/libpng") +set(_PNG_LIB_SEARCH_NORMAL + "$ENV{ProgramFiles}/libpng/lib" + "$ENV{ProgramFiles${_PNG_x86}}/libpng/lib") +unset(_PNG_x86) + if(PNG_FIND_QUIETLY) set(_FIND_ZLIB_ARG QUIET) endif() find_package(ZLIB ${_FIND_ZLIB_ARG}) if(ZLIB_FOUND) - find_path(PNG_PNG_INCLUDE_DIR png.h PATH_SUFFIXES include/libpng) + set(_PNG_VERSION_SUFFIXES 17 16 15 14 12) + + list(APPEND _PNG_INCLUDE_PATH_SUFFIXES include/libpng) + foreach(v IN LISTS _PNG_VERSION_SUFFIXES) + list(APPEND _PNG_INCLUDE_PATH_SUFFIXES include/libpng${v}) + endforeach() + + find_path(PNG_PNG_INCLUDE_DIR png.h PATH_SUFFIXES ${_PNG_INCLUDE_PATH_SUFFIXES} PATHS ${_PNG_INCLUDE_SEARCH_NORMAL} ) mark_as_advanced(PNG_PNG_INCLUDE_DIR) list(APPEND PNG_NAMES png libpng) unset(PNG_NAMES_DEBUG) - set(_PNG_VERSION_SUFFIXES 17 16 15 14 12) if (PNG_FIND_VERSION MATCHES "^([0-9]+)\\.([0-9]+)(\\..*)?$") set(_PNG_VERSION_SUFFIX_MIN "${CMAKE_MATCH_1}${CMAKE_MATCH_2}") if (PNG_FIND_VERSION_EXACT) @@ -79,14 +96,15 @@ if(ZLIB_FOUND) # For compatibility with versions prior to this multi-config search, honor # any PNG_LIBRARY that is already specified and skip the search. if(NOT PNG_LIBRARY) - find_library(PNG_LIBRARY_RELEASE NAMES ${PNG_NAMES} NAMES_PER_DIR) - find_library(PNG_LIBRARY_DEBUG NAMES ${PNG_NAMES_DEBUG} NAMES_PER_DIR) + find_library(PNG_LIBRARY_RELEASE NAMES ${PNG_NAMES} NAMES_PER_DIR PATHS ${_PNG_LIB_SEARCH_NORMAL}) + find_library(PNG_LIBRARY_DEBUG NAMES ${PNG_NAMES_DEBUG} NAMES_PER_DIR PATHS ${_PNG_LIB_SEARCH_NORMAL}) include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) select_library_configurations(PNG) mark_as_advanced(PNG_LIBRARY_RELEASE PNG_LIBRARY_DEBUG) endif() unset(PNG_NAMES) unset(PNG_NAMES_DEBUG) + unset(_PNG_INCLUDE_PATH_SUFFIXES) # Set by select_library_configurations(), but we want the one from # find_package_handle_standard_args() below. -- cgit v0.12 From 5e8e5d4744e68b8b5d2b894e703d7a49f7cfb5e8 Mon Sep 17 00:00:00 2001 From: Lisanna Date: Thu, 2 Feb 2023 18:38:36 -0500 Subject: FindOpenCL: Add default install locations on Windows Add the default install locations when OpenCL is built and installed from source on Windows. --- Modules/FindOpenCL.cmake | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Modules/FindOpenCL.cmake b/Modules/FindOpenCL.cmake index 2b700ff..55be667 100644 --- a/Modules/FindOpenCL.cmake +++ b/Modules/FindOpenCL.cmake @@ -39,6 +39,8 @@ The module will also define two cache variables:: #]=======================================================================] +set(_OPENCL_x86 "(x86)") + function(_FIND_OPENCL_VERSION) include(CheckSymbolExists) include(CMakePushCheckState) @@ -79,6 +81,9 @@ find_path(OpenCL_INCLUDE_DIR CL/cl.h OpenCL/cl.h PATHS ENV "PROGRAMFILES(X86)" + ENV "PROGRAMFILES" + $ENV{PROGRAMFILES${_OPENCL_x86}}/OpenCLHeaders + $ENV{PROGRAMFILES}/OpenCLHeaders ENV AMDAPPSDKROOT ENV INTELOCLSDKROOT ENV NVSDKCOMPUTE_ROOT @@ -100,6 +105,9 @@ if(WIN32) NAMES OpenCL PATHS ENV "PROGRAMFILES(X86)" + ENV "PROGRAMFILES" + $ENV{PROGRAMFILES${_OPENCL_x86}}/OpenCL-ICD-Loader + $ENV{PROGRAMFILES}/OpenCL-ICD-Loader ENV AMDAPPSDKROOT ENV INTELOCLSDKROOT ENV CUDA_PATH @@ -116,6 +124,9 @@ if(WIN32) NAMES OpenCL PATHS ENV "PROGRAMFILES(X86)" + ENV "PROGRAMFILES" + $ENV{PROGRAMFILES${_OPENCL_x86}}/OpenCL-ICD-Loader + $ENV{PROGRAMFILES}/OpenCL-ICD-Loader ENV AMDAPPSDKROOT ENV INTELOCLSDKROOT ENV CUDA_PATH @@ -126,6 +137,7 @@ if(WIN32) "AMD APP/lib/x86_64" lib/x86_64 lib/x64 + lib OpenCL/common/lib/x64) endif() else() @@ -156,6 +168,8 @@ else() endif() endif() +unset(_OPENCL_x86) + set(OpenCL_LIBRARIES ${OpenCL_LIBRARY}) set(OpenCL_INCLUDE_DIRS ${OpenCL_INCLUDE_DIR}) -- cgit v0.12