-
Notifications
You must be signed in to change notification settings - Fork 32
CMake Configuration
Apple has deprecated support for targeting 32-bit builds and has not shipped a 32-bit machine in over 10 years. Furthermore, Ableton Live 10 (released Fall 2017) and Max 8 (released Fall 2018) are both 64-bit only.
For these reasons the default target architecture of the Min-DevKit is 64-bit only. However, some third-party developers may wish to continue building for 32-bit to support 32-bit users of Max 7. To do so you will need to modify your CMakeList.txt files in your individual project folders by adding a line that specifies the architectures prior to including the "pretarget" file.
Here is an example, where line 5 has been inserted to build both 32-bit and 64-bit binaries:
# Copyright 2018 The Min-DevKit Authors. All rights reserved.
# Use of this source code is governed by the MIT License found in the
License.md file.
cmake_minimum_required(VERSION 3.0)
set(CMAKE_OSX_ARCHITECTURES x86_64;i386)
set(C74_MIN_API_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../min-api)
include(${C74_MIN_API_DIR}/script/min-pretarget.cmake)
...
The only caveat is that Xcode will probably start complaining because Apple has deprecated 32-bit builds, though how harshly it complains will depend on your version of Xcode.
The Min-DevKit, by default, treats most warnings as errors. As a result, these warnings may prohibit you from building unless you change this default behavior. To do so you will need to find the string -Werror
in the cmake scripts in the submodules and remove it.
To check that your builds are actually producing universal binaries with both 32-bit and 64-bit architectures, you can use the lipo
program on the command line. Here is an example -- you will need to substitute the correct path/name for the arguments to the lipo
command.
lipo -info /Users/tim/Documents/Max\ 7/Packages/my_package/externals/my.object~.mxo/Contents/MacOS/my.object~
Architectures in the fat file: /Users/tim/Documents/Max 7/Packages/my_package/externals/my.object~.mxo/Contents/MacOS/my.object~ are: x86_64 i386
Sometimes CMake won't pick up and apply all the changes made in CMake files when you edit them. If you aren't seeing the expected results then delete your build folder and run CMake fresh to produce a new Xcode project.
Visual Studio can compile for various CPUs using various toolchains. For example VS2017 can compile for the old Windows Vista using the "XP" toolchain. Or it can compile using the "v140" toolchain which makes binaries compatible with the VS2015 compiler. You may need to define the compiler toolset with the cmake -T option if your project needs a non-default compiler toolset.
For example:
cmake -G "Visual Studio 15 2017 Win64" -T v140 ..