yglukhov / nimx

GUI library
MIT License
1.08k stars 76 forks source link

Documentation for NimX is unclear. #499

Open ShockedCoder opened 1 year ago

ShockedCoder commented 1 year ago

I cannot seem to find a solution to changing some of the attributes of "Builder".

I'm trying to do it like this after looking through the code:

import nimx/naketools
import strformat

const
    appName           = "CollectiveGallery"
    appVersion        = "1.0"
    javaPackageId     = &"eu.example.{appName}"
    activityClassName = &"{javaPackageId}.MainActivity"
    mainFile          = "src/CollectiveGallery"
    bin               = mainFile

var cgBuild = newBuilder() # cg = CollectiveGallery

cgBuild.appName           = appName
cgBuild.appVersion        = appVersion
cgBuild.javaPackageId     = javaPackageId
cgBuild.activityClassName = activityClassName
cgBuild.mainFile          = mainFile

beforeBuild(cgBuild)

But, as expected, this doesn't work and I'm met with a SIGSEGV error.

There also doesn't seem to be a way to change what name the binary ends up as.

yglukhov commented 1 year ago

Here's how it should look like:

import nimx/naketools

# Your constants here ...

beforeBuild = proc(b: Builder) =
  b.mainFile = mainFile
  b.appName = appName
  # ... etc...

There also doesn't seem to be a way to change what name the binary ends up as.

True, there's no way to adjust final executable name. It is either appName.* or main.* depending on target platform. What is the reason you want the binary name to be different?

ShockedCoder commented 1 year ago

What is the reason you want the binary name to be different?

A bit late because i forgor💀, but because why not?

There's no reason not to be able to have the name of the resulting executable not be customizable.

nixfreak commented 1 year ago

You don't have to use naketools then. Just use nim c -r --threads:on <file>.nim