Can I use the Intel C++ compiler with biicode? - icc

biicode is a dependency management system for C++. I use the Intel C++ compiler (ICC), rather than gcc. Is it possible to use biicode, but continue to use ICC for building my project and dependencies?

As biicode uses the CMake build system, it should be possible just indicating CMake that you want to use that compiler. Depending on the platform it can be done differently. You can find info about setting different compilers here
E.g. in Linux, it could be enough to define environment variables:
CC=icc
CXX=icc
bii build
You can pass variables and options to cmake project configuration with the command bii configure, exactly as they would be passed to cmake, e.g. the generator:
bii configure -G "Visual Studio 12" -DMY_OPTION="myvalue"
So you could try something like:
bii configure -D CMAKE_CXX_COMPILER=icc
In win with VS, you might need to set the toolset, this can be done with something like this in your CMakeLists.txt:
set(CMAKE_GENERATOR_TOOLSET "Intel C++ Compiler XE 14.0" CACHE STRING "Platform Toolset" FORCE)
Though in general, specific configuration of compilers in the CMakeLists should be avoided and setting the environment via env or variables is preferred.

Related

How do I specify a compiler in a different directory than MinGW in a NetBeans Toolchain module

I am attempting to make a simple ToolChain for the Borland 4.5 compiler with the Pharlap extender based on instructions at the Apache website: https://netbeans.apache.org/kb/docs/cnd/toolchain.html
I am basing the ToolChain on MinGW so that I can use those tools for make.
I cannot get the new toolset to find the Borland compilers the way MinGW is automatically discovered. If I use g++ as the compiler name, Netbeans finds that OK. The issue seems to be with the directory. I'm assuming an installation directory of C:\BC45\BIN and attempting to find BCC32.EXE in that directory.
When I run (clean, build, then run) the test installation of the netbeans module, I see my new toolchain in C/C++, but the field for the C++ compiler is always empty unless I specify a program in the c:\mingw\bin (base) directory.
I have tried variations on the following in my cpp xml file, making sure from time to time that it works just fine with g++ as the name:
<cpp>
<compiler name="bcc32.exe"/>
<recognizer pattern=".*[\\/]bc45.*[\\/]bin[\\/]?$"/>
I haven't found documents beyond the Apache website. I'm basing my guesses on what I have found in: %appdata%\NetBeans\12.4\config\CND\ToolChain\MinGW.xml
The XML above was OK as far as it goes. The example at apache.org only fills in the subclass of c++ (cpp). When I also subclassed the c, assembler, and linker, I ended up with the fields in the C++ options automatically populating as expected.
vcc4n (https://sourceforge.net/p/vcc4n/wiki/Home/) has a good example of implementing the four important classes for those build tools, but really just continuing the example to create and fill in the additional XML as specified in layer.xml is straightforward enough.

CMake kits .... are they just for VS Code or would I use them for other environments too?

Background: I work in a company with many preferences. We currently use makefiles for our complex build with the developer's choice of IDE (or even VIM) for editing source files.
I'm looking at CMake to clean up our un-tame-able gnu make build system. I like the integration with VS Code, but I couldn't possibly manage to dictate the IDE to many of our more prickly DSP engineers and their preferred editing environment (which I totally understand; I'm a bit of Visual Studio guy, myself).
Anyways, is the cmake-kits.json method of specifying kits or toolchains/targets/etc. the "right" way to do it? Or is that just for VS Code.
If it's just for VS Code, what's the proper CMake-y way to put in new toolchains (we do cross compiling using non-gnu tools for 3 different processors) that would work in VSCode, or eclipse, or from the command line.
Kits are part of the CMake extension for VS Code. You want to read cmake-toolchains(7). A kit is something like setting CC and CXX in the environment so CMake knows which compiler to use for Makefile and Ninja generators. It is different for the other generators as the IDE can control which exact compiler is used and you tell CMake which toolset to use and it generates the project accordingly. FYI, kits don't handle having to write your own toolchain file for cross compilers.
You can use a toolchain file for cross compiling. This can be simple to hard depending on the compiler and how well it acts like a gcc cross compiler. If it's really different a toolchain file isn't quite enough as you then need to update the platform items to get it all working. Since this gets into the area of being CMake implementation dependent it's not that well documented. But there is help at https://discourse.cmake.org/.
You could just use Ninja as the build tool. Then you setup your toolchain file. After your original run on CMake to create the Ninja project files, you can just run Ninja to build the software.
Then it's easy to set your IDE to just call Ninja to build the software.
Personally, I don't like the CMake integration in VS Code (it's just an add-on). It's always been too buggy for me to want to use it. But it was good for pulling the information out of the build to get the cpp-tools setup correctly. As for project files for Eclipse CDT4 - Ninja I've never personally used them.

Visual Studio Code - interconnected environment variables

I am investigating how feasible would it be to switch to Visual Studio Code with larger and more complex projects in C++ with cmake and have hit the wall regarding environmental variables.
Some projects I'm dealing with require a complex structure of interconnected environmental variables, currently this is solved by mostly manual build in bash prompt
$ source envSetupFile
$ mkdir build && cd build
$ cmake .. && make -j $(nproc)
where the envSetupFile contains a lot of different variables, most cases related to toolchain and some specific settings. When those are just plain strings, everything works fine, however there are many cases of variables depending on another one, for example something like (in bash)
export PATH=/opt/custom/lib: $PATH
export ROOT=/some/path
export BIN=$ROOT/bin
export LIB=$ROOT/lib
what I did
I installed the c/c++ extension package along with CMake and CMakeTools packages plus EditorConfig for VS Code
and added custom lines to the visual studio config in the workspace:
/projectpath/.vscode/cmake-kits.json where I set the environmental variables, but while I can set (and verify) directly defined work, any that requires value of another fails completely.
example:
"environmentVariables":{
"POTATO": "aaa",
"CARROT": "bbb",
"CABAGE": "${POTATO}/${CARROT}"
}
I'd expect that afterwards when running cmake which references ${CABAGE} would resolve it as aaa/bbb, but instead of it it takes them as string literals and produces ${POTATO}/${CARROT} as ouptut
I must confess I'm a bit surprised by no trace of such use case in documentation or examples I've seen so far. Perhaps someone could lend a hand? (I'm running VisualStudio Code Version: 1.36.1 on ubuntu 16.04)

How do I find what the Eclipse Cross Settings Prefix should be?

I have installed the latest version of Eclipse on my Windows 7 64-bit machine and the mingw compiler. In setting up a Hello World project, all goes well until I am asked for the Cross Settings what the Prefix is and the Path. The Path is obvious, it's the path to the compiler. However, I haven't the slightest idea what the Prefix is and Googling for much of the day hasn't enlightened me other than finding that a lot of other people have asked the question. Unfortunately the answers I've found appear to be for specific hardware. All I want to do is to produce an executable that will run on a Windows 32 bit or 64 bit machine.
So, what is the Prefix and how do I find what it should be?
What is probably happening here is that CDT is not locating your MingW or GCC installations.
simple - but unlikely reason - covering bases
There can be many reasons, from the simple - but unlikely at this point:
You don't have mingw installed
You don't have GCC installed
This can be tested easily by starting a shell and running gcc --version.
CDT heuristic not working
To more complicated reasons relating to your installation not being detected because the heuristic in CDT did not work on your machine. To find the correct settings, CDT will do:
Check $MINGW_HOME/bin for existence
Check <Eclipse install location>/mingw/bin for existence
Look for mingw32-gcc.exe or x86_64-w64-mingw32-gcc.exe on the PATH
Check C:\MinGW for existence
If CDT cannot find any of the above, you may lead to the situation you are in.
So, how to fix it!
Option 1
Start Eclipse from within a mingw set up shell. i.e. the one you can successfully run gcc --version from. That way Eclipse will inherit an environment that can launch GCC successfully.
Option 2
Set your environment up so that MINGW_HOME is properly defined. You can do this at the system level or within the build settings in Eclipse CDT. For example, on my machine in the build settings for the project (Right-click on the project, choose Properties, then choose C/C++ -> Environment) I have set:
MINGW_HOME to C:\MinGW
MSYS_HOME to C:\MinGW\msys\1.0
PATH to ${MINGW_HOME}\bin;${MSYS_HOME}\bin;<my normal path>
and this allows Eclipse to launch gcc as part of the build process.
NOTE The above setting were done automatically on my machine because mingw was correctly located by the heuristic.
Here is a screenshot of the build settings if it helps:
Prefix: Under the hood
To try and answer part of your original question about what Prefix is, I provide the below information. It is unlikely to be particularly helpf
Prefix, in GCC parlance, refers to the directory under which all the related GCC files are placed. With different prefixes you can have multiple GCC installed on your machine.
From the GCC FAQ:
It may be desirable to install multiple versions of the compiler on
the same system. This can be done by using different prefix paths at
configure time and a few symlinks.
The concept comes from autotools in general. Autotools is the standard GNU make system (where you do ./configure && make - simplified). The prefix is the command line option to the configure stage (--prefix) to specify where to install the tool to. GCC above uses the --prefix to allow multiple GCCs on your system.
If you really want to know more about this, read the autobook. The section on configuring covers --prefix:
‘--prefix=prefix’
The –prefix option is one of the most frequently
used. If generated ‘Makefile’s choose to observe the argument you pass
with this option, it is possible to entirely relocate the
architecture-independent portion of a package when it is installed.
For example, when installing a package like Emacs, the following
command line will cause the Emacs Lisp files to be installed in
‘/opt/gnu/share’:
$ ./configure --prefix=/opt/gnu
It is important to stress that this behavior is dependent on the generated files making use of this
information. For developers writing these files, Automake simplifies
this process a great deal. Automake is introduced in Introducing GNU
Automake.
Additionally, Mingw takes advantage of all this prefix options. Read more about that on mingw's site. But the short of it is that the main prefix for mingw is /mingw.

How to build static lib of ecl.dll under Windows with MSVC2010?

I want to build a program ("exe" or "static lib") using ECL, but under windows. My application must depend on "ecl.dll".
How to modify the MSVC makefile to build ECL statically?
As I explained in the mailing list, ECL's Makefile for Microsoft's compilers currently does not have this option. It simply hasn't been ported from their siblings that run on Unix-type environments. But that does not mean it cannot be done.