Skip to content

Commit

Permalink
nsfplay wxWidgets build
Browse files Browse the repository at this point in the history
now building MSVC Windows 64/32, MSYS2 Windows 64/32, and Ubuntu
nsfplay executable now has a cross platform gui stub
updating readme with some build instructions
  • Loading branch information
bbbradsmith authored Apr 13, 2024
1 parent 60b3baa commit c80c9a8
Show file tree
Hide file tree
Showing 18 changed files with 504 additions and 102 deletions.
91 changes: 87 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,35 @@ jobs:

build-msvc:
name: Windows MSVC
runs-on: windows-latest
runs-on: windows-2019
steps:
- name: Checkout Files
uses: actions/checkout@v4
- name: Setup MSVC
uses: microsoft/setup-msbuild@v2
- name: wxWidgets Cache Key
shell: pwsh
run: echo "WXHASH=$($(git submodule status wx) -replace '\s','')" >> $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: |
echo on
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 @@ -58,13 +81,37 @@ jobs:
uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
install: make mingw-w64-ucrt-x86_64-gcc mingw-w64-i686-gcc
install: git make mingw-w64-ucrt-x86_64-gcc mingw-w64-i686-gcc mingw-w64-ucrt-x86_64-cmake mingw-w64-i686-cmake
- name: wxWidgets Cache Key
shell: pwsh
run: echo "WXHASH=$($(git submodule status wx) -replace '\s','')" >> $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: |
export WXL_CMAKEDIR=make64
make wxlib
export PATH="/mingw32/bin:$PATH"
export WXL_CMAKEDIR=make32
make wxlib
- name: Make 64-bit
shell: msys2 {0}
run: export OUTDIR=output/make64 INTDIR=intermediate/make64 ; make cmd gui
run: |
export OUTDIR=output/make64 INTDIR=intermediate/make64
make cmd nsfplay
- 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"
export WXL_LIBDIR=gcc_lib
export OUTDIR=output/make32 INTDIR=intermediate/make32
make cmd nsfplay winamp
- name: Prepare Artifacts
shell: pwsh
run: |
Expand All @@ -89,3 +136,39 @@ jobs:
with:
name: nsfplay3-win32-mingw--${{ env.BUILD_TAG }}
path: artifact32/

build-ubuntu:
name: Ubuntu
runs-on: ubuntu-latest
steps:
- name: Checkout Files
uses: actions/checkout@v4
- name: Setup Ubuntu
run: |
sudo apt-get update
sudo apt-get install git make gcc cmake libgtk-3-dev
- name: wxWidgets Cache Key
run: echo "WXHASH=$(git submodule status wx | tr -d '[:blank:]')" >> $GITHUB_ENV
- name: Cache wxWidgets
id: cache-wx
uses: actions/cache@v4
with:
path: wxlib
key: wx-ubuntu-${{ env.WXHASH }}
- name: Build wxWidgets
if: steps.cache-wx.outputs.cache-hit != 'true'
run: make wxlib
- name: Make
run: make cmd nsfplay
- name: Prepare Artifacts
run: |
mkdir artifact
cp nsfplay.txt artifact
cp output/make/nsfplay artifact
cp output/make/nsfplac artifact
echo "BUILD_TAG=$(git log -1 --format="%ad--%h" --date=format-local:"%Y-%m-%d-%H%M%S")" >> $GITHUB_ENV
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: nsfplay3-ubuntu--${{ env.BUILD_TAG }}
path: artifact/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
intermediate
output
wxlib
secrets
*.user
.vs
2 changes: 1 addition & 1 deletion cmd/cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@

int main()
{
printf("nsfplaycmd stub\n");
printf("nsfplac stub\n");
return nsfplaycore::test();
}
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\</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\</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>
<AdditionalIncludeDirectories>..\include\</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError>
<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>
<AdditionalIncludeDirectories>..\include\</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError>
<AdditionalIncludeDirectories>..\include\;..\wxlib\include\;..\wxlib\lib\vc_x64_lib\mswu\</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>
Expand Down
8 changes: 1 addition & 7 deletions gui/gui.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,13 @@
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="framework.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="pch.h">
<ClInclude Include="..\include\nsfplaygui.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="gui.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="pch.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
5 changes: 3 additions & 2 deletions gui/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@ default: $(TARGET)
SRCS = $(wildcard *.cpp)
OBJS = $(addprefix $(GUI_INTDIR)/,$(SRCS:.cpp=.o))
DEPS = $(addprefix $(GUI_INTDIR)/,$(SRCS:.cpp=.d))
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 $(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 $@ $(CXXFLAGS) -c $<
$(CXX) -o $@ $(CXXFLAGS_ALL) -c $<

$(GUI_INTDIR)/:
$(MKDIR) $@
Expand Down
9 changes: 4 additions & 5 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
include makefile.common

.PHONY: default core cmd gui nsfplay winamp install uninstall clean
.PHONY: default core cmd gui wxlib nsfplay winamp install uninstall clean

default: core cmd nsfplay

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

core:
$(MAKE) -C core

Expand All @@ -17,6 +13,9 @@ cmd: core
gui: core
$(MAKE) -C gui

wxlib:
$(MAKE) -f makefile.wx

nsfplay: core gui
$(MAKE) -C nsfplay

Expand Down
Loading

0 comments on commit c80c9a8

Please sign in to comment.