You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ecf2fd4
Browse filesBrowse the repository at this point in the historyBrowse files
<p>Rice includes a <code>CMakePresets.json</code> file (in the <code>test</code> directory) that provides pre-configured build settings for various platforms and compilers. Using presets is highly recommended as they encode the correct compiler flags for each platform.</p>
3398
+
<p>Rice includes a <code>CMakePresets.json</code> file that provides pre-configured build settings for various platforms and compilers. Using presets is highly recommended as they encode the correct compiler flags for each platform.</p>
3366
3399
<p>The available presets include:</p>
3367
3400
<ul>
3368
3401
<li><code>linux-debug</code> / <code>linux-release</code> - Linux with GCC</li>
@@ -3416,7 +3449,7 @@ <h2 id="example">Example<a class="headerlink" href="#example" title="Permanent l
<p>Currently you will need to manually specify where the Rice <ahref="../packaging/#header-files">header files</a> are located.</p>
3429
-
<p>Note that using the <code>Ruby::Ruby</code> imported target (available in CMake 3.18+) is preferred over manually specifying include directories and libraries, as it automatically sets up all necessary include paths and link libraries.</p>
3462
+
<p>Note that using the <code>Ruby::Module</code> imported target is preferred over manually specifying include directories and libraries, as it automatically sets up all necessary include paths and compiler settings for building Ruby extensions.</p>
<p>Rice's <code>FindRuby.cmake</code> provides modern CMake imported targets:</p>
3493
+
<table>
3494
+
<thead>
3495
+
<tr>
3496
+
<th>Target</th>
3497
+
<th>Description</th>
3498
+
</tr>
3499
+
</thead>
3500
+
<tbody>
3501
+
<tr>
3502
+
<td><code>Ruby::Interpreter</code></td>
3503
+
<td>Ruby interpreter executable</td>
3504
+
</tr>
3505
+
<tr>
3506
+
<td><code>Ruby::Module</code></td>
3507
+
<td>For building Ruby extension modules. Use this for gems with native extensions. On Unix, does not link to libruby (symbols resolved at load time). Includes hidden visibility settings.</td>
3508
+
</tr>
3509
+
<tr>
3510
+
<td><code>Ruby::Ruby</code></td>
3511
+
<td>For embedding Ruby in C/C++ applications. Links to libruby.</td>
3512
+
</tr>
3513
+
</tbody>
3514
+
</table>
3515
+
<p>Embedding Ruby (including Rice's C++ test runner) requires a shared Ruby library to be available.
3516
+
Extension-only modules should link <code>Ruby::Module</code> and can build on macOS/Linux without a shared
3517
+
libruby.</p>
3518
+
<p>For building Ruby extensions, use <code>Ruby::Module</code>:</p>
<p>For a complete, real-world example of using CMake with Rice, see <ahref="https://github.com/ruby-rice/BitmapPlusPlus-ruby/blob/main/ext/CMakeLists.txt">BitmapPlusPlus-ruby</a>.</p>
3600
+
<p>This example demonstrates:</p>
3601
+
<ul>
3602
+
<li>Fetching Rice via <code>FetchContent</code></li>
3603
+
<li>Using <code>Ruby::Module</code> for extension modules</li>
3604
+
<li>Using <code>Rice::Rice</code> for Rice headers</li>
<p>The second option is to simply copy them from <ahref="https://github.com/ruby-rice/rice/tree/master/include/rice">github</a> and copy them into your repo. Remember the provided link points to the master branch - you should pick a specific release tag and use those instead.</p>
<p>Rice extensions requires several compiler settings to be set. These are captured in the <ahref="https://github.com/ruby-rice/rice/blob/master/test/CMakePresets.json">CMakePresets.json</a> file for all supported platforms.</p>
3386
+
<p>Rice extensions requires several compiler settings to be set. These are captured in the <ahref="https://github.com/ruby-rice/rice/blob/master/CMakePresets.json">CMakePresets.json</a> file for all supported platforms.</p>
0 commit comments