diff --git a/docs/src/make.bat b/docs/src/make.bat index 4568e03aa..796773c61 100644 --- a/docs/src/make.bat +++ b/docs/src/make.bat @@ -22,7 +22,7 @@ if errorlevel 9009 ( echo. echo.If you don't have Sphinx installed, grab it from echo.https://www.sphinx-doc.org/ - exit /b 1 + exit /b %ERRORLEVEL% ) %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% diff --git a/package/CMakeLists.txt b/package/CMakeLists.txt index e9fc1153f..92a5f23d1 100644 --- a/package/CMakeLists.txt +++ b/package/CMakeLists.txt @@ -66,8 +66,11 @@ get_qt_version() set(QT_LIST_FILE ${PACKAGES_DIR}/vcpkg/installed/vcpkg/info/qt${QT_VERSION_MAJOR}-base_${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}_${VCPKG_TRIPLET}.list) add_custom_command( OUTPUT ${QT_LIST_FILE} - COMMAND echo "Building QT..." + COMMAND echo. + COMMAND echo "vcpkg is building Qt" COMMAND ${PACKAGES_DIR}/vcpkg/vcpkg.exe install qt5[core,imageformats]:${VCPKG_TRIPLET} --overlay-ports=${VCPKG_OVERLAYS_DIR} + COMMAND echo "vcpkg finished building Qt" + COMMAND echo. ) add_custom_target( vcpkg-qt ALL @@ -80,8 +83,11 @@ get_ffmpeg_version() set(FFMPEG_LIST_FILE ${PACKAGES_DIR}/vcpkg/installed/vcpkg/info/ffmpeg_${FFMPEG_VERSION_MAJOR}.${FFMPEG_VERSION_MINOR}.${FFMPEG_VERSION_PATCH}_${VCPKG_TRIPLET}.list) add_custom_command( OUTPUT ${FFMPEG_LIST_FILE} - COMMAND echo "Building FFMPEG..." + COMMAND echo. + COMMAND echo "vcpkg is building FFMpeg" COMMAND ${PACKAGES_DIR}/vcpkg/vcpkg.exe install ffmpeg[avcodec,avdevice,avfilter,avformat,avresample,bzip2,ffmpeg,fontconfig,freetype,lzma,opengl,swresample,swscale,x264,x265,zlib]:${VCPKG_TRIPLET} --overlay-ports=${VCPKG_OVERLAYS_DIR} + COMMAND echo "vcpkg finished building FFMpeg" + COMMAND echo. ) add_custom_target( vcpkg-ffmpeg ALL @@ -94,8 +100,12 @@ get_oiio_version() set(OIIO_LIST_FILE ${PACKAGES_DIR}/vcpkg/installed/vcpkg/info/openimageio_${OIIO_VERSION_MAJOR}.${OIIO_VERSION_MINOR}.${OIIO_VERSION_PATCH}.${OIIO_VERSION_TWEAK}_${VCPKG_TRIPLET}.list) add_custom_command( OUTPUT ${OIIO_LIST_FILE} - COMMAND echo "Building OpenImageIO..." + COMMAND echo. + COMMAND echo "vcpkg is building OpenImageIO" COMMAND ${PACKAGES_DIR}/vcpkg/vcpkg.exe install openimageio[ffmpeg,freetype,gif,libheif,libraw,opencolorio,openjpeg,pybind11,tools,webp]:${VCPKG_TRIPLET} --overlay-ports=${VCPKG_OVERLAYS_DIR} + COMMAND echo "vcpkg finished building OpenImageIO" + COMMAND echo. + ) add_custom_target( vcpkg-oiio ALL @@ -113,7 +123,7 @@ elseif(QT_VERSION_MAJOR STREQUAL 6) set(PYSIDE_VERSION_MAJOR "6") set(SHIBOKEN "shiboken6") else() - message(FATAL_ERROR "PySide only supports Qt5 and Qt6") + message(FATAL_ERROR "Build script only supports Qt5 or Qt6") endif() string(TOLOWER ${PYSIDE} PYSIDE_LOWER) diff --git a/package/build-imageutil.bat.in b/package/build-imageutil.bat.in index 820c58083..5bb139b1a 100644 --- a/package/build-imageutil.bat.in +++ b/package/build-imageutil.bat.in @@ -1,11 +1,14 @@ @echo off set "CMAKE_TOOLCHAIN_FILE=${PACKAGES_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake" + if not exist "%CMAKE_TOOLCHAIN_FILE%" ( echo "%CMAKE_TOOLCHAIN_FILE% not found" - exit /b 1 + exit /b %ERRORLEVEL% ) +set "PATH=${PACKAGES_DIR}\python;${PACKAGES_DIR}\python\bin;%PATH%" + "${CMAKE_COMMAND}" ^ -S "${PROJECT_SOURCE_DIR}/imageutil" ^ -B "${PROJECT_BINARY_DIR}/imageutil" ^ @@ -13,12 +16,17 @@ if not exist "%CMAKE_TOOLCHAIN_FILE%" ( -A ${CMAKE_GENERATOR_PLATFORM} ^ -DCMAKE_BUILD_TYPE=Release ^ -DCMAKE_TOOLCHAIN_FILE="${PACKAGES_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake" ^ --DBUILD_TEST:BOOL=OFF +-DBUILD_TESTS=OFF + +if ERRORLEVEL 1 ( + echo Failed to configure imageutil + exit /b %ERRORLEVEL% +) cd "${PROJECT_BINARY_DIR}/imageutil" if not exist "${PROJECT_BINARY_DIR}/imageutil/imageutil.sln" ( echo "imageutil.sln not found" - exit /b 1 + exit /b %ERRORLEVEL% ) -msbuild.exe "${PROJECT_BINARY_DIR}/imageutil/imageutil.sln" /t:Build /p:Configuration=Release /p:Platform=${CMAKE_GENERATOR_PLATFORM} /m /nologo \ No newline at end of file +cmd /c msbuild.exe "${PROJECT_BINARY_DIR}/imageutil/imageutil.sln" /t:Build /p:Configuration=Release /p:Platform=${CMAKE_GENERATOR_PLATFORM} /m /nologo \ No newline at end of file diff --git a/package/build-pyside.bat.in b/package/build-pyside.bat.in index 5b30fdf13..500b93e9a 100644 --- a/package/build-pyside.bat.in +++ b/package/build-pyside.bat.in @@ -23,12 +23,36 @@ mkdir "${PYTHON_DIR}/libs" robocopy "${PACKAGES_DIR}/vcpkg/installed/${VCPKG_TRIPLET}/lib" "${PYTHON_DIR}/libs" python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}.lib /IS /IT /NFL /NDL /NJH /NJS /R:0 /W:0 robocopy "${PACKAGES_DIR}/vcpkg/installed/${VCPKG_TRIPLET}/debug/lib" "${PYTHON_DIR}/libs" python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}_d.lib /IS /IT /NFL /NDL /NJH /NJS /R:0 /W:0 -@REM Clone qt-for-python +@REM Clone PySide/qt-for-python cd /d "${PACKAGES_DIR}" if EXIST "${PACKAGES_DIR}/pyside-setup" rmdir "${PACKAGES_DIR}/pyside-setup" /S /Q git clone git://code.qt.io/pyside/pyside-setup.git "${PACKAGES_DIR}/pyside-setup" cd pyside-setup + +@REM Checkout our Qt version git checkout ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH} + +IF ERRORLEVEL 1 ( + git checkout ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.2 +) + +IF ERRORLEVEL 1 ( + git checkout ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.1 +) + +IF ERRORLEVEL 1 ( + git checkout ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.0 +) + +IF ERRORLEVEL 1 ( + git checkout ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR} +) + +IF ERRORLEVEL 1 ( + echo Failed to find a suitable branch + exit /b %ERRORLEVEL% +) + git submodule update --init git submodule foreach git fetch --all @@ -48,10 +72,10 @@ set "Qt${QT_VERSION_MAJOR}Widgets_DIR=${PACKAGES_DIR}/vcpkg/installed/${VCPKG_TR set "LLVM_INSTALL_DIR=${LLVM_INSTALL_DIR}" set PATH=^ ${PYTHON_DIR};^ -${PYTHON_DIR}/Scripts;^ +${PYTHON_DIR}\Scripts;^ ${LLVM_INSTALL_DIR};^ -${PACKAGES_DIR}/vcpkg/installed/${VCPKG_TRIPLET}/tools/qt${QT_VERSION_MAJOR}/bin;^ -${PACKAGES_DIR}/vcpkg/installed/${VCPKG_TRIPLET}/bin;^ +${PACKAGES_DIR}\vcpkg\installed\${VCPKG_TRIPLET}\tools\qt${QT_VERSION_MAJOR}\bin;^ +${PACKAGES_DIR}\vcpkg\installed\${VCPKG_TRIPLET}\bin;^ %PATH% @REM Build using cmake @@ -77,11 +101,17 @@ ${PACKAGES_DIR}/vcpkg/installed/${VCPKG_TRIPLET}/bin;^ -DPYTHON_DEBUG_LIBRARY:FILEPATH="${PYTHON_DIR}/libs/python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}_d.lib" ^ -DQUIET_BUILD=1 +IF ERRORLEVEL 1 ( + echo Could not configure PySide + exit /b %ERRORLEVEL% +) + + @REM Build solution set "SOLUTION=${PACKAGES_DIR}/pyside-setup/build/${PYSIDE_LOWER}_super_project.sln" if not exist "%SOLUTION%" ( echo Error: Could not find %SOLUTION% - exit /b 1 + exit /b %ERRORLEVEL% ) @REM Build pyside diff --git a/package/build.bat b/package/build.bat index 0109ac564..cad01a209 100644 --- a/package/build.bat +++ b/package/build.bat @@ -6,7 +6,7 @@ SET VSWHERE="C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.ex :: Check if vswhere is available IF NOT EXIST %VSWHERE% ( echo Error: "vswhere.exe" not found. Please ensure you have Visual Studio 2017 or newer installed. - exit /b 1 + exit /b %ERRORLEVEL% ) :: Use vswhere to find the latest VS installation with VC tools @@ -16,7 +16,7 @@ FOR /F "tokens=*" %%i IN ('%VSWHERE% -latest -products * -requires Microsoft.Vis IF NOT DEFINED VSPATH ( echo Error: Suitable Visual Studio installation not found. - exit /b 1 + exit /b %ERRORLEVEL% ) :: Construct path to vcvars64.bat using the found VS path @@ -25,7 +25,7 @@ SET VCVARS64="%VSPATH%\VC\Auxiliary\Build\vcvars64.bat" :: Check for vcvars64.bat existence IF NOT EXIST %VCVARS64% ( echo Error: "vcvars64.bat" not found in detected Visual Studio path. - exit /b 1 + exit /b %ERRORLEVEL% ) call %VCVARS64% @@ -34,7 +34,7 @@ call %VCVARS64% where cmake >nul 2>nul IF ERRORLEVEL 1 ( echo Error: cmake is not installed or not in the PATH. - exit /b 1 + exit /b %ERRORLEVEL% ) :: Get the Visual Studio version @@ -42,7 +42,7 @@ if defined VisualStudioVersion ( set VS_VERSION=%VisualStudioVersion% ) else ( echo Visual Studio environment not set up! - exit /b 1 + exit /b %ERRORLEVEL% ) :: Get the Visual Studio name for CMake @@ -50,7 +50,7 @@ if "%VS_VERSION%"=="16.0" ( set VS_NAME="Visual Studio 16 2019" ) else ( echo Unsupported Visual Studio version! - exit /b 1 + exit /b %ERRORLEVEL% ) :: Get the architecture @@ -58,7 +58,7 @@ if defined VSCMD_ARG_TGT_ARCH ( set VS_ARCH=%VSCMD_ARG_TGT_ARCH% ) else ( echo Architecture not set! - exit /b 1 + exit /b %ERRORLEVEL% ) :: Print the values @@ -70,34 +70,83 @@ set "_script_dir=%~dp0" set "_script_dir=%_script_dir:~0,-1%" echo The directory of the script is: %_script_dir% + +:: Make sure we're using short paths for the build +subst B: "%_script_dir%/build" + :: Get the parent directory for %%i in ("%_script_dir%") do set "_parent_dir=%%~dpi" cmake ^ -S "%_script_dir%" ^ --B "%_script_dir%/build" ^ +-B "B:" ^ -G %VS_NAME% ^ -A %VS_ARCH% ^ -DCMAKE_BUILD_TYPE=Release +IF ERRORLEVEL 1 ( + echo Failed to configure build project. + subst B: /D + exit /b %ERRORLEVEL% +) + + @REM @REM Build dependencies -cmd /c msbuild.exe "%_script_dir%/build/Bookmarks.sln" -target:Build -property:Configuration=Release -property:Platform=%VS_ARCH% /m /nologo +cmd /c msbuild.exe "B:/Bookmarks.sln" -target:Build -property:Configuration=Release -property:Platform=%VS_ARCH% /m /nologo + +IF ERRORLEVEL 1 ( + echo Failed to build Bookmarks.sln + subst B: /D + exit /b %ERRORLEVEL% +) + @REM @REM Build pyside -cmd /c "%_script_dir%/build/packages/build-pyside.bat" +cmd /c "B:/packages/build-pyside.bat" + +IF ERRORLEVEL 1 ( + echo PySide encountered errors + echo %ERRORLEVEL% + echo Continuing build... +) @REM @REM Build image util -cmd /c "%_script_dir%/build/build-imageutil.bat" +cmd /c "B:/build-imageutil.bat" + +IF ERRORLEVEL 1 ( + echo Failed to build imageutil + subst B: /D + exit /b %ERRORLEVEL% +) @REM Build application package -cmd /c "%_script_dir%/build/packages/build-package.bat" +cmd /c "B:/packages/build-package.bat" + +IF ERRORLEVEL 1 ( + echo Failed to build package + subst B: /D + exit /b %ERRORLEVEL% +) @REM Build installer -mkdir "%_script_dir%/build/install" -for /d /r "%_script_dir%/build/package" %%G in (__pycache__) do ( +mkdir "B:/install" +for /d /r "B:/package" %%G in (__pycache__) do ( if exist "%%G" ( echo Removing "%%G" rd /s /q "%%G" ) ) -"%_script_dir%/build/packages/inno/ISCC.exe" /O"%_script_dir%/build/install" "%_script_dir%/build/install/installer.iss" +"B:/packages/inno/ISCC.exe" /O"B:/install" "B:/install/installer.iss" + +IF ERRORLEVEL 1 ( + echo Failed to build installer + subst B: /D + exit /b %ERRORLEVEL% +) + +subst B: /D + +echo. +echo Build completed. +echo Installer saved to: +echo %_script_dir%/build/install \ No newline at end of file diff --git a/package/imageutil/CMakeLists.txt b/package/imageutil/CMakeLists.txt index 72a2f0178..12e28a394 100644 --- a/package/imageutil/CMakeLists.txt +++ b/package/imageutil/CMakeLists.txt @@ -8,11 +8,11 @@ project( HOMEPAGE_URL "https://bookmarks-vfx.com" ) -option(BUILD_TESTS "Build the project tests" ON) # Default is ON, set it to OFF if you don't want to build tests by default +option(BUILD_TESTS "Build the project tests" OFF) # Find packages +find_package(Python3 REQUIRED COMPONENTS Interpreter Development) find_package(pybind11 REQUIRED) -find_package(Python3 REQUIRED COMPONENTS Development) find_package(OpenImageIO CONFIG REQUIRED) message(STATUS "OpenImageIO_INCLUDE_DIR: ${OpenImageIO_INCLUDE_DIR}") @@ -29,12 +29,25 @@ set_target_properties(pyimageutil PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/build ) + +# Set the platform details +if(WIN32) + set(PLATFORM_TAG "win_amd64") +elseif(APPLE) + set(PLATFORM_TAG "macosx") +else() + set(PLATFORM_TAG "linux_x86_64") +endif() + +# Get the Python version +string(REGEX MATCH "([0-9]+)\\.([0-9]+)" _ ${Python3_VERSION}) if(WIN32) - set_target_properties(pyimageutil PROPERTIES SUFFIX ".pyd") + set_target_properties(pyimageutil PROPERTIES SUFFIX ".cp${CMAKE_MATCH_1}${CMAKE_MATCH_2}-${PLATFORM_TAG}.pyd") else() - set_target_properties(pyimageutil PROPERTIES SUFFIX ".so") + set_target_properties(pyimageutil PROPERTIES SUFFIX ".cp${CMAKE_MATCH_1}${CMAKE_MATCH_2}-${PLATFORM_TAG}.so") endif() + target_compile_definitions(pyimageutil PRIVATE -DBUILD_PYBIND11) target_include_directories(pyimageutil PRIVATE ${INCLUDE_DIR} ${OpenImageIO_INCLUDE_DIR}) @@ -57,28 +70,28 @@ add_dependencies(imageutil libimageutil) # Testing if(BUILD_TESTS) -set(TEST_DIR ${CMAKE_BINARY_DIR}/test) -set(OIIO_TEST_IMAGES_URL "https://github.com/OpenImageIO/oiio-images/archive/aae37a54e31c0e719edcec852994d052ecf6541e.zip") -set(OIIO_TEST_IMAGES_DIR ${TEST_DIR}/oiio-images) -set(OIIO_TEST_IMAGES_ZIP "${CMAKE_BINARY_DIR}/test/oiio-images.zip") -set(OIIO_TEST_IMAGES_EXTRACTED ${TEST_DIR}/oiio-images/oiio-images-aae37a54e31c0e719edcec852994d052ecf6541e) - -configure_file(${CMAKE_SOURCE_DIR}/test/images.txt ${TEST_DIR}/images.txt COPYONLY) -configure_file(${CMAKE_SOURCE_DIR}/test/test_oiio_images.py.in ${TEST_DIR}/test_oiio_images.py @ONLY) - -message(STATUS "Downloading oiio-images...") -file(DOWNLOAD ${OIIO_TEST_IMAGES_URL} ${OIIO_TEST_IMAGES_ZIP} - EXPECTED_HASH SHA512=0272ecef88ce859edead6e5a823aebe46d27542d67f827348c9c4d0576e500e82d23786bfd125bdf1dd878d5d065a2a29f23a82a8ba1053cc805c05a201f9c87 -SHOW_PROGRESS) - -file(ARCHIVE_EXTRACT INPUT ${OIIO_TEST_IMAGES_ZIP} - DESTINATION ${OIIO_TEST_IMAGES_DIR}) - -# Custom command to run Python tests -add_custom_command( - TARGET pyimageutil POST_BUILD # replace 'your_target' with your actual target - COMMAND ${Python3_EXECUTABLE} ${CMAKE_BINARY_DIR}/test/test_oiio_images.py --module $ - COMMENT "Running Python tests..." -) + set(TEST_DIR ${CMAKE_BINARY_DIR}/test) + set(OIIO_TEST_IMAGES_URL "https://github.com/OpenImageIO/oiio-images/archive/aae37a54e31c0e719edcec852994d052ecf6541e.zip") + set(OIIO_TEST_IMAGES_DIR ${TEST_DIR}/oiio-images) + set(OIIO_TEST_IMAGES_ZIP "${CMAKE_BINARY_DIR}/test/oiio-images.zip") + set(OIIO_TEST_IMAGES_EXTRACTED ${TEST_DIR}/oiio-images/oiio-images-aae37a54e31c0e719edcec852994d052ecf6541e) + + configure_file(${CMAKE_SOURCE_DIR}/test/images.txt ${TEST_DIR}/images.txt COPYONLY) + configure_file(${CMAKE_SOURCE_DIR}/test/test_oiio_images.py.in ${TEST_DIR}/test_oiio_images.py @ONLY) + + message(STATUS "Downloading oiio-images...") + file(DOWNLOAD ${OIIO_TEST_IMAGES_URL} ${OIIO_TEST_IMAGES_ZIP} + EXPECTED_HASH SHA512=0272ecef88ce859edead6e5a823aebe46d27542d67f827348c9c4d0576e500e82d23786bfd125bdf1dd878d5d065a2a29f23a82a8ba1053cc805c05a201f9c87 + SHOW_PROGRESS) + + file(ARCHIVE_EXTRACT INPUT ${OIIO_TEST_IMAGES_ZIP} + DESTINATION ${OIIO_TEST_IMAGES_DIR}) + + # Custom command to run Python tests + add_custom_command( + TARGET pyimageutil POST_BUILD # replace 'your_target' with your actual target + COMMAND ${Python3_EXECUTABLE} ${CMAKE_BINARY_DIR}/test/test_oiio_images.py --module $ + COMMENT "Running Python tests..." + ) endif() \ No newline at end of file diff --git a/set_version.py b/set_version.py index dccda2111..b64882a98 100644 --- a/set_version.py +++ b/set_version.py @@ -1,4 +1,4 @@ -"""Set the version string.""" +Y"""Set the version string.""" import os import re