Skip to content

Commit

Permalink
Move OSX specific code and build files to new location, cleanup so ol…
Browse files Browse the repository at this point in the history
…d code no longer used
  • Loading branch information
dkulp committed Feb 13, 2021
1 parent e2029da commit b09c536
Show file tree
Hide file tree
Showing 124 changed files with 254 additions and 8,747 deletions.
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@
[submodule "dependencies/libltc"]
path = dependencies/libltc
url = https://github.com/x42/libltc.git
[submodule "macOS"]
path = macOS
url = https://github.com/xLightsSequencer/xLights-macOS.git
branch = main
310 changes: 8 additions & 302 deletions README.osx
Original file line number Diff line number Diff line change
@@ -1,306 +1,12 @@
xLights OS/X build instructions
------------------------------------------------------------------------------
NOTE: These docs need updating for build instructions for xLights
These are the original Mac OS/X notes from ToolConfig.txt created by
Matt Brown for xLights.
------------------------------------------------------------------------------
xLights macOS build instructions

xLights can be built and run on Linux, Mac OS/X, or Windows. This
document describes how **developers** should set up their tool chain to build
xLights on Mac OS/X.
To build/debug xLights on macOS, you need to checkout the macOS updates, scripts, build system, etc...

xLights is written in C++ and uses the wxWidgets library as a
compatibility layer across operating systems. The minimum required version
of wxWidgets for xLights on OS X is 3.1.3.
The easiest way to do that is to run:
git submodule update --init macOS

Unfortunately, xLights cannot be compiled wxWidgets3 that is part
of MacPorts due to that build not including the wxMediaControl widgets that
is required for xLights. You must build wxWidgets from source.
That will heckout the code as a submodule. There will be a README.macOS file in the macOS directory
that explains how to build the various 3rd party dependencies that xLights needs.


On OS/X, compilation is done using Xcode. Code::Blocks is not used.
Xcode can be downloaded from the Apple developer web site or the App Store. Make
sure you install the version of Xcode that matches your version of
OS/X. For example, I use OS/X 10.15, so I installed Xcode 11.5.


The latest wxWidgets release (3.1.3) will not work anymore as we need some API's that have
been added since then. We also have several other fixes in place for background rendering, etc...

To get the latest code that we've tested, do:

git clone --recurse-submodules -b xlights_2021.02 https://github.com/dkulp/wxWidgets


First, setup the target directories:
sudo mkdir -p /opt/local/lib
sudo mkdir -p /opt/local/libdbg
sudo mkdir -p /opt/local/bin

#setup permissions on /opt/local
sudo chgrp -R staff /opt/local*
sudo chmod -R g+w /opt/local*

If you are planning on being able to build Release builds, you will need to a release build
wxWidgets first. If not doing release builds, this can be skipped.
cd <wxMac base dir>
cd build
export BINARY_PLATFORMS="x86_64"
# export BINARY_PLATFORMS="x86_64,arm64"
export CXXFLAGS=""
export OBJCXXFLAGS=""
export CPPFLAGS="-g -flto=thin"
export LDFLAGS="-flto=thin"
export CXX=clang++
export CXXCPP="clang++ -E"
export CC=clang
export CPP="clang -E"
export CFLAGS="-g"
../configure --disable-debug_flag --enable-optimise --prefix=/opt/local --enable-universal_binary=${BINARY_PLATFORMS} \
--with-osx_cocoa --with-macosx-version-min=10.10 --disable-dependency-tracking \
--disable-compat30 --enable-mimetype --enable-aui --with-opengl \
--disable-webview --disable-webviewwebkit --disable-richtext --disable-mdi --disable-mdidoc --disable-loggui \
--disable-xrc --disable-stc --disable-ribbon --disable-htmlhelp \
--with-cxx=17 --enable-cxx11 --enable-std_containers --enable-std_string --enable-std_string_conv_in_wxstring \
--without-liblzma --with-expat=builtin --with-zlib=builtin --with-libjpeg=builtin --without-libtiff \
--enable-backtrace --enable-exceptions --disable-shared
make -j 8
make install
make clean

For debug builds:
cd <wxMac base dir>
cd build
export BINARY_PLATFORMS=x86_64
# export BINARY_PLATFORMS="x86_64,arm64"
export CXXFLAGS=""
export OBJCXXFLAGS=""
export CPPFLAGS="-g"
export LDFLAGS=""
export CXX=clang++
export CXXCPP="clang++ -E"
export CC=clang
export CPP="clang -E"
export CFLAGS="-g"
../configure --prefix=/opt/local --libdir=/opt/local/libdbg \
--enable-debug --enable-debug_info --disable-optimise --enable-universal_binary=${BINARY_PLATFORMS} \
--with-osx_cocoa --with-macosx-version-min=10.10 --disable-dependency-tracking \
--disable-compat30 --enable-mimetype --enable-aui --with-opengl \
--disable-webview --disable-webviewwebkit --disable-richtext --disable-mdi --disable-mdidoc --disable-loggui \
--disable-xrc --disable-stc --disable-ribbon --disable-htmlhelp \
--with-cxx=17 --enable-cxx11 --enable-std_containers --enable-std_string --enable-std_string_conv_in_wxstring \
--without-liblzma --with-expat=builtin --with-zlib=builtin --with-libjpeg=builtin --without-libtiff \
--enable-backtrace --enable-exceptions
make -j 8
make install



Next, you will use Xcode to compile xLights. Most of the steps are listed here:

http://wiki.wxwidgets.org/Creating_Xcode_projects_for_wxWidgets_applications

However, if you have the XCode command line tools installed, you should just be able to run "xcodebuild" and it should build and compile xLights automatically.



Other library notes:
Note: These instructions now assume Xcode 12 with support for Arm64.
You must set the env variables at the top first to setup the architecture and version targets


export MACOSX_DEPLOYMENT_TARGET=10.10
export OSX_VERSION_MIN="-mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET}"
export ARM64_TARGETS="-target arm64-apple-macos10.10 -arch arm64"
export X86_64_TARGETS="-target x86_64-apple-macos10.10 -arch x86_64"

#need ONE of these lines
export XL_TARGETS="${X86_64_TARGETS} ${ARM64_TARGETS}"
# export XL_TARGETS="${X86_64_TARGETS}"
# export XL_TARGETS="${ARM64_TARGETS}"

# need ONE of these
export BUILD_HOST=x86_64
# export BUILD_HOST=arm



libzstd:
git clone https://github.com/facebook/zstd
cd zstd
# need to move any local libraries from homebrew out of the way
sudo mv /usr/local/lib /usr/local/l2
export CFLAGS="-g -flto=thin ${OSX_VERSION_MIN} ${XL_TARGETS}"
export LDFLAGS="-flto=thin ${OSX_VERSION_MIN} ${XL_TARGETS} "
make clean
make -j 8
cp lib/libzstd.a /opt/local/lib
export CFLAGS="-g ${OSX_VERSION_MIN} ${XL_TARGETS}"
export LDFLAGS=" ${OSX_VERSION_MIN} ${XL_TARGETS}"
make clean
make -j 8
cp lib/libzstd.a /opt/local/libdbg
# restore any local libraries from homebrew
sudo mv /usr/local/l2 /usr/local/lib
unset CFLAGS
unset LDFLAGS



log4cpp:
Download latest src release (current 1.1.3)
patch -p1 < ~/working/xLights/lib/osx/log4cpp.patch
export CXXFLAGS="-g -O2 -flto=thin ${OSX_VERSION_MIN} ${XL_TARGETS} -std=c++11 -stdlib=libc++ -fvisibility-inlines-hidden"
export LDFLAGS="-flto=thin ${XL_TARGETS} "
./configure --prefix=/opt/local -host ${BUILD_HOST}
make clean
make -j 8
cp src/.libs/liblog4cpp.a /opt/local/lib
export CXXFLAGS="-g ${OSX_VERSION_MIN} ${XL_TARGETS} -std=c++11 -stdlib=libc++ -fvisibility-inlines-hidden"
export LDFLAGS="${XL_TARGETS} "
./configure --prefix=/opt/local -host ${BUILD_HOST}
make clean
make -j 8
cp src/.libs/liblog4cpp.a /opt/local/libdbg
unset CXXFLAGS
unset LDFLAGS


liquidfun:
# requires cmake to be installed, most likely need to have
# homebrew installed and then "brew install cmake"
# aternatively, install CMAKE for OSX from https://cmake.org/download/
# and add the full path to cmake to PATH
# PATH=$PATH:/Applications/CMake.app/Contents/bin/
git clone https://github.com/google/liquidfun
cd liquidfun/liquidfun/Box2D
git status --ignored -s | colrm 1 2 | xargs rm -rf
export CXX=clang++
export CXXFLAGS="-g -O3 -flto=thin ${XL_TARGETS} ${OSX_VERSION_MIN}"
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DBOX2D_BUILD_EXAMPLES=OFF
make clean
make -j 8
cp ./Box2D/Release/libliquidfun.a /opt/local/lib
git status --ignored -s | colrm 1 2 | xargs rm -rf
export CXXFLAGS="-g ${XL_TARGETS} ${OSX_VERSION_MIN}"
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DBOX2D_BUILD_EXAMPLES=OFF
make clean
make -j 8
cp ./Box2D/Release/libliquidfun.a /opt/local/libdbg
unset CXXFLAGS
unset CXX


SDL2: currently using 2.0.12
git clone https://github.com/SDL-mirror/SDL
cd SDL
git checkout release-2.0.12
# need a fix to the config script to be able to build on arm mac
git cherry-pick 89e9ad5a9f9d90b9d304663fddf5927890284de6
export CXXFLAGS="-g -O3 -flto=thin ${XL_TARGETS} ${OSX_VERSION_MIN}"
export CFLAGS="-g -O3 -flto=thin ${XL_TARGETS} ${OSX_VERSION_MIN}"
export LDFLAGS="-g -O3 -flto=thin ${XL_TARGETS} ${OSX_VERSION_MIN}"
./configure --disable-shared --enable-static --disable-render-metal --disable-video-opengl --disable-video-opengles --disable-video-opengles2 --disable-video-vulkan --disable-haptic --disable-joystick
make clean
make -j 8
cp ./build/.libs/libSDL2.a /opt/local/lib
export CXXFLAGS="-g ${XL_TARGETS} ${OSX_VERSION_MIN}"
export CFLAGS="-g ${XL_TARGETS} ${OSX_VERSION_MIN}"
export LDFLAGS="-g ${XL_TARGETS} ${OSX_VERSION_MIN}"
./configure --disable-shared --enable-static --disable-render-metal --disable-video-opengl --disable-video-opengles --disable-video-opengles2 --disable-video-vulkan --disable-haptic --disable-joystick
make clean
make -j 8
cp ./build/.libs/libSDL2.a /opt/local/libdbg
unset CXXFLAGS
unset CFLAGS
unset LDFLAGS


ffmpeg: currently using 4.3.1 - needs x264 installed as above
git clone https://git.ffmpeg.org/ffmpeg.git
cd ffmpeg
git checkout n4.3.1
./configure --disable-asm --disable-x86asm --enable-static --disable-shared --disable-securetransport --extra-cflags="${OSX_VERSION_MIN}" --disable-indev=lavfi --disable-libx264 --disable-lzma --enable-gpl --enable-opengl --disable-programs
sed -i -e "s/^CFLAGS=/CFLAGS=-g -O3 ${XL_TARGETS} /" ffbuild/config.mak
sed -i -e "s/^CXXFLAGS=/CXXFLAGS=-g -O3 ${XL_TARGETS} /" ffbuild/config.mak
sed -i -e "s/^LDFLAGS=/LDFLAGS=-g -O3 ${XL_TARGETS} /" ffbuild/config.mak
make clean
make -j 16
find . -name "*.a" -exec cp {} /opt/local/lib/ \;
make clean
./configure --disable-asm --disable-x86asm --enable-static --disable-shared --disable-securetransport --extra-cflags="${OSX_VERSION_MIN}" --disable-indev=lavfi --disable-libx264 --enable-gpl --enable-opengl --disable-programs
sed -i -e "s/^CFLAGS=/CFLAGS=-g ${XL_TARGETS} /" ffbuild/config.mak
sed -i -e "s/^CXXFLAGS=/CXXFLAGS=-g ${XL_TARGETS} /" ffbuild/config.mak
sed -i -e "s/^LDFLAGS=/LDFLAGS=-g ${XL_TARGETS} /" ffbuild/config.mak
make -j 8
find . -name "*.a" -exec cp {} /opt/local/libdbg/ \;






//TODO - stuff below is still todo

portmidi:
git clone https://github.com/AndrewBelt/portmidi
Remove i386 from CMakeLists.txt


Codeblocks:
Codeblocks needs to have wxWidgets compiled differently, specifically c++14, no lto-thin, and without the containers, shared libs

Set install dir: needs to be separate from wxWidgets used for xLights:
export CB_INSTALL=${CB_INSTALL:=~/working/codeblocks/install_dir}

export CXXFLAGS="-stdlib=libc++ -std=c++14"
export OBJCXXFLAGS="-stdlib=libc++ -std=c++14"
export CPPFLAGS="-stdlib=libc++"
export LDFLAGS="-stdlib=libc++"
export CXX=clang++
export CXXCPP="clang++ -E"
export CC=clang
export CPP="clang -E"
export CFLAGS=""
mkdir -p $CB_INSTALL
../configure --disable-debug --enable-optimise --prefix=$CB_INSTALL --enable-macosx_arch=x86_64 \
--enable-mediactrl --with-osx_cocoa --with-opengl --disable-dependency-tracking \
--disable-compat30 --with-macosx-version-min=10.10 --with-libjpeg=builtin --without-libtiff --enable-mimetype \
--with-cxx=14 --enable-cxx11 \
--enable-backtrace --enable-exceptions --enable-aui --without-liblzma --with-expat=builtin
make -j 8
make install

Then in codeblocks, after bootstrap:
PATH=$CB_INSTALL/bin:$PATH
./configure --with-contrib-plugins=all,-spellchecker,-FileManager,-NassiShneiderman,-profiler --prefix=$CB_INSTALL
make -j 8
make install
./bundle.sh



wxWidgets git hash history:
Feb 28, 2016 - cbb799b1ae3f309c99beb0d287e9bb3b62ea405c Update to 3.1.0 release from 3.0.x
Nov 23, 2016 - b28dd88994ec144c2235721ef8e1133b3651e790 Newer version fixing various bugs, also for 10.12 sdk support
Jun 1, 2017 - ff447038714f853a0bae1720e3e8d6f8da279c51 to be able to compile with 10.13 sdk
Aug 30, 2017 - 4a71ba820f085a3d5a7233e9fd0e23ae4e45af58 attempt to see if fixes #884
Sept 17, 2017 - a8b33bf08ed582a241071ff7fa876dec1911ed7a fix popup menus on dialogs
Jan 12, 2018 - 6bd8cb964bd625d7f974621cc9883ba52b58600a Start testing/preparing for wxWidgets 3.1.1/3.2, update to minver 10.10
Jan 24, 2018 - d8b3fc84c2239effb1824e7094c7bf24db45a7ba Fixes sorting in TreeListCtrl, also changed compile flags to
--enable-std_containers --enable-std_string_conv_in_wxstring
Feb 26, 2018 - switch to 3.1.1 release tar.bz2
June 17, 2018 - add notes about wxWidgets for OSX Mojave
July 16, 2018 - 85c2877a6c660c3b59c7a5400bab224374e3324a Fixes the native wxDataViewCtrl drag/drop
Aug 1, 2018 - c83f3b39424fd0d6690a64ba05277c77c077b861 Fixes sRGB <-> RGB color space issues
Oct 30, 2018 - move to dkulp/wxWidgets xlights_fixes branch to grab atomic ref counting, Mojave fixes, color fixes, etc...
Jan 6, 2019 - 81de073d3b06d61ed8959d417692e27d49ec17eb Move to c++17, fixes for multitouch on OpenGL
Jun 30, 2019 - 51bce4ec0b2f1d6e38e1d5ae75e0ad1cec9bae13 Contains fixes for opengl window resizing
July 21, 2019 - 9ede90257fa5813bbb6c32f949b8d69619e14c03 add --enable-mimetype
July 27, 2019 - d50b91554ada145c8031db4540008b0f641bed28 fixes for some openGL issues, wxGrid crashes
Nov 17, 2019 - 099a4c8b77ccca16870d8761ba724be4e4d13643 Update to wxWidget 3.1.3
July 9, 2020 - tag: xlights_2020.28 - Update to prepare for moving to wxWidgets 3.1.4, start preparing for ARM builds
July 16, 2020 - tag: xlights_2020.29 - Update to prepare for moving to wxWidgets 3.1.4, start preparing for ARM builds, fixes socket issues
Oct 6, 2020 - tag: xlights_2020.41 - Fixes some Big Sur issues with fonts, colors
Dec 18, 2020 - tag: xlights_2020.56 - Fixes some make install things in wxwidgets, some osx graphics memory leaks, font handle leaks, various colors
Dec 21, 2020 - tag: xlights_2020.56b - Fixes potential crash when calling append/insert on wxCheckListBox
Once the dependencies are built, open up the xcodeproject file in Xcode and you should be able to
build and run xLights.
40 changes: 0 additions & 40 deletions bin/mac_fix_dylibs

This file was deleted.

14 changes: 0 additions & 14 deletions bin/xcapture.mac.properties

This file was deleted.

14 changes: 0 additions & 14 deletions bin/xfade.mac.properties

This file was deleted.

Loading

0 comments on commit b09c536

Please sign in to comment.