Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Genetic Algorithm Library

, 7 Apr 2012
A framework for genetic algorithms
Prize winner in Competition "Best C++/MFC article of May 2008"
galdemoapps.zip
GalDemoSource.zip
TestApp1
TestApp1.vcxproj.filters
TestApp2
TestApp2.vcxproj.filters
TSP
res
.svn
entries
prop-base
Toolbar.bmp.svn-base
TSP.ico.svn-base
props
text-base
Toolbar.bmp.svn-base
TSP.ico.svn-base
TSP.rc2.svn-base
tmp
prop-base
props
text-base
Toolbar.bmp
TSP.ico
TSP.vcxproj.filters
GaSchedule
Algorithm
GaSchedule.cfg
GaSchedule.vcxproj.filters
res
GaSchedule.ico
galdocumentation.zip
Graphic
ab_cp.png
alg_st.png
a_cr.png
c_cp.png
i_cp.png
mp_cr.png
mv_cr.png
r_cp.png
s_cp.png
s_cr.png
galsource.zip
GeneticLibrary
build
release
gcc_bsd
gcc_linux
gcc_macos
gcc_solaris
icc_linux
icc_macos
icc_win
mingw
msvc
scc_solaris
makefiles
gcc_bsd_debug
gcc_bsd_release
gcc_linux_debug
gcc_linux_release
gcc_macos_debug
gcc_macos_release
gcc_solaris_debug
gcc_solaris_release
icc_linux_debug
icc_linux_release
icc_macos_debug
icc_macos_release
scc_solaris_debug
scc_solaris_release
source
vs
/*! \file Platform.h
    \brief This file detects used compiler and platform and defines macros that customize compilation.
*/

/*
 * 
 * website: http://www.coolsoft-sd.com/
 * contact: support@coolsoft-sd.com
 *
 */

/*
 * Genetic Algorithm Library
 * Copyright (C) 2007-2008 Coolsoft Software Development
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
 */

#ifndef __PLATFORM_H__
#define __PLATFORM_H__

#ifdef __GAL_DOCUMENTATION__

	/// <summary>This macro is defined when Intel C++ compiler is detected. It is used to handle compiler specific syntax.</summary>
	#define GAL_SYNTAX_INTL

	/// <summary>This macro is defined when Microsoft C/C++ compiler is detected. It is used to handle compiler specific syntax.</summary>
	#define GAL_SYNTAX_MSVC

	/// <summary>This macro is defined when GNU G++ compiler is detected. It is used to handle compiler specific syntax.</summary>
	#define GAL_SYNTAX_GNUC

	/// <summary>This macro is defined when Sun Studio C++ compiler is detected. It is used to handle compiler specific syntax.</summary>
	#define GAL_SYNTAX_SUNC

	/// <summary>This macro is defined when Borland C++ compiler is detected. It is used to handle compiler specific syntax.</summary>
	#define GAL_SYNTAX_BCC

	/// <summary>This macro is defined when Windows operating system is detected. It is used to handle operating system specifica calls.</summary>
	#define GAL_PLATFORM_WIN

	/// <summary>This macro is defined when Unix-like operating system (Linux, Mac OS X, BSD) is detected.
	/// It is used to handle operating system specifica calls.</summary>
	#define GAL_PLATFORM_NIX

	/// <summary>This macro is defined when Mac OS X operating system is detected. It is used to handle operating system specifica calls.</summary>
	#define GAL_PLATFORM_MACOS

	/// <summary>This macro is defined when Solaris operating system is detected. It is used to handle operating system specifica calls.</summary>
	#define GAL_PLATFORM_SOL

	/// <summary>This macro is defined when Microsoft STL extensions are detected. It is used to handle different STD extensions.</summary>
	#define GAL_STL_EXT_MSVC

	/// <summary>This macro is defined when GNU STL extensions are detected. It is used to handle different STD extensions..</summary>
	#define GAL_STL_EXT_GNUC

	/// <summary>This macro is defined when STLport (Digital Mars and Sun C++) STL extensions are detected.
	/// It is used to handle different STD extensions.</summary>
	#define GAL_STL_EXT_STLPORT

	/// <summary>Defines calling convention used by run-time environment and operating system API.
	/// On all supported systems and compilers this macro is set to <c>cdecl</c> except for Sun C++ compiler which ignores this macro.</summary>
	#define APICALL

	/// <summary>Defines calling convention used by GAL.
	/// For all supported systems and compilers except Borland C++ on Windows and Intel C++ compiler on Linux and Mac OS this macro is set to <c>fastcall</c>.
	/// Borland C++ on Windows and Intel C++ compilers on Linux and Mac OS this macro is set to <c>cdecl</c>. Sun C++ compiler ignores this macro.</summary>
	#define GACALL

	/// <summary>This macro marks function/methods or global variable as exported symbol when building library. When it used from another
	/// project which use the library it marks function/method or global variable as imported symbol. It should only be specified in
	/// function/method declaration, not in definition. This macro is set to nothing on all systems except on Windows.</summary>
	#define GAL_API

	/// <summary>This macro is defined when the library is compiled. This macro is not defined for projects that imports the library.</summary>
	#define GAL_API_EXPORTING

#else

#if defined(__INTEL_COMPILER)

	#define GAL_SYNTAX_INTL

	#if defined(_MSC_VER)

		#define GAL_STL_EXT_MSVC
		#define GAL_SYNTAX_MSVC
		#define GAL_PLATFORM_WIN

	#elif defined(__GNUC__)

		#define GAL_STL_EXT_GNUC
		#define GAL_SYNTAX_GNUC
		#define GAL_PLATFORM_NIX
		
		#if defined(__APPLE__)

			#define GAL_PLATFORM_MACOS

		#endif

	#endif

#elif defined(_MSC_VER)

	#define GAL_STL_EXT_MSVC
	#define GAL_SYNTAX_MSVC
	#define GAL_PLATFORM_WIN

#elif defined(__CYGWIN__)

	#define GAL_STL_EXT_GNUC
	#define GAL_SYNTAX_GNUC
	#define GAL_PLATFORM_WIN

#elif defined(__MINGW32__)

	#define GAL_STL_EXT_GNUC
	#define GAL_SYNTAX_GNUC
	#define GAL_PLATFORM_WIN

#elif defined(__DMC__)

	#define GAL_STL_EXT_STLPORT
	#define GAL_STL_EXT_GNUC
	#define GAL_SYNTAX_MSVC
	#define GAL_PLATFORM_WIN

#elif defined(__BORLANDC__)

	#define GAL_STL_EXT_STLPORT
	#define GAL_SYNTAX_BCC
	#define GAL_PLATFORM_WIN

#elif defined(__GNUC__)

	#define GAL_STL_EXT_GNUC
	#define GAL_SYNTAX_GNUC
	#define GAL_PLATFORM_NIX
	
	#if defined(__APPLE__)

		#define GAL_PLATFORM_MACOS

	#endif

	#if defined(__sun)

		#define GAL_PLATFORM_SOL

	#endif

#elif defined(__SUNPRO_CC)

	#define GAL_STL_EXT_STLPORT
	#define GAL_SYNTAX_SUNC
	#define GAL_PLATFORM_NIX

	#if defined(__sun)

		#define GAL_PLATFORM_SOL

	#endif

#endif

#if defined(GAL_PLATFORM_WIN)

	#define APICALL	__cdecl

	#if !defined(GAL_SYNTAX_BCC)

		#define GACALL	__fastcall

	#else

		#define GACALL __cdecl

	#endif

#elif defined(GAL_PLATFORM_NIX)

	#if defined (GAL_SYNTAX_SUNC)

		#define APICALL
		#define GACALL

	#else

		#define APICALL __attribute__((cdecl))

		#if defined(GAL_SYNTAX_INTL)

			#define GACALL __attribute__((cdecl))

		#else

			#define GACALL __attribute__((fastcall))

		#endif

	#endif

#endif

#ifdef GENETICLIBRARY_EXPORTS
	
	#if defined(GAL_PLATFORM_WIN)

		#if defined(GENETICLIBRARY_STATIC)

			#define GAL_API

		#else

			#define GAL_API __declspec(dllexport)

		#endif

	#elif defined(GAL_PLATFORM_NIX)
	
		#define GAL_API

	#endif

	#define GAL_API_EXPORTING

#else

	#if defined(GAL_PLATFORM_WIN)

		#if defined(GENETICLIBRARY_STATIC)

			#define GAL_API

		#else

			#define GAL_API __declspec(dllimport)

		#endif

	#elif defined(GAL_PLATFORM_NIX)	

		#define GAL_API

	#endif

#endif

#endif

#endif // __PLATFORM_H__

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)

Share

About the Author

Mladen Janković
Software Developer
Serbia Serbia
No Biography provided

| Advertise | Privacy | Mobile
Web04 | 2.8.140821.2 | Last Updated 7 Apr 2012
Article Copyright 2008 by Mladen Janković
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid