homebrew-core/Formula/open-scene-graph.rb

94 lines
3.3 KiB
Ruby

class OpenSceneGraph < Formula
desc "3D graphics toolkit"
homepage "https://github.com/openscenegraph/OpenSceneGraph"
license "LGPL-2.1-or-later" => { with: "WxWindows-exception-3.1" }
revision 2
head "https://github.com/openscenegraph/OpenSceneGraph.git", branch: "master"
stable do
url "https://github.com/openscenegraph/OpenSceneGraph/archive/OpenSceneGraph-3.6.5.tar.gz"
sha256 "aea196550f02974d6d09291c5d83b51ca6a03b3767e234a8c0e21322927d1e12"
# patch to fix build from source when asio library is present
patch do
url "https://github.com/openscenegraph/OpenSceneGraph/commit/21f5a0adfb57dc4c28b696e93beface45de28194.patch?full_index=1"
sha256 "d1e4e33b50ab006420417c7998d7e0d43d0349e6f407b5eb92a3fc6636523fbf"
end
end
bottle do
sha256 arm64_ventura: "a061b2925b3d50c71102706eb8ccb68669df838cd4a716da8a1534003a55bc33"
sha256 arm64_monterey: "cea275ac6fd59178f3d55ef6bf2ffedd5d8aab1431877007cba73d7844dc6091"
sha256 arm64_big_sur: "637623babd3324b945b39a4af706874c3f48420854e7b591e0df2ef0d1c77dc1"
sha256 ventura: "3fb06fe37e263b10478e97504eacbd3588dd50a845b3a4f8b280c43798ff67fb"
sha256 monterey: "2f2617969f263e4aa08b51fb64d9a7023c42e2d14e2c075a7a4602ba95a726f3"
sha256 big_sur: "95a78e9f79bdb83a94b9d9be412e4b4520f2467a2f55ea8479b494144175b2cf"
sha256 catalina: "1d38f6730fda72b85bdd25600cd415e747f5ade8645a6f4270d9e87dd275103e"
sha256 x86_64_linux: "43c4367454e8de65443937a3509f96d4d273b50431b0a4fde16607c88183b247"
end
depends_on "cmake" => :build
depends_on "doxygen" => :build
depends_on "graphviz" => :build
depends_on "pkg-config" => :build
depends_on "fontconfig"
depends_on "freetype"
depends_on "jpeg-turbo"
depends_on "sdl2"
on_linux do
depends_on "librsvg"
depends_on "mesa"
depends_on "mesa-glu"
end
def install
# Fix "fatal error: 'os/availability.h' file not found" on 10.11 and
# "error: expected function body after function declarator" on 10.12
# Requires the CLT to be the active developer directory if Xcode is installed
ENV["SDKROOT"] = MacOS.sdk_path if MacOS.version <= :sierra
args = std_cmake_args + %w[
-DBUILD_DOCUMENTATION=ON
-DCMAKE_DISABLE_FIND_PACKAGE_FFmpeg=ON
-DCMAKE_DISABLE_FIND_PACKAGE_GDAL=ON
-DCMAKE_DISABLE_FIND_PACKAGE_Jasper=ON
-DCMAKE_DISABLE_FIND_PACKAGE_OpenEXR=ON
-DCMAKE_DISABLE_FIND_PACKAGE_SDL=ON
-DCMAKE_DISABLE_FIND_PACKAGE_TIFF=ON
-DCMAKE_CXX_FLAGS=-Wno-error=narrowing
]
if OS.mac?
args += %w[
-DCMAKE_OSX_ARCHITECTURES=x86_64
-DOSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX=imageio
-DOSG_WINDOWING_SYSTEM=Cocoa
]
end
mkdir "build" do
system "cmake", "..", *args
system "make"
system "make", "doc_openscenegraph"
system "make", "install"
doc.install Dir["#{prefix}/doc/OpenSceneGraphReferenceDocs/*"]
end
end
test do
(testpath/"test.cpp").write <<~EOS
#include <iostream>
#include <osg/Version>
using namespace std;
int main()
{
cout << osgGetVersion() << endl;
return 0;
}
EOS
system ENV.cxx, "test.cpp", "-I#{include}", "-L#{lib}", "-losg", "-o", "test"
assert_equal `./test`.chomp, version.to_s
end
end