#454 Feature: msys2 as a project template

Next_Release
open
nobody
Feature_Request
2016-12-31
2016-12-22
W Sforge
No

Would be nice to have an msys2 project template that takes a list of /bin/pkg-config names to use to generate C and linker flags.

example:

click new project->msys2

STEP 1: Dialog box for selecting msys/mingw install

the following msys2 installs were detected:
C:/msys64/mingw32
C:/msys64/mingw64

STEP 2: Dialog box auto-detect if msys pkg-config installed.

does file C:/msys64/mingw32/bin/pkg-config exist?

if it does not run msys2 command:

pacman -S mingw-w64-i686-pkg-config

dialog can optionally list common msys2
programming library packages to install
with checkboxs: for example:

  pacman -S mingw-w64-i686-gtkmm3
  pacman -S mingw-w64-i686-gtk2
  pacman -S mingw-w64-i686-gtk3

  (pacman -Ss <search_string>)

STEP 3: Dialog box for msys "pkg-config --list-all"

(This part of dialog executes command
"C:/msys64/mingw32/bin/pkg-config --list-all"
and adds the output of the command to a scrollable checkbox list)

EXAMPLE: in the list the user see "gtkmm-3.0"
and he clicks on it because he wants to build
a gtkmm-3.0 C++ project.

STEP 4: now codeblock does the following automatically:

MENU: Settings->Compiler->Compiler Settings
-> Other Compiler Options

C:/msys64/mingw32/bin/pkg-config gtkmm-3.0 --cflags

MENU: Settings->Compiler->Linker Settings
-> Other Compiler Options

C:/msys64/mingw32/bin/pkg-config gtkmm-3.0 --libs

MENU: Settings->Compiler->Toolchain executables
->Compiler's installation directory

C:\msys64\mingw32\bin

=======================================================================
Incidently here's my msys setup for gtkmm-3.0/mingw-w64 enivironment that compiles under codeblocks:

MSYS2 Setup Script:

L="$L mingw-w64-i686-gcc"
L="$L mingw-w64-i686-gtkmm3"
L="$L mingw-w64-i686-pkg-config"
L="$L mingw-w64-i686-make"
L="$L mingw-w64-i686-glade"
L="$L mingw-w64-i686-tcl"
L="$L m3m perl p7zip tar diffutils vim msys/git"

for x in $L; do
yes | pacman -S $x
done

Discussion

  • W Sforge

    W Sforge - 2016-12-22

    I think the above codeblocks msys2 template should run pkg-config like this to create files in the project directory:

    PATH=C:\msys64\mingw32\bin:$PATH
    pkg-config gtkmm-3.0 --cflags > gtkmm-3.0.pkc
    pkg-config gtkmm-3.0 --libs   > gtkmm-3.0.pkl
    

    And then invoke the gcc compiler like this during build:

    gcc @gtkmm-3.0.pkc -c -g examplewindow.cc
    gcc @gtkmm-3.0.pkc -c -g main.cc
    gcc examplewindow.o main.o -o examplewindow.exe  @gtkmm-3.0.pkl
    

    GTK has too many compiler and linker flags... it really gets annoying when you invoke the compiler this way:

    PATH=C:\msys64\mingw32\bin:$PATH
    gcc `pkg-config gtkmm-3.0 --cflags` -c -g examplewindow.cc
    gcc `pkg-config gtkmm-3.0 --cflags` -c -g main.cc
    gcc examplewindow.o main.o -o examplewindow.exe  `pkg-config gtkmm-3.0 --libs`
    

    I would suggest that template follow above method of providing gcc options through a file using @ option for selected pkg-config's.

    Here's a sniplet my makefile:

    PKG        := gtkmm-3.0 zlib
    
    PKG_C      := $(PKG:=.pkc)
    PKG_L      := $(PKG:=.pkl)
    PAT_C      := $(addprefix @, $(PKG_C))
    PAT_L      := $(addprefix @, $(PKG_L))
    
    %.pkc: 
        pkg-config $(basename $@) --cflags  >  $@
    
    %.pkl: 
        pkg-config $(basename $@) --libs    >  $@
    
    obj/%.o: %.c
        $(GCC) $(GC_FLAGS) $(PAT_C) -o $@ $<
    
    obj/%.o: %.cpp
        $(GPP) $(CC_FLAGS) $(PAT_C) -o $@ $<
    
    $(TARGET): $(OBJ)
        $(GPP) $^ -o $@ $(LD_FLAGS) $(PAT_L)
    
    dirs:
        @mkdir -p obj out
    
     
    Last edit: W Sforge 2016-12-24
  • W Sforge

    W Sforge - 2016-12-24

    complete make with pkg-config

     
  • W Sforge

    W Sforge - 2016-12-24

    I just noticed that pkg-config is part of menu:
    Projects->Properties->Libraries

    Doesn't seem to work... but, that's what is needed
    for an Msys2 icon under add new projects...
    Some type of Dialog box for selecting libraries...

     
  • W Sforge

    W Sforge - 2016-12-25

    I wonder... why not add a template wizard for Makefile projects as well?

    I had Msys2 template and Makefile template under create new project... its done... that's the only thing I would ever need...

     
  • ollydbg

    ollydbg - 2016-12-31

    A project wizard is a squirrel script file which is maintained by scriptedwizard plugin. You can create one for you need if you like.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks