diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml new file mode 100644 index 0000000..143f867 --- /dev/null +++ b/.github/workflows/main.yaml @@ -0,0 +1,105 @@ +name: OnMain + +on: + push: + branches: [master] + + + +permissions: + contents: read + +concurrency: + group: "${{ github.ref }}-${{ github.workflow }}" + cancel-in-progress: true + +jobs: + + build-linux: + name: Linux Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + with: + submodules: true + - name: Build + run: | + mkdir -p bin/linux + make clean + make + - name: Archive + uses: actions/upload-artifact@v1 + with: + name: Linux-binaries.zip + path: bin/linux + build-windows: + name: Windows Build + runs-on: windows-latest + steps: + - uses: actions/checkout@v1 + with: + submodules: true + - name: Build + run: | + ./build.ps1 + - name: Archive x86 + uses: actions/upload-artifact@v1 + with: + name: Windows-x86-binaries.zip + path: bin/windows/x86/Release + - name: Archive x64 + uses: actions/upload-artifact@v1 + with: + name: Windows-x64-binaries.zip + path: bin/windows/x64/Release + version: + runs-on: ubuntu-latest + needs: + - build-linux + - build-windows + permissions: + contents: write + outputs: + newtag: ${{ steps.calculate-version.outputs.version-string }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true + - name: calculate version + id: calculate-version + uses: bitshifted/git-auto-semver@v1 + with: + main_branch: master + create_tag: true + tag_prefix: 'v' + - name: Use version + run: 'echo "Calculated version: ${{ steps.calculate-version.outputs.version-string }}"' + + release: + runs-on: ubuntu-latest + permissions: + contents: write + needs: version + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-tags: true + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + path: artifacts + pattern: *binaries.zip + merge-multiple: true + - name: Create a Release + uses: softprops/action-gh-release@v2 + with: + name: ${{ needs.version.outputs.newtag }} + tag_name: ${{ needs.version.outputs.newtag }} + token: ${{ secrets.GITHUB_TOKEN }} + make_latest: true + files: + artifacts/*binaries.zip + \ No newline at end of file diff --git a/.gitignore b/.gitignore index 9f0d199..a8dc535 100644 --- a/.gitignore +++ b/.gitignore @@ -219,4 +219,5 @@ pip-log.txt ############## .ntvs_analysis.dat -.vs \ No newline at end of file +.vs +*.o \ No newline at end of file diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 0000000..a795cb6 --- /dev/null +++ b/build.ps1 @@ -0,0 +1,38 @@ +[CmdletBinding()] +param( + [ValidateSet("x64", "x86")][String[]]$Platforms = @("x64", "x86"), + [ValidateSet("Debug", "Release")][String[]]$Flavors = @("Release"), + [Switch]$KeepPDB +) + +$msbuildPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -requires Microsoft.Component.MSBuild -find MSBuild\Current\Bin\amd64\MSBuild.exe | Select-Object -First 1 +Set-Alias -name msbuild -Value $msbuildPath + + +$Platforms | ForEach-Object { + $platform = $_ + $Flavors | ForEach-Object { + $config = $_ + $outDir = ".\bin\windows\$platform\$config" + if (-not (Test-Path -PathType Container $outDir)) { + New-Item -Path $outDir -ItemType Directory -Force | Out-Null + } + $outDir = Resolve-Path $outDir + Write-Progress -Activity "Building" -Status ($platform + "," + $config) + msbuild -noLogo -m -verbosity:detailed -restore -target:Rebuild -property:Configuration=$config -property:Platform=$platform -property:OutDir=$outDir -clp:"ErrorsOnly;NoSummary" oless.sln + Write-Progress -Activity "Building" -Status ($platform + "," + $config) -Completed + if ($LASTEXITCODE) { + exit $LASTEXITCODE + } else { + Write-Host "Build Successful: $platform, $config" + } + + } +} + +if ($KeepPDB) { + Get-ChildItem -Path .\Bin -Recurse -Exclude @("*.exe", "*.pdb") -File | Remove-Item +} else { + #Clean up other artifacts + Get-ChildItem -Path .\Bin -Recurse -Exclude @("*.exe") -File | Remove-Item +} \ No newline at end of file diff --git a/makefile b/makefile index 6fc180c..2fcea00 100644 --- a/makefile +++ b/makefile @@ -12,7 +12,7 @@ SOURCE = \ oless/vbahelper.cpp \ oless/program.cpp -OBJECT = $(SOURCE:.c=.o) +OBJECT = $(SOURCE:.cpp=.o) # Rules all: $(EXECUTABLE) diff --git a/oless.sln b/oless.sln index fa433a7..f16fc60 100644 --- a/oless.sln +++ b/oless.sln @@ -15,20 +15,20 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 + Debug|x86 = Debug|x86 Release|x64 = Release|x64 + Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {FD435309-E24E-4A45-A30D-F5FADD0E73C7}.Debug|Win32.ActiveCfg = Debug|Win32 - {FD435309-E24E-4A45-A30D-F5FADD0E73C7}.Debug|Win32.Build.0 = Debug|Win32 {FD435309-E24E-4A45-A30D-F5FADD0E73C7}.Debug|x64.ActiveCfg = Debug|x64 {FD435309-E24E-4A45-A30D-F5FADD0E73C7}.Debug|x64.Build.0 = Debug|x64 - {FD435309-E24E-4A45-A30D-F5FADD0E73C7}.Release|Win32.ActiveCfg = Release|Win32 - {FD435309-E24E-4A45-A30D-F5FADD0E73C7}.Release|Win32.Build.0 = Release|Win32 + {FD435309-E24E-4A45-A30D-F5FADD0E73C7}.Debug|x86.ActiveCfg = Debug|Win32 + {FD435309-E24E-4A45-A30D-F5FADD0E73C7}.Debug|x86.Build.0 = Debug|Win32 {FD435309-E24E-4A45-A30D-F5FADD0E73C7}.Release|x64.ActiveCfg = Release|x64 {FD435309-E24E-4A45-A30D-F5FADD0E73C7}.Release|x64.Build.0 = Release|x64 + {FD435309-E24E-4A45-A30D-F5FADD0E73C7}.Release|x86.ActiveCfg = Release|Win32 + {FD435309-E24E-4A45-A30D-F5FADD0E73C7}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/oless/oless.vcxproj b/oless/oless.vcxproj index 246666e..09662e8 100644 --- a/oless/oless.vcxproj +++ b/oless/oless.vcxproj @@ -20,28 +20,30 @@ {FD435309-E24E-4A45-A30D-F5FADD0E73C7} - Win32Proj + 10.0 + $(SolutionDir)bin\windows\$(Platform)\$(Configuration)\ + $(SolutionDir)obj\windows\$(Platform)_$(Configuration)\ - + Application true v143 Static - + Application true v143 Static - + Application false v143 Static - + Application false v143 @@ -50,82 +52,88 @@ - - - - + + + + - - true - true - + true true - + + true + + - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) MultiThreadedDebugDLL Level3 ProgramDatabase Disabled + stdcpp20 - MachineX86 true Console - + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) MultiThreadedDebugDLL Level3 ProgramDatabase Disabled + stdcpp20 true Console - + - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) MultiThreadedDLL Level3 ProgramDatabase + stdcpp20 + true + true - MachineX86 - true + false Console true true - + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) MultiThreadedDLL Level3 ProgramDatabase + stdcpp20 + true + true - true + false Console true true