Skip to content

Commit

Permalink
wxwidgets builds complete
Browse files Browse the repository at this point in the history
  • Loading branch information
bbbradsmith committed Apr 12, 2024
1 parent 8d5cbe4 commit ebed277
Show file tree
Hide file tree
Showing 15 changed files with 265 additions and 118 deletions.
39 changes: 38 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,28 @@ jobs:
uses: actions/checkout@v4
- name: Setup MSVC
uses: microsoft/setup-msbuild@v2
- name: wxWidgets Cache Key
shell: pwsh
run: echo WXHASH=$(git ls-tree HEAD wx) >> $env:GITHUB_ENV
- name: Cache wxWidgets
id: cache-wx
uses: actions/cache@v4
with:
path: wxlib
key: wx-msvc-${{ env.WXHASH }}
- name: Build wxWidgets
if: steps.cache-wx.outputs.cache-hit != 'true'
shell: cmd
run: |
git submodule init
git submodule update --depth 1
cd wx
git submodule init
git submodule update --depth 1
cd ..
set WXB_NODEBUG=1
set WXB_NOPAUSE=1
wxlib.bat
- name: Build 64-bit
run: msbuild nsfplay.sln -t:rebuild -property:Configuration=Release -property:Platform=x64
- name: Build 32-bit
Expand Down Expand Up @@ -59,12 +81,27 @@ jobs:
with:
msystem: UCRT64
install: make mingw-w64-ucrt-x86_64-gcc mingw-w64-i686-gcc
- name: wxWidgets Cache Key
shell: msys2 {0}
run: echo WXHASH=$(git ls-tree HEAD wx) >> $env:GITHUB_ENV
- name: Cache wxWidgets
id: cache-wx
uses: actions/cache@v4
with:
path: wxlib
key: wx-msys2-${{ env.WXHASH }}
- name: Build wxWidgets
if: steps.cache-wx.outputs.cache-hit != 'true'
shell: msys2 {0}
run: |
make wx
export PATH="/mingw32/bin:$PATH" WXCMAKE=make32; make wx
- name: Make 64-bit
shell: msys2 {0}
run: export OUTDIR=output/make64 INTDIR=intermediate/make64 ; make cmd gui
- name: Make 32-bit
shell: msys2 {0}
run: export PATH="/mingw32/bin:$PATH" OUTDIR=output/make32 INTDIR=intermediate/make32 ; make
run: export PATH="/mingw32/bin:$PATH" OUTDIR=output/make32 INTDIR=intermediate/make32 WXL_LIBTYPE=gcc_lib ; make cmd gui winamp
- name: Prepare Artifacts
shell: pwsh
run: |
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
intermediate
output
output_wx
wxlib
secrets
*.user
.vs
8 changes: 5 additions & 3 deletions cmd/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,18 @@ SRCS = $(wildcard *.cpp)
OBJS = $(addprefix $(CMD_INTDIR)/,$(SRCS:.cpp=.o))
DEPS = $(addprefix $(CMD_INTDIR)/,$(SRCS:.cpp=.d))
CORE = ../$(OUTDIR)/$(CORE_NAME)$(LIB_SUFFIX)
CXXFLAGS_ALL = $(CXXFLAGS) $(CXXFLAGS_EXTRA) $(INC_COMMON)
LDFLAGS_ALL = $(LDFLAGS) $(LDFLAGS_EXTRA) $(LDFLAGS_CMD)

$(TARGET): $(OBJS) $(CORE) | $(dir $(TARGET))
$(CXX) -o $(TARGET) $(LDFLAGS) $(LDFLAGS_CMD) $(OBJS) $(CORE)
$(CXX) -o $(TARGET) $(LDFLAGS_ALL) $(OBJS) $(CORE)
$(STRIP_DEBUG)

$(CMD_INTDIR)/%.d: %.cpp | $(CMD_INTDIR)/
$(CXX) -M -MM -MF $@ -MT $(CMD_INTDIR)/$(basename $<).o $(CXXFLAGS) -c $<
$(CXX) -M -MM -MF $@ -MT $(CMD_INTDIR)/$(basename $<).o $(CXXFLAGS_ALL) -c $<

$(CMD_INTDIR)/%.o: %.cpp $(CMD_INTDIR)/%.d | $(CMD_INTDIR)/
$(CXX) -o $@ $(CXXFLAGS) -c $<
$(CXX) -o $@ $(CXXFLAGS_ALL) -c $<

$(CMD_INTDIR)/:
$(MKDIR) $@
Expand Down
5 changes: 3 additions & 2 deletions core/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@ default: $(TARGET)
SRCS = $(wildcard *.cpp)
OBJS = $(addprefix $(CORE_INTDIR)/,$(SRCS:.cpp=.o))
DEPS = $(addprefix $(CORE_INTDIR)/,$(SRCS:.cpp=.d))
CXXFLAGS_ALL = $(CXXFLAGS) $(CXXFLAGS_EXTRA) $(INC_COMMON)

$(TARGET): $(OBJS) | $(dir $(TARGET))
rm -f $(TARGET)
$(AR) rcs $(TARGET) $(OBJS)

$(CORE_INTDIR)/%.d: %.cpp | $(CORE_INTDIR)/
$(CXX) -M -MM -MF $@ -MT $(CORE_INTDIR)/$(basename $<).o $(CXXFLAGS) -c $<
$(CXX) -M -MM -MF $@ -MT $(CORE_INTDIR)/$(basename $<).o $(CXXFLAGS_ALL) -c $<

$(CORE_INTDIR)/%.o: %.cpp $(CORE_INTDIR)/%.d | $(CORE_INTDIR)/
$(CXX) -o $@ $(CXXFLAGS) -c $<
$(CXX) -o $@ $(CXXFLAGS_ALL) -c $<

$(CORE_INTDIR)/:
$(MKDIR) $@
Expand Down
16 changes: 8 additions & 8 deletions gui/gui.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>__WXMSW__;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<AdditionalIncludeDirectories>..\include\;..\wx\include\;..\output_wx\x86\lib\vc_lib\mswu\</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\include\;..\wxlib\include\;..\wxlib\lib\vc_lib\mswud\</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
Expand All @@ -118,12 +118,12 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>__WXMSW__;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>..\include\;..\wx\include\;..\output_wx\x86\lib\vc_lib\mswu\</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\include\;..\wxlib\include\;..\wxlib\lib\vc_lib\mswu\</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
Expand All @@ -138,13 +138,13 @@
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>__WXMSW__;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<TreatWarningAsError>true</TreatWarningAsError>
<AdditionalIncludeDirectories>..\include\;..\wx\include\;..\output_wx\x64\lib\vc_x64_lib\mswu\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\include\;..\wxlib\include\;..\wxlib\lib\vc_x64_lib\mswud\</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>
Expand All @@ -158,13 +158,13 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>__WXMSW__;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<TreatWarningAsError>true</TreatWarningAsError>
<AdditionalIncludeDirectories>..\include\;..\wx\include\;..\output_wx\x64\lib\vc_x64_lib\mswu\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\include\;..\wxlib\include\;..\wxlib\lib\vc_x64_lib\mswu\</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>
Expand Down
6 changes: 3 additions & 3 deletions gui/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ default: $(TARGET)
SRCS = $(wildcard *.cpp)
OBJS = $(addprefix $(GUI_INTDIR)/,$(SRCS:.cpp=.o))
DEPS = $(addprefix $(GUI_INTDIR)/,$(SRCS:.cpp=.d))
INCS = -I$(WX_INCLUDE) -I$(WX_LIB_INCLUDE)
CXXFLAGS_ALL = $(CXXFLAGS) $(CXXFLAGS_EXTRA) $(INC_COMMON) $(WXL_CXXFLAGS)

$(TARGET): $(OBJS) | $(dir $(TARGET))
rm -f $(TARGET)
$(AR) rcs $(TARGET) $(OBJS)

$(GUI_INTDIR)/%.d: %.cpp | $(GUI_INTDIR)/
$(CXX) -M -MM -MF $@ -MT $(GUI_INTDIR)/$(basename $<).o $(INCS) $(CXXFLAGS) -c $<
$(CXX) -M -MM -MF $@ -MT $(GUI_INTDIR)/$(basename $<).o $(CXXFLAGS_ALL) -c $<

$(GUI_INTDIR)/%.o: %.cpp $(GUI_INTDIR)/%.d | $(GUI_INTDIR)/
$(CXX) -o $@ $(INCS) $(CXXFLAGS) -c $<
$(CXX) -o $@ $(CXXFLAGS_ALL) -c $<

$(GUI_INTDIR)/:
$(MKDIR) $@
Expand Down
4 changes: 0 additions & 4 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ include makefile.common

default: core cmd nsfplay

ifeq ($(OS),Windows_NT)
default: winamp
endif

core:
$(MAKE) -C core

Expand Down
102 changes: 74 additions & 28 deletions makefile.common
Original file line number Diff line number Diff line change
@@ -1,47 +1,93 @@
# output directories

OUTDIR ?= output/make
INTDIR ?= intermediate/make
prefix ?= /usr/local/bin

# output binary names

CORE_NAME ?= nsfcore
CMD_NAME ?= nsfplac
GUI_NAME ?= nsfgui
NSFPLAY_NAME ?= nsfplay
WINAMP_NAME ?= nsfplay

# tool names

MAKE ?= make
CXX ?= g++
AR ?= ar
MKDIR ?= mkdir -p

CXXFLAGS += -I../include -O3 -Wall -Werror -g
LDFLAGS += -Wl,--fatal-warnings -g
LDFLAGS_CMD +=
LDFLAGS_GUI +=
LDFLAGS_NSFPLAY +=
LDFLAGS_DLL +=
# optimization, can be cleared for debugging purposes

LIB_SUFFIX ?= .a
EXE_SUFFIX ?= .exe
DLL_SUFFIX ?= .dll
OPTIMIZE ?= -O3

CORE_NAME ?= nsfcore
CMD_NAME ?= nsfplac
GUI_NAME ?= nsfgui
NSFPLAY_NAME ?= nsfplay
WINAMP_NAME ?= nsfplay
# wxWidgets

STRIP_DEBUG = \
objcopy --only-keep-debug $@ [email protected] ; \
strip --strip-debug --strip-unneeded $@ ; \
objcopy [email protected] $@
WXL_DEBUG ?= 0
WXL_DIR ?= ../wxlib

# platform settings

ifeq ($(OS),Windows_NT)
CXXFLAGS_EXTRA ?= -municode
LDFLAGS_EXTRA ?= -static -static-libgcc -static-libstdc++
LDFLAGS_CMD ?= -mconsole
LDFLAGS_GUI ?=
LDFLAGS_NSFPLAY ?= -mwindows
LDFLAGS_DLL ?= -mdll
LIB_SUFFIX ?= .a
EXE_SUFFIX ?= .exe
DLL_SUFFIX ?= .dll
WXL_DEFINE ?= -D__WXMSW__
WXL_LIBTYPE ?= gcc_x64_lib
WXL_PLATFORM ?= msw
WXL_DEPS ?= -lcomctl32 -luuid -lole32 -loleacc -loleaut32 -lversion -lshlwapi -luxtheme -lwinspool
else
CXXFLAGS_EXTRA ?=
LDFLAGS_EXTRA ?=
LDFLAGS_CMD ?=
LDFLAGS_GUI ?=
LDFLAGS_NSFPLAY ?=
LDFLAGS_DLL ?= -shared
LIB_SUFFIX ?= .a
EXE_SUFFIX ?=
DLL_SUFFIX ?= .so
WXL_LIBTYPE ?= gcc_x64_lib
WXL_PLATFORM ?= gtk
WXL_DEFINE ?= -D__WXGTK__
WXL_DEPS ?=
endif

CXXFLAGS += -municode
LDFLAGS += -static-libgcc
LDFLAGS_CMD += -mconsole
LDFLAGS_NSFPLAY += -municode -mwindows
LDFLAGS_DLL += -municode -mdll
# common build flags

WX_INCLUDE ?= ../wx/include
WX_LIB_PATH ?= ../output_wx/make/lib/gcc_x64_lib
WX_LIB_INCLUDE ?= ../output_wx/make/lib/gcc_x64_lib/mswu
WX_LIBS ?= -lwxmsw32u_propgrid -lwxmsw32u_core -lwxbase32u -lwxpng -lwxzlib -lcomctl32 -lrpcrt4
CXXFLAGS ?= $(OPTIMIZE) -Wall -Werror -g
LDFLAGS ?= -Wl,--fatal-warnings -g
INC_COMMON ?= -I../include

else
# utility to move GCC debug information outside of binaries

STRIP_DEBUG = \
objcopy --only-keep-debug $@ [email protected] ; \
strip --strip-debug --strip-unneeded $@ ; \
objcopy [email protected] $@

ifeq ($(WXL_DEBUG),0)
WXL_SUFFIX =
else
WXL_SUFFIX = d
endif

WXL_CXXFLAGS ?= \
$(WXL_DEFINE) \
-I$(WXL_DIR)/include \
-I$(WXL_DIR)/lib/$(WXL_LIBTYPE)/$(WXL_PLATFORM)u$(WXL_SUFFIX)
WXL_LIBS ?= \
-L$(WXL_DIR)/lib/$(WXL_LIBTYPE) \
-lwx$(WXL_PLATFORM)32u$(WXL_SUFFIX)_propgrid \
-lwx$(WXL_PLATFORM)32u$(WXL_SUFFIX)_core \
-lwxbase32u$(WXL_SUFFIX) \
-lwxpng$(WXL_SUFFIX) \
-lwxzlib$(WXL_SUFFIX) \
$(WXL_DEPS)
41 changes: 31 additions & 10 deletions makefile.wx
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
include makefile.common

WXDIR ?= wx
WXOUT ?= output_wx/make
WXSRC ?= wx
WXOUT ?= wxlib
WXCMAKE ?= make64
WXREL ?= ../../wx

# default cmake configuration

WXCONF ?= \
-DCMAKE_BUILD_TYPE=Release \
-DwxBUILD_SHARED=OFF \
-DwxUSE_UNICODE=ON \
-DwxUSE_AUI=OFF \
-DwxUSE_HTML=OFF \
-DwxUSE_MEDIACTRL=OFF \
Expand All @@ -28,20 +31,38 @@ WXCONF ?= \
-DwxUSE_LIBLZMA=OFF \
-DwxUSE_WXHTML_HELP=OFF

.PHONY: default test
# WXCONF_EXTRA can be be used to provide extra configuration

ifeq ($(OS),Windows_NT)
WXCONF_EXTRA ?= -DwxBUILD_USE_STATIC_RUNTIME=ON
else
WXCONF_EXTRA ?=
endif

# WXL_DEBUG=1 will build debug libraries instead

ifeq ($(WXL_DEBUG),0)
WXBUILD_TYPE ?= -DCMAKE_BUILD_TYPE=Release
else
WXBUILD_TYPE ?= -DCMAKE_BUILD_TYPE=Debug
endif


.PHONY: default

default: wx

submodules:
git submodule init
git submodule update --depth 1
(cd $(WXDIR) && git submodule init)
(cd $(WXDIR) && git submodule update --depth 1)
(cd $(WXSRC) && git submodule init)
(cd $(WXSRC) && git submodule update --depth 1)

wx: submodules
mkdir -p $(WXOUT)
(cd $(WXOUT) && cmake $(WXREL) $(WXCONF))
(cd $(WXOUT) && cmake --build .)
mkdir -p $(WXOUT)/$(WXCMAKE)
(cd $(WXOUT)/$(WXCMAKE) && cmake $(WXREL) $(WXCONF) $(WXCONF_EXTRA) $(WXBUILD_TYPE))
(cd $(WXOUT)/$(WXCMAKE) && cmake --build .)
(cd $(WXOUT)/$(WXCMAKE) && cmake --install . --prefix ..)

clean:
rm -f -r $(WXOUT)
rm -f -r $(WXOUT)/$(WXCMAKE)
Loading

0 comments on commit ebed277

Please sign in to comment.