2018-12-27 17:29:13 +03:00
|
|
|
|
_README.macOS.md - Building FLTK under Apple macOS_
|
|
|
|
|
|
2018-12-28 17:35:51 +03:00
|
|
|
|
|
2018-12-27 18:10:35 +03:00
|
|
|
|
<a name="contents"></a>
|
|
|
|
|
## Contents
|
|
|
|
|
|
|
|
|
|
* [Contents](#contents)
|
|
|
|
|
* [Introduction](#introduction)
|
2018-12-28 17:35:51 +03:00
|
|
|
|
|
2019-02-05 13:24:06 +03:00
|
|
|
|
* [How to Build FLTK using _CMake_ and _Xcode_](#build_cmake_xcode)
|
2018-12-28 17:35:51 +03:00
|
|
|
|
* [Prerequisites](#bcx_prerequisites)
|
|
|
|
|
* [Downloading FLTK and Unpacking](#bcx_download)
|
|
|
|
|
* [Configuring FLTK](#bcx_config)
|
|
|
|
|
* [Building FLTK](#bcx_build)
|
|
|
|
|
* [Testing FLTK](#bcx_test)
|
|
|
|
|
* [Installing FLTK](#bcx_install)
|
|
|
|
|
* [Creating new Projects](#bcx_new_projects)
|
|
|
|
|
|
2018-12-28 18:06:59 +03:00
|
|
|
|
* [How to Build FLTK using _CMake_ and _make_](#build_cmake_make)
|
2018-12-28 17:35:51 +03:00
|
|
|
|
* [Prerequisites](#bcm_prerequisites)
|
|
|
|
|
* [Downloading FLTK and Unpacking](#bcm_download)
|
|
|
|
|
* [Configuring FLTK](#bcm_config)
|
|
|
|
|
* [Building FLTK](#bcm_build)
|
|
|
|
|
* [Testing FLTK](#bcm_test)
|
|
|
|
|
* [Installing FLTK](#bcm_install)
|
|
|
|
|
* [Creating new Projects](#bcm_new_projects)
|
|
|
|
|
|
2018-12-28 17:07:07 +03:00
|
|
|
|
* [How to Build FLTK Using _autoconf_ and _make_](#build_autoconf_make)
|
2018-12-27 18:10:35 +03:00
|
|
|
|
* [Prerequisites](#bam_prerequisites)
|
2018-12-28 17:07:07 +03:00
|
|
|
|
* [Downloading FLTK and Unpacking](#bam_download)
|
|
|
|
|
* [Configuring FLTK](#bam_config)
|
|
|
|
|
* [Building FLTK](#bam_build)
|
|
|
|
|
* [Testing FLTK](#bam_test)
|
|
|
|
|
* [Installing FLTK](#bam_install)
|
|
|
|
|
* [Creating new Projects](#bam_new_projects)
|
2020-07-01 19:03:10 +03:00
|
|
|
|
|
2018-12-28 17:35:51 +03:00
|
|
|
|
* [Make an Application Launchable by Dropping Files on its Icon](#dropstart)
|
|
|
|
|
* [Document History](#doc_history)
|
|
|
|
|
|
2010-10-24 02:50:39 +04:00
|
|
|
|
|
2018-12-27 18:10:35 +03:00
|
|
|
|
<a name="introduction"></a>
|
2018-12-28 18:06:59 +03:00
|
|
|
|
## Introduction
|
2010-10-24 02:50:39 +04:00
|
|
|
|
|
2018-12-28 18:06:59 +03:00
|
|
|
|
FLTK supports macOS version 10.3 Panther and above. At the time of writing (Jan. 2019),
|
|
|
|
|
FLTK compiles and runs fine on the most recent macOS 10.14 Mojave.
|
2014-04-28 20:27:55 +04:00
|
|
|
|
|
2021-02-28 16:56:19 +03:00
|
|
|
|
Update (March 2021): FLTK builds and runs fine on macOS 11 (Big Sur) on Intel and
|
|
|
|
|
the new M1 Apple Silicon (Arm) processors.
|
|
|
|
|
|
2018-12-27 18:10:35 +03:00
|
|
|
|
FLTK 1.4 supports the following build environments on the macOS
|
2010-10-24 02:50:39 +04:00
|
|
|
|
platform:
|
|
|
|
|
|
2018-12-28 18:06:59 +03:00
|
|
|
|
* [_cmake_ and _Xcode_](#build_cmake_xcode), no shell needed
|
|
|
|
|
* [_cmake_ and _make_](#build_cmake_make) from the command line
|
|
|
|
|
* [_autoconf_ and _make_](#build_autoconf_make) from the command line
|
2010-10-24 02:50:39 +04:00
|
|
|
|
|
2018-12-27 18:10:35 +03:00
|
|
|
|
All environments will generate Unix style static libraries and macOS style app bundles.
|
2010-10-24 02:50:39 +04:00
|
|
|
|
|
2018-12-28 17:35:51 +03:00
|
|
|
|
|
|
|
|
|
<a name="build_cmake_xcode"></a>
|
|
|
|
|
## How to Build FLTK Using _CMake_ and _Xcode_
|
|
|
|
|
|
2018-12-28 18:06:59 +03:00
|
|
|
|
This option is best for users who like to develop their apps using Apple's Xcode IDE. There
|
|
|
|
|
is no need to ever use a command line shell in this configuration.
|
2018-12-28 17:35:51 +03:00
|
|
|
|
|
2019-02-05 13:24:06 +03:00
|
|
|
|
This option requires an Apple ID and the Administrator password.
|
2018-12-28 21:37:31 +03:00
|
|
|
|
|
2018-12-28 17:35:51 +03:00
|
|
|
|
<a name="bcx_prerequisites"></a>
|
|
|
|
|
### Prerequisites (CMake, Xcode)
|
|
|
|
|
|
2018-12-28 18:06:59 +03:00
|
|
|
|
In order to build FLTK, you need to install _CMake_ and _Xcode_.
|
|
|
|
|
|
2020-07-01 19:03:10 +03:00
|
|
|
|
_Xcode_ is Apple's IDE (Integrated Devloper Environment) and can be downloaded via the
|
2019-02-05 13:24:06 +03:00
|
|
|
|
[App Store](https://itunes.apple.com/de/app/xcode/id497799835?l=en&mt=12). You will
|
|
|
|
|
need an Apple ID and administrator right for this. Installing _Xcode_ needs little to no
|
|
|
|
|
user input, but will likely take well over an hour.
|
|
|
|
|
|
2020-07-01 19:03:10 +03:00
|
|
|
|
"CMake is used to control the software compilation process using simple platform and
|
2018-12-28 18:06:59 +03:00
|
|
|
|
compiler independent configuration files, and generate native makefiles and workspaces
|
|
|
|
|
that can be used in the compiler environment of your choice."
|
|
|
|
|
|
2021-02-28 16:56:19 +03:00
|
|
|
|
Please download and install the macOS version of _CMake_ from
|
2018-12-28 21:23:10 +03:00
|
|
|
|
[www.cmake.org](https://cmake.org/download/). Download the .dmg file, click it, and when
|
|
|
|
|
the Finder window opens, drag the _CMake_ icon into the Applications folder.
|
2018-12-28 17:35:51 +03:00
|
|
|
|
|
|
|
|
|
<a name="bcx_download"></a>
|
2019-02-05 13:24:06 +03:00
|
|
|
|
### Downloading FLTK and Unpacking (CMake, Xcode)
|
2018-12-28 17:35:51 +03:00
|
|
|
|
|
2021-05-13 17:21:52 +03:00
|
|
|
|
FLTK 1.4 is currently (as of May 2021) available as a source code repository via GitHub.
|
2018-12-28 17:35:51 +03:00
|
|
|
|
You will need to clone the repository to check out the source code onto your machine. This
|
|
|
|
|
has the great benefit that the source code can be updated later simply by telling _git_ to
|
|
|
|
|
_pull_ the newest release.
|
|
|
|
|
|
2021-05-13 17:21:52 +03:00
|
|
|
|
Weekly snapshots ("tarballs") can be downloaded from https://www.fltk.org/software.php .
|
|
|
|
|
|
2020-07-01 19:03:10 +03:00
|
|
|
|
If you want to use _Xcode_ to clone the FLTK GitHub repository, you will have to give _Xcode_
|
2019-02-05 13:24:06 +03:00
|
|
|
|
access to your GitHub Account in the _Xcode_ preferences. If you don't have a GitHub
|
2020-07-01 19:03:10 +03:00
|
|
|
|
account, or don't want to share your credentials with _Xcode_, you can use still the command
|
2021-02-28 16:56:19 +03:00
|
|
|
|
line `git clone https://github.com/fltk/fltk.git fltk-1.4`
|
|
|
|
|
to check out the repo.
|
2018-12-28 22:28:29 +03:00
|
|
|
|
|
2020-07-01 19:03:10 +03:00
|
|
|
|
Start _Xcode_. Select `Source Control >> Clone...` in the main menu.
|
2018-12-28 17:35:51 +03:00
|
|
|
|
|
2020-07-01 19:03:10 +03:00
|
|
|
|
A dialog box will open with a search field and a list of repositories. Enter `fltk/fltk` in
|
2021-02-28 16:56:19 +03:00
|
|
|
|
the search field. A list of matching repositories appears. The first one should be named `fltk`
|
2018-12-28 21:23:10 +03:00
|
|
|
|
and be owned by `fltk`. Select it and click _Clone_.
|
2018-12-28 17:35:51 +03:00
|
|
|
|
|
2021-02-28 16:56:19 +03:00
|
|
|
|
A file chooser appears. Navigate to your home directory. Create a new folder named
|
|
|
|
|
`dev`. Enter `fltk-1.4` in the _Save As:_ field and click _Clone_, then _Done_ in the
|
2020-07-01 19:03:10 +03:00
|
|
|
|
previous dialog.
|
2018-12-28 21:23:10 +03:00
|
|
|
|
|
|
|
|
|
The local copy of your repository can be updated by loading it into _Xcode_ and selecting
|
2020-07-01 19:03:10 +03:00
|
|
|
|
`Source Control >> Pull...` in the main menu.
|
2018-12-28 17:35:51 +03:00
|
|
|
|
|
|
|
|
|
<a name="bcx_config"></a>
|
|
|
|
|
### Configuring FLTK (CMake, Xcode)
|
|
|
|
|
|
2021-02-28 16:56:19 +03:00
|
|
|
|
Launch _CMake_ by pressing Command+Spacebar, then type _CMake_ and press return.
|
2018-12-28 21:23:10 +03:00
|
|
|
|
_CMake_ should open with a large dialog box.
|
2018-12-28 17:35:51 +03:00
|
|
|
|
|
2018-12-28 21:23:10 +03:00
|
|
|
|
The first input field is labeled with _Where is the source code:_ . Click on _Browse Source..._
|
2021-02-28 16:56:19 +03:00
|
|
|
|
and navigate to your home folder, then `dev`, then `fltk-1.4`. Click _Open_.
|
2018-12-28 17:35:51 +03:00
|
|
|
|
|
2018-12-28 21:23:10 +03:00
|
|
|
|
The next input field is marked _Where to build the binaries:_. Click _Browse Build..._
|
2021-02-28 16:56:19 +03:00
|
|
|
|
and navigate to your home folder, then `dev`, then `fltk-1.4`, then use _New Folder_
|
2018-12-28 21:23:10 +03:00
|
|
|
|
to create a folder named `build`, and inside that, create a folder named `Xcode`. Click _Open_.
|
2018-12-28 17:35:51 +03:00
|
|
|
|
|
2020-07-01 19:03:10 +03:00
|
|
|
|
The top two input fields should read
|
2018-12-28 21:23:10 +03:00
|
|
|
|
```
|
2021-02-28 16:56:19 +03:00
|
|
|
|
/Users/your_name/dev/fltk-1.4
|
2018-12-28 21:23:10 +03:00
|
|
|
|
```
|
|
|
|
|
and
|
|
|
|
|
```
|
2021-02-28 16:56:19 +03:00
|
|
|
|
/Users/your_name/dev/fltk-1.4/build/Xcode
|
2018-12-28 17:35:51 +03:00
|
|
|
|
```
|
|
|
|
|
|
2020-07-01 19:03:10 +03:00
|
|
|
|
Back in the _CMake_ main window, click _Configure_, select _Xcode_ as the generator and
|
2018-12-28 21:23:10 +03:00
|
|
|
|
click _Done_. _CMake_ will now analyse your system and find tools and dependencies. When
|
2020-07-01 19:03:10 +03:00
|
|
|
|
done, the upper list field in _CMake_ will show CMAKE, FLTK, and OPTION. Open the OPTION
|
2018-12-28 21:23:10 +03:00
|
|
|
|
field and find the entries OPTION_USE_SYSTEM_LIBJPEG and OPTION_USE_SYSTEM_LIBPNG,
|
|
|
|
|
and disable both for maximum compatibility with other macOS installation.
|
2018-12-28 17:35:51 +03:00
|
|
|
|
|
2018-12-28 21:23:10 +03:00
|
|
|
|
Finally, click _Generate_ to generate the _Xcode_ IDE file.
|
|
|
|
|
|
2020-07-01 19:03:10 +03:00
|
|
|
|
You may be wondering why we chose this rather involved way of creating the IDE files instead
|
2018-12-28 21:23:10 +03:00
|
|
|
|
of just including the IDEs in the repo. Well, we did for the longest time, but creating new IDEs
|
2020-07-01 19:03:10 +03:00
|
|
|
|
for every possible platform is quite involved. IDE file formats change, platforms change, and
|
2018-12-28 21:23:10 +03:00
|
|
|
|
FLTK changes as well, and maintenance of the IDEs had become a nightmare. _CMake_ on the
|
|
|
|
|
other hand is very smart, knows about platforms and IDEs that we could never support manually,
|
|
|
|
|
and usually needs to be run only once. Even when updating the FLTK source code later,
|
|
|
|
|
_CMake_ will be smart enough to update the build files as well.
|
2018-12-28 17:35:51 +03:00
|
|
|
|
|
|
|
|
|
<a name="bcx_build"></a>
|
|
|
|
|
### Building FLTK (CMake, Xcode)
|
|
|
|
|
|
2018-12-28 21:23:10 +03:00
|
|
|
|
Now this is easy if all the previous steps were successful. If you are still in _CMake_, just click
|
2020-07-01 19:03:10 +03:00
|
|
|
|
_Open Project_ and _CMake_ will launch _XCode_ for you. If not, just launch _XCode_ and
|
2021-02-28 16:56:19 +03:00
|
|
|
|
open `Macintosh HD ▸ Users ▸ your_name ▸ dev ▸ fltk-1.4 ▸ build ▸ Xcode ▸ FLTK.xcodeproj`.
|
2018-12-28 17:35:51 +03:00
|
|
|
|
|
2018-12-28 21:23:10 +03:00
|
|
|
|
_XCode_ may or may not ask to Autocreate Schemes. Click _Automatically Create Schemes_.
|
2018-12-28 17:35:51 +03:00
|
|
|
|
|
2020-07-01 19:03:10 +03:00
|
|
|
|
In _Xcode_, set the 'active Scheme' to 'hello' or any other test program and press CMD+R
|
2018-12-28 21:23:10 +03:00
|
|
|
|
to compile and run that application.
|
2018-12-28 17:35:51 +03:00
|
|
|
|
|
|
|
|
|
<a name="bcx_test"></a>
|
|
|
|
|
### Testing FLTK (CMake, Xcode)
|
|
|
|
|
|
2020-07-01 19:03:10 +03:00
|
|
|
|
After a successful build, you can test FLTK's capabilities by choosing 'ALL_BUILD' as the
|
|
|
|
|
'active Scheme' and pressing CMD+B to build, then choosing 'demo' and pressing CMD+R to
|
|
|
|
|
run the demo program.
|
2018-12-28 17:35:51 +03:00
|
|
|
|
|
2021-05-13 17:21:52 +03:00
|
|
|
|
Note: compiling 'demo' will not compile any of the other demo programs automatically.
|
|
|
|
|
This is intentional so you can build the test and demo programs incrementally.
|
2018-12-28 17:35:51 +03:00
|
|
|
|
|
|
|
|
|
<a name="bcx_install"></a>
|
|
|
|
|
### Installing FLTK (CMake, Xcode)
|
|
|
|
|
|
2018-12-28 21:23:10 +03:00
|
|
|
|
TODO: choosing the target 'INSTALL' will not work at this point because it requires root
|
|
|
|
|
permission.
|
2018-12-28 17:35:51 +03:00
|
|
|
|
|
|
|
|
|
<a name="bcx_new_projects"></a>
|
|
|
|
|
### Creating new Projects (CMake, Xcode)
|
|
|
|
|
|
2021-02-28 16:56:19 +03:00
|
|
|
|
See README.CMake.txt
|
2018-12-28 17:35:51 +03:00
|
|
|
|
|
|
|
|
|
<a name="build_cmake_make"></a>
|
|
|
|
|
## How to Build FLTK Using _CMake_ and _make_
|
|
|
|
|
|
2018-12-28 21:23:10 +03:00
|
|
|
|
This option is best for users who like to develop their apps without using Apple's Xcode IDE,
|
2020-07-01 19:03:10 +03:00
|
|
|
|
but like the advantages of _CMake_ over _autoconf_. Users should be comfortable with
|
|
|
|
|
using `bash` or `tcsh` in a terminal window.
|
2018-12-28 17:35:51 +03:00
|
|
|
|
|
2018-12-28 21:37:31 +03:00
|
|
|
|
This option requires neither administrator rights, nor an Apple ID.
|
|
|
|
|
|
2018-12-28 17:35:51 +03:00
|
|
|
|
<a name="bcm_prerequisites"></a>
|
|
|
|
|
### Prerequisites (CMake, make)
|
|
|
|
|
|
2018-12-28 21:23:10 +03:00
|
|
|
|
In order to build FLTK, you need to install _CMake_ and the _Xcode_ command line tools.
|
2018-12-28 17:35:51 +03:00
|
|
|
|
|
2020-07-01 19:03:10 +03:00
|
|
|
|
"CMake is used to control the software compilation process using simple platform and
|
2018-12-28 21:23:10 +03:00
|
|
|
|
compiler independent configuration files, and generate native makefiles and workspaces
|
|
|
|
|
that can be used in the compiler environment of your choice."
|
2018-12-28 17:35:51 +03:00
|
|
|
|
|
2021-02-28 16:56:19 +03:00
|
|
|
|
Please download and install the macOS version of _CMake_ from
|
2018-12-28 21:23:10 +03:00
|
|
|
|
[www.cmake.org](https://cmake.org/download/). Download the .dmg file, click it, and when
|
|
|
|
|
the Finder window opens, drag the _CMake_ icon into the Applications folder.
|
2018-12-28 17:35:51 +03:00
|
|
|
|
|
2020-07-01 19:03:10 +03:00
|
|
|
|
We will be using _CMake_ from the command line. Please launch _CMake_ and choose
|
2018-12-28 21:23:10 +03:00
|
|
|
|
`Tools > How to Install for Command Line Use` and follow the instructions
|
2018-12-28 21:50:39 +03:00
|
|
|
|
in the dialog box. If you have admin right, you can also use
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
sudo ln -s /Applications/CMake.app/Contents/bin/cmake /usr/local/bin/cmake
|
|
|
|
|
```
|
2018-12-28 17:35:51 +03:00
|
|
|
|
|
2020-07-01 19:03:10 +03:00
|
|
|
|
Installing the _Xcode_ command line tools is pretty straight forward. Just enter this
|
2018-12-28 21:29:34 +03:00
|
|
|
|
in your shell and follow the dialogs:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
xcode-select --install
|
|
|
|
|
```
|
|
|
|
|
|
2020-07-01 19:03:10 +03:00
|
|
|
|
On older versions of macOS, you will have to install _Xcode_ from the
|
2018-12-28 21:29:34 +03:00
|
|
|
|
[App Store](https://itunes.apple.com/de/app/xcode/id497799835?l=en&mt=12)
|
|
|
|
|
and then install the command line tools from within _Xcode_.
|
|
|
|
|
|
2018-12-28 17:35:51 +03:00
|
|
|
|
|
2018-12-28 21:23:10 +03:00
|
|
|
|
<a name="bcm_download"></a>
|
|
|
|
|
### Downloading and Unpacking (CMake, make)
|
2018-12-28 17:35:51 +03:00
|
|
|
|
|
2018-12-28 21:23:10 +03:00
|
|
|
|
Downloading FLTK is explained [here](#bam_download).
|
2018-12-28 17:35:51 +03:00
|
|
|
|
|
|
|
|
|
<a name="bcm_config"></a>
|
|
|
|
|
### Configuring FLTK (CMake, make)
|
|
|
|
|
|
2021-02-28 16:56:19 +03:00
|
|
|
|
Using your shell in the terminal, make sure that you are in the root directory of your
|
2018-12-28 17:35:51 +03:00
|
|
|
|
FLTK source code tree.
|
|
|
|
|
|
2018-12-28 21:23:10 +03:00
|
|
|
|
Create a directory where all FLTK binaries will be built:
|
2018-12-28 17:35:51 +03:00
|
|
|
|
|
|
|
|
|
```bash
|
2018-12-28 21:23:10 +03:00
|
|
|
|
mkdir build
|
|
|
|
|
cd build
|
|
|
|
|
mkdir Makefile
|
|
|
|
|
cd Makefile
|
2018-12-28 17:35:51 +03:00
|
|
|
|
```
|
2018-12-28 21:23:10 +03:00
|
|
|
|
Now configure your FLTK installation:
|
2018-12-28 17:35:51 +03:00
|
|
|
|
|
|
|
|
|
```bash
|
2018-12-28 21:23:10 +03:00
|
|
|
|
cmake -G "Unix Makefiles" \
|
|
|
|
|
-D OPTION_USE_SYSTEM_LIBJPEG=Off \
|
|
|
|
|
-D OPTION_USE_SYSTEM_ZLIB=Off \
|
|
|
|
|
-D OPTION_USE_SYSTEM_LIBPNG=Off \
|
|
|
|
|
../..
|
2018-12-28 17:35:51 +03:00
|
|
|
|
```
|
|
|
|
|
|
2018-12-28 21:23:10 +03:00
|
|
|
|
_CMake_ runs a number of tests to find external headers, libraries, and tools.
|
2018-12-28 17:35:51 +03:00
|
|
|
|
The configuration summary should not show any errors. You can now continue to build FLTK.
|
|
|
|
|
|
2021-02-28 16:56:19 +03:00
|
|
|
|
For the advanced user there are a few more options to the _CMake_ setup. Type
|
2020-07-01 19:03:10 +03:00
|
|
|
|
`cmake -L ../..` to get a complete list of options. These should be pretty
|
|
|
|
|
self-explanatory. Some more details can be found in
|
2018-12-28 17:35:51 +03:00
|
|
|
|
[online documentation](https://www.fltk.org/doc-1.4/intro.html#intro_unix).
|
|
|
|
|
|
|
|
|
|
<a name="bcm_build"></a>
|
|
|
|
|
### Building FLTK (CMake, make)
|
|
|
|
|
|
2020-07-01 19:03:10 +03:00
|
|
|
|
Now this is easy if all the previous steps were successful. Stay in your `build/Makefiles`
|
2018-12-28 17:35:51 +03:00
|
|
|
|
directory and type:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
make
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
The entire FLTK toolkit including many test programs will be built for you. No
|
|
|
|
|
warnings should appear, but "ranlib" may complain about a few modules having no
|
|
|
|
|
symbols. This is normal and can safely be ignored.
|
|
|
|
|
|
|
|
|
|
<a name="bcm_test"></a>
|
|
|
|
|
### Testing FLTK (CMake, make)
|
|
|
|
|
|
|
|
|
|
After a successful build, you can test FLTK's capabilities by running
|
|
|
|
|
|
|
|
|
|
```bash
|
2021-02-28 16:56:19 +03:00
|
|
|
|
open bin/test/demo.app
|
2018-12-28 17:35:51 +03:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
<a name="bcm_install"></a>
|
|
|
|
|
### Installing FLTK (CMake, make)
|
|
|
|
|
|
|
|
|
|
If you did not change any of the configuration settings, FLTK will be installed
|
|
|
|
|
in `/usr/local/include`, `/usr/local/lib`, and `/usr/local/bin` by typing
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
sudo make install
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
It is possible to install FLTK without superuser privileges by changing the
|
|
|
|
|
installation path to a location within the user account by adding the
|
2021-05-13 17:21:52 +03:00
|
|
|
|
`-D CMAKE_INSTALL_PREFIX=<PREFIX>` parameter to the `cmake` command.
|
2018-12-28 17:35:51 +03:00
|
|
|
|
|
|
|
|
|
<a name="bcm_new_projects"></a>
|
|
|
|
|
### Creating new Projects (CMake, make)
|
|
|
|
|
|
|
|
|
|
FLTK provides a neat script named `fltk-config` that can provide all the flags
|
|
|
|
|
needed to build FLTK applications using the same flags that were used to build
|
|
|
|
|
the library itself. Running `fltk-config` without arguments will print a list
|
|
|
|
|
of options. The easiest call to compile an FLTK application from a single source
|
|
|
|
|
file is:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
fltk-config --compile myProgram.cxx
|
|
|
|
|
```
|
|
|
|
|
|
2020-07-01 19:03:10 +03:00
|
|
|
|
`fltk-config` and our user interface designer `fluid` will be installed in
|
2018-12-28 17:35:51 +03:00
|
|
|
|
`/usr/local/bin/` by default. I recommend that you add this directory to the shell
|
|
|
|
|
`PATH` variable.
|
|
|
|
|
|
|
|
|
|
|
2018-12-27 18:10:35 +03:00
|
|
|
|
<a name="build_autoconf_make"></a>
|
2018-12-28 17:07:07 +03:00
|
|
|
|
## How to Build FLTK Using _autoconf_ and _make_
|
|
|
|
|
|
2018-12-28 21:23:10 +03:00
|
|
|
|
This option is best for users who like to develop their apps without using Apple's Xcode IDE
|
2020-07-01 19:03:10 +03:00
|
|
|
|
and prefer minimal dependencies of a _Makefile_ over _CMake_. Users should be comfortable
|
|
|
|
|
with using `bash` or `tcsh` in a terminal window.
|
2010-10-24 02:50:39 +04:00
|
|
|
|
|
2018-12-28 21:37:31 +03:00
|
|
|
|
This option requires administrator rights, but no Apple ID.
|
|
|
|
|
|
2018-12-27 18:10:35 +03:00
|
|
|
|
<a name="bam_prerequisites"></a>
|
2018-12-28 18:36:11 +03:00
|
|
|
|
### Prerequisites (autoconf, make)
|
2010-10-24 02:50:39 +04:00
|
|
|
|
|
2020-07-01 19:03:10 +03:00
|
|
|
|
In order to build FLTK from the command line, you need to install a C++ compiler
|
2018-12-28 18:06:59 +03:00
|
|
|
|
environment, `make` and `autoconf`. Installing the _Xcode_ command line tools is the easiest
|
|
|
|
|
way to get all prerequisites in one simple step.
|
2010-10-24 02:50:39 +04:00
|
|
|
|
|
2018-12-28 21:23:10 +03:00
|
|
|
|
<a name="xcode_command_line_tools"></a>
|
2020-07-01 19:03:10 +03:00
|
|
|
|
Launch _Terminal.app_ by pressing Command+Spacebar and typing `Terminal` and pressing _return_.
|
2018-12-28 18:06:59 +03:00
|
|
|
|
I like to keep the Terminal in the Dock for future use (launch Terminal, right-click or control-click
|
2018-12-28 17:07:07 +03:00
|
|
|
|
on the Terminal icon that is now in the docking bar, and choose _Options_->_Keep in Dock_).
|
2010-10-24 02:50:39 +04:00
|
|
|
|
|
2020-07-01 19:03:10 +03:00
|
|
|
|
Installing the _Xcode_ command line tools is pretty straight forward. Just enter this
|
2018-12-28 21:29:34 +03:00
|
|
|
|
and follow the dialogs:
|
2018-12-28 18:06:59 +03:00
|
|
|
|
|
|
|
|
|
```bash
|
2018-12-28 21:29:34 +03:00
|
|
|
|
xcode-select --install
|
2018-12-28 18:06:59 +03:00
|
|
|
|
```
|
|
|
|
|
|
2020-07-01 19:03:10 +03:00
|
|
|
|
On older versions of macOS, you will have to install _Xcode_ from the
|
2018-12-28 18:06:59 +03:00
|
|
|
|
[App Store](https://itunes.apple.com/de/app/xcode/id497799835?l=en&mt=12)
|
|
|
|
|
and then install the command line tools from within _Xcode_.
|
|
|
|
|
|
2020-07-01 19:03:10 +03:00
|
|
|
|
Apple no longer includes _autoconf_ in the _Xcode_ command line tools. To install
|
2018-12-28 19:25:16 +03:00
|
|
|
|
_autoconf_, we first need to installe _brew_ by typing this rather cryptic command in the shell
|
|
|
|
|
you will need the root password):
|
2018-12-28 18:36:11 +03:00
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
After a few minutes, we can now build and install all other tools from one simple command:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
brew install autoconf automake
|
|
|
|
|
```
|
|
|
|
|
|
2018-12-28 17:07:07 +03:00
|
|
|
|
<a name="bam_download"></a>
|
2018-12-28 18:36:11 +03:00
|
|
|
|
### Downloading and Unpacking (autoconf, make)
|
2010-10-24 02:50:39 +04:00
|
|
|
|
|
2021-05-13 17:21:52 +03:00
|
|
|
|
FLTK 1.4 is currently (as of May 2021) available as a source code repository via GitHub.
|
2018-12-28 17:07:07 +03:00
|
|
|
|
You will need to clone the repository to check out the source code onto your machine. This
|
2018-12-28 17:35:51 +03:00
|
|
|
|
has the great benefit that the source code can be updated later simply by telling _git_ to
|
|
|
|
|
_pull_ the newest release.
|
2010-10-24 02:50:39 +04:00
|
|
|
|
|
2021-05-13 17:21:52 +03:00
|
|
|
|
Weekly snapshots ("tarballs") can be downloaded from https://www.fltk.org/software.php .
|
|
|
|
|
|
|
|
|
|
Start your terminal. If you have not set up a developer directory yet, I recommend to use
|
2018-12-28 17:07:07 +03:00
|
|
|
|
`~/dev` and put all your projects there:
|
2010-10-24 02:50:39 +04:00
|
|
|
|
|
2018-12-27 18:10:35 +03:00
|
|
|
|
```bash
|
2018-12-28 17:07:07 +03:00
|
|
|
|
# make sure we are in the home directory
|
|
|
|
|
cd ~
|
|
|
|
|
# create our developer directory and go there
|
2018-12-27 18:10:35 +03:00
|
|
|
|
mkdir dev
|
|
|
|
|
cd dev
|
2018-12-28 17:07:07 +03:00
|
|
|
|
```
|
2018-12-28 17:35:51 +03:00
|
|
|
|
Now create a copy of the source code archive at Github on your local file system:
|
2010-10-24 02:50:39 +04:00
|
|
|
|
|
2018-12-28 17:07:07 +03:00
|
|
|
|
```bash
|
2021-02-28 16:56:19 +03:00
|
|
|
|
git clone https://github.com/fltk/fltk.git fltk-1.4
|
|
|
|
|
cd fltk-1.4
|
2018-12-28 17:07:07 +03:00
|
|
|
|
```
|
2010-10-24 02:50:39 +04:00
|
|
|
|
|
2018-12-28 17:35:51 +03:00
|
|
|
|
<a name="bam_config"></a>
|
2018-12-28 18:36:11 +03:00
|
|
|
|
### Configuring FLTK (autoconf, make)
|
2015-03-18 15:49:18 +03:00
|
|
|
|
|
2021-05-13 17:21:52 +03:00
|
|
|
|
Using your shell in the terminal, make sure that you are in the root directory of your
|
2018-12-28 17:07:07 +03:00
|
|
|
|
FLTK source code tree.
|
2015-03-18 15:49:18 +03:00
|
|
|
|
|
2020-07-01 19:03:10 +03:00
|
|
|
|
If you are configuring fltk for the first time, you need to instruct FLTK to create some
|
2018-12-28 17:07:07 +03:00
|
|
|
|
very basic configuration files. Type:
|
|
|
|
|
|
|
|
|
|
```bash
|
2021-02-28 16:56:19 +03:00
|
|
|
|
autoconf
|
2018-12-28 17:07:07 +03:00
|
|
|
|
```
|
2021-02-28 16:56:19 +03:00
|
|
|
|
This creates the configure script.
|
2015-03-18 15:49:18 +03:00
|
|
|
|
|
2018-12-28 17:35:51 +03:00
|
|
|
|
Now configure your FLTK installation. Stay in your FLTK source-code directory
|
2016-04-01 14:11:11 +03:00
|
|
|
|
and type
|
2010-10-24 02:50:39 +04:00
|
|
|
|
|
2018-12-28 17:07:07 +03:00
|
|
|
|
```bash
|
|
|
|
|
./configure
|
|
|
|
|
```
|
2010-10-24 02:50:39 +04:00
|
|
|
|
|
2018-12-28 17:35:51 +03:00
|
|
|
|
The configuration script runs a number of tests to find external headers, libraries, and tools.
|
|
|
|
|
The configuration summary should not show any errors. You can now continue to build FLTK.
|
2010-10-24 02:50:39 +04:00
|
|
|
|
|
2021-05-13 17:21:52 +03:00
|
|
|
|
For the advanced user there are a few more options to the _configure_ script. Type
|
2020-07-01 19:03:10 +03:00
|
|
|
|
`./configure --help` to get a complete list of options. These should be pretty
|
|
|
|
|
self-explanatory. Some more details can be found in
|
2018-12-28 17:07:07 +03:00
|
|
|
|
[online documentation](https://www.fltk.org/doc-1.4/intro.html#intro_unix).
|
2010-10-24 02:50:39 +04:00
|
|
|
|
|
2018-12-28 17:07:07 +03:00
|
|
|
|
<a name="bam_build"></a>
|
2018-12-28 18:36:11 +03:00
|
|
|
|
### Building FLTK (autoconf, make)
|
2010-10-24 02:50:39 +04:00
|
|
|
|
|
2020-07-01 19:03:10 +03:00
|
|
|
|
Now this is easy if all the previous steps were successful. Stay in your FLTK source-code
|
2018-12-28 17:07:07 +03:00
|
|
|
|
directory and type:
|
2010-10-24 02:50:39 +04:00
|
|
|
|
|
2018-12-28 17:07:07 +03:00
|
|
|
|
```bash
|
|
|
|
|
make
|
|
|
|
|
```
|
2010-10-24 02:50:39 +04:00
|
|
|
|
|
2016-04-01 14:11:11 +03:00
|
|
|
|
The entire FLTK toolkit including many test programs will be built for you. No
|
2010-10-30 18:51:32 +04:00
|
|
|
|
warnings should appear, but "ranlib" may complain about a few modules having no
|
2010-10-24 02:50:39 +04:00
|
|
|
|
symbols. This is normal and can safely be ignored.
|
|
|
|
|
|
2018-12-28 17:07:07 +03:00
|
|
|
|
<a name="bam_test"></a>
|
2018-12-28 18:36:11 +03:00
|
|
|
|
### Testing FLTK (autoconf, make)
|
2010-10-24 02:50:39 +04:00
|
|
|
|
|
2018-12-28 17:07:07 +03:00
|
|
|
|
After a successful build, you can test FLTK's capabilities by running
|
2010-10-24 02:50:39 +04:00
|
|
|
|
|
2018-12-28 17:07:07 +03:00
|
|
|
|
```bash
|
|
|
|
|
test/demo
|
|
|
|
|
```
|
2010-10-24 02:50:39 +04:00
|
|
|
|
|
2018-12-28 17:07:07 +03:00
|
|
|
|
<a name="bam_install"></a>
|
2018-12-28 18:36:11 +03:00
|
|
|
|
### Installing FLTK (autoconf, make)
|
2010-10-24 02:50:39 +04:00
|
|
|
|
|
2016-04-01 14:11:11 +03:00
|
|
|
|
If you did not change any of the configuration settings, FLTK will be installed
|
2018-12-28 19:25:16 +03:00
|
|
|
|
in `/usr/local/include`, `/usr/local/lib`, and `/usr/local/bin` by typing:
|
2010-10-24 02:50:39 +04:00
|
|
|
|
|
2018-12-28 17:07:07 +03:00
|
|
|
|
```bash
|
|
|
|
|
sudo make install
|
|
|
|
|
```
|
2016-04-01 14:11:11 +03:00
|
|
|
|
|
|
|
|
|
It is possible to install FLTK without superuser privileges by changing the
|
|
|
|
|
installation path to a location within the user account by adding the
|
2018-12-28 17:07:07 +03:00
|
|
|
|
`--prefix=PREFIX` parameter to the `./configure` command.
|
2010-10-24 02:50:39 +04:00
|
|
|
|
|
2018-12-28 17:07:07 +03:00
|
|
|
|
<a name="bam_new_projects"></a>
|
2018-12-28 18:36:11 +03:00
|
|
|
|
### Creating new Projects (autoconf, make)
|
2010-10-24 02:50:39 +04:00
|
|
|
|
|
2018-12-28 17:07:07 +03:00
|
|
|
|
FLTK provides a neat script named `fltk-config` that can provide all the flags
|
2010-10-24 02:50:39 +04:00
|
|
|
|
needed to build FLTK applications using the same flags that were used to build
|
2018-12-28 17:07:07 +03:00
|
|
|
|
the library itself. Running `fltk-config` without arguments will print a list
|
2016-04-01 14:11:11 +03:00
|
|
|
|
of options. The easiest call to compile an FLTK application from a single source
|
|
|
|
|
file is:
|
2010-10-24 02:50:39 +04:00
|
|
|
|
|
2018-12-28 17:07:07 +03:00
|
|
|
|
```bash
|
2018-12-28 18:36:11 +03:00
|
|
|
|
cat << EOF > main.cxx
|
|
|
|
|
#include <FL/Fl_Window.H>
|
|
|
|
|
int main(int argc, char **argv) {
|
|
|
|
|
Fl_Window *win = new Fl_Window(600, 400, "Hello, world!");
|
|
|
|
|
win->show(argc, argv);
|
|
|
|
|
return Fl::run();
|
|
|
|
|
}
|
|
|
|
|
EOF
|
|
|
|
|
fltk-config --compile main.cxx
|
|
|
|
|
./main
|
2018-12-28 17:07:07 +03:00
|
|
|
|
```
|
2010-10-24 02:50:39 +04:00
|
|
|
|
|
2020-07-01 19:03:10 +03:00
|
|
|
|
`fltk-config` and our user interface designer `fluid` will be installed in
|
2018-12-28 17:07:07 +03:00
|
|
|
|
`/usr/local/bin/` by default. I recommend that you add this directory to the shell
|
|
|
|
|
`PATH` variable.
|
2010-10-24 02:50:39 +04:00
|
|
|
|
|
|
|
|
|
|
2018-12-28 17:35:51 +03:00
|
|
|
|
<a name="dropstart"></a>
|
2019-01-04 01:16:59 +03:00
|
|
|
|
## Make an Application Launchable by Dropping Files on its Icon
|
2018-12-28 17:35:51 +03:00
|
|
|
|
|
|
|
|
|
TODO: update for FLTK 1.4
|
2012-11-13 17:03:20 +04:00
|
|
|
|
|
|
|
|
|
- Prepare an Info.plist file for your application derived from file
|
2021-05-13 17:21:52 +03:00
|
|
|
|
test/mac-resources/editor.plist which allows any file to be dropped
|
2012-11-13 17:03:20 +04:00
|
|
|
|
on the application icon.
|
2016-04-01 14:11:11 +03:00
|
|
|
|
You can edit this file in Xcode and change
|
2012-11-13 17:03:20 +04:00
|
|
|
|
Document types/Item 0/CFBundleTypeExtensions/Item 0
|
2016-04-01 14:11:11 +03:00
|
|
|
|
from the current "*" to the desired file extension. Use several items to
|
|
|
|
|
declare several extensions.
|
2012-11-13 17:03:20 +04:00
|
|
|
|
|
2016-04-01 14:11:11 +03:00
|
|
|
|
- Call fl_open_callback() at the beginning of your main() function that sets
|
|
|
|
|
what function will be called when a file is dropped on the application icon.
|
2012-11-13 17:03:20 +04:00
|
|
|
|
|
|
|
|
|
- In Xcode, set the "Info.plist File" build setting of your target application
|
|
|
|
|
to the Info.plist file you have prepared.
|
|
|
|
|
|
|
|
|
|
- Rebuild your application.
|
|
|
|
|
|
2019-01-04 01:16:59 +03:00
|
|
|
|
## Links
|
|
|
|
|
|
|
|
|
|
[GitHub, git, forking, fetching. and pull requests](https://gist.github.com/Chaser324/ce0505fbed06b947d962)
|
2012-11-13 17:03:20 +04:00
|
|
|
|
|
2018-12-28 17:35:51 +03:00
|
|
|
|
<a name="doc_history"></a>
|
|
|
|
|
## DOCUMENT HISTORY
|
2010-10-24 02:50:39 +04:00
|
|
|
|
|
2018-12-28 18:36:11 +03:00
|
|
|
|
- Oct 29 2010 - matt: removed warnings
|
|
|
|
|
- Oct 24 2010 - matt: restructured entire document and verified instructions
|
|
|
|
|
- Dec 19 2010 - Manolo: corrected typos
|
|
|
|
|
- Dec 29 2010 - Manolo: removed reference to AudioToolbox.framework that's no longer needed
|
|
|
|
|
- Feb 24 2011 - Manolo: architecture flags are not propagated to the fltk-config script.
|
|
|
|
|
- Apr 17 2012 - matt: added Xcode4 documentation
|
|
|
|
|
- Nov 13 2012 - Manolo: added "MAKE AN APPLICATION LAUNCHABLE BY DROPPING FILES ON ITS ICON"
|
2021-02-28 16:56:19 +03:00
|
|
|
|
- Apr 28 2014 - Manolo: how to build programs that run on various macOS versions
|
2018-12-28 18:36:11 +03:00
|
|
|
|
- Mar 18 2015 - Manolo: removed uses of the Xcode3 project
|
2021-02-28 16:56:19 +03:00
|
|
|
|
- Apr 01 2016 - Albrecht: corrected typo, formatted most line breaks < 80 columns
|
|
|
|
|
- Dec 04 2018 - Albrecht: fix typo (lowercase fluid.app) for case sensitive macOS
|
2018-12-28 18:36:11 +03:00
|
|
|
|
- Dec 28 2018 - Matt: complete rework for FLTK 1.4
|
2021-02-28 16:56:19 +03:00
|
|
|
|
- Mar 01 2021 - Albrecht: minor updates, macOS Big Sur and Apple Silicon M1 (ARM)
|