BaseLinkerDefaults.xcpjh


////////////////////////// Linker //////////////////////////

@if (IsGccBasedCompiler)
{
    +link("Dynamic-Link Library") 
    {
        @if (IsiOSBasedPlatform)
        {
            -dynamic
        }
        @else
        {
            -shared
        }
    }
    +link("Dynamic-Link Library", "Application", "Console Application")
    {
        -L"$(EXPORT_LIB)/$(PLATFORM)/$(CONFIG)"
    }

    /*
    todo: code::blocks defaults to -s for release builds.  Is this a good idea?

    +link("Release")
    {
        -s
    }
    */
}

@if (IsLinuxPlatform)
{
    +link("Dynamic-Link Library", "Application", "Console Application")
    {
        //-Wl,-rpath=.
        -Wl,-rpath,'$$ORIGIN'
        -lncurses
        -lpthread
    }
}

@if ("$(COMPILER)" == "winegcc")
{
    +link("Console Application")
    {
        -mconsole
    }

    +link
    {
        -l"odbc32" -l"ole32" -l"oleaut32" -l"winspool" -l"odbccp32"
    }
}

@if (IsiOSSimPlatform)
{
    +link("Static Library")
    {
        //-static
        -arch_only i386 
        -syslibroot "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk"
        //-framework UIKit 
        //-framework Foundation 
        //-framework CoreGraphics
    }

    +link("Dynamic-Link Library", "Application", "Console Application")
    {
        -arch i386 
        -isysroot "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk" 
        //-L"$(EXPORT_LIB)/$(PLATFORM)/$(CONFIG)"
        //-F"$(EXPORT_LIB)/$(PLATFORM)/$(CONFIG)"
         
        -Xlinker -objc_abi_version 
        -Xlinker 2 
        -fobjc-arc 
        -fobjc-link-runtime 
        -Xlinker 
        -no_implicit_dylibs 
        -stdlib=libc++ 
        -mios-simulator-version-min=6.1 
        -framework UIKit 
        -framework Foundation 
        -framework CoreGraphics
 
        //-F/Users/david/developer/_root_/ThirdParty.Ceda/boost/1_53_0/framework 
        //-framework boost 

        //-arch i386 
        //-miphoneos-version-min=5.0 
        //--sysroot="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk/"
    }
}

@if (IsiOSPlatform)
{
    +link("Static Library")
    {
         // todo: we are ignoring the target type
         //-dynamic 
         //-static
 
        //-arch_only armv7 
        -syslibroot "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk"
        //-framework Foundation 

    }
    +link("Dynamic-Link Library", "Application", "Console Application")
    {
        -std=C++11
        -stdlib=libc++
        -arch armv7
        //-arch armv7s 
        -isysroot "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/"
        //-miphoneos-version-min=5.0 
        -miphoneos-version-min=6.1
        //--sysroot="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/"

        -fvisibility=hidden 
        -fvisibility-inlines-hidden


        //-framework UIKit 
        -framework Foundation 
        //-framework CoreGraphics

        //-F"$(HOME)/developer/_root_/ThirdParty.Ceda/boost/1_53_0/framework"
        //-framework boost 

        //-mthumb
    } 
}

@if (IsMacOSXPlatform)
{
    +link
    {
        -stdlib=libc++
        -arch x86_64 
        //-mmacosx-version-min=10.7 
        //-fvisibility-inlines-hidden
        -lncurses                           // todo: doesn't belong here
    }
    +link("Dynamic-Link Library")
    {
        // lib tool only allows this option to be used with -dynamic, but we are using -static 
        -install_name "@rpath/lib$(PROJNAME).so"
    }
    +link("Application", "Console Application")
    {
        -Wl,-rpath,@loader_path/.
    }
}

@if (IsMsvcCompiler)
{
	+link
	{
		/OUT:"$(EXPORT_LIB)/$(PLATFORM)/$(CONFIG)/$(PROJNAME).$(TGT_EXTENSION)"
		/NOLOGO                     // Prevent display of the copyright message and version number. 
	}

	+link("Application", "Console Application", "Dynamic-Link Library") 
	{
		// /VERBOSE:LIB
		/PDB:"$(EXPORT_LIB)/$(PLATFORM)/$(CONFIG)/$(PROJNAME).pdb"
		/LARGEADDRESSAWARE
		/DEBUG                      // Creates debugging information for the .exe file or DLL
		///ERRORREPORT:NONE         // Reports about internal compiler errors will not be collected or sent to Microsoft.
	}

	+link("Dynamic-Link Library")
	{
		/DLL
	    
		// VS2010 can't handle OutputDirectory not matching location of files generated by the linker
		// /IMPLIB:"$(EXPORT_LIB)/$(PLATFORM)/$(CONFIG)/$(PROJNAME)/$(PROJNAME).lib"

		/IMPLIB:"$(EXPORT_LIB)/$(PLATFORM)/$(CONFIG)/$(PROJNAME).lib"
	}

	+link("Release|Application", "Release|Console Application", "Release|Dynamic-Link Library")
	{
		/PROFILE        // Produces an output file that can be used with the Performance Tools profiler.
						// Implies /OPT:REF , /OPT:NOICF, /INCREMENTAL:NO, /FIXED:NO 
		/MAP:"$(EXPORT_LIB)/$(PLATFORM)/$(CONFIG)/$(PROJNAME).map"
		/INCREMENTAL:NO // Disable incremental linking
		/OPT:REF        // Eliminates functions and/or data that are never referenced  
		/OPT:ICF        // Remove redundant COMDATs from the linker output
	}

	+link("Debug|Application", "Debug|Console Application", "Debug|Dynamic-Link Library")
	{
		/INCREMENTAL    // Incremental linking (the default)
	}

	/*
	There is no need to specify /LTCG explicitly if WholeProgramOptimization = "1" in the
	project defaults

	+link("Release|Application", "Release|Console Application", "Release|Dynamic-Link Library")
	{
		/LTCG           // Enable link time code generation
	}
	*/

	+link("Console Application")
	{
		/SUBSYSTEM:CONSOLE
	}

	+link("Application|Win32", "Application|x64")
	{
		/SUBSYSTEM:WINDOWS
	}

	+link("x64|Application", "x64|Console Application", "x64|Dynamic-Link Library")
	{
		/MACHINE:X64
		/MANIFEST 
		/MANIFESTFILE:"$(PLATFORM)/$(CONFIG)/$(PROJNAME)/$(PROJNAME).$(TGT_EXTENSION).intermediate.manifest"
		"kernel32.lib"
		"user32.lib" 
		"gdi32.lib" 
		"winspool.lib" 
		"comdlg32.lib" 
		"advapi32.lib" 
		"shell32.lib" 
		"ole32.lib" 
		"oleaut32.lib" 
		"uuid.lib" 
		"odbc32.lib" 
		"odbccp32.lib" 
	}

	+link("Win32|Application", "Win32|Console Application", "Win32|Dynamic-Link Library")
	{
		/MACHINE:X86
		/MANIFEST 
		/MANIFESTFILE:"$(PLATFORM)/$(CONFIG)/$(PROJNAME)/$(PROJNAME).$(TGT_EXTENSION).intermediate.manifest"
		"kernel32.lib"
		"user32.lib" 
		"gdi32.lib" 
		"winspool.lib" 
		"comdlg32.lib" 
		"advapi32.lib" 
		"shell32.lib" 
		"ole32.lib" 
		"oleaut32.lib" 
		"uuid.lib" 
		"odbc32.lib" 
		"odbccp32.lib" 
	}

	+link("WinCE|Application", "WinCE|Console Application", "WinCE|Dynamic-Link Library")
	{
		/SUBSYSTEM:WINDOWSCE,4.20
		/MACHINE:ARM 
		/ARMPADCODE
		/MANIFEST:NO
		/NODEFAULTLIB:"oldnames.lib"
		/STACK:65536,4096       // sets the size of the stack in bytes. This option is only for use when building an .exe file.
								// This option specifies the total stack allocation in virtual memory. 
								// The default stack size is 1 MB. The linker rounds up the specified value to the nearest 4 bytes.
		"coredll.lib"
		"corelibc.lib"
		"ole32.lib"
		"oleaut32.lib"
		"uuid.lib"
		"commctrl.lib"
	}
}