[Lazarus] Compiler Options - Conditionally add a package dependency?
Marcos Douglas
md at delfire.net
Thu Jul 9 21:06:59 CEST 2015
On Thu, Jul 9, 2015 at 3:45 PM, Michael Van Canneyt
<michael at freepascal.org> wrote:
>
>
> On Thu, 9 Jul 2015, Marcos Douglas wrote:
>
>> On Thu, Jul 9, 2015 at 2:58 PM, Michael Van Canneyt
>> <michael at freepascal.org> wrote:
>>>
>>>
>>>
>>> On Thu, 9 Jul 2015, Marcos Douglas wrote:
>>>
>>>> On Thu, Jul 9, 2015 at 12:58 PM, Michael Van Canneyt
>>>> <michael at freepascal.org> wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Thu, 9 Jul 2015, Graeme Geldenhuys wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I have two independent packages. I would like my project to toggle
>>>>>> between either one (but never both at the same time). Both have a unit
>>>>>> with the exact same name, hence both packages can't be added to the
>>>>>> dependency list at the same time.
>>>>>>
>>>>>> Is there a way with the Compiler Options -> Other (or Additions and
>>>>>> Overrides) to include a specific package based on a compiler define?
>>>>>>
>>>>>> eg:
>>>>>> if defined UsePackageA
>>>>>> PackageDependecy.Add(PackageA)
>>>>>> else
>>>>>> PackageDependency.Add(PackageB)
>>>>>>
>>>>>> Well something like that at least.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> I would even go further, and have a package included or not depending
>>>>> on
>>>>> the
>>>>> OS.
>>>>> Similar, I think it should be possible to include a unit in a package,
>>>>> depending on the OS.
>>>>>
>>>>> In short, a set of conditions for package dependencies and contains
>>>>> lists.
>>>>
>>>>
>>>>
>>>> I would even go further even more:
>>>> If we have two units with the same name, would be better if were
>>>> possible to create an alias namespace for each unit, like C# does.
>>>>
>>>> https://msdn.microsoft.com/en-us/library/aa664765(v=vs.71).aspx
>>>>
>>>> But you, guys, will talk about "an Unit is a namespace" -- we know
>>>> this is true -- and this is not necessary... anyway.
>>>
>>>
>>>
>>> This is not correct.
>>>
>>> We have support for dotted unit names. The only thing missing is a
>>> namespace
>>> directive.
>>
>>
>> I know we have support for dotted unit names -- and this is not so
>> important, ie, what the difference between MyUnitName to my.unit.name?
>> -- the real problem, IMHO, is the names collisions between packages.
>
>
> I repeat:
> "The only thing missing is a namespace directive."
>
> And then you have what you need.
Ok.
To get ideas, Graeme has created this years ago:
http://wiki.lazarus.freepascal.org/Namespaces
Regards,
Marcos Douglas
More information about the Lazarus
mailing list