Skip to content

Commit

Permalink
Some macOS hack... I mean changes
Browse files Browse the repository at this point in the history
  • Loading branch information
MrRevo3D committed Feb 11, 2021
1 parent 8df953c commit c072c71
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 54 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ bld/
[Oo]bj/
[Ll]og/
[Ii]nstall/
cmake-build-*/

# Visual Studio 2015 cache/options directory
.vs/
Expand Down Expand Up @@ -197,6 +198,11 @@ ClientBin/
*.publishsettings
node_modules/
orleans.codegen.cs
*.cbp
cmake_install.cmake
include/
Makefile
.DS_Store

# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
Expand Down
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -477,11 +477,17 @@ else()

list(APPEND Impacto_Libs
${SDL2_LIBRARIES}
glm
ZLIB::ZLIB
${OGGVORBIS_LIBRARIES}
)

# If we don't do this it decides to link glm as a library on macOS for some reason
if(NOT APPLE)
list(APPEND Impacto_Libs
glm
)
endif()

add_definitions(-DIMPACTO_OPENAL_HAVE_ALEXT)
endif()

Expand Down
107 changes: 54 additions & 53 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,17 @@ jobs:
profiles/**/*
games/**/*
src/shaders/**/*
TargetFolder: '$(Build.ArtifactStagingDirectory)'
TargetFolder: '$(Build.ArtifactStagingDirectory)/impacto'
- task: CopyFiles@2
displayName: Copy artifact
inputs:
SourceFolder: 'src'
Contents: 'shaders/**/*'
TargetFolder: '$(Build.ArtifactStagingDirectory)'
TargetFolder: '$(Build.ArtifactStagingDirectory)/impacto'
- task: ArchiveFiles@2
displayName: Archive artifact
inputs:
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)'
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)/impacto'
includeRootFolder: true
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/impacto-linux-$(version)-$(Build.SourceVersion).zip'
Expand All @@ -128,53 +128,53 @@ jobs:
ArtifactName: 'release'
publishLocation: 'Container'

#- job: macos_build
# displayName: macOS Build
#
# pool:
# vmImage: 'macOS-latest'
#
# steps:
# - script: |
# brew install openal-soft sdl2 glm
# pushd vendor
# git clone https://github.com/Thealexbarney/LibAtrac9.git --depth 1
# cd LibAtrac9/C && make
# mkdir -p ../include/libatrac9
# mkdir -p ../libs
# cp bin/libatrac9.a ../libs/
# cp src/libatrac9.h ../include/libatrac9/
# popd
# LIBATRAC9DIR=vendor/LibAtrac9 cmake -DOPENAL_LIBRARY=/usr/local/opt/openal-soft/lib/libopenal.dylib -DOPENAL_INCLUDE_DIR=/usr/local/opt/openal-soft/include/AL .
# make -j2
# - task: CopyFiles@2
# displayName: Copy artifact
# inputs:
# Contents: |
# impacto
# profiles/**/*
# games/**/*
# src/shaders/**/*
# TargetFolder: '$(Build.ArtifactStagingDirectory)'
# - task: CopyFiles@2
# displayName: Copy artifact
# inputs:
# SourceFolder: 'src'
# Contents: 'shaders/**/*'
# TargetFolder: '$(Build.ArtifactStagingDirectory)'
# - task: ArchiveFiles@2
# displayName: Archive artifact
# inputs:
# rootFolderOrFile: '$(Build.ArtifactStagingDirectory)'
# includeRootFolder: true
# archiveType: 'zip'
# archiveFile: '$(Build.ArtifactStagingDirectory)/impacto-macos-$(version)-$(Build.SourceVersion).zip'
# replaceExistingArchive: true
# - task: PublishBuildArtifacts@1
# inputs:
# PathtoPublish: '$(Build.ArtifactStagingDirectory)/impacto-macos-$(version)-$(Build.SourceVersion).zip'
# ArtifactName: 'release'
# publishLocation: 'Container'
- job: macos_build
displayName: macOS Build

pool:
vmImage: 'macOS-latest'

steps:
- script: |
brew install openal-soft sdl2 glm
pushd vendor
git clone https://github.com/Thealexbarney/LibAtrac9.git --depth 1
cd LibAtrac9/C && make
mkdir -p ../include/libatrac9
mkdir -p ../libs
cp bin/libatrac9.a ../libs/
cp src/libatrac9.h ../include/libatrac9/
popd
LIBATRAC9DIR=vendor/LibAtrac9 cmake -DOPENAL_LIBRARY=/usr/local/opt/openal-soft/lib/libopenal.dylib -DOPENAL_INCLUDE_DIR=/usr/local/opt/openal-soft/include/AL .
make -j2
- task: CopyFiles@2
displayName: Copy artifact
inputs:
Contents: |
impacto
profiles/**/*
games/**/*
src/shaders/**/*
TargetFolder: '$(Build.ArtifactStagingDirectory)/impacto'
- task: CopyFiles@2
displayName: Copy artifact
inputs:
SourceFolder: 'src'
Contents: 'shaders/**/*'
TargetFolder: '$(Build.ArtifactStagingDirectory)/impacto'
- task: ArchiveFiles@2
displayName: Archive artifact
inputs:
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)/impacto'
includeRootFolder: true
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/impacto-macos-$(version)-$(Build.SourceVersion).zip'
replaceExistingArchive: true
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)/impacto-macos-$(version)-$(Build.SourceVersion).zip'
ArtifactName: 'release'
publishLocation: 'Container'

- job: publish_artifacts
displayName: Publish Artifacts
Expand Down Expand Up @@ -233,16 +233,17 @@ jobs:
dependsOn:
- win_x64_build
- linux_x64_build
# - macos_build
- macos_build
variables:
winBuildStatus: $[ dependencies.win_x64_build.result ]
linuxBuildStatus: $[ dependencies.linux_x64_build.result ]
# macOSBuildStatus: $[ dependencies.macos_build.result ]
macOSBuildStatus: $[ dependencies.macos_build.result ]
condition: |
or
(
in(dependencies.win_x64_build.result, 'Failed', 'Canceled'),
in(dependencies.linux_x64_build.result, 'Failed', 'Canceled')
in(dependencies.linux_x64_build.result, 'Failed', 'Canceled'),
in(dependencies.macos_build.result, 'Failed', 'Canceled')
)
pool:
Expand Down
2 changes: 2 additions & 0 deletions src/impacto.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#ifndef __APPLE__
#include <malloc.h>
#endif
#define _USE_MATH_DEFINES
#include <math.h>

Expand Down
3 changes: 3 additions & 0 deletions src/shader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ GLuint ShaderCompile(char const* name, ShaderParamMap const& params) {
return 0;
}

// TODO: Figure out why this actually doesn't work on macOS
#ifndef __APPLE__
glValidateProgram(program);
glGetProgramiv(program, GL_VALIDATE_STATUS, &result);
if (!result) {
Expand All @@ -229,6 +231,7 @@ GLuint ShaderCompile(char const* name, ShaderParamMap const& params) {
glDeleteProgram(program);
return 0;
}
#endif

return program;
}
Expand Down
4 changes: 4 additions & 0 deletions vendor/nuklear/nuklear_sdl_gl3.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@
#define NK_SDL_GL3_H_

#include <SDL.h>
#ifdef __APPLE__
#include <SDL2/SDL_opengl.h>
#else
#include <SDL_opengles2.h>
#endif

NK_API struct nk_context* nk_sdl_init(SDL_Window *win, int max_vertex_buffer, int max_element_buffer);
NK_API void nk_sdl_font_stash_begin(struct nk_font_atlas **atlas);
Expand Down

0 comments on commit c072c71

Please sign in to comment.