Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions Formula/c/ctk.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
class Ctk < Formula
desc "Support code for medical imaging, surgical navigation, and related purposes"
homepage "https://github.com/commontk/CTK"

url "https://github.com/commontk/CTK/archive/refs/tags/2026.08.06.tar.gz"
sha256 "e2d8376b2b1644ec7112d4779549cf96cb486e671f1cb6f00ac0e3f27f1379ae"
license "Apache-2.0"
head "https://github.com/commontk/CTK.git", branch: "master"

depends_on "cmake" => :build
depends_on "itk"
depends_on "qt5compat"
depends_on "qtbase"
depends_on "qtmultimedia"
depends_on "qtscxml"
depends_on "qtsvg"
depends_on "qttools"
depends_on "qtwebengine"
depends_on "vtk"

def install
args = %w[
-DCTK_QT_VERSION=6
-DCTK_SUPERBUILD=OFF
]
system "cmake", "-S", ".", "-B", "builddir", *args, *std_cmake_args
system "cmake", "--build", "builddir"
system "cmake", "--install", "builddir"
end

test do

Check failure on line 31 in Formula/c/ctk.rb

View workflow job for this annotation

GitHub Actions / macOS 26-arm64

`brew test --verbose ctk` failed on macOS Tahoe (26) on Apple Silicon!

/opt/homebrew/Library/Homebrew/vendor/portable-ruby/4.0.6/bin/bundle ==> Testing ctk ==> /usr/bin/clang++ test.cpp -I/opt/homebrew/Cellar/ctk/2026.08.06/include/ctk-0.1 -L/opt/homebrew/Cellar/ctk/2026.08.06/lib/ctk-0.1 -lCTKCore -I/opt/homebrew/opt/qtbase/include/QtCore -F/opt/homebrew/opt/qtbase/lib -framework QtCore -o test In file included from test.cpp:1: /opt/homebrew/Cellar/ctk/2026.08.06/include/ctk-0.1/ctkLogger.h:25:10: fatal error: 'QObject' file not found 25 | #include <QObject> | ^~~~~~~~~ 1 error generated. ::error::ctk: failed An exception occurred within a child process: BuildError: Failed executing: /usr/bin/clang++ test.cpp -I/opt/homebrew/Cellar/ctk/2026.08.06/include/ctk-0.1 -L/opt/homebrew/Cellar/ctk/2026.08.06/lib/ctk-0.1 -lCTKCore -I/opt/homebrew/opt/qtbase/include/QtCore -F/opt/homebrew/opt/qtbase/lib -framework QtCore -o test /opt/homebrew/Library/Homebrew/formula.rb:3616:in 'block in Formula#system' /opt/homebrew/Library/Homebrew/formula.rb:3552:in 'IO.open' /opt/homebrew/Library/Homebrew/formula.rb:3552:in 'Formula#system' /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/4.0.0/gems/sorbet-runtime-0.6.13365/lib/types/private/methods/call_validation.rb:331:in 'UnboundMethod#bind_call' /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/4.0.0/gems/sorbet-runtime-0.6.13365/lib/types/private/methods/call_validation.rb:331:in 'T::Private::Methods::CallValidation.validate_call' /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/4.0.0/gems/sorbet-runtime-0.6.13365/lib/types/private/methods/_methods.rb:379:in 'block in Formula#_on_method_added' /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/c/ctk.rb:58:in 'block in <class:Ctk>' /opt/homebrew/Library/Homebrew/formula.rb:3314:in 'block (3 levels) in Formula#run_test' /opt/homebrew/Library/Homebrew/extend/kernel.rb:227:in 'Kernel#with_env' /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/4.0.0/gems/sorbet-runtime-0.6.13365/lib/types/private/methods/call_validation.rb:331:in 'UnboundMethod#bind_call' /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/4.0.0/gems/sorbet-runtime-0.6.13365/lib/types/private/methods/call_validation.rb:331:in 'T::Private::Methods::CallValidation.validate_call' /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/4.0.0/gems/sorbet-runtime-0.6.13365/lib/types/private/methods/_methods.rb:379:in 'block in Kernel#_on_method_added' /opt/homebrew/Library/Homebrew/formula.rb:3313:in 'block (2 levels) in Formula#run_test' /opt/homebrew/Library/Homebrew/formula.rb:1462:in 'Formula#with_logging' /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/4.0.0/gems/sorbet-runtime-0.6.13365/lib/types/private/methods/call_validation.rb:331:in 'UnboundMethod#bind_call' /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/4.0.0/gems/sorbet-runtime-0.6.13365/lib/types/private/methods/call_validation.rb:331:in 'T::Private::Methods::CallValidation.validate_call' /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/4.0.0/gems/sorbet-runtime-0.6.13365/lib/types/private/methods/_methods.rb:379:in 'block in Formula#_on_method_added' /opt/homebrew/Library/Homebrew/formula.rb:3312:in 'block in Formula#run_test' /opt/homebrew/Library/Homebrew/mktemp.rb:97:in 'block in Mktemp#run' /opt/homebrew/Library/Homebrew/mktemp.rb:97:in 'Dir.chdir' /opt/homebrew/Library/Homebrew/mktemp.rb:97:in 'Mktemp#run' /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/4.0.0/gems/sorbet-runtime-0.6.13365/lib/types/private/methods/call_validation.rb:331:in 'UnboundMethod#bind_call' /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/4.0.0/gems/sorbet-runtime-0.6.13365/lib/types/private/methods/call_validation.rb:331:in 'T::Private::Methods::CallValidation.validate_call' /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/4.0.0/gems/sorbet-runtime-0.6.13365/lib/types/private/methods/_methods.rb:379:in 'block in Mktemp#_on_method_added' /opt/homebrew/Library/Homebrew/formula.rb:3678:in 'Formula#mktemp' /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/4.0.0/gems/sorbet-runtime-0.6.13365/lib/types/private/methods/call_validation.rb:331:in 'UnboundMethod#bind_call' /opt/

Check failure on line 31 in Formula/c/ctk.rb

View workflow job for this annotation

GitHub Actions / macOS 14-arm64

`brew test --verbose ctk` failed on macOS Sonoma (14) on Apple Silicon!

/opt/homebrew/Library/Homebrew/vendor/portable-ruby/4.0.6/bin/bundle ==> Testing ctk ==> /usr/bin/clang++ test.cpp -I/opt/homebrew/Cellar/ctk/2026.08.06/include/ctk-0.1 -L/opt/homebrew/Cellar/ctk/2026.08.06/lib/ctk-0.1 -lCTKCore -I/opt/homebrew/opt/qtbase/include/QtCore -F/opt/homebrew/opt/qtbase/lib -framework QtCore -o test In file included from test.cpp:1: /opt/homebrew/Cellar/ctk/2026.08.06/include/ctk-0.1/ctkLogger.h:25:10: fatal error: 'QObject' file not found 25 | #include <QObject> | ^~~~~~~~~ 1 error generated. ::error::ctk: failed An exception occurred within a child process: BuildError: Failed executing: /usr/bin/clang++ test.cpp -I/opt/homebrew/Cellar/ctk/2026.08.06/include/ctk-0.1 -L/opt/homebrew/Cellar/ctk/2026.08.06/lib/ctk-0.1 -lCTKCore -I/opt/homebrew/opt/qtbase/include/QtCore -F/opt/homebrew/opt/qtbase/lib -framework QtCore -o test /opt/homebrew/Library/Homebrew/formula.rb:3616:in 'block in Formula#system' /opt/homebrew/Library/Homebrew/formula.rb:3552:in 'IO.open' /opt/homebrew/Library/Homebrew/formula.rb:3552:in 'Formula#system' /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/4.0.0/gems/sorbet-runtime-0.6.13365/lib/types/private/methods/call_validation.rb:331:in 'UnboundMethod#bind_call' /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/4.0.0/gems/sorbet-runtime-0.6.13365/lib/types/private/methods/call_validation.rb:331:in 'T::Private::Methods::CallValidation.validate_call' /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/4.0.0/gems/sorbet-runtime-0.6.13365/lib/types/private/methods/_methods.rb:379:in 'block in Formula#_on_method_added' /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/c/ctk.rb:58:in 'block in <class:Ctk>' /opt/homebrew/Library/Homebrew/formula.rb:3314:in 'block (3 levels) in Formula#run_test' /opt/homebrew/Library/Homebrew/extend/kernel.rb:227:in 'Kernel#with_env' /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/4.0.0/gems/sorbet-runtime-0.6.13365/lib/types/private/methods/call_validation.rb:331:in 'UnboundMethod#bind_call' /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/4.0.0/gems/sorbet-runtime-0.6.13365/lib/types/private/methods/call_validation.rb:331:in 'T::Private::Methods::CallValidation.validate_call' /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/4.0.0/gems/sorbet-runtime-0.6.13365/lib/types/private/methods/_methods.rb:379:in 'block in Kernel#_on_method_added' /opt/homebrew/Library/Homebrew/formula.rb:3313:in 'block (2 levels) in Formula#run_test' /opt/homebrew/Library/Homebrew/formula.rb:1462:in 'Formula#with_logging' /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/4.0.0/gems/sorbet-runtime-0.6.13365/lib/types/private/methods/call_validation.rb:331:in 'UnboundMethod#bind_call' /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/4.0.0/gems/sorbet-runtime-0.6.13365/lib/types/private/methods/call_validation.rb:331:in 'T::Private::Methods::CallValidation.validate_call' /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/4.0.0/gems/sorbet-runtime-0.6.13365/lib/types/private/methods/_methods.rb:379:in 'block in Formula#_on_method_added' /opt/homebrew/Library/Homebrew/formula.rb:3312:in 'block in Formula#run_test' /opt/homebrew/Library/Homebrew/mktemp.rb:97:in 'block in Mktemp#run' /opt/homebrew/Library/Homebrew/mktemp.rb:97:in 'Dir.chdir' /opt/homebrew/Library/Homebrew/mktemp.rb:97:in 'Mktemp#run' /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/4.0.0/gems/sorbet-runtime-0.6.13365/lib/types/private/methods/call_validation.rb:331:in 'UnboundMethod#bind_call' /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/4.0.0/gems/sorbet-runtime-0.6.13365/lib/types/private/methods/call_validation.rb:331:in 'T::Private::Methods::CallValidation.validate_call' /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/4.0.0/gems/sorbet-runtime-0.6.13365/lib/types/private/methods/_methods.rb:379:in 'block in Mktemp#_on_method_added' /opt/homebrew/Library/Homebrew/formula.rb:3678:in 'Formula#mktemp' /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/4.0.0/gems/sorbet-runtime-0.6.13365/lib/types/private/methods/call_validation.rb:331:in 'UnboundMethod#bind_call' /opt/
(testpath/"test.cpp").write <<~CPP
#include <ctkLogger.h>
int main() {
ctkLogger logger("org.commontk.test");
logger.info("OK");
return 0;
}
CPP
flags = ["-I#{formula_opt_include("qtbase")}/QtCore"]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SMillerDev do you happen to know what is the proper way of making QObject.h visible for the compiler? For the test to work.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, you might be better off letting CMake do it for you.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried copy-pasting the structure present Formula/q/qtkeychain.rb and also tried with /QtCore variant but to no avail.

flags += if OS.mac?
[
"-F#{formula_opt_lib("qtbase")}",
"-framework", "QtCore"
]
else
[
"-fPIC",
"-L#{formula_opt_lib("qtbase")}", "-lQt6Core",
"-Wl,-rpath,#{formula_opt_lib("qtbase")}",
"-Wl,-rpath,#{lib}"
]
end
system ENV.cxx, "test.cpp",
"-I#{include}/ctk-0.1",
"-L#{lib}/ctk-0.1", "-lCTKCore",
*flags,
"-o", "test"
assert_match "OK", shell_output("./test")
end
end
Loading