From c117e22c534de250dd8a504a4ca7108fb929bc20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Garramu=C3=B1o?= Date: Tue, 4 Jun 2024 04:24:49 -0300 Subject: [PATCH] Configure fixed for compilation with TLRENDER_NET under macOS. --- .github/workflows/python.yml | 13 ++++++++++--- CMakeLists.txt | 16 ++++++++-------- cmake/Modules/BuildPython.cmake | 17 ++++++++++++++++- etc/build_dir.sh | 7 ++----- etc/configure-macos-python.sh | 14 -------------- etc/runme_nolog.sh | 1 + mrv2/docs/HISTORY.md | 1 + 7 files changed, 38 insertions(+), 31 deletions(-) delete mode 100755 etc/configure-macos-python.sh diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 4f4e4a514..195cb021b 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -141,7 +141,7 @@ jobs: run: brew install gnu-sed - name: Install Python dependencies - run: brew install libb2 libffi readline sqlite3 xz zlib + run: brew install libb2 libffi openssl readline sqlite3 xz zlib - name: Install pyFLTK dependencies run: brew install subversion swig @@ -174,14 +174,21 @@ jobs: # ./bin/upload_sourceforge.sh - macos-m1-python-build: + macos-14-python-build: runs-on: macos-14 + env: + CMAKE_OSX_DEPLOYMENT_TARGET: 14.0 + steps: - uses: actions/checkout@v4 with: submodules: recursive + + - name: Get machine name + run: | + echo "Machine name: $RUNNER_NAME" - name: Install ninja-build run: brew install ninja @@ -193,7 +200,7 @@ jobs: run: brew install gnu-sed - name: Install Python dependencies - run: brew install libb2 libffi readline sqlite3 xz zlib + run: brew install libb2 libffi openssl readline sqlite3 xz zlib - name: Install pyFLTK dependencies run: brew install subversion swig diff --git a/CMakeLists.txt b/CMakeLists.txt index f9b758921..4d6e2e246 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -133,8 +133,8 @@ if(UNIX AND NOT APPLE) include( cmake/Modules/Buildlibbacktrace.cmake ) endif() -set( PYBIND11_DEP ) -if( MRV2_PYBIND11 ) +set(PYBIND11_DEP ) +if(MRV2_PYBIND11 ) include( cmake/Modules/Buildpybind11.cmake ) endif() @@ -158,22 +158,22 @@ endif() # building Python's _ssl module. if(TLRENDER_NET AND NOT WIN32) if (BUILD_PYTHON) - add_dependencies( Python OpenSSL) + add_dependencies(Python OpenSSL) endif() endif() -set( POCO_DEP ) -if( MRV2_NETWORK ) +set(POCO_DEP ) +if(MRV2_NETWORK) include( cmake/Modules/BuildPoco.cmake ) endif() -set( LibHaru_DEP ) -if( MRV2_PDF ) +set(LibHaru_DEP ) +if(MRV2_PDF) include( cmake/Modules/BuildLibHaru.cmake ) endif() -if( BUILD_MRV2 ) +if(BUILD_MRV2) include( cmake/Modules/Buildmrv2.cmake ) endif() diff --git a/cmake/Modules/BuildPython.cmake b/cmake/Modules/BuildPython.cmake index 37d174a93..5dbdbfe98 100644 --- a/cmake/Modules/BuildPython.cmake +++ b/cmake/Modules/BuildPython.cmake @@ -25,8 +25,23 @@ if(APPLE) if(CMAKE_OSX_DEPLOYMENT_TARGET) set( Python_C_FLAGS "-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} ${CMAKE_C_FLAGS}") endif() + + if(TLRENDER_NET) + set(_openssl_LOC ${CMAKE_PREFIX_PATH}) + else() + execute_process( + COMMAND brew --prefix openssl + OUTPUT_VARIABLE _openssl_LOC + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_VARIABLE openssl_prefix_error + ) + + if(openssl_prefix_error) + message(FATAL_ERROR "Could not located openssl with 'brew --prefix openssl'. Error: ${openssl_prefix_error}") + endif() + endif() - set( Python_CONFIGURE ${CMAKE_COMMAND} -E env "CFLAGS=${Python_C_FLAGS}" "CPPFLAGS=${Python_C_FLAGS}" "CXXFLAGS=${Python_CXX_FLAGS}" "LDFLAGS=${Python_LD_FLAGS}" -- ./configure --enable-optimizations --enable-shared --with-openssl=${CMAKE_PREFIX_PATH} --prefix=${CMAKE_INSTALL_PREFIX} + set( Python_CONFIGURE ${CMAKE_COMMAND} -E env "CFLAGS=${Python_C_FLAGS}" "CPPFLAGS=${Python_C_FLAGS}" "CXXFLAGS=${Python_CXX_FLAGS}" "LDFLAGS=${Python_LD_FLAGS}" -- ./configure --enable-optimizations --enable-shared --with-openssl="${_openssl_LOC}" --prefix=${CMAKE_INSTALL_PREFIX} ) set( Python_BUILD make -j ${NPROCS} ) set( Python_INSTALL make -j ${NPROCS} install ) diff --git a/etc/build_dir.sh b/etc/build_dir.sh index bfc5cf29b..d066bf308 100755 --- a/etc/build_dir.sh +++ b/etc/build_dir.sh @@ -67,19 +67,16 @@ get_compiler_version # # For Darwin, when building amd64, we make it compatible with macOS 11.0 # -osx_target=11.0 - +export CMAKE_OSX_DEPLOYMENT_TARGET=11.0 if [[ $KERNEL == *Darwin* ]]; then export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:${PATH}" if [[ $ARCH == arm64 ]]; then export CMAKE_OSX_ARCHITECTURES=$ARCH - osx_target=11.3 + export CMAKE_OSX_DEPLOYMENT_TARGET=11.3 else - osx_target=11.0 export CMAKE_OSX_ARCHITECTURES="x86_64" fi - export CMAKE_FLAGS="-DCMAKE_OSX_DEPLOYMENT_TARGET=${osx_target} ${CMAKE_FLAGS}" fi if [[ $FLAGS == "" ]]; then diff --git a/etc/configure-macos-python.sh b/etc/configure-macos-python.sh deleted file mode 100755 index 94162fb63..000000000 --- a/etc/configure-macos-python.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash -# SPDX-License-Identifier: BSD-3-Clause -# mrv2 -# Copyright Contributors to the mrv2 Project. All rights reserved. - -#!/usr/bin/env bash - -echo "Running Python macOS configure" -#./configure --enable-optimizations --with-openssl=$(brew --prefix openssl) --with-system-ffi --with-ensurepip=install $* -./configure \ - --enable-optimizations \ - --enable-shared \ - --with-openssl=$(brew --prefix openssl) \ - --with-ensurepip=install $* \ diff --git a/etc/runme_nolog.sh b/etc/runme_nolog.sh index a538f0bfa..eb3ec793b 100755 --- a/etc/runme_nolog.sh +++ b/etc/runme_nolog.sh @@ -255,6 +255,7 @@ cmd="cmake -G '${CMAKE_GENERATOR}' -D CMAKE_INSTALL_PREFIX=$PWD/install -D CMAKE_PREFIX_PATH=$PWD/install -D CMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} + -D CMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET} -D BUILD_PYTHON=${BUILD_PYTHON} -D BUILD_X11=${BUILD_X11} diff --git a/mrv2/docs/HISTORY.md b/mrv2/docs/HISTORY.md index 773d21528..55041a56e 100644 --- a/mrv2/docs/HISTORY.md +++ b/mrv2/docs/HISTORY.md @@ -30,6 +30,7 @@ v1.1.9 - Improved -pythonScript functionality. It is now possible to change OCIO settings, load clips and save out a new movie file with baked OCIO, all from a Python script. +- Fixed building mrv2 without TLRENDER_NET and with BUILD_PYTHON ON on macOS. - Consolidated Python commands to all use "filename" instead of "file". - Added bakeOCIO.py demo script with arguments. - Added -pythonArgs command-line string to pass a string of separated arguments