Closed janimatic closed 3 months ago
I'm currently using conan 2.1.0, and cmake 3.28.1 on Windows (and python 3.12.1). A clean build of the current main
branch (60262ef) works for me in that case, using scripts/build.sh
. Does that (latest) version of conan work for you? If so, I'll update the README.
I have not tried building OpenCL on Windows though. I'll try your suggestions.
Please note that the gpu-gain-example branch has now been merged into main, so please test on main.
Glad it's working now! I think if you want OpenCL support you also have to add "-DOFX_SUPPORTS_OPENCLRENDER" to your cmake line; see scripts/build-cmake.sh
.
Also, Is your last note about hpp headers something we should include in our GPUGain sample? I'm not all that familiar with OpenCL.
I confirm that "conan>=2.1.0" is working perfectly I had to manually remove conan's cache, and create a default profile (with conan profile detect) :
rmdir /s /q %userprofile%\.conan
rmdir /s /q %userprofile%\.conan2
pip install --force-reinstall -v "conan>=2.1.0"
conan --version
conan profile detect
In the main branch :
conan install -s build_type=Release --build=missing .
cmake --build build --config Release
In the opencl branch :
conan install -s build_type=Release --build=missing . -o use_opencl=True
cmake --build build --config Release
It builds fine.
I could switch to hpp headers and choose opencl version
//#include <CL/cl.h>
#define CL_HPP_TARGET_OPENCL_VERSION 200
#include <CL/opencl.hpp>
Thanks! (sorry for my cross posting mess...)
Also, Is your last note about hpp headers something we should include in our GPUGain sample? I'm not all that familiar with OpenCL.
yes i think you can safely replace the include by hpp as it works with the current opencl packages. That might be handy to be able to switch opencl version, with some drivers.
I just noticed that, when switching to hpp, opencl2.0 is the minimum though,
# define CL_HPP_MINIMUM_OPENCL_VERSION 200
I am not sure if that's the case with cl.h
https://stackoverflow.com/questions/40613243/cant-run-any-available-opencl-sample-with-recent-api-cl-cl2-hpp
EDIT: sorry for the confusion, actually you can go lower, if some driver needs it :
#define CL_HPP_MINIMUM_OPENCL_VERSION 120
#define CL_HPP_TARGET_OPENCL_VERSION 120
Hello @garyo and everyone, Do you have any guideline about creating cmake based project from scratch, linking OpenFx ? Is it recommended to use cmake's FetchContent with conan at all ? Or do you have some dev releases packages that could be later easily integrated in github workflow actions ? (for the moment, i've just worked in the plugin folder of my openfx fork to avoid those questions...) Thanks ! Best regard Julien
ps : using openfx as a git submodule was much easier, thanks anyway...
Git submodule is what some other folks are doing too; that should work fine. I am hoping to package up the conan recipe to put on conancenter soon; that should make it even easier to work with. I would love any help with that.
BTW, this isn't OpenFX-specific (yet!), but I did create a simple CMake+Conan plugin build template at https://github.com/garyo/cmake-conan-plugin-template -- you might find it useful.
This is now merged in as #149
Hello, I am using vs2019 under windows10 x64 with gpu-gain-example branch to test opencl image vs opencl buffer.
The README.md should be updated with conan version
I had success with conan<2, but Gary mentioned conan v 2 (2.0.1?) is working for him. following https://github.com/AcademySoftwareFoundation/openfx/pull/113 and the current README.md instructions
pip install --force-reinstall -v "conan<2.0.0" conan install -s build_type=Release --build=missing . cmake --build build/Release --config Release cmake --build build --config Release
if(WIN32) if (OFX_SUPPORTS_OPENCLRENDER) set(OpenCL_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/OpenCL/include) set(OpenCL_LIBRARY ${PROJECT_SOURCE_DIR}/OpenCL/lib/x86_64/OpenCL.lib)
find_package(OpenCL REQUIRED)
endif()
foreach(PLUGIN IN LISTS PLUGINS) [...] elseif(WIN32) if (OFX_SUPPORTS_OPENCLRENDER) target_include_directories(${TGT} PUBLIC "${OpenCL_INCLUDE_DIR}") target_link_libraries(${TGT} "${OpenCL_LIBRARY}") endif() else() endif() endforeach()
ifdef APPLE
include <OpenCL/cl.h>
else
//#include <CL/cl.h> //#define CL_HPP_TARGET_OPENCL_VERSION 200
include <CL/opencl.hpp>
endif