Building from source on Windows

CodeLite installation/troubleshooting forum
PaowZ
CodeLite Curious
Posts: 6
Joined: Sat Apr 16, 2011 8:23 pm
Genuine User: Yes
IDE Question: C++
Location: South France
Contact:

Building from source on Windows

Post by PaowZ »

Hello there,

I'm experiencing some issues regarding the build of Codelite for Windows. I had to fiddle with the CMakeLists.txt of the workspace to make it compile, but I cannot succeed at linking the libs altogether..

I added the followings into CMakeLists.txt:

Code: Select all

SET(CMAKE_VERBOSE_MAKEFILE ON)
SET(wxWidgets_ROOT_DIR "C:/_Projects/codelite_build/wxWidgets")
SET(CL_SRC_ROOT "C:/_Projects/codelite_build/codelite" )
..so that Makefiles could be generated.. I'm not sure this is the good way to proceed as I had to put those paths the hard-coded way..

Anyway, I ended up with the following link error concerning a lib called plugin (???)
https://paste.ofcode.org/wfgqNy5gsA8Phua5Cqipc4

Any clue would be greatly appreciated. ;)
User avatar
eranif
CodeLite Plugin
Posts: 6367
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Building from source on Windows

Post by eranif »

On Windows, CodeLite is built using CodeLite not CMake
Make sure you have read the HOW TO POST thread
PaowZ
CodeLite Curious
Posts: 6
Joined: Sat Apr 16, 2011 8:23 pm
Genuine User: Yes
IDE Question: C++
Location: South France
Contact:

Re: Building from source on Windows

Post by PaowZ »

ok, thanks..

Actually, there are some weirdies.. Project files refer to g++64 compiler which is not present, by default, once Codelite just got installed.
When I right-clic/settings on the project, it shows GCC (x86_64) compiler.. but, this is not taken into account.. combo just show an available compiler, since index list is broken due to lack of g++64..
Other strange thing, $(WorkspaceConfiguration) is blank.. I had to add it in Environment Variable. When is it supposed to be set by Codelite ?

It goes the same for the Makefile Generator which is blank, index in the combo might be broken. I had to revert it to Default manually for all projects.. once all done, it eventually builds.. :)
User avatar
eranif
CodeLite Plugin
Posts: 6367
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Building from source on Windows

Post by eranif »

$(WorkspaceConfiguration) always has value (when a workspace is opened)
Click on Help button at the bottom of the project settings dialog to see the complete list of macros available

When you start a build and the compiler does not exists on your machine, CodeLite will prompt you and will ask you to choose a compiler to replace the one it needs.
Make sure you have read the HOW TO POST thread
PaowZ
CodeLite Curious
Posts: 6
Joined: Sat Apr 16, 2011 8:23 pm
Genuine User: Yes
IDE Question: C++
Location: South France
Contact:

Re: Building from source on Windows

Post by PaowZ »

..ok, just to give a bit more of insight for Codelite build under Windows.

As of today, the shortest way to get around build issue is:

1) Add the followings to pre-build step for SQLite3 project in SDK:
if not exist "$(WorkspacePath)\build-$(WorkspaceConfiguration)\lib" mkdir "$(WorkspacePath)\build-$(WorkspaceConfiguration)\lib"
Why ? This will create the folder for libraries delivery, since codelite/plugin require some libs to be present in $(WorkspacePath)\build-$(WorkspaceConfiguration)\lib

2) Append the following env variables with shift+ctrl+V to Codelite environment.
WorkspaceConfiguration=Win_x64_Release
IntermediateDirectory=.
ArchiveOutputSwitch=$(WorkspacePath)\build-$(WorkspaceConfiguration)\lib\
LibPath=$(LibraryPathSwitch)../Runtime $(LibraryPathSwitch)../../Runtime $(LibraryPathSwitch)$(WorkspacePath)/build-$(WorkspaceConfiguration)/lib $(LibraryPathSwitch)../sdk/libssh/lib


Why ? WorkspaceConfiguration shall be defined somewhere at the beginning of the build. This is not the case, we just then supply the target build for the subsequent projects to build.
We also need to set IntermediateDirectory as a folder for building objects, this is actually the folder of the project currently being built, otherwise, all objects would be created at the root of your disk (namely c:\). Why ? Because throughout the generated Makefiles, you'd see stuff like:
Objects0=$(IntermediateDirectory)/src_wxsqlite3.cpp$(ObjectSuffix) $(IntermediateDirectory)/src_wxsqlite3_resourecs.rc$(ObjectSuffix)
.. and if IntermediateDirectory is not defined, you end up with objects at the root of your disk.

Why ArchiveOutputSwitch? It's just a trick to force the ar command to deliver to lib folder, directly.. no big deal.

Why LibPath ? Because each project being built, require some libs to be accessible for linking stage. Thus, I just append some libraries paths to -L option for the linker.. This way, the post-build step which states a copy of the library into ../Runtime is just enough..

3) Set Makefile Generator to Default for main Codelite project and Hit F7

The goal is to avoid adding extra steps for each of the projects.. so, I touched at global env. variable. But, maybe we may glance at builder_gnumake.cpp to dig a bit.. and also do some little cleanings for each projects.

EDIT: I just saw your response, Eran, below my reply to yours :)
$(WorkspaceConfiguration) always has value (when a workspace is opened)
For some reason and tested over 3 OSWindows machine, WorkspaceConfiguration is broken.. I had paths like c:\src\codelite\build-\lib.. "build-" is not correct..
When you start a build and the compiler does not exists on your machine, CodeLite will prompt you and will ask you to choose a compiler to replace the one it needs.
Yes indeed, that's not a big deal and a convenient way to proceed :)
Post Reply