User forums > Using Code::Blocks

[RESOLVED]Squirrel set $(var_name)

<< < (2/3) > >>

BlueHazzard:
I have not read or understand your problem ( i will try to) but to quickly try to help: you can use
--- Code: ---Log ()
--- End code ---
to log to the console for debugging purposes...

BlueHazzard:
Also can you add an example project file?

BlueHazzard:
I am afraid, i do not think you can set environment variables with squirrel at the moment.

If you post a example project i can try to implement something.

Suryavarman:
Oo thank you BuelHazzard…Really.

Here you have the git project:
https://framagit.org/Suryavarman/ma/

Here the codeblocks workspace ( i don't like how cmake generate CB project. i prefer to use CB without makefile and with a Workspace)
https://framagit.org/Suryavarman/ma/

Here one of the three projects:
https://framagit.org/Suryavarman/ma/blob/master/code/API/API.cbp

Here the bash script to create the dependencies.cfg and to build some dependencies.
https://framagit.org/Suryavarman/ma/blob/master/dependencies/install_dependencies.sh

Here some config files exemples:
https://framagit.org/Suryavarman/ma/blob/master/dependencies/dependencies_kubuntu18.04.cfg
https://framagit.org/Suryavarman/ma/blob/master/dependencies/dependencies_mageia6.cfg

Here the squirrel scripts to be place into the:
- «Project/target > Build Scripts»:
https://framagit.org/Suryavarman/ma/blob/master/code/API/src/LoadConfig.script

- «project pre-build steps»:
https://framagit.org/Suryavarman/ma/blob/master/code/API/src/LoadConfigPreBuild.script
 Here an output example from LoadConfigPostBuild.script :

--- Code: ---MA_PYTHON_PATH="/usr/bin/python3.7m"
MA_PYTHONENV_PATH="/home/blabla/Ma/dependencies/venv-test"
MA_PYTHONENV_SP_PATH="/home/blabla/Ma/dependencies/venv-test/lib64/python3.7/site-packages"
MA_PYTHONENV_INCLUDE_PATH="/home/blabla/Ma/dependencies/venv-test/include/python3.7m"
MA_WXPYTHON_PATH="/home/blabla/Ma/dependencies/wxPython"
MA_WX_MINOR_VERSION="0"
MA_WX_SO_SUFFIX=".so.0"
MA_CPPCLAY_PATH="/home/blabla/Ma/dependencies/CppClay/CppClay"
MA_CPPCLAYDLL_PATH="/home/blabla/Ma/dependencies/CppClay/CppClay/src/clay"
MA_PYBIND11_PATH="/home/blabla/Ma/dependencies/pybind11"
MA_OGRE_INCLUDE_PATH="/usr/include/OGRE"
MA_LINUX_GTK3_INCLUDE_PATH="/usr/include/gtk-3.0"
MA_LINUX_GLIB_INCLUDE_PATH="/usr/include/glib-2.0"
MA_LINUX_GLIBCONFIG_INCLUDE_PATH="/usr/lib64/glib-2.0/include"
MA_LINUX_PANGO_INCLUDE_PATH="/usr/include/pango-1.0"
MA_LINUX_CAIRO_INCLUDE_PATH="/usr/include/cairo"
MA_LINUX_GDKPIXBUF_INCLUDE_PATH="/usr/include/gdk-pixbuf-2.0"
MA_LINUX_ATK_INCLUDE_PATH="/usr/include/atk-1.0"

--- End code ---

BlueHazzard:
Ok, i found the function to set environment variables and a quick test worked. I did not test your project, but please report if it works for you!


--- Code: ---EnvvarApply
--- End code ---
the syntax is

--- Code: ---EnvvarApply(wxString vraname, wxString value)
--- End code ---
this worked for me on windows in the prebuild steps:

--- Code: ---[[EnvvarApply(_("test"), _("theValueOfTest"));]]
echo %test%
--- End code ---

There are other functions, provided by envar plugin:

--- Code: ---wxArrayString EnvvarGetEnvvarSetNames()
wxArrayString EnvvarGetActiveSetName()
wxArrayString EnvVarGetEnvvarsBySetPath(wxString path)
bool EnvvarSetExists(wxString path)
EnvvarSetApply(wxString setName, bool evenIfActive)
EnvvarSetDiscard(wxString setName) 
EnvvarApply(wxString key, wxString value)
EnvvarDiscard(wxString key)

--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version