Skip to content

Commit

Permalink
Install instructions updated
Browse files Browse the repository at this point in the history
  • Loading branch information
harveynw committed Nov 13, 2023
1 parent 142443f commit 8c2f2f3
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 14 deletions.
1 change: 1 addition & 0 deletions tinyrender/code/install_add_subdirectory.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add_subdirectory(tinyrender)
3 changes: 0 additions & 3 deletions tinyrender/code/install_build.sh

This file was deleted.

8 changes: 8 additions & 0 deletions tinyrender/code/install_cmake.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
add_executable(YourApp source_files.cpp ...)
target_compile_features(YourApp PRIVATE cxx_std_17)

# Link + include shared library file for WebGPU
target_link_libraries(YourApp PUBLIC tinyrender)
# Do not forget this step, the WebGPU wrapper that tinyrender uses provides this function.
# Read more at: https://github.com/eliemichel/WebGPU-distribution
target_copy_webgpu_binaries(YourApp)
6 changes: 6 additions & 0 deletions tinyrender/code/install_fetch_content.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FetchContent_Declare(
tinyrender
GIT_REPOSITORY https://github.com/harveynw/tinyrender
GIT_TAG main
)
FetchContent_MakeAvailable(tinyrender)
3 changes: 1 addition & 2 deletions tinyrender/code/usage_object_appearance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
object->setColor(glm::vec3(1.0, 0.5, 0.3));

// Adding an image texture
auto texture = std::make_shared<engine::Texture2D::common::BasicImgRepeatingTexture>(engine->getContext().get(), "path/to/image.png");
object->setTexture(texture);
object->setTexture("path/to/image");
15 changes: 6 additions & 9 deletions tinyrender/install.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/bash.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/cmake.min.js"></script>
<script>hljs.highlightAll();</script>
</head>
<body>
<h1>tinyrender</h1>
Expand All @@ -25,14 +24,12 @@ <h1>tinyrender</h1>
<div class="hide-desktop"><hr></div>

<h3>Install</h3>
tinyrender is configured as a CMake project and should build with minimal configuration.

<pre><code class="code language-bash">code/install_build.sh</code></pre>

Then link with your executable:

<pre><code class="language-cmake">TODO</code>
</pre>
tinyrender is configured as a CMake project. You can either download the <a href="https://github.com/harveynw/tinyrender">github repository</a>, place it in your own project's root directory, and then:
<pre><code class="code language-cmake">code/install_add_subdirectory.cmake</code></pre>
Or even simpler, use <i>FetchContent</i>:
<pre><code class="code language-cmake">code/install_fetch_content.cmake</code></pre>
Finally, link tinyrender with your target:
<pre><code class="code language-cmake">code/install_cmake.cmake</code></pre>
</div>
</div>
<script src="scripts/code.js"></script>
Expand Down

0 comments on commit 8c2f2f3

Please sign in to comment.