From f9d677516a66484cbe1dc0708698c1ddfec5baac Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Thu, 16 Apr 2015 22:07:51 -0400 Subject: [PATCH] Add icon to windows binary --- Makefile | 49 +++++++++++++++++++----------- resources/platform/msw/resource.rc | 1 + src/widgets/EditPane.h | 4 +-- src/widgets/MainFrame.cpp | 4 +-- 4 files changed, 37 insertions(+), 21 deletions(-) create mode 100644 resources/platform/msw/resource.rc diff --git a/Makefile b/Makefile index 46d113c..2830104 100644 --- a/Makefile +++ b/Makefile @@ -8,24 +8,25 @@ JSON_FILES = $(patsubst config/%.json,%.json, $(wildcard config/*.json)) PROGRAM_SRC = $(wildcard src/*.cpp src/widgets/*.cpp) 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 -CXXFLAGS = -Os +CXXFLAGS = -Os -s + TEST_SRC = $(wildcard tests/*.cpp) TESTS = $(patsubst %.cpp,%,$(TEST_SRC)) -UNAME = $(shell uname -s) +OS ?= $(shell uname -s) -# Add the /lib search directory for MSyS on Windows -ifdef OS - ifeq($(OS),Windows_NT) - LDLIBS += -L/lib - endif +ifeq ($(OS),Windows_NT) + LDLIBS += -L/lib +endif all: build json_wrapper $(TARGET) $(PROGRAM) @@ -41,7 +42,6 @@ json_wrapper_build: build: @mkdir -p build -#$(TARGET): CXXFLAGS += $(TARGET): $(OBJECTS) ar rcs $@ $(OBJECTS) ranlib $@ @@ -49,19 +49,32 @@ $(TARGET): $(OBJECTS) $(PROGRAM): CXXFLAGS += $(WX_CXXFLAGS) $(TARGET) $(PROGRAM): - $(CXX) $(WX_CXXFLAGS) $(PROGRAM_SRC) $(LDLIBS) -o $(PROGRAM) + $(CXX) $(WX_CXXFLAGS) $(PROGRAM_SRC) $(LDLIBS) $(WX_LDLIBS) -o $(PROGRAM) run: ./build/Tyro -release: all -ifeq ($(UNAME),Darwin) +release: +ifeq ($(OS),Darwin) make Tyro.app 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 + strip -sxX $(PROGRAM) SetFile -t APPL $(TARGET) -mkdir Tyro.app -mkdir Tyro.app/Contents @@ -79,9 +92,11 @@ tests: $(TESTS) sh ./tests/runtests.sh clean: + rm -f *.res rm -f config/json2c + rm -f config/json2c.exe rm -f config/*_json.h - rm -f *.o + rm -rf *.o rm -rf Tyro.app rm -rf build $(OBJECTS) $(PROGRAM) $(TARGET) $(TESTS) find . -name "*.gc*" -exec rm {} \; diff --git a/resources/platform/msw/resource.rc b/resources/platform/msw/resource.rc new file mode 100644 index 0000000..e26a663 --- /dev/null +++ b/resources/platform/msw/resource.rc @@ -0,0 +1 @@ +APP_ICON ICON "tyro.ico" \ No newline at end of file diff --git a/src/widgets/EditPane.h b/src/widgets/EditPane.h index 74f5465..f4fb9f2 100644 --- a/src/widgets/EditPane.h +++ b/src/widgets/EditPane.h @@ -33,8 +33,8 @@ private: TyroConfig *config; enum { - MARGIN_LINE_NUMBERS, - MARGIN_FOLD + MARGIN_FOLD, + MARGIN_LINE_NUMBERS }; void BindEvents(); void OnMarginClick(wxStyledTextEvent &event); diff --git a/src/widgets/MainFrame.cpp b/src/widgets/MainFrame.cpp index 8cf52c9..017118b 100644 --- a/src/widgets/MainFrame.cpp +++ b/src/widgets/MainFrame.cpp @@ -5,7 +5,7 @@ MainFrame::MainFrame(wxFrame *frame, const wxString& title) : wxFrame(frame, -1, title) -{ +{ // Create menus and bars this->SetupMenu(); this->SetupStatusBar(); @@ -61,7 +61,7 @@ void MainFrame::SetupToolbar() wxBitmap new_file_icon = wxArtProvider::GetBitmap(wxART_NEW); wxBitmap open_file_icon = wxArtProvider::GetBitmap(wxART_FILE_OPEN); 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 cut_icon = wxArtProvider::GetBitmap(wxART_CUT); wxBitmap paste_icon = wxArtProvider::GetBitmap(wxART_PASTE);