Giter Club home page Giter Club logo

Comments (6)

winksaville avatar winksaville commented on May 28, 2024

How about passing a second parameter to load_module('compiler', 'c') then
C.executable(...) And C.objects(...)

On Wed, Oct 7, 2015, 5:08 AM Niklas Rosenstein [email protected]
wrote:

The compiler modules should get rule functions that will generate the
correct commands to build object files, libraries and executables.

C = load_module('compiler')
build_dir = join(project_dir, 'build')

C.cc_objects('Objects',
sources = glob(join(project_dir, 'src/*/.c')),
includes = [join(project_dir, 'include')],
)

C.cc_executable('Bin',
program = 'main',
inputs = Objects,
)


Reply to this email directly or view it on GitHub
https://github.com/craftr-build/craftr/issues/14.

from craftr-build-4.x.

NiklasRosenstein avatar NiklasRosenstein commented on May 28, 2024

There might be data in the module that you would want to use when declaring a target, eg. let's say to enable all warnings.

C.cc_objects('Objects',
  sources = glob(join(project_dir, 'src/*.c')),
  additional_flags = [C.wall],
)

But yes, maybe something like this would be possible instead, but all flags would need to be duplicated on the C and CXX objects.

C = load_module('compiler').C
C.objects('Objects',
  sources = glob(join(project_dir, 'src/*.c')),
  additional_flags = [C.wall],
)

I can imagine that it could become a cleaner implementation using classes and inheritance, though, so thanks for the idea.

from craftr-build-4.x.

winksaville avatar winksaville commented on May 28, 2024

As long as setting the flags is obvious and easy seems reasonable. I assume
based on what you've written the syntax for other 'compiler's' would be:

Cxx = load_module('compiler').cxx
Asm = load_module('compiler').asm
....

Also, is it going to be "easy" for programmers to create there own
'compiler' modules and 'register" them with Creatr?

On Sun, Oct 11, 2015 at 6:41 AM Niklas Rosenstein [email protected]
wrote:

There might be data in the module that you would want to use when
declaring a target, eg. let's say to enable all warnings.

C.cc_objects('Objects',
sources = glob(join(project_dir, 'src/*.c')),
additional_flags = [C.wall],
)

But yes, maybe something like this would be possible instead, but all
flags would need to be duplicated on the C and CXX objects.

C = load_module('compiler').C
C.objects('Objects',
sources = glob(join(project_dir, 'src/*.c')),
additional_flags = [C.wall],
)


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

from craftr-build-4.x.

winksaville avatar winksaville commented on May 28, 2024

Whoops Craftr :)

On Sun, Oct 11, 2015 at 6:49 PM Wink Saville [email protected] wrote:

As long as setting the flags is obvious and easy seems reasonable. I
assume based on what you've written the syntax for other 'compiler's' would
be:

Cxx = load_module('compiler').cxx
Asm = load_module('compiler').asm
....

Also, is it going to be "easy" for programmers to create there own
'compiler' modules and 'register" them with Creatr?

On Sun, Oct 11, 2015 at 6:41 AM Niklas Rosenstein <
[email protected]> wrote:

There might be data in the module that you would want to use when
declaring a target, eg. let's say to enable all warnings.

C.cc_objects('Objects',
sources = glob(join(project_dir, 'src/*.c')),
additional_flags = [C.wall],
)

But yes, maybe something like this would be possible instead, but all
flags would need to be duplicated on the C and CXX objects.

C = load_module('compiler').C
C.objects('Objects',
sources = glob(join(project_dir, 'src/*.c')),
additional_flags = [C.wall],
)


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

from craftr-build-4.x.

NiklasRosenstein avatar NiklasRosenstein commented on May 28, 2024

Almost, yes. Currently it looks like this:

# craftr_module(hello_world)

P = load_module('platform')
Cxx = load_module('compiler').CxxCompiler()
Cxx.detect()

build_dir = join(project_dir, 'build')

Cxx.objects(
  'Objects',
  sources = glob(join(project_dir, 'source/**/*.cpp')),
)

Cxx.executable(
  'Program',
  name = join(build_dir, 'main'),
  inputs = [Objects],
)

Implemented in c90c4a7.

from craftr-build-4.x.

winksaville avatar winksaville commented on May 28, 2024

The minimum would be: release (-O2), debug (-O0 -g), debugoptimized (-O2
-g) but critically the author needs to be able to remove any predefined
flags and provide exactly what the author requires. In Meson these are
"buildtype's" and one of them is "plain" which sets the "compiler" flags
globally always to empty when creating a compiler. I suggest Craftr should
allow the flags to be defined as each "compiler" is created and the syntax
should allow adding to the defaults or replace the defaults.

My two centavos :)

On Wed, Oct 14, 2015 at 6:33 AM Niklas Rosenstein [email protected]
wrote:

Closed #14 https://github.com/craftr-build/craftr/issues/14.


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

from craftr-build-4.x.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.