Include only specific libraries in the operating system

When writing an application that needs to be compiled on Mac, Linux, and Windows, the best way to manage the various libraries that will need to be included in various operating systems. For example, using the glut opengl toolkit requires different inclusions on each operating system.

+3
source share
8 answers

Your question actually consists of two questions:

1) How to write your own C ++ code to include the necessary include files on the correct platform?

2) How to write my Makefile to work on different platforms?

++ - , , .

Automake scons , . "" make . Windows GNU Make for Windows ( nmake , .

+2

, , . , , , .

:

CMake. Autotools , , scons . Cmake IDE, make .

+1

Macros . , OS/COmpiler ( ).

Autoconfiguration , , , , , Branan

+1

, , script autoconf, Makefile, , :

./configure
make
make install
0

Scons , , autotools , ( , autotools).

0

, , . linux gcc Linux, _WIN32 V++. - , autoconf, Unix.

, OpenSource. . AutoSense.hpp ( ) Apache Xerces.

0

API , -, #ifdef s. " " , . .

API , .

0

, , , ? autoconf, - bjam, , , . , MSVC. , defs /, , , , , .

0

Source: https://habr.com/ru/post/1697340/


All Articles