I rolled my own makefile for a wx project that I have as a part of my efforts to become familiar with the make system and command line compiling and so forth. I'm seeing some differences between the options being posted to the log (c::b) / console (my make) and in the resulting GUI of the app itself. I don't see any significant differences to my untrained eye in the command line being used (in the case of my make) and the options in codeblocks for the project. So I'm wondering what goes on with wx projects behind the scenes as far as command line goes that isn't seen in the project or ide options.
This is on Kubuntu 14.04, so global variables in C::B don't come into play like they would on Windows.
Here is my make file.
CC := g++
EXE := wxDFedit
EXE_DIR := bin/
EXE_PATH := $(EXE_DIR)$(EXE)
OBJ_LIST = DFTab.o GeneralsTab.o wxDFeditApp.o wxDFeditMain.o
OBJ_DIR := obj/
OBJS = $(foreach obj,$(OBJ_LIST), $(OBJ_DIR)$(obj))
LIBS = $(shell wx-config --libs base, core, aui)
CXXFLAGS = -Wall -O2 -s $(shell wx-config --cflags)
build: $(EXE_PATH)
$(EXE_PATH): $(OBJS)
$(CC) -s -o $@ $^ $(LIBS)
$(OBJ_DIR)%.o: interface/%.cpp
$(CC) $(CXXFLAGS) -c $< -o $@
clean:
-rm -f $(OBJS) $(EXE_PATH)
rebuild: clean build
which results in the following:
g++ -Wall -O2 -s -I/usr/lib/x86_64-linux-gnu/wx/include/gtk2-unicode-3.0 -I/usr/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -c interface/DFTab.cpp -o obj/DFTab.o
g++ -Wall -O2 -s -I/usr/lib/x86_64-linux-gnu/wx/include/gtk2-unicode-3.0 -I/usr/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -c interface/GeneralsTab.cpp -o obj/GeneralsTab.o
g++ -Wall -O2 -s -I/usr/lib/x86_64-linux-gnu/wx/include/gtk2-unicode-3.0 -I/usr/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -c interface/wxDFeditApp.cpp -o obj/wxDFeditApp.o
g++ -Wall -O2 -s -I/usr/lib/x86_64-linux-gnu/wx/include/gtk2-unicode-3.0 -I/usr/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -c interface/wxDFeditMain.cpp -o obj/wxDFeditMain.o
g++ -s -o bin/wxDFedit obj/DFTab.o obj/GeneralsTab.o obj/wxDFeditApp.o obj/wxDFeditMain.o -L/usr/lib/x86_64-linux-gnu -pthread -lwx_baseu-3.0 -lwx_gtk2u_core-3.0 -lwx_gtk2u_aui-3.0
The options relevant to wxWidgets in Code::Blocks for the project are:
aside from general compiler options you'll see in the output below:
++ -Wall -O2 -I/opt/wx/3.0_unicode_monolithic_shared/lib/wx/include/gtk3-unicode-3.0 -I/opt/wx/3.0_unicode_monolithic_shared/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -O2 -Wextra -Wall -std=c++11 -c ~/Code/wxWidgets/dfedit-wx/interface/DFTab.cpp -o obj/Release/interface/DFTab.o
g++ -Wall -O2 -I/opt/wx/3.0_unicode_monolithic_shared/lib/wx/include/gtk3-unicode-3.0 -I/opt/wx/3.0_unicode_monolithic_shared/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -O2 -Wextra -Wall -std=c++11 -c ~/Code/wxWidgets/dfedit-wx/interface/GeneralsTab.cpp -o obj/Release/interface/GeneralsTab.o
g++ -Wall -O2 -I/opt/wx/3.0_unicode_monolithic_shared/lib/wx/include/gtk3-unicode-3.0 -I/opt/wx/3.0_unicode_monolithic_shared/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -O2 -Wextra -Wall -std=c++11 -c ~/Code/wxWidgets/dfedit-wx/interface/wxDFeditApp.cpp -o obj/Release/interface/wxDFeditApp.o
g++ -Wall -O2 -I/opt/wx/3.0_unicode_monolithic_shared/lib/wx/include/gtk3-unicode-3.0 -I/opt/wx/3.0_unicode_monolithic_shared/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -O2 -Wextra -Wall -std=c++11 -c ~/Code/wxWidgets/dfedit-wx/interface/wxDFeditMain.cpp -o obj/Release/interface/wxDFeditMain.o
g++ -o bin/Release/wxDFedit obj/Release/interface/DFTab.o obj/Release/interface/GeneralsTab.o obj/Release/interface/wxDFeditApp.o obj/Release/interface/wxDFeditMain.o -s -L/opt/wx/3.0_unicode_monolithic_shared/lib -pthread -lwx_gtk3u-3.0
Code::Blocks version is 119,976 bytes.
My version is 115,880 bytes.
What I'm not getting is just looking at the wx-config string that I can see in C::B and the one I've used in my make, they seem to be exactly the same (aside from having to add core, base, aui manually because it fails to link with just plain wx-config --libs alone). But, they are resulting in different application results. The sizes are different (no suprise given the compiling and linking is different), and the application is visually different. On my system, closeable tabs from wxWidgets apps such as C::B itself have a red circle with a white x. My make-d application has this same look. The C::B version has a rounded square outline with a black x. Also in both C::B and my make-d app, menu options with key accelerators are underlined, but in the C::B version of the app, they aren't.
I was assuming the wx-config options would get passed as-is to the compiler and linker, but, I guess something else is happening to result in different output?