Sign in Join
Wiki copytemporary

Revision 1 of 2, by Mattias2 on 2-27-2024. The page as it is now.

pas2js.cfg

Locations

You can see where pas2js searches for its cfg file and what it finds using the command line parameter -vt.

On Unix (Linux, MacOS, BSD) pas2js searches

On Windows the compiler searches:

You can disable the search for the default config file using the parameter -n.

You can pass additional config files using the @ parameter. For example:

pas2js -n @/etc/pas2js.cfg

This will skip the default config file and parse /etc/pas2js.cfg.

Structure

Macros

You can see the supported macros running pas2js -h

Examples

Here is a typical pas2js.cfg file:

pascal
#
# Minimal config file for pas2js compiler
#
# -d is the same as #DEFINE
# -u is the same as #UNDEF
#
# Write always a nice logo ;)
-l
pascal
# Display Warnings, Notes and Hints
-vwnh
# If you don't want so much verbosity use
#-vw
pascal
# Allow C-operators
-Sc
pascal
#IFDEF FPC_SUBTARGET_NAMESPACED
-Fu$CfgDir/../../packages/*/*/namespaced
-Fi$CfgDir/../../packages/*/*/src
#else
-Fu$CfgDir/../../packages/*/*/src
#endif
pascal
# path to rtl.js
-Fu../../compiler/utils/pas2js/dist/
pascal
#IFDEF nodejs
-Jirtl.js
#ENDIF
pascal
# Put all generated JavaScript into one file
-Jc
pascal
# end.

Creating pas2js.cfg

When you built via make, it creates a pas2js.cfg in bin/$(TargetCPU)-$(TargetOS)/.

There is a tool to create a basic pas2js.cfg: tools/createconfig/createconfig


From the Free Pascal wiki, page "pas2js.cfg", as it stood on 2024-02-27 after a change by Mattias2, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.