Skip to content

Commit

Permalink
Make 'Hello, World' example reader/writer downloadable (AcademySoftwa…
Browse files Browse the repository at this point in the history
…reFoundation#1620)

Signed-off-by: Cary Phillips <cary@ilm.com>
  • Loading branch information
cary-ilm committed Feb 2, 2024
1 parent 9503110 commit 8743203
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 24 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ for more information.
# Quick Start

See the [technical documentation](https://openexr.readthedocs.io) for
complete details, but to get started, the "hello, world" `.exr` writer program is:
complete details, but to get started, the "Hello, world" [`exrwriter.cpp`](https://raw.githubusercontent.com/AcademySoftwareFoundation/openexr/main/website/src/exrwriter/exrwriter.cpp) writer program is:

#include <ImfRgbaFile.h>
#include <ImfArray.h>
Expand Down Expand Up @@ -87,18 +87,18 @@ complete details, but to get started, the "hello, world" `.exr` writer program i
return 0;
}

The `CMakeLists.txt` to build:
The [`CMakeLists.txt`](https://raw.githubusercontent.com/AcademySoftwareFoundation/openexr/main/website/src/exrwriter/CMakeLists.txt) to build:

cmake_minimum_required(VERSION 3.10)
cmake_minimum_required(VERSION 3.12)
project(exrwriter)
find_package(OpenEXR REQUIRED)

add_executable(${PROJECT_NAME} writer.cpp)
add_executable(${PROJECT_NAME} exrwriter.cpp)
target_link_libraries(${PROJECT_NAME} OpenEXR::OpenEXR)

To build:

$ cmake -S . -B _build
$ cmake -S . -B _build -DCMAKE_PREFIX_PATH=<path to OpenEXR libraries/includes>
$ cmake --build _build

For more details, see [The OpenEXR
Expand Down
29 changes: 18 additions & 11 deletions website/HelloWorld.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,40 @@ Hello, World
:caption: Hello, World
:maxdepth: 1

A simple program to write a simple ``.exr`` file of an image of 10x10
pixels with values that are a ramp in green and blue:
Write an Image
==============

.. literalinclude:: src/writer/writer.cpp
This example :download:`exrwriter.cpp <src/exrwriter/exrwriter.cpp>`
program writes a simple ``hello.exr`` file of an image of 10x10 pixels with
values that are a ramp in green and blue:

And the ``CMakeLists.txt`` file to build:
.. literalinclude:: src/exrwriter/exrwriter.cpp

And the :download:`CMakeLists.txt <src/exrwriter/CMakeLists.txt>` file to build:

.. literalinclude:: src/writer/CMakeLists.txt
.. literalinclude:: src/exrwriter/CMakeLists.txt

To build:

.. literalinclude:: src/writer/build.sh
.. literalinclude:: src/exrwriter/build.sh

For more details, see :ref:`The OpenEXR API`.

And a simple program to read an ``.exr`` file:
Read an Image
=============

.. literalinclude:: src/reader/reader.cpp
This companion example :download:`exrreader.cpp <src/exrreader/exrreader.cpp>`
program reads the ``hello.exr`` file written by the writer program above:

.. literalinclude:: src/exrreader/exrreader.cpp

And the ``CMakeLists.txt`` file to build:
And the :download:`CMakeLists.txt <src/exrreader/CMakeLists.txt>` file to build:

.. literalinclude:: src/reader/CMakeLists.txt
.. literalinclude:: src/exrreader/CMakeLists.txt

To build:

.. literalinclude:: src/reader/build.sh
.. literalinclude:: src/exrreader/build.sh



Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ cmake_minimum_required(VERSION 3.12)
project(exrreader)
find_package(OpenEXR REQUIRED)

add_executable(${PROJECT_NAME} reader.cpp)
add_executable(${PROJECT_NAME} exrreader.cpp)
target_link_libraries(${PROJECT_NAME} OpenEXR::OpenEXR)

3 changes: 3 additions & 0 deletions website/src/exrreader/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
$ mkdir _build
$ cmake -S . -B _build -DCMAKE_PREFIX_PATH=<path to OpenEXR libraries/includes>
$ cmake --build _build
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ cmake_minimum_required(VERSION 3.12)
project(exrwriter)
find_package(OpenEXR REQUIRED)

add_executable(${PROJECT_NAME} writer.cpp)
add_executable(${PROJECT_NAME} exrwriter.cpp)
target_link_libraries(${PROJECT_NAME} OpenEXR::OpenEXR)

3 changes: 3 additions & 0 deletions website/src/exrwriter/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
$ mkdir _build
$ cmake -S . -B _build -DCMAKE_PREFIX_PATH=<path to OpenEXR libraries/includes>
$ cmake --build _build
File renamed without changes.
3 changes: 0 additions & 3 deletions website/src/reader/build.sh

This file was deleted.

3 changes: 0 additions & 3 deletions website/src/writer/build.sh

This file was deleted.

0 comments on commit 8743203

Please sign in to comment.