diff --git a/.vcpkg/linux.cmake b/.vcpkg/linux.cmake new file mode 100644 index 000000000..6794dda10 --- /dev/null +++ b/.vcpkg/linux.cmake @@ -0,0 +1,7 @@ +set(VCPKG_TARGET_TRIPLET x64-linux) + +if(NOT DEFINED ENV{VCPKG_ROOT}) + message(FATAL_ERROR "ERROR: VCPKG_ROOT environment variable is not defined. Please set it to the root directory of your vcpkg installation.") +endif() +file(TO_CMAKE_PATH $ENV{VCPKG_ROOT} VCPKG_ROOT) +include(${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake) diff --git a/.vcpkg/osx.cmake b/.vcpkg/osx.cmake new file mode 100644 index 000000000..f6420d637 --- /dev/null +++ b/.vcpkg/osx.cmake @@ -0,0 +1,7 @@ +set(VCPKG_TARGET_TRIPLET x64-osx) + +if(NOT DEFINED ENV{VCPKG_ROOT}) + message(FATAL_ERROR "ERROR: VCPKG_ROOT environment variable is not defined. Please set it to the root directory of your vcpkg installation.") +endif() +file(TO_CMAKE_PATH $ENV{VCPKG_ROOT} VCPKG_ROOT) +include(${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake) diff --git a/.vcpkg/windows.cmake b/.vcpkg/windows.cmake new file mode 100644 index 000000000..8ba55c929 --- /dev/null +++ b/.vcpkg/windows.cmake @@ -0,0 +1,7 @@ +set(VCPKG_TARGET_TRIPLET x64-windows-static) + +if(NOT DEFINED ENV{VCPKG_ROOT}) + message(FATAL_ERROR "ERROR: VCPKG_ROOT environment variable is not defined. Please set it to the root directory of your vcpkg installation.") +endif() +file(TO_CMAKE_PATH $ENV{VCPKG_ROOT} VCPKG_ROOT) +include(${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake) diff --git a/CMakeLists.txt b/CMakeLists.txt index ea3262089..4fb146361 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,9 @@ add_definitions(-D_HAS_AUTO_PTR_ETC) if(APPLE) set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64") endif() +if(WIN32) + add_definitions(-DWINDOWS -DNOMINMAX) +endif() option(BUILD_EXAMPLE_PLUGINS "Build example plugins" OFF) option(OFX_SUPPORTS_OPENGLRENDER "Build with support for GPU rendering (OpenGL/CUDA/Metal/OpenCL)" ON) @@ -19,9 +22,9 @@ endif() list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ${CMAKE_BINARY_DIR} ) -# Conan packages -find_package(EXPAT) -find_package(opengl_system) +# Dependencies +find_package(expat CONFIG REQUIRED) +find_package(OpenGL REQUIRED) # Macros set(OFX_SUPPORT_SYMBOLS_DIR ${PROJECT_SOURCE_DIR}/symbols) @@ -43,3 +46,31 @@ add_subdirectory(Support) if(BUILD_EXAMPLE_PLUGINS) add_subdirectory(Examples) endif() + +# Install +install(TARGETS OfxSupport OfxHost + EXPORT OpenFXTargets + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) + +install(DIRECTORY ${OFX_SUPPORT_SYMBOLS_DIR}/ DESTINATION symbols) + +# Package +include(CMakePackageConfigHelpers) + +export(EXPORT OpenFXTargets + FILE "${CMAKE_CURRENT_BINARY_DIR}/OpenFXTargets.cmake" + NAMESPACE OpenFX::) + +configure_package_config_file(cmake/OpenFXConfig.cmake.in + "${CMAKE_CURRENT_BINARY_DIR}/OpenFXConfig.cmake" + INSTALL_DESTINATION lib/cmake/OpenFX) + +install(EXPORT OpenFXTargets + FILE OpenFXTargets.cmake + NAMESPACE OpenFX:: + DESTINATION lib/cmake/OpenFX) + +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/OpenFXConfig.cmake" + DESTINATION lib/cmake/OpenFX) diff --git a/Examples/CMakeLists.txt b/Examples/CMakeLists.txt index ae9421b95..90806f389 100644 --- a/Examples/CMakeLists.txt +++ b/Examples/CMakeLists.txt @@ -17,9 +17,9 @@ foreach(PLUGIN IN LISTS PLUGINS) set(TGT example-${PLUGIN}) add_ofx_plugin(${TGT} ${PLUGIN}) target_sources(${TGT} PUBLIC ${PLUGIN_SOURCES}) - target_link_libraries(${TGT} ${CONAN_LIBS}) + target_link_libraries(${TGT}) target_include_directories(${TGT} PUBLIC ${OFX_HEADER_DIR}) endforeach() -target_link_libraries(example-OpenGL PRIVATE opengl::opengl) -target_link_libraries(example-Custom PRIVATE opengl::opengl) +target_link_libraries(example-OpenGL PRIVATE OpenGL::GL) +target_link_libraries(example-Custom PRIVATE OpenGL::GL) diff --git a/HostSupport/CMakeLists.txt b/HostSupport/CMakeLists.txt index 263242b76..33799dd96 100644 --- a/HostSupport/CMakeLists.txt +++ b/HostSupport/CMakeLists.txt @@ -16,7 +16,16 @@ endif() target_link_libraries(OfxHost PUBLIC expat::expat) -target_include_directories(OfxHost PUBLIC +target_include_directories(OfxHost PRIVATE ${OFX_HEADER_DIR} - ${OFX_HOSTSUPPORT_HEADER_DIR} - ${expat_INCLUDE_DIR}) + ${OFX_HOSTSUPPORT_HEADER_DIR}) + +target_include_directories(OfxHost INTERFACE + $ + $ + $) + +install(FILES + ${OFX_HEADER_FILES} + ${OFX_HOSTSUPPORT_HEADER_FILES} + DESTINATION include) diff --git a/Support/Library/CMakeLists.txt b/Support/Library/CMakeLists.txt index 5f72b7f05..eb0ec3240 100644 --- a/Support/Library/CMakeLists.txt +++ b/Support/Library/CMakeLists.txt @@ -11,6 +11,16 @@ if(NOT MSVC) set_target_properties(OfxSupport PROPERTIES COMPILE_FLAGS "-fPIC") endif() -target_include_directories(OfxSupport PUBLIC +target_include_directories(OfxSupport PRIVATE ${OFX_HEADER_DIR} ${OFX_SUPPORT_HEADER_DIR}) + +target_include_directories(OfxSupport INTERFACE + $ + $ + $) + +install(FILES + ${OFX_HEADER_FILES} + ${OFX_SUPPORT_HEADER_FILES} + DESTINATION include) diff --git a/Support/Plugins/CMakeLists.txt b/Support/Plugins/CMakeLists.txt index 0bb2493b6..23ee7e83f 100644 --- a/Support/Plugins/CMakeLists.txt +++ b/Support/Plugins/CMakeLists.txt @@ -16,6 +16,6 @@ foreach(PLUGIN IN LISTS PLUGINS) set(TGT example-${PLUGIN}-support) add_ofx_plugin(${TGT} ${PLUGIN}) target_sources(${TGT} PUBLIC ${PLUGIN_SOURCES}) - target_link_libraries(${TGT} ${CONAN_LIBS} OfxSupport opengl::opengl) + target_link_libraries(${TGT} OfxSupport OpenGL::GL) target_include_directories(${TGT} PUBLIC ${OFX_HEADER_DIR} ${OFX_SUPPORT_HEADER_DIR}) endforeach() diff --git a/Support/PropTester/CMakeLists.txt b/Support/PropTester/CMakeLists.txt index 44bb26f05..f85cf73e1 100644 --- a/Support/PropTester/CMakeLists.txt +++ b/Support/PropTester/CMakeLists.txt @@ -3,5 +3,5 @@ file(GLOB_RECURSE PLUGIN_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp") set(TGT example-PropTester) add_ofx_plugin(${TGT} ${CMAKE_CURRENT_SOURCE_DIR}) target_sources(${TGT} PUBLIC ${PLUGIN_SOURCES}) -target_link_libraries(${TGT} ${CONAN_LIBS} OfxSupport opengl::opengl) +target_link_libraries(${TGT} OfxSupport OpenGL::GL) target_include_directories(${TGT} PUBLIC ${OFX_HEADER_DIR} ${OFX_SUPPORT_HEADER_DIR}) diff --git a/cmake/OpenFXConfig.cmake.in b/cmake/OpenFXConfig.cmake.in new file mode 100644 index 000000000..123401840 --- /dev/null +++ b/cmake/OpenFXConfig.cmake.in @@ -0,0 +1,8 @@ +@PACKAGE_INIT@ +include(CMakeFindDependencyMacro) + +set(OPENFX_INCLUDE_DIRS "@CMAKE_INSTALL_PREFIX@/include") +find_dependency(expat CONFIG REQUIRED) +find_dependency(OpenGL REQUIRED) + +include("${CMAKE_CURRENT_LIST_DIR}/OpenFXTargets.cmake") diff --git a/conanfile.py b/conanfile.py deleted file mode 100644 index 1bb30fa0f..000000000 --- a/conanfile.py +++ /dev/null @@ -1,89 +0,0 @@ -from conan import ConanFile -from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -from conan.tools.files import copy, collect_libs -import os.path - -required_conan_version = ">=1.59.0" - -class openfx(ConanFile): - name = "openfx" - version = "1.4.0" - license = "BSD-3-Clause" - url = "https://github.com/AcademySoftwareFoundation/openfx" - description = "OpenFX image processing plug-in standard" - - requires = ( - "opengl/system", - "expat/2.4.8" # for HostSupport - ) - - exports_sources = ( - "cmake/*", - "Examples/*", - "HostSupport/*", - "include/*", - "scripts/*", - "Support/*", - "symbols/*", - "CMakeLists.txt", - "LICENSE", - "README.md", - "INSTALL.md" - ) - - settings = "os", "arch", "compiler", "build_type" - - default_options = { - "expat/*:shared": True - } - - def layout(self): - cmake_layout(self) - - def generate(self): - deps = CMakeDeps(self) - deps.generate() - - tc = CMakeToolchain(self) - if self.settings.os == "Windows": - tc.preprocessor_definitions["WINDOWS"] = 1 - tc.preprocessor_definitions["NOMINMAX"] = 1 - tc.generate() - - def build(self): - cmake = CMake(self) - cmake.configure() - cmake.build() - - def package(self): - copy(self, "cmake/*", src=self.source_folder, dst=self.package_folder) - copy(self, "LICENSE, README.md, INSTALL.md", src=self.source_folder, dst=self.package_folder) - copy(self, "include/*.h", src=self.source_folder, dst=self.package_folder) - copy(self,"HostSupport/include/*.h", src=self.source_folder, dst=self.package_folder) - copy(self,"Support/*.h", src=self.source_folder, dst=self.package_folder) - copy(self,"Support/Plugins/include/*.h", src=self.source_folder, dst=self.package_folder) - copy(self,"*.a", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) - copy(self,"*.lib", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) - copy(self,"*.ofx", src=self.build_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) - copy(self,"*.dll", src=self.build_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) - copy(self,"*.so", src=self.build_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) - copy(self,"*.symbols", src=self.source_folder, dst=os.path.join(self.package_folder, "symbols"), keep_path=False) - - def package_info(self): - libs = collect_libs(self) - - self.cpp_info.set_property("cmake_build_modules", [os.path.join("cmake", "OpenFX.cmake")]) - self.cpp_info.builddirs = ["symbols"] - self.cpp_info.components["Api"].includedirs = ["include"] - self.cpp_info.components["HostSupport"].libs = [i for i in libs if "OfxHost" in i] - self.cpp_info.components["HostSupport"].includedirs = ["HostSupport/include"] - self.cpp_info.components["HostSupport"].requires = ["expat::expat"] - self.cpp_info.components["Support"].libs = [i for i in libs if "OfxSupport" in i] - self.cpp_info.components["Support"].includedirs = ["Support/include"] - self.cpp_info.components["Support"].requires = ["opengl::opengl"] - - if self.settings.os == "Windows": - win_defines = ["WINDOWS", "NOMINMAX"] - self.cpp_info.components["Api"].defines = win_defines - self.cpp_info.components["HostSupport"].defines = win_defines - self.cpp_info.components["Support"].defines = win_defines diff --git a/test_package/CMakeLists.txt b/test_package/CMakeLists.txt index 4ba66c09c..5a2c06933 100644 --- a/test_package/CMakeLists.txt +++ b/test_package/CMakeLists.txt @@ -3,14 +3,12 @@ project(PackageTest CXX) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) -find_package(openfx CONFIG REQUIRED) +find_package(OpenFX CONFIG REQUIRED) add_executable(test_package src/test_package.cpp) -target_include_directories(test_package PUBLIC ${openfx_INCLUDE_DIRS}) -target_link_libraries(test_package openfx::HostSupport) +target_link_libraries(test_package OpenFX::OfxHost) file(GLOB_RECURSE PLUGIN_SOURCES "../Support/Plugins/Invert/*.cpp") add_ofx_plugin(invert_plugin ../Support/Plugins/Invert) target_sources(invert_plugin PUBLIC ${PLUGIN_SOURCES}) -target_include_directories(invert_plugin PUBLIC ${openfx_INCLUDE_DIRS}) -target_link_libraries(invert_plugin openfx::Support) \ No newline at end of file +target_link_libraries(invert_plugin OpenFX::OfxSupport) \ No newline at end of file diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json new file mode 100644 index 000000000..bef09525d --- /dev/null +++ b/vcpkg-configuration.json @@ -0,0 +1,7 @@ +{ + "default-registry": { + "kind": "git", + "repository": "https://github.com/microsoft/vcpkg", + "baseline": "4a600e9fea71bd7872080cbb716797e04d30e6d3" + } +} diff --git a/vcpkg.json b/vcpkg.json new file mode 100644 index 000000000..40f7546f0 --- /dev/null +++ b/vcpkg.json @@ -0,0 +1,14 @@ +{ + "name": "openfx", + "version": "1.4.0", + "description": "OpenFX image processing plug-in standard.", + "homepage": "https://github.com/AcademySoftwareFoundation/openfx", + "dependencies": [ + "opengl", + "expat" + ], + "overrides": [ + { "name": "opengl", "version-string": "2022-12-04#3" }, + { "name": "expat", "version": "2.5.0#3" } + ] +}