Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for smart object layers #134

Merged
merged 129 commits into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
129 commits
Select commit Hold shift + click to select a range
c1e30c4
add WriteBinaryArray specialization which doesnt require the array to…
EmilDohne Jul 11, 2024
2a902b2
Modify bidirectional_map to provide more logical access patterns for …
EmilDohne Jul 16, 2024
cdf364c
add char specialization to EndianByteSwap
EmilDohne Jul 16, 2024
ed1723b
Add initial parsing of descriptor structures. Still requires further …
EmilDohne Jul 16, 2024
c0b94c2
Add basic tests for parsing of descriptors
EmilDohne Jul 16, 2024
cfe95c1
setup descriptor tests for simple parsing and roundtripping
EmilDohne Jul 17, 2024
f86f745
Expand on descriptors to allow for writes as well as access patterns …
EmilDohne Jul 17, 2024
84671b3
Add DescriptorUtil file to check for 4-byte keys which are preceded w…
EmilDohne Jul 17, 2024
301ace6
add script to hexdump the section of a file to parse small parts of t…
EmilDohne Jul 19, 2024
16c12ac
TODO: refactor descriptor to represent all types
EmilDohne Jul 19, 2024
2c88b0a
update default Descriptor constructor as well as modifying hexdump.py…
EmilDohne Sep 8, 2024
c9a9909
tmp transfer to other pc
EmilDohne Oct 6, 2024
0ff1956
Add (read) support for LinkedLayers
EmilDohne Oct 8, 2024
8baec9d
add json and openimageio dependencies
EmilDohne Oct 26, 2024
d0c2ea5
make base endian encode take unused arg
EmilDohne Oct 26, 2024
2d0df8a
add json write to descriptor
EmilDohne Oct 26, 2024
070824b
Start working on smart object implementation
EmilDohne Oct 26, 2024
5cf92a9
tmp
EmilDohne Oct 27, 2024
f1de182
Add basic rendering and geometry support for warps
EmilDohne Oct 29, 2024
89d8993
Update warp implementation
EmilDohne Oct 29, 2024
4ab9260
Refactor profiling functions from PROFILE_FUNCTION -> PSAPI_PROFILE_F…
EmilDohne Oct 29, 2024
763aed8
add freetype to oiio vcpkg install
EmilDohne Oct 29, 2024
b4d44a5
add support for multiple bezier patches in a single surface
EmilDohne Nov 1, 2024
183caf6
add support for non-affine transformations (skew, warp)
EmilDohne Nov 1, 2024
1e47bfb
expand api
EmilDohne Nov 1, 2024
e232f1e
add initial bicubic interpolation function
EmilDohne Nov 2, 2024
496958f
Split ImageBuffer.h and Render.h
EmilDohne Nov 2, 2024
0a4968a
Refactor all API components to make member variables private and use …
EmilDohne Nov 3, 2024
a55f795
Harden template requirements to only allow instantiation of 8- 16- an…
EmilDohne Nov 3, 2024
802842f
add linked_layers property
EmilDohne Nov 3, 2024
b893fcd
tmp
EmilDohne Nov 5, 2024
8bc7483
Refactor C++ API to make members private and access through methods
EmilDohne Nov 7, 2024
05849f2
sync
EmilDohne Nov 9, 2024
bd5ffb4
start adding serialization functions to warp
EmilDohne Nov 13, 2024
9dc409b
Add equality operators to descriptor structure
EmilDohne Nov 14, 2024
9e04a00
Add roundtripping to warp descriptors
EmilDohne Nov 14, 2024
d507611
add initial testing of SmartObjects as well as refining the API
EmilDohne Nov 17, 2024
ac6d10a
Slight changes
EmilDohne Nov 21, 2024
1c77756
tmp
EmilDohne Dec 13, 2024
20d0a4a
tmps
EmilDohne Dec 15, 2024
dc94014
refactor transfomrations
EmilDohne Dec 15, 2024
c17d44e
Add interleave and deinterleave functions
EmilDohne Dec 16, 2024
a7c381e
implement replacing of image data
EmilDohne Dec 16, 2024
fd3db83
Start work on adding write support for smart objects
EmilDohne Dec 16, 2024
d8d8a15
some commit
EmilDohne Dec 18, 2024
c0c3722
Refactor TaggedBlocks to separate them into different files
EmilDohne Dec 20, 2024
6a43703
Refactor away calculateSize() in favor of a scope based length calcul…
EmilDohne Dec 22, 2024
ee8936b
Fix replacing of image data
EmilDohne Dec 25, 2024
7887788
Fix transformation issues
EmilDohne Dec 25, 2024
6ed81db
Fix test suite
EmilDohne Dec 25, 2024
488f1c2
Fix unicode skipping issues
EmilDohne Dec 25, 2024
ff856d8
add support for externally linked layers
EmilDohne Dec 26, 2024
a938870
Add example for smart objects and work on docs. Update calling signat…
EmilDohne Dec 28, 2024
b56a9cb
sync python implementation start
EmilDohne Dec 31, 2024
a8f8c40
sync
EmilDohne Jan 4, 2025
1686a81
- Rename python declaration function names
EmilDohne Jan 4, 2025
ed1dda0
Start declaring smart object warp and point2d structs
EmilDohne Jan 4, 2025
e06d652
add python stubs for smart objects
EmilDohne Jan 19, 2025
1352308
fix compilation of python bindings
EmilDohne Jan 19, 2025
6f87a17
add python tests for smart objects
EmilDohne Jan 19, 2025
47a1f44
Add SmartObjectWarp tests c++
EmilDohne Jan 19, 2025
4e367e5
fix various compilation errors
EmilDohne Jan 19, 2025
63947e1
Start work on compositing framework
EmilDohne Jan 19, 2025
4b46586
fix smart object example
EmilDohne Jan 19, 2025
97d08ad
sync
EmilDohne Jan 23, 2025
e47789e
tmp
EmilDohne Jan 24, 2025
d1ac9aa
fix double alpha composite
EmilDohne Jan 24, 2025
d2d63e3
start running actions to check for build errors
EmilDohne Jan 24, 2025
1711789
Fix some compile errors on gcc and set osx variables
EmilDohne Jan 24, 2025
9aba958
set osx variable to only arm64 and move declaration of template funct…
EmilDohne Jan 24, 2025
23397aa
Change gcc -> clang
EmilDohne Jan 24, 2025
c56ce13
fix final gcc errors
EmilDohne Jan 24, 2025
8025446
Swap localtime_s to localtime
EmilDohne Jan 24, 2025
6a516e9
Fix dependant template typenames and localtime
EmilDohne Jan 24, 2025
161deb8
misc fixes
EmilDohne Jan 24, 2025
6762452
misc fixes
EmilDohne Jan 24, 2025
8b1f37f
fix composite template
EmilDohne Jan 24, 2025
16cc4f4
try osx
EmilDohne Jan 24, 2025
bd39899
upload macos artifacts
EmilDohne Jan 24, 2025
a86d4c9
add ninja
EmilDohne Jan 24, 2025
8788443
remove freetype reliant functions since we didnt use them anyways
EmilDohne Jan 24, 2025
4736d9d
ci
EmilDohne Jan 24, 2025
6af7301
update vcpkg to fix libbacktrace
EmilDohne Jan 24, 2025
437f778
update builtin baseline
EmilDohne Jan 24, 2025
ab30c57
unshallow
EmilDohne Jan 24, 2025
e22e48d
remove freetype and install further brew libs for vcpkg
EmilDohne Jan 25, 2025
4250ca6
tmp
EmilDohne Jan 25, 2025
9e28784
Change descriptors to use polymorphism and unique_ptr instead of vari…
EmilDohne Jan 26, 2025
bc7e1f6
Fix mesh _vertices
EmilDohne Jan 26, 2025
d0ae9da
fix dependent typename
EmilDohne Jan 26, 2025
23c3dc0
fix missing c_str()
EmilDohne Jan 26, 2025
ade02d5
fix metadata
EmilDohne Jan 26, 2025
eb3b975
move asan to CI rather than in the CMakeLists
EmilDohne Jan 26, 2025
c920789
add macos clang target to CI
EmilDohne Jan 26, 2025
62222b0
disable leak-sanitizer on macos as its unsupported
EmilDohne Jan 26, 2025
176d482
boot macos clang because no parallel stl, add windows clang-cl
EmilDohne Jan 26, 2025
2f85c08
Add compiler as cmake arg
EmilDohne Jan 26, 2025
26be7fb
remove windows clang as it doesnt pickup
EmilDohne Jan 26, 2025
a85700d
bump c-blosc2 -> 2.15.2
EmilDohne Jan 26, 2025
6e2f281
Setup valgrind and parallel builds
EmilDohne Jan 26, 2025
be29bed
valgrind use asan because of vcpkg package cache, enable wheel building
EmilDohne Jan 26, 2025
a3bcd14
pull wheels
EmilDohne Jan 26, 2025
3573e7a
upload logs
EmilDohne Jan 26, 2025
9b33cc6
Ensure cmake on windows
EmilDohne Jan 26, 2025
46e3f3e
fix os_dist
EmilDohne Jan 26, 2025
6395cdf
logs
EmilDohne Jan 26, 2025
0118900
sync
EmilDohne Jan 28, 2025
696c65e
sync rewrite mixins and add code for bbox retrieval etc.
EmilDohne Feb 2, 2025
bab390e
fix test compilation
EmilDohne Feb 3, 2025
de3def7
Fix test failures
EmilDohne Feb 3, 2025
e042eaf
refactor to make image and mask data mixins
EmilDohne Feb 12, 2025
aed998c
remove upload logs
EmilDohne Feb 12, 2025
a1ec285
Update build-wheels.yml
EmilDohne Feb 12, 2025
15417e5
fix python unittests
EmilDohne Feb 14, 2025
2321923
fix rescale_canvas.py
EmilDohne Feb 14, 2025
f2eda96
Make byteswap fail on compilation rather than at runtime
EmilDohne Feb 14, 2025
83e90d8
swap macro args
EmilDohne Feb 14, 2025
01acddc
revert to error message but with funcsig
EmilDohne Feb 14, 2025
3855bce
valgrind track-origins
EmilDohne Feb 14, 2025
6f50b4f
static constexpr
EmilDohne Feb 14, 2025
fb7fad8
more detailed endian errors
EmilDohne Feb 14, 2025
235a01e
make endian functions generic to work with any type
EmilDohne Feb 17, 2025
8d48c26
- update docs
EmilDohne Feb 22, 2025
3c77525
fix python tests
EmilDohne Feb 22, 2025
752f8b2
-update docs
EmilDohne Feb 22, 2025
fc61840
clean up CI statuses
EmilDohne Feb 23, 2025
7319fca
rebase
EmilDohne Feb 23, 2025
9338071
fix py tests
EmilDohne Feb 23, 2025
1b6f46c
fix python tests
EmilDohne Feb 24, 2025
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
32 changes: 21 additions & 11 deletions .github/workflows/build-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,31 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
submodules: true

# We need to specify Xcode15.3 here as the default for macos-14 runners is 15.01 which has a bug
# causing linking to fail.
- name: Setup Xcode 15.3
if: matrix.os == 'macos-latest'
uses: maxim-lobanov/setup-xcode@v1
submodules: 'recursive'
fetch-depth: 0

# Further brew packages needed to run/install vcpkg dependencies
- name: Setup macos dependencies
if: matrix.os_dist.os == 'macos-latest'
run: |
brew install ninja
brew install autoconf
brew install libtool
brew install automake

- name: Initialize vcpkg
uses: lukka/run-vcpkg@v11
with:
xcode-version: '15.3'
vcpkgDirectory: '${{ github.workspace }}/thirdparty/vcpkg'

- uses: pypa/cibuildwheel@v2.16
- uses: pypa/cibuildwheel@v2.22.0
env:
CC: gcc-13
CXX: g++-13
CIBW_ARCHS: auto64
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
MACOSX_DEPLOYMENT_TARGET: 14.0
CIBW_BEFORE_BUILD: pip install cmake
CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/manylinux_2_34_x86_64:latest
CIBW_BUILD: "${{ matrix.os_dist.dist }}"
# Test not only by running the test suite but also by executing every example we provide. This is to ensure
# our examples are working and users can rely on them for starting off points
Expand All @@ -91,6 +100,7 @@ jobs:
python -u {project}/PhotoshopExamples/ModifyLayerStructure/modify_layer_structure.py &&
python -u {project}/PhotoshopExamples/ReplaceImageData/replace_image_data.py &&
python -u {project}/PhotoshopExamples/RescaleCanvas/rescale_canvas.py &&
python -u {project}/PhotoshopExamples/SmartObjects/smart_objects.py &&
nosetests {project}/python/psapi-test --verbose

- name: Verify clean directory
Expand All @@ -102,7 +112,7 @@ jobs:
with:
name: PhotoshopAPI_Py-${{ matrix.os_dist.os }}-${{ matrix.os_dist.dist }}
path: wheelhouse/*.whl

mock-publish:
name: Mock Upload release to PyPI
permissions:
Expand Down
55 changes: 29 additions & 26 deletions .github/workflows/cmake-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,60 +26,63 @@ jobs:
os: ubuntu-24.04
compiler: gcc-13
compilercxx: g++-13
cflags: ""
cxxflags: ""
- name: Ubuntu Clang
os: ubuntu-24.04
compiler: clang
compilercxx: clang++
cflags: ""
cxxflags: ""
- name: Windows MSVC
os: windows-latest
compiler: msvc
compilercxx: msvc
cflags: ""
cxxflags: ""
- name: MacOS ARM GCC
os: macos-latest
compiler: gcc-13
compilercxx: g++-13
compilercxx: g++-13
cflags: ""
cxxflags: ""

steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'

# We need to specify Xcode15.3 here as the default for macos-14 runners is 15.01 which has a bug
# causing linking to fail.
- name: Setup Xcode 15.3
fetch-depth: 0
# Further brew packages needed to run/install vcpkg dependencies
- name: Setup MacOS dependencies
if: matrix.os == 'macos-latest'
uses: maxim-lobanov/setup-xcode@v1
run: |
brew install ninja
brew install autoconf
brew install libtool
brew install automake

- name: Initialize vcpkg
uses: lukka/run-vcpkg@v11
with:
xcode-version: '15.3'
vcpkgDirectory: '${{ github.workspace }}/thirdparty/vcpkg'

- name: Configure CMake ${{ matrix.os }}-${{ matrix.compilercxx }}
env:
CC: ${{ matrix.compiler }}
CXX: ${{ matrix.compilercxx }}
CFLAGS: ${{ matrix.cflags }}
CXXFLAGS: ${{ matrix.cxxflags }}
run: |
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DPSAPI_BUILD_DOCS=OFF -DPSAPI_BUILD_BENCHMARKS=OFF -DPSAPI_BUILD_EXAMPLES=OFF -DPSAPI_BUILD_PYTHON=OFF
cmake -B ${{github.workspace}}/build -DCMAKE_OSX_ARCHITECTURES="arm64" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DPSAPI_BUILD_DOCS=OFF -DPSAPI_BUILD_BENCHMARKS=OFF -DPSAPI_BUILD_TESTS=OFF -DPSAPI_BUILD_EXAMPLES=ON -DPSAPI_BUILD_PYTHON=OFF


- name: Build ${{ matrix.os }}-${{ matrix.compilercxx }}
# Build your program with the given configuration
env:
CC: ${{ matrix.compiler }}
CXX: ${{ matrix.compilercxx }}
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}


# Call our python script to generate the relevant release artifacts after which we upload
# them for each platform
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Generate artifacts for ${{ matrix.os }}-${{ matrix.compilercxx }}
run: python scripts/generate_release.py --build-dir ${{github.workspace}}/build

- name: Upload Release Artifacts
uses: actions/upload-artifact@v4
with:
name: PhotoshopAPI-${{ matrix.os }}-${{ matrix.compilercxx }}
path: ${{github.workspace}}/release
CFLAGS: ${{ matrix.cflags }}
CXXFLAGS: ${{ matrix.cxxflags }}
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel $(getconf _NPROCESSORS_ONLN || sysctl -n hw.ncpu || echo %NUMBER_OF_PROCESSORS%)

31 changes: 19 additions & 12 deletions .github/workflows/cmake-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ jobs:
os: ubuntu-24.04
compiler: gcc-13
compilercxx: g++-13
cflags: ""
cxxflags: ""
cflags: "-fsanitize=address,leak,undefined"
cxxflags: "-fsanitize=address,leak,undefined"
- name: Ubuntu Clang
os: ubuntu-24.04
compiler: clang
compilercxx: clang++
cflags: "-fsanitize=address,leak,undefined"
cxxflags: "-fsanitize=address,leak,undefined"
compilercxx: clang++
- name: Windows MSVC
os: windows-latest
compiler: msvc
Expand All @@ -51,31 +51,38 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: 'recursive'

# We need to specify Xcode15.3 here as the default for macos-14 runners is 15.01 which has a bug
# causing linking to fail.
- name: Setup Xcode 15.3
fetch-depth: 0
# Further brew packages needed to run/install vcpkg dependencies
- name: Setup MacOS dependencies
if: matrix.os == 'macos-latest'
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '15.3'
run: |
brew install ninja
brew install autoconf
brew install libtool
brew install automake

- name: Initialize vcpkg
uses: lukka/run-vcpkg@v11
with:
vcpkgDirectory: '${{ github.workspace }}/thirdparty/vcpkg'

- name: Configure CMake ${{ matrix.os }}-${{ matrix.compilercxx }}
env:
CC: ${{ matrix.compiler }}
CXX: ${{ matrix.compilercxx }}
CFLAGS: ${{ matrix.cflags }}
CXXFLAGS: ${{ matrix.cxxflags }}
run: |
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DPSAPI_BUILD_DOCS=OFF -DPSAPI_BUILD_BENCHMARKS=OFF -DPSAPI_BUILD_EXAMPLES=OFF -DPSAPI_BUILD_PYTHON=OFF
cmake -B ${{github.workspace}}/build -DCMAKE_OSX_ARCHITECTURES="arm64" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DPSAPI_BUILD_DOCS=OFF -DPSAPI_BUILD_BENCHMARKS=OFF -DPSAPI_BUILD_EXAMPLES=OFF -DPSAPI_BUILD_PYTHON=OFF

- name: Build ${{ matrix.os }}-${{ matrix.compilercxx }}
env:
CC: ${{ matrix.compiler }}
CXX: ${{ matrix.compilercxx }}
CFLAGS: ${{ matrix.cflags }}
CXXFLAGS: ${{ matrix.cxxflags }}
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel $(getconf _NPROCESSORS_ONLN || sysctl -n hw.ncpu || echo %NUMBER_OF_PROCESSORS%)

# On windows we need to copy the test files differently as it generates sub-folders
# for the copied test files
Expand Down
20 changes: 17 additions & 3 deletions .github/workflows/cmake-valgrind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,34 +26,48 @@ jobs:
os: ubuntu-24.04
compiler: gcc-13
compilercxx: g++-13
cflags: ""
cxxflags: ""
- name: Ubuntu Clang
os: ubuntu-24.04
compiler: clang
compilercxx: clang++
cflags: ""
cxxflags: ""

steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
fetch-depth: 0

- name: Load or restore vcpkg libraries
uses: lukka/run-vcpkg@v11
with:
vcpkgDirectory: '${{ github.workspace }}/thirdparty/vcpkg'

- name: Configure CMake ${{ matrix.os }}-${{ matrix.compilercxx }}
env:
CC: ${{ matrix.compiler }}
CXX: ${{ matrix.compilercxx }}
CFLAGS: ${{ matrix.cflags }}
CXXFLAGS: ${{ matrix.cxxflags }}
run: |
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DPSAPI_BUILD_DOCS=OFF -DPSAPI_BUILD_BENCHMARKS=OFF -DPSAPI_BUILD_EXAMPLES=OFF -DPSAPI_BUILD_PYTHON=OFF
cmake -B ${{github.workspace}}/build -DCMAKE_OSX_ARCHITECTURES="arm64" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DPSAPI_BUILD_DOCS=OFF -DPSAPI_BUILD_BENCHMARKS=OFF -DPSAPI_BUILD_EXAMPLES=ON -DPSAPI_BUILD_PYTHON=OFF

- name: Build ${{ matrix.os }}-${{ matrix.compilercxx }}
env:
CC: ${{ matrix.compiler }}
CXX: ${{ matrix.compilercxx }}
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
CFLAGS: ${{ matrix.cflags }}
CXXFLAGS: ${{ matrix.cxxflags }}
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel $(getconf _NPROCESSORS_ONLN || sysctl -n hw.ncpu || echo %NUMBER_OF_PROCESSORS%)

- name: Run Valgrind
if: matrix.os == 'ubuntu-24.04'
working-directory: ${{github.workspace}}/build/PhotoshopTest
run: |
sudo apt-get update
sudo apt-get install -y valgrind
valgrind --leak-check=full ./PhotoshopTest
valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes ./PhotoshopTest
continue-on-error: false
9 changes: 6 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
[submodule "thirdparty/pybind11"]
path = thirdparty/pybind11
url = https://github.com/pybind/pybind11
[submodule "thirdparty/libdeflate"]
path = thirdparty/libdeflate
url = https://github.com/ebiggers/libdeflate
[submodule "thirdparty/mio"]
path = thirdparty/mio
url = https://github.com/vimpunk/mio
[submodule "thirdparty/simdutf"]
path = thirdparty/simdutf
url = https://github.com/simdutf/simdutf
[submodule "thirdparty/vcpkg"]
path = thirdparty/vcpkg
url = https://github.com/microsoft/vcpkg
[submodule "thirdparty/json"]
path = thirdparty/json
url = https://github.com/nlohmann/json
44 changes: 34 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
cmake_minimum_required (VERSION 3.20)
set(VCPKG_LIBRARY_LINKAGE "static")
project ("PhotoshopAPIBuild" VERSION 0.5.2 LANGUAGES CXX)

if (MSVC)
# MSVC is stupid
add_compile_definitions(NOMINMAX)
endif()

# --------------------------------------------------------------------------
# Configurable options

option(PSAPI_BUILD_STATIC "Build a static library version of the PhotoshopAPI" ON)
option(PSAPI_BUILD_STATIC "Build a static library version of the PhotoshopAPI, currently must be on as we dont create a dynamic library target" ON)
option(PSAPI_USE_VCPKG "Build the extra dependencies using vckpg instead of system installed libraries" ON)
option(PSAPI_BUILD_TESTS "Build the tests associated with the PhotoshopAPI" ON)
option(PSAPI_BUILD_EXAMPLES "Build the examples associated with the PhotoshopAPI" ON)
option(PSAPI_BUILD_BENCHMARKS "Build the benchmarks associated with the PhotoshopAPI" ON)
option(PSAPI_BUILD_DOCS "Builds the documentation, requires some external installs which are documented in the README.md" OFF)
option(PSAPI_BUILD_PYTHON "Build the python bindings associated with the PhotoshopAPI" OFF)
option(PSAPI_BUILD_DOCS "Builds the documentation, requires some external installs which are documented in the README.md" ON)
option(PSAPI_BUILD_PYTHON "Build the python bindings associated with the PhotoshopAPI" ON)


if (PSAPI_BUILD_PYTHON)
Expand All @@ -23,6 +24,7 @@ if (PSAPI_BUILD_PYTHON)
endif()



# Build setup
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set (CMAKE_CXX_STANDARD 20)
Expand All @@ -32,14 +34,33 @@ set (CMAKE_CXX_STANDARD 20)
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})


# Add thirdparty libraries
# Set up our toolchain using the local vcpkg, gets the
# --------------------------------------------------------------------------

# Include the local vcpkg toolchain, if specified
if (PSAPI_USE_VCPKG)
include("${PROJECT_SOURCE_DIR}/thirdparty/vcpkg/scripts/buildsystems/vcpkg.cmake")
endif()

# Here we add support for OpenImageIO which is used for smart object image data extraction.
find_package(OpenImageIO CONFIG REQUIRED)

# Add libdeflate for zip compression and decompression
find_package(libdeflate CONFIG REQUIRED)

# Eigen is used to construct e.g. homographies for applying non-affine transforms
find_package(Eigen3 CONFIG REQUIRED)

# fmt library for formatting and logging.
find_package(fmt CONFIG REQUIRED)

# Add libdeflate
add_subdirectory (thirdparty/libdeflate)
add_library(libdeflate_include INTERFACE)
target_include_directories(libdeflate_include SYSTEM INTERFACE thirdparty/libdeflate)
# UUID for storing e.g. uuids of smart objects
find_package(stduuid CONFIG REQUIRED)



# Add thirdparty libraries
# --------------------------------------------------------------------------

# Add mio for memory-mapped IO files
add_subdirectory (thirdparty/mio)
Expand All @@ -57,7 +78,6 @@ add_subdirectory (thirdparty/c-blosc2 EXCLUDE_FROM_ALL)
add_library(blosc2_include INTERFACE)
target_include_directories(blosc2_include SYSTEM INTERFACE thirdparty/c-blosc2/include)


# Add doctest
add_library(doctest INTERFACE)
target_include_directories(doctest SYSTEM INTERFACE thirdparty/doctest/doctest)
Expand All @@ -68,6 +88,9 @@ set (SIMDUTF_TOOLS OFF)
set (SIMDUTF_ICONV OFF)
add_subdirectory (thirdparty/simdutf)

# JSON module for parsing of Descriptors
add_subdirectory(thirdparty/json)

# Add span from tcb for compatibility with older compilers for python bindings
add_library(tcb_span INTERFACE)
target_include_directories(tcb_span SYSTEM INTERFACE thirdparty/compatibility)
Expand All @@ -92,6 +115,7 @@ if(PSAPI_BUILD_EXAMPLES)
add_subdirectory (PhotoshopExamples/ModifyLayerStructure)
add_subdirectory (PhotoshopExamples/ProgressCallbacks)
add_subdirectory (PhotoshopExamples/ReplaceImageData)
add_subdirectory (PhotoshopExamples/SmartObjects)
endif()
if(PSAPI_BUILD_DOCS)
if(NOT PSAPI_BUILD_PYTHON)
Expand Down
Loading
Loading