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

Fix recently introduced macOS deployment target issue #4573

Merged
merged 6 commits into from
Mar 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 14 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ if(POLICY CMP0077) # Let parent project set child project options (used to skip
endif()

include("cmake/Modules/openscad_version.cmake")
project(OpenSCAD
VERSION ${PROJECT_VERSION}
DESCRIPTION "The Programmer's Solid 3D CAD Modeler"
LANGUAGES C CXX
)

option(INFO "Display build configuration info at end of cmake config" ON)
option(ENABLE_TESTS "Run testsuite after building." ON)
Expand Down Expand Up @@ -60,11 +55,20 @@ cmake_dependent_option(ENABLE_GAMEPAD "Enable Qt5Gamepad input driver." ON "NOT

if(ENABLE_MANIFOLD)
# Requirement from TBB 2021.8.0
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14" CACHE STRING "Minimum OS X deployment version")
set(DEPLOYMENT_TARGET "10.14")
else()
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13" CACHE STRING "Minimum OS X deployment version")
set(DEPLOYMENT_TARGET "10.13")
endif()

# Note: CMAKE_OSX_DEPLOYMENT_TARGET must be set before the project() invocation
set(CMAKE_OSX_DEPLOYMENT_TARGET ${DEPLOYMENT_TARGET} CACHE STRING "Minimum OS X deployment version")

project(OpenSCAD
VERSION ${PROJECT_VERSION}
DESCRIPTION "The Programmer's Solid 3D CAD Modeler"
LANGUAGES C CXX
)

# GNUInstallDirs must be done before BuildParameters
include(GNUInstallDirs)

Expand Down Expand Up @@ -753,6 +757,9 @@ endif()

if(ENABLE_MANIFOLD)

# Hack to find our wanted version of Python before Manifold's included googletest finds Python2
find_package(PythonInterp 3.4 REQUIRED)

if(NOT DEFINED MANIFOLD_PAR AND ENABLE_TBB)
set(MANIFOLD_PAR TBB CACHE STRING "Parallel backend, either \"TBB\" or \"OpenMP\" or \"NONE\"" FORCE)
endif()
Expand Down
4 changes: 4 additions & 0 deletions cmake/Modules/info.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ message(STATUS "CMAKE_PREFIX_PATH: ${CMAKE_PREFIX_PATH}")
message(STATUS "CMAKE_CXX_COMPILER_ID: ${CMAKE_CXX_COMPILER_ID}")
message(STATUS "CMAKE_CXX_COMPILER_VERSION: ${CMAKE_CXX_COMPILER_VERSION}")
message(STATUS "SUFFIX: ${SUFFIX}")
if (APPLE)
message(STATUS "CMAKE_OSX_DEPLOYMENT_TARGET: ${CMAKE_OSX_DEPLOYMENT_TARGET}")
message(STATUS "CMAKE_OSX_ARCHITECTURES: ${CMAKE_OSX_ARCHITECTURES}")
endif()
if (OPENSCAD_LIBRARIES)
message(STATUS "OPENSCAD_LIBRARIES: $ENV{OPENSCAD_LIBRARIES}")
endif()
Expand Down
12 changes: 7 additions & 5 deletions scripts/macosx-sanity-check.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env python
#!/usr/bin/env python3

#
# This is used to verify that all the dependent libraries of a Mac OS X executable
# are present and that they are backwards compatible with at least 10.13.
# are present and that they are backwards compatible with at least 10.14.
# Run with an executable as parameter
# Will return 0 if the executable an all libraries are OK
# Returns != 0 and prints some textural description on error
Expand All @@ -24,13 +24,12 @@
import os
import subprocess
import re
from distutils.version import StrictVersion

DEBUG = False

cxxlib = None

macos_version_min = '10.13'
macos_version_min = '10.14'

def usage():
print("Usage: " + sys.argv[0] + " <executable>", sys.stderr)
Expand Down Expand Up @@ -94,6 +93,9 @@ def find_dependencies(file):
libs.append(dep)
return libs

def version_larger_than(a,b):
return list(map(int, a.split('.'))) > list(map(int, b.split('.')))

def validate_lib(lib):
p = subprocess.Popen(["otool", "-l", lib], stdout=subprocess.PIPE, universal_newlines=True)
output = p.communicate()[0]
Expand All @@ -110,7 +112,7 @@ def validate_lib(lib):
if deploymenttarget is None:
print("Error: Neither LC_VERSION_MIN_MACOSX nor LC_BUILD_VERSION found in " + lib)
return False
if StrictVersion(deploymenttarget) > StrictVersion(macos_version_min):
if version_larger_than(deploymenttarget, macos_version_min):
print("Error: Unsupported deployment target " + m.group(2) + " found: " + lib)
return False

Expand Down