craftr-build / craftr-build-4.x

Frontend for the Craftr build framework.
https://craftr-build.github.io/craftr/
Other
60 stars 14 forks source link

Move compiler.toolset to platform.toolset #39

Closed NiklasRosenstein closed 8 years ago

NiklasRosenstein commented 8 years ago

Makes more sense. :-)

winksaville commented 8 years ago

I'm curious, can multiple tool sets be used in a given build, so could I use gcc and clang at the same time on different "Compiler's"?

On Wed, Dec 16, 2015 at 5:24 AM Niklas Rosenstein notifications@github.com wrote:

Closed #39 https://github.com/craftr-build/craftr/issues/39 via 500c49e https://github.com/craftr-build/craftr/commit/500c49e76def7a3c718420fcf47ad95794434388 .

— Reply to this email directly or view it on GitHub https://github.com/craftr-build/craftr/issues/39#event-493450922.

NiklasRosenstein commented 8 years ago

Using Clang and GCC at the same time is no problem at all. Only the platform toolset won't give you both of them at the same time.

from craftr.ext.compiler import gcc, llvm

gcc_cxx = gcc.CxxCompiler()
llvm_cxx = llvm.CxxCompiler()

gcc_objects = gcc_cxx.compile(
  sources = path.glob('src/*.cpp')
)

llvm_objects = llvm_cxx.compile(
  sources = path.glon('src/*.cpp'),
)
winksaville commented 8 years ago

SG, so a single platform defines a particular toolset can I, the user of Craftr, create different platforms?

On Wed, Dec 16, 2015 at 7:15 AM Niklas Rosenstein notifications@github.com wrote:

Using Clang and GCC at the same time is no problem at all. Only the platform toolset won't give you both of them at the same time.

from craftr.ext.compiler import gcc, llvm

gcc_cxx = gcc.CxxCompiler() llvm_cxx = llvm.CxxCompiler()

gcc_objects = gcc_cxx.compile( sources = path.glob('src/*.cpp') )

llvm_objects = llvm_cxx.compile( sources = path.glon('src/*.cpp'), )

— Reply to this email directly or view it on GitHub https://github.com/craftr-build/craftr/issues/39#issuecomment-165137478.

NiklasRosenstein commented 8 years ago

Depends on what you think of as a platform in this context. The craftr.ext.platform module simply checks the OS name and does some very simple definitions based on that. Goto platform.craftr

In some previous version, Craftr used to have separate modules for the supported platforms, eg platform.nt, platform.linux, platform.darwin and the platform module basically did the same as it does now, only import the definitions from these sub-modules.

It might be useful to add that again in case you need access to other platform definitions rather than the current one.

from craftr.ext.platform import linux
cc = linux.toolset.CCompiler()  # that probably doesn't make sense
linux_objects = linux.obj(path.glob('src/*.c'))  # that probably does a lot more sense
winksaville commented 8 years ago

I'm not sure, I just hope that there are "defaults" based on the current platform but that any default can be "trivially" overridden. This is just a restatement of my desire to be able to control the defaults and be able to use cross-compilers, or gcc or clang or gold linker or ld linker or .....

I definitely want easy things to be easy and there should be "platform" defaults but I, the programmer, should be able to changes these defaults. And also be able to use multiple tools that overlap in functionality and sometimes use tool A and sometimes tool B. (I sound like a broken record :) )

I think you're really close!

-- Wink

On Wed, Dec 16, 2015 at 7:56 AM Niklas Rosenstein notifications@github.com wrote:

Depends on what you think of as a platform in this context. The craftr.ext.platform module simply checks the OS name and does some very simple definitions based on that. Goto platform.craftr https://github.com/craftr-build/craftr/blob/master/craftr/lib/platform.craftr

In some previous version, Craftr used to have separate modules for the supported platforms, eg platform.nt, platform.linux, platform.darwin and the platform module basically did the same as it does now, only import the definitions from these sub-modules.

It might be useful to add that again in case you need access to other platform definitions rather than the current one.

from craftr.ext.platform import linux cc = linux.toolset.CCompiler() # that probably doesn't make sense linux_objects = linux.obj(path.glob('src/*.c')) # that probably does a lot more sense

— Reply to this email directly or view it on GitHub https://github.com/craftr-build/craftr/issues/39#issuecomment-165153719.