Add icon to windows binary

This commit is contained in:
Timothy Warren 2015-04-16 22:07:51 -04:00
parent 6dec55b0d2
commit f9d677516a
4 changed files with 37 additions and 21 deletions

View File

@ -8,24 +8,25 @@ JSON_FILES = $(patsubst config/%.json,%.json, $(wildcard config/*.json))
PROGRAM_SRC = $(wildcard src/*.cpp src/widgets/*.cpp) PROGRAM_SRC = $(wildcard src/*.cpp src/widgets/*.cpp)
PROGRAM = build/Tyro PROGRAM = build/Tyro
PROGRAM_OBJECTS = $(patsubst %.cpp,%.o, $(PROGRAM_SRC)) PROGRAM_OBJECTS = $(patsubst %.cpp,%.o, $(PROGRAM_SRC))
BASE_FLAGS = -DSCI_LEXER WX_LDLIBS = $(shell wx-config --libs base core aui stc adv) -lssh2
WX_CXXFLAGS = $(shell wx-config --cxxflags)
WX_RES = $(shell wx-config --rescomp)
LDLIBS = $(TARGET)
LDLIBS = $(TARGET) $(shell wx-config --libs base core aui stc adv) -lssh2
WX_CXXFLAGS = $(shell wx-config --cxxflags) $(BASE_FLAGS)
DEV_CXXFLAGS = -g -Wall -Wextra DEV_CXXFLAGS = -g -Wall -Wextra
CXXFLAGS = -Os CXXFLAGS = -Os -s
TEST_SRC = $(wildcard tests/*.cpp) TEST_SRC = $(wildcard tests/*.cpp)
TESTS = $(patsubst %.cpp,%,$(TEST_SRC)) TESTS = $(patsubst %.cpp,%,$(TEST_SRC))
UNAME = $(shell uname -s) OS ?= $(shell uname -s)
# Add the /lib search directory for MSyS on Windows ifeq ($(OS),Windows_NT)
ifdef OS LDLIBS += -L/lib
ifeq($(OS),Windows_NT) endif
LDLIBS += -L/lib
endif
all: build json_wrapper $(TARGET) $(PROGRAM) all: build json_wrapper $(TARGET) $(PROGRAM)
@ -41,7 +42,6 @@ json_wrapper_build:
build: build:
@mkdir -p build @mkdir -p build
#$(TARGET): CXXFLAGS +=
$(TARGET): $(OBJECTS) $(TARGET): $(OBJECTS)
ar rcs $@ $(OBJECTS) ar rcs $@ $(OBJECTS)
ranlib $@ ranlib $@
@ -49,19 +49,32 @@ $(TARGET): $(OBJECTS)
$(PROGRAM): CXXFLAGS += $(WX_CXXFLAGS) $(TARGET) $(PROGRAM): CXXFLAGS += $(WX_CXXFLAGS) $(TARGET)
$(PROGRAM): $(PROGRAM):
$(CXX) $(WX_CXXFLAGS) $(PROGRAM_SRC) $(LDLIBS) -o $(PROGRAM) $(CXX) $(WX_CXXFLAGS) $(PROGRAM_SRC) $(LDLIBS) $(WX_LDLIBS) -o $(PROGRAM)
run: run:
./build/Tyro ./build/Tyro
release: all release:
ifeq ($(UNAME),Darwin) ifeq ($(OS),Darwin)
make Tyro.app make Tyro.app
endif endif
ifeq ($(OS),Windows_NT)
make exe
endif
ifeq ($(OS),Linux)
make all
endif
# strip -sxX $(PROGRAM)
msw_resource:
$(WX_RES) resources/platform/msw/resource.rc -O coff -o resource.res
exe: LDLIBS += resource.res
exe: msw_resource all
Tyro.app: all resources/platform/osx/Info.plist Tyro.app: all resources/platform/osx/Info.plist
strip -sxX $(PROGRAM)
SetFile -t APPL $(TARGET) SetFile -t APPL $(TARGET)
-mkdir Tyro.app -mkdir Tyro.app
-mkdir Tyro.app/Contents -mkdir Tyro.app/Contents
@ -79,9 +92,11 @@ tests: $(TESTS)
sh ./tests/runtests.sh sh ./tests/runtests.sh
clean: clean:
rm -f *.res
rm -f config/json2c rm -f config/json2c
rm -f config/json2c.exe
rm -f config/*_json.h rm -f config/*_json.h
rm -f *.o rm -rf *.o
rm -rf Tyro.app rm -rf Tyro.app
rm -rf build $(OBJECTS) $(PROGRAM) $(TARGET) $(TESTS) rm -rf build $(OBJECTS) $(PROGRAM) $(TARGET) $(TESTS)
find . -name "*.gc*" -exec rm {} \; find . -name "*.gc*" -exec rm {} \;

View File

@ -0,0 +1 @@
APP_ICON ICON "tyro.ico"

View File

@ -33,8 +33,8 @@ private:
TyroConfig *config; TyroConfig *config;
enum enum
{ {
MARGIN_LINE_NUMBERS, MARGIN_FOLD,
MARGIN_FOLD MARGIN_LINE_NUMBERS
}; };
void BindEvents(); void BindEvents();
void OnMarginClick(wxStyledTextEvent &event); void OnMarginClick(wxStyledTextEvent &event);

View File

@ -5,7 +5,7 @@
MainFrame::MainFrame(wxFrame *frame, const wxString& title) MainFrame::MainFrame(wxFrame *frame, const wxString& title)
: wxFrame(frame, -1, title) : wxFrame(frame, -1, title)
{ {
// Create menus and bars // Create menus and bars
this->SetupMenu(); this->SetupMenu();
this->SetupStatusBar(); this->SetupStatusBar();
@ -61,7 +61,7 @@ void MainFrame::SetupToolbar()
wxBitmap new_file_icon = wxArtProvider::GetBitmap(wxART_NEW); wxBitmap new_file_icon = wxArtProvider::GetBitmap(wxART_NEW);
wxBitmap open_file_icon = wxArtProvider::GetBitmap(wxART_FILE_OPEN); wxBitmap open_file_icon = wxArtProvider::GetBitmap(wxART_FILE_OPEN);
wxBitmap save_file_icon = wxArtProvider::GetBitmap(wxART_FILE_SAVE); wxBitmap save_file_icon = wxArtProvider::GetBitmap(wxART_FILE_SAVE);
wxBitmap close_file_icon = wxArtProvider::GetBitmap(wxART_FILE_CLOSE); wxBitmap close_file_icon = wxArtProvider::GetBitmap(wxART_CLOSE);
wxBitmap copy_icon = wxArtProvider::GetBitmap(wxART_COPY); wxBitmap copy_icon = wxArtProvider::GetBitmap(wxART_COPY);
wxBitmap cut_icon = wxArtProvider::GetBitmap(wxART_CUT); wxBitmap cut_icon = wxArtProvider::GetBitmap(wxART_CUT);
wxBitmap paste_icon = wxArtProvider::GetBitmap(wxART_PASTE); wxBitmap paste_icon = wxArtProvider::GetBitmap(wxART_PASTE);