Completed README for macOS command line builds. Must still be verified on a clean machine.

This commit is contained in:
Matthias Melcher
2018-12-28 15:07:07 +01:00
parent 62ff8695a0
commit f2ddd52f76
+86 -72
View File
@@ -5,14 +5,14 @@ _README.macOS.md - Building FLTK under Apple macOS_
* [Contents](#contents) * [Contents](#contents)
* [Introduction](#introduction) * [Introduction](#introduction)
* [How to Build FLTK Using _autoconf_ And _make_](#build_autoconf_make) * [How to Build FLTK Using _autoconf_ and _make_](#build_autoconf_make)
* [Prerequisites](#bam_prerequisites) * [Prerequisites](#bam_prerequisites)
2.2. Downloading and Unpacking * [Downloading FLTK and Unpacking](#bam_download)
2.3. Configuring FLTK * [Configuring FLTK](#bam_config)
2.4. Building FLTK * [Building FLTK](#bam_build)
2.5. Testing FLTK * [Testing FLTK](#bam_test)
2.6. Installing FLTK * [Installing FLTK](#bam_install)
2.7. Creating new Projects * [Creating new Projects](#bam_new_projects)
3. HOW TO BUILD FLTK USING _CMake_ AND _Xcode_ 3. HOW TO BUILD FLTK USING _CMake_ AND _Xcode_
1. Prerequisites 1. Prerequisites
2. Downloading and Unpacking 2. Downloading and Unpacking
@@ -43,119 +43,133 @@ platform:
All environments will generate Unix style static libraries and macOS style app bundles. All environments will generate Unix style static libraries and macOS style app bundles.
<a name="build_autoconf_make"></a> <a name="build_autoconf_make"></a>
## How to Build FLTK Using _autoconf_ And _make_ ## How to Build FLTK Using _autoconf_ and _make_
This option is best for users who like to develop their apps without using Apple's Xcode IDE.
Users should be comfortable with using `bash` or `tcsh` in a terminal window.
<a name="bam_prerequisites"></a> <a name="bam_prerequisites"></a>
### Prerequisites ### Prerequisites
In order to build FLTK from the command line, you need to install the Xcode In order to build FLTK from the command line, you need to install a C++ compiler
developer environment. It can be downloaded from the Apple Store for free. environment, `make` and `autoconf`. _Xcode_ is the easiest way to install all prerequisites,
even if you don't plan to use it as your iDE.
After downloading and installing, you need to launch the Terminal. Terminal.app _Xcode_ can be downloaded via the
is located in the "Utilities" folder inside the "Applications" folder. I like [App Store](https://itunes.apple.com/de/app/xcode/id497799835?l=en&mt=12).
to keep the Terminal in the Dock.
After downloading and installing, you need to launch the Terminal. _Terminal.app_
is located in the _Utilities_ folder inside the _Applications_ folder. I like
to keep the Terminal in the Dock for future use (launch Terminal, right-click or control-click
on the Terminal icon that is now in the docking bar, and choose _Options_->_Keep in Dock_).
2.2 Downloading and Unpacking <a name="bam_download"></a>
-------------------------------- ### Downloading and Unpacking
Download FLTK from here: FLTK 1.4 is currently (as of Jan. 2019) only available as a source code repository via GitHub.
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 simly by telling _git_ to _pull_
the newest release.
https://www.fltk.org/software.php Start your terminal. If you have not set up a developer directory yet, I recomment to use
`~/dev` and put all your projects there:
If you are familiar with Git and like to stay current with your version,
you will find the Git access parameters at the bottom of that page.
Unpack FLTK into a convenient location. I like to have everything in my
dev directory:
```bash ```bash
cd # make sure we are in the home directory
cd ~
# create our developer directory and go there
mkdir dev mkdir dev
cd dev cd dev
mv ~/Downloads/fltk-1.3.xxxx.tar.gz . ```
tar xvfz fltk-1.3.xxxx.tar.gz Now create a copy of the current source code locally:
cd fltk-1.3.xxxx
```bash
git clone https://github.com/fltk/fltk.git fltk-1.4.git
cd fltk-1.4.git
``` ```
If you got FLTK via Git then you need one extra step: build the <a name="fltk-1.4.git"></a>
configure script. Otherwise skip the following part marked ADVANCED: ### Configuring FLTK
Using you shell in the terminal, make sure that you are in the root directory of your
FLTK source code tree.
2.3 Configuring FLTK If you are configuring fltk for the first time, you need to instruct FLTK to create some
----------------------- very basic configuration files. Type:
```bash
NOCONFIGURE=1 ./autogen.sh
```
This script may generate a few error messages which you can sefely ignore.
Now configure your FLTK installation: stay in your FLTK source-code directory Now configure your FLTK installation: stay in your FLTK source-code directory
and type and type
./configure ```bash
./configure
```
ADVANCED: type "./configure --help" to get a complete list of optional The configuration script runs a number of tests to find libraries and tools. The configuration
configurations parameters. These should be pretty self-explanatory. Some summary should not show any errors. You can now continue to build FLTK.
more details can be found in README.
To create multi-architecture binaries, start "configure" with these flags: For the advanced user, there are a few more optinons to the _configure_ script. Type
./configure --with-archflags="-arch i386 -arch x86_64" `./configure --help` to get a complete list of options. These should be pretty
self-explanatory. Some more details can be found in
[online documentation](https://www.fltk.org/doc-1.4/intro.html#intro_unix).
To create applications that can run under macOS 10.4 and above, use these flags: <a name="bam_build"></a>
./configure CXXFLAGS="-mmacosx-version-min=10.4" LDFLAGS="-mmacosx-version-min=10.4" ### Building FLTK
:END_ADVANCED Now this is easy if all the previous steps were successful. Stay in your FLTK source-code
directory and type:
The configuration script will check your machine for the required resources ```bash
which should all have been part of your Xcode installation. Review the make
Configuration Summary, maybe take some notes. ```
2.4 Building FLTK
--------------------
Now this is easy. Stay in your FLTK source-code directory and type:
make
The entire FLTK toolkit including many test programs will be built for you. No 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 warnings should appear, but "ranlib" may complain about a few modules having no
symbols. This is normal and can safely be ignored. symbols. This is normal and can safely be ignored.
<a name="bam_test"></a>
### Testing FLTK
2.5 Testing FLTK After a successful build, you can test FLTK's capabilities by running
-------------------
After a successful build, you can test FLTK's capabilities: ```bash
test/demo
```
test/demo <a name="bam_install"></a>
### Installing FLTK
2.6 Installing FLTK
----------------------
If you did not change any of the configuration settings, FLTK will be installed If you did not change any of the configuration settings, FLTK will be installed
in "/usr/local/include" and "/usr/local/lib" by typing in `/usr/local/include`, `/usr/local/lib`, and `/usr/local/bin` by typing
sudo make install ```bash
sudo make install
```
It is possible to install FLTK without superuser privileges by changing the It is possible to install FLTK without superuser privileges by changing the
installation path to a location within the user account by adding the installation path to a location within the user account by adding the
"--prefix=PREFIX" parameter to the "./configure" command. `--prefix=PREFIX` parameter to the `./configure` command.
<a name="bam_new_projects"></a>
### Creating new Projects
2.7 Creating new Projects FLTK provides a neat script named `fltk-config` that can provide all the flags
----------------------------
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 needed to build FLTK applications using the same flags that were used to build
the library itself. Architecture flags (e.g., -arch i386) used to build the the library itself. Running `fltk-config` without arguments will print a list
library, though, are not provided by the fltk-config script. This allows to
build universal libraries and to produce applications of any architecture
from them. Running "fltk-config" without arguments will print a list
of options. The easiest call to compile an FLTK application from a single source of options. The easiest call to compile an FLTK application from a single source
file is: file is:
fltk-config --compile myProgram.cxx ```bash
fltk-config --compile myProgram.cxx
```
"fltk-config" and "fluid" will be installed in "/usr/local/bin/" by default. I `fltk-config` and our user interface designer `fluid` will be installed in
recommend that you add it to the command search path. `/usr/local/bin/` by default. I recommend that you add this directory to the shell
`PATH` variable.