@@ -107,7 +107,7 @@ macro(pass_through_cpack_vars)
107107endmacro ()
108108
109109# don't allow implicit function declarations
110- if (UNIX )
110+ if (UNIX OR MINGW )
111111 if ((CMAKE_C_COMPILER_ID STREQUAL "GNU" ) OR
112112 (CMAKE_C_COMPILER_ID STREQUAL "Clang" ) OR
113113 (CMAKE_C_COMPILER_ID STREQUAL "AppleClang" ))
@@ -404,10 +404,6 @@ if(ENABLE_LLVM_PLATFORM_SUPPORT)
404404 if (NOT ENABLE_LLVM)
405405 message (FATAL_ERROR "ENABLE_LLVM_PLATFORM_SUPPORT requires also ENABLE_LLVM" )
406406 endif ()
407- if (ENABLE_LOADABLE_DRIVERS)
408- message (WARNING "LLVM dynlibs implementation doesn't support loadable drivers, disabling." )
409- set (ENABLE_LOADABLE_DRIVERS 0)
410- endif ()
411407 if (ENABLE_PRINTF_IMMEDIATE_FLUSH)
412408 message (WARNING "LLVM dynlibs implementation doesn't support printf() immediate flush, disabling." )
413409 set (ENABLE_PRINTF_IMMEDIATE_FLUSH 0)
@@ -494,11 +490,22 @@ set(COMMAND_USES_TERMINAL USES_TERMINAL)
494490
495491include (GNUInstallDirs)
496492
497- # for libpocl.so
498- set (POCL_INSTALL_PUBLIC_LIBDIR "${CMAKE_INSTALL_FULL_LIBDIR} " CACHE PATH "POCL public libdir" )
493+ # for (lib)pocl.(so|dll|dylib)
494+ if (WIN32 )
495+ set (POCL_INSTALL_PUBLIC_LIBDIR "${CMAKE_INSTALL_FULL_BINDIR} " CACHE PATH "POCL public libdir" )
496+ else ()
497+ set (POCL_INSTALL_PUBLIC_LIBDIR "${CMAKE_INSTALL_FULL_LIBDIR} " CACHE PATH "POCL public libdir" )
498+ endif ()
499+
500+ # for (lib)pocl-devices-*.(so|dll|dylib)
501+ set (POCL_INSTALL_PRIVATE_LIBDIR "${POCL_INSTALL_PUBLIC_LIBDIR} /pocl" CACHE PATH "POCL private libdir" )
499502
500- # for libpocl-devices-*.so
501- set (POCL_INSTALL_PRIVATE_LIBDIR "${CMAKE_INSTALL_FULL_LIBDIR} /pocl" CACHE PATH "POCL private libdir" )
503+ # for libpocl.(a|dll.a)
504+ if (WIN32 )
505+ set (POCL_INSTALL_STATIC_LIBDIR "${CMAKE_INSTALL_FULL_LIBDIR} " CACHE PATH "POCL public libdir" )
506+ else ()
507+ set (POCL_INSTALL_STATIC_LIBDIR "${POCL_INSTALL_PUBLIC_LIBDIR} /static" CACHE PATH "POCL public libdir" )
508+ endif ()
502509
503510# for pocl.icd
504511set (POCL_INSTALL_ICD_VENDORDIR "${CMAKE_INSTALL_FULL_SYSCONFDIR} /OpenCL/vendors" CACHE PATH "POCL ICD file destination" )
@@ -742,7 +749,7 @@ endif()
742749
743750######################################################################################
744751
745- if (UNIX )
752+ if (UNIX OR MINGW )
746753 include (CheckCSourceCompiles)
747754 include (CheckSymbolExists)
748755
@@ -909,6 +916,10 @@ if(NOT DEFINED DEFAULT_ENABLE_IPO)
909916
910917 if (DEVELOPER_MODE)
911918 set (IPO 0)
919+ elseif (MINGW)
920+ # XXX: IPO on MinGW runs into linker errors (such as `two or more sections
921+ # for .gnu.lto__ZN4llvm12DenseMapInfoIPKNS_8MetadataEvE7isEqualES3_S3_.65576.2f694590`)
922+ set (IPO 0)
912923 else ()
913924 include (CheckIPOSupported)
914925 check_ipo_supported(RESULT IPO OUTPUT IPO_OUTPUT)
@@ -1133,14 +1144,17 @@ endif()
11331144######################################################################################
11341145
11351146if (ENABLE_HOST_CPU_DEVICES AND PKG_CONFIG_FOUND AND NOT ENABLE_CONFORMANCE)
1147+ # PoCL requires libxsmm to support LIBXSMM_DATATYPE_F16, which was added after the
1148+ # 1.17 release. Until there is a new release, building libxsmm from git and
1149+ # manually updating the version number in version.txt before building is necessary.
11361150 if (BUILD_SHARED_LIBS )
1137- pkg_check_modules(LIBXSMM IMPORTED_TARGET libxsmm-shared>=1.15 )
1151+ pkg_check_modules(LIBXSMM IMPORTED_TARGET libxsmm-shared>1.17.0 )
11381152 endif ()
11391153 if (NOT LIBXSMM_FOUND)
1140- pkg_check_modules(LIBXSMM IMPORTED_TARGET libxsmm-static >=1.15 )
1154+ pkg_check_modules(LIBXSMM IMPORTED_TARGET libxsmm-static >1.17.0 )
11411155 endif ()
11421156 if (NOT LIBXSMM_FOUND)
1143- pkg_check_modules(LIBXSMM IMPORTED_TARGET libxsmm>=1.15 )
1157+ pkg_check_modules(LIBXSMM IMPORTED_TARGET libxsmm>1.17.0 )
11441158 endif ()
11451159
11461160 # libxsmm needs BLAS as fallback
@@ -1155,6 +1169,8 @@ if(LIBXSMM_FOUND AND TARGET BLAS::BLAS)
11551169else ()
11561170 set (HAVE_LIBXSMM 0)
11571171 message (STATUS "libxsmm or libblas not found, XSMM disabled" )
1172+ message (STATUS "NOTE: If you meant to use a git build of libxsmm you may have to manually bump "
1173+ "the version in its version.txt before building." )
11581174endif ()
11591175
11601176function (print_target_properties target )
@@ -1193,7 +1209,9 @@ if(ENABLE_HOST_CPU_DEVICES AND NOT ENABLE_CONFORMANCE)
11931209 set (HAVE_ONNXRT ON )
11941210 endif ()
11951211 else ()
1196- find_package (onnxruntime QUIET )
1212+ # PoCL requires SetUserLoggingFunction which was introduced in 1.17,
1213+ # search for a version that is compatible with this.
1214+ find_package (onnxruntime 1.17 QUIET )
11971215 set (HAVE_ONNXRT ${onnxruntime_FOUND} )
11981216 if (${HAVE_ONNXRT} )
11991217 # TODO: this is a hack, just passing onnxruntime::onnxruntime
@@ -2177,9 +2195,11 @@ configure_file("cl_offline_compiler.sh.in.cmake" "cl_offline_compiler.sh.config.
21772195rename_if_different(
21782196 "${CMAKE_BINARY_DIR} /cl_offline_compiler.sh.config.new"
21792197 "${CMAKE_BINARY_DIR} /cl_offline_compiler.sh.config" 1)
2180- file (GENERATE
2181- OUTPUT "${CMAKE_BINARY_DIR} /cl_offline_compiler.sh"
2182- INPUT "${CMAKE_BINARY_DIR} /cl_offline_compiler.sh.config" )
2198+ if (ENABLE_SPIRV)
2199+ file (GENERATE
2200+ OUTPUT "${CMAKE_BINARY_DIR} /cl_offline_compiler.sh"
2201+ INPUT "${CMAKE_BINARY_DIR} /cl_offline_compiler.sh.config" )
2202+ endif ()
21832203
21842204include_directories ("${CMAKE_BINARY_DIR} " )
21852205
@@ -2226,7 +2246,7 @@ endif()
22262246
22272247##########################################################
22282248
2229- if (UNIX )
2249+ if (UNIX OR MINGW )
22302250 configure_file ("${CMAKE_SOURCE_DIR} /pocl.pc.in.cmake" "${CMAKE_BINARY_DIR} /pocl.pc" @ONLY)
22312251 install (FILES "${CMAKE_BINARY_DIR} /pocl.pc"
22322252 DESTINATION "${POCL_INSTALL_PKGCONFIG_DIR} " COMPONENT "dev" )
@@ -2296,7 +2316,7 @@ set(POCLU_LINK_OPTIONS poclu ${OPENCL_LIBS} ${LIBMATH})
22962316message (STATUS "POCLU LINK OPTS: ${POCLU_LINK_OPTIONS} " )
22972317
22982318# poclcc bin
2299- if (ENABLE_POCLCC)
2319+ if (ENABLE_POCLCC OR ENABLE_SPIRV )
23002320 add_subdirectory ("bin" )
23012321endif ()
23022322
0 commit comments