From 35e0670a7ff4da868756543a9fa11ce691a3b11d Mon Sep 17 00:00:00 2001 From: Jonathon Fowler Date: Wed, 7 Feb 2024 23:07:08 +1000 Subject: [PATCH] ci: build for macos Needed to adapt the project to fetch the SDL2 framework automatically, and alter how git version stamping of the engine is performed. --- .github/workflows/ci.yml | 17 +++- .gitignore | 1 + README.md | 13 +-- xcode/engine.xcodeproj/project.pbxproj | 109 +++++++++++++++++++------ xcode/frameworks/.keep | 0 xcode/game.xcodeproj/project.pbxproj | 24 ++---- 6 files changed, 112 insertions(+), 52 deletions(-) create mode 100644 xcode/frameworks/.keep diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 23c92cc8..e00d3a65 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install dependencies run: | sudo apt-get update @@ -53,7 +53,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup MSVC uses: ilammy/msvc-dev-cmd@v1 with: @@ -67,3 +67,16 @@ jobs: echo USE_OPENGL=${{ matrix.use_opengl }} >> Makefile.msvcuser echo VCPKG_ROOT=%VCPKG_INSTALLATION_ROOT% > kenbuild\Makefile.msvcuser nmake /f Makefile.msvc all + + build-macos: + name: macOS + runs-on: macos-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Build + run: | + set -xe + cd $GITHUB_WORKSPACE/xcode + xcodebuild -project game.xcodeproj -alltargets diff --git a/.gitignore b/.gitignore index 53cfcda6..208d069a 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ /xcode/*.xcodeproj/xcuserdata /xcode/Signing.xcconfig /xcode/build +/xcode/frameworks /Makefile.*user /kenbuild/Makefile.*user diff --git a/README.md b/README.md index 9c5a35e4..23df523f 100644 --- a/README.md +++ b/README.md @@ -47,12 +47,13 @@ Now, based on your chosen OS and compiler: ### macOS 1. [Install Xcode from the Mac App Store](https://itunes.apple.com/au/app/xcode/id497799835?mt=12). -2. Fetch and install the SDL 2.0 development package: - 1. Fetch _SDL2-2.0.x.dmg_ from http://libsdl.org/download-2.0.php. - 2. Copy _SDL2.framework_ found in the DMG file to `~/Library/Frameworks`. Create the - _Frameworks_ directory if it doesn't exist on your system. -3. Open _game.xcodeproj_ from within the JFBuild source code's _xcode_ folder. -4. From the Product menu choose Run. +2. Open _game.xcodeproj_ from within the JFBuild source code's _xcode_ folder. +3. From the Product menu choose Run. + +The project will automatically download the SDL2 framework to _xcode/frameworks_ +upon first build. If there are problems with this process, you can manually +fetch _SDL2-2.x.y.dmg_ from http://libsdl.org/download-2.0.php and copy +_SDL2.framework_ found in the _.dmg_ file to _xcode/frameworks_. ### Windows using Microsoft Visual C++ 2015 (or newer) and NMAKE diff --git a/xcode/engine.xcodeproj/project.pbxproj b/xcode/engine.xcodeproj/project.pbxproj index 08c55277..16d44b19 100644 --- a/xcode/engine.xcodeproj/project.pbxproj +++ b/xcode/engine.xcodeproj/project.pbxproj @@ -7,6 +7,17 @@ objects = { /* Begin PBXAggregateTarget section */ + AB4C36E32B75852A0092B8DD /* fetch-deps */ = { + isa = PBXAggregateTarget; + buildConfigurationList = AB4C36E62B75852A0092B8DD /* Build configuration list for PBXAggregateTarget "fetch-deps" */; + buildPhases = ( + AB53C0A62B75858500410583 /* Fetch SDL2 framework */, + ); + dependencies = ( + ); + name = "fetch-deps"; + productName = "third-party"; + }; AB77B4D2171AC3E800982712 /* tools */ = { isa = PBXAggregateTarget; buildConfigurationList = AB77B4EB171AC41C00982712 /* Build configuration list for PBXAggregateTarget "tools" */; @@ -35,7 +46,7 @@ AB3B2C810EE41B9000944CD1 /* smalltextfont.c in Sources */ = {isa = PBXBuildFile; fileRef = AB3B2C7F0EE41B9000944CD1 /* smalltextfont.c */; }; AB3B2C820EE41B9000944CD1 /* textfont.c in Sources */ = {isa = PBXBuildFile; fileRef = AB3B2C800EE41B9000944CD1 /* textfont.c */; }; AB3FE4500C04336F00D5DBDC /* EditorStartupWinController.m in Sources */ = {isa = PBXBuildFile; fileRef = AB3E07290A33035B00FF2442 /* EditorStartupWinController.m */; }; - AB48BD6D208C0AEA00E38090 /* version-auto.c in Sources */ = {isa = PBXBuildFile; fileRef = AB48BD6C208C0AEA00E38090 /* version-auto.c */; }; + AB4C36DC2B74EFF30092B8DD /* engine-version.c in Sources */ = {isa = PBXBuildFile; fileRef = AB4C36DB2B74EFC50092B8DD /* engine-version.c */; }; AB4F6B7023118E6C00713ACC /* polymost_vs.glsl in Sources */ = {isa = PBXBuildFile; fileRef = ABE362562144F78100BA44B3 /* polymost_vs.glsl */; }; AB4F6B7123118E7000713ACC /* polymost_fs.glsl in Sources */ = {isa = PBXBuildFile; fileRef = ABE3624D2144CC9000BA44B3 /* polymost_fs.glsl */; }; AB4F6B7223118E7B00713ACC /* polymostaux_vs.glsl in Sources */ = {isa = PBXBuildFile; fileRef = ABE362572146955700BA44B3 /* polymostaux_vs.glsl */; }; @@ -135,6 +146,13 @@ remoteGlobalIDString = AB3FE44A0C04336F00D5DBDC; remoteInfo = editorsupp; }; + AB4C36E72B7585340092B8DD /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = AB735F3A0A29A24A003261DC /* Project object */; + proxyType = 1; + remoteGlobalIDString = AB4C36E32B75852A0092B8DD; + remoteInfo = "third-party"; + }; AB77B4D5171AC3F700982712 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = AB735F3A0A29A24A003261DC /* Project object */; @@ -178,7 +196,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - AB1751260CEF5AF8003AF128 /* SDL2.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL2.framework; path = /Users/jonof/Library/Frameworks/SDL2.framework; sourceTree = ""; }; + AB1751260CEF5AF8003AF128 /* SDL2.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL2.framework; path = frameworks/SDL2.framework; sourceTree = SOURCE_ROOT; }; AB3B2A0D0EE3FC0400944CD1 /* hightile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hightile.c; sourceTree = ""; }; AB3B2A1C0EE3FCF900944CD1 /* polymost.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = polymost.c; sourceTree = ""; usesTabs = 1; }; AB3B2A6B0EE4007B00944CD1 /* mdsprite.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mdsprite.c; sourceTree = ""; usesTabs = 1; }; @@ -190,7 +208,7 @@ AB3B2C800EE41B9000944CD1 /* textfont.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = textfont.c; sourceTree = ""; }; AB3E07290A33035B00FF2442 /* EditorStartupWinController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EditorStartupWinController.m; sourceTree = ""; }; AB3FE4550C04336F00D5DBDC /* libeditorsupp.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libeditorsupp.a; sourceTree = BUILT_PRODUCTS_DIR; }; - AB48BD6C208C0AEA00E38090 /* version-auto.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "version-auto.c"; sourceTree = ""; }; + AB4C36DB2B74EFC50092B8DD /* engine-version.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "engine-version.c"; sourceTree = BUILT_PRODUCTS_DIR; }; AB66C6A92907E89F0063C874 /* glbuild_priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glbuild_priv.h; sourceTree = ""; }; AB66C6AB2907E8BE0063C874 /* rg_etc1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rg_etc1.h; sourceTree = ""; }; AB66C6AC2907E8BE0063C874 /* polymosttexcompress.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = polymosttexcompress.h; sourceTree = ""; }; @@ -391,6 +409,7 @@ children = ( AB735FBF0A29A89F003261DC /* Editor */, AB735F720A29A3A0003261DC /* Engine */, + AB4C36DB2B74EFC50092B8DD /* engine-version.c */, ABAE9ADA0F0B30D500A528DC /* Tools */, AB67283F0F109615000C7D92 /* libsquish */, AB735F4A0A29A2DC003261DC /* Products */, @@ -470,7 +489,6 @@ AB3B2C7F0EE41B9000944CD1 /* smalltextfont.c */, AB76E4FE294DFC0B00B11DAF /* talltextfont.c */, AB3B2C800EE41B9000944CD1 /* textfont.c */, - AB48BD6C208C0AEA00E38090 /* version-auto.c */, ); name = src; path = ../src; @@ -612,7 +630,7 @@ buildConfigurationList = AB735F4B0A29A2DD003261DC /* Build configuration list for PBXNativeTarget "engine" */; buildPhases = ( AB735F450A29A2DC003261DC /* Headers */, - AB48BD6B208C090300E38090 /* Generate version-auto.c */, + AB48BD6B208C090300E38090 /* Generate engine-version.c */, AB735F460A29A2DC003261DC /* Sources */, AB735F470A29A2DC003261DC /* Frameworks */, ); @@ -620,6 +638,7 @@ AB4F6B6E23118B7600713ACC /* PBXBuildRule */, ); dependencies = ( + AB4C36E82B7585340092B8DD /* PBXTargetDependency */, ); name = engine; productName = engine; @@ -736,6 +755,9 @@ AB3FE44A0C04336F00D5DBDC = { DevelopmentTeam = S7U4E54CHC; }; + AB4C36E32B75852A0092B8DD = { + CreatedOnToolsVersion = 15.2; + }; AB735F480A29A2DC003261DC = { DevelopmentTeam = S7U4E54CHC; }; @@ -745,18 +767,8 @@ AB77B4D2171AC3E800982712 = { DevelopmentTeam = S7U4E54CHC; }; - ABAE9AD10F0B307500A528DC = { - DevelopmentTeam = S7U4E54CHC; - }; - ABAE9C270F0CC80200A528DC = { - DevelopmentTeam = S7U4E54CHC; - }; - ABAE9C320F0CC81900A528DC = { - DevelopmentTeam = S7U4E54CHC; - }; ABD03E201A5189E00012B9D1 = { CreatedOnToolsVersion = 6.1.1; - DevelopmentTeam = S7U4E54CHC; }; }; }; @@ -782,12 +794,13 @@ ABAE9C320F0CC81900A528DC /* kgroup */, ABD03E201A5189E00012B9D1 /* transpal */, AB77B4D2171AC3E800982712 /* tools */, + AB4C36E32B75852A0092B8DD /* fetch-deps */, ); }; /* End PBXProject section */ /* Begin PBXShellScriptBuildPhase section */ - AB48BD6B208C090300E38090 /* Generate version-auto.c */ = { + AB48BD6B208C090300E38090 /* Generate engine-version.c */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; buildActionMask = 2147483647; @@ -795,12 +808,34 @@ ); inputPaths = ( ); - name = "Generate version-auto.c"; + name = "Generate engine-version.c"; outputPaths = ( + "$(BUILT_PRODUCTS_DIR)/engine-version.c", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "cd $PROJECT_DIR/..\ngitdescribe=$(git describe --always 2>/dev/null || echo git error)\n\ncat >src/version-auto.c <