Portable fltk setup for Visual Studio and Xcode

24 views
Skip to first unread message

anmol....@gmail.com

unread,
Jul 17, 2021, 12:41:24 AM7/17/21
to fltk.general
This is an excellent article by Ian about making portable makefiles using fltk-config 

However this makes a vanilla Makefile, and most of us use IDEs like Visual Studio and Xcode.

Is there a way to use fltk-config inside the Flags and linker fields within these IDE settings ?

I could not figure out how to use scripts to set header paths, linker flags, c++ flags.

duncan

unread,
Jul 17, 2021, 3:45:31 AM7/17/21
to fltk.general
This is an excellent article by Ian about making portable makefiles using fltk-config 

However this makes a vanilla Makefile, and most of us use IDEs like Visual Studio and Xcode.
Is there a way to use fltk-config inside the Flags and linker fields within these IDE settings ?

If you are using FLTK-1.3.x there are some manually maintained configurations for Visual
Studio, but these are obviously snapshots tested on the specific version of Visual Studio
available at that point in time. As FLTK-1.3.x is "end-of-life" it's unlikely that there will be
further updates for newer version of Visual Studio [or Xcode], so to some extent you are
up a creek and need to find your own paddle.

One of the big steps forward in FLTK-1.4.x is the move to CMake, which can then generate
the *.sln file needed for Visual Studio and should offer a more stable build capability.

See also:

However, do remember that FLTK-1.4.x is still a development version and a work-in-progress.

anmol....@gmail.com

unread,
Jul 17, 2021, 3:52:09 AM7/17/21
to fltk.general
I used the macOS guide to build and setup 1.4 and It works well. However, the includes, linker and loader flags need to copy-pasted into every project. 
I think fltk-config is an excellent utility and there may be a way to just pipe its output using the flags fields.
If I find out how the output of shell scripts can be used within the IDE flags - I will post it here.

anmol....@gmail.com

unread,
Jul 17, 2021, 5:22:07 AM7/17/21
to fltk.general
FWIW,

git clone https://github.com/fltk/fltk.git fltk-1.4

cd fltk-1.4 

mkdir build

cd build 

mkdir Xcode

cd Xcode 

cmake -G "Xcode" \         

    -D OPTION_USE_SYSTEM_LIBJPEG=Off \

    -D OPTION_USE_SYSTEM_ZLIB=Off \

    -D OPTION_USE_SYSTEM_LIBPNG=Off \

    ../..


Now open the .xcodeproj with Xcode and 

Xcode will ask to Autocreate Schemes. Click Automatically Create Schemes.

In Xcode, set the 'active Scheme' to 'fltk' and press CMD+R to compile

Right click on scheme and Open in Finder.

Now, close the fltk project. <-- THIS IS IMPORTANT as the project must not be open


You can drag the fltk xcodeproj to your custom project, and add under 

Target->Build Phases->Dependencies and

Target->Build Phases->Link Library with binaries


Now the static lib and headers are automatically picked up in your project.




Reply all
Reply to author
Forward
0 new messages