Skip to content

Commit

Permalink
Vcpkg: Build
Browse files Browse the repository at this point in the history
  • Loading branch information
Iswenzz committed Sep 24, 2023
1 parent 95a1179 commit 6101617
Show file tree
Hide file tree
Showing 14 changed files with 115 additions and 106 deletions.
7 changes: 7 additions & 0 deletions .vcpkg/linux.cmake
Original file line number Diff line number Diff line change
@@ -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)
7 changes: 7 additions & 0 deletions .vcpkg/osx.cmake
Original file line number Diff line number Diff line change
@@ -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)
7 changes: 7 additions & 0 deletions .vcpkg/windows.cmake
Original file line number Diff line number Diff line change
@@ -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)
37 changes: 34 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
6 changes: 3 additions & 3 deletions Examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
15 changes: 12 additions & 3 deletions HostSupport/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
$<BUILD_INTERFACE:${OFX_HEADER_DIR}>
$<BUILD_INTERFACE:${OFX_HOSTSUPPORT_HEADER_DIR}>
$<INSTALL_INTERFACE:include>)

install(FILES
${OFX_HEADER_FILES}
${OFX_HOSTSUPPORT_HEADER_FILES}
DESTINATION include)
12 changes: 11 additions & 1 deletion Support/Library/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
$<BUILD_INTERFACE:${OFX_HEADER_DIR}>
$<BUILD_INTERFACE:${OFX_SUPPORT_HEADER_DIR}>
$<INSTALL_INTERFACE:include>)

install(FILES
${OFX_HEADER_FILES}
${OFX_SUPPORT_HEADER_FILES}
DESTINATION include)
2 changes: 1 addition & 1 deletion Support/Plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
2 changes: 1 addition & 1 deletion Support/PropTester/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
8 changes: 8 additions & 0 deletions cmake/OpenFXConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -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")
89 changes: 0 additions & 89 deletions conanfile.py

This file was deleted.

8 changes: 3 additions & 5 deletions test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
target_link_libraries(invert_plugin OpenFX::OfxSupport)
7 changes: 7 additions & 0 deletions vcpkg-configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"default-registry": {
"kind": "git",
"repository": "https://github.com/microsoft/vcpkg",
"baseline": "4a600e9fea71bd7872080cbb716797e04d30e6d3"
}
}
14 changes: 14 additions & 0 deletions vcpkg.json
Original file line number Diff line number Diff line change
@@ -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" }
]
}

0 comments on commit 6101617

Please sign in to comment.