Skip to content

Commit

Permalink
Merge pull request #108 from fallahn/golf-1.16
Browse files Browse the repository at this point in the history
Golf 1.16
  • Loading branch information
fallahn authored Apr 3, 2024
2 parents a99f758 + e31f688 commit 595254c
Show file tree
Hide file tree
Showing 160 changed files with 14,045 additions and 1,873 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ jobs:
- { name: Static, flags: -DBUILD_SHARED_LIBS=OFF }

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install linux Dependencies
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install libgtk-3-dev libenet-dev libxrandr-dev libudev-dev libopenal-dev libflac-dev libvorbis-dev libsdl2-dev libunwind-dev libassimp-dev assimp-utils
run: sudo apt-get update && sudo apt-get install libgtk-3-dev libenet-dev libxrandr-dev libudev-dev libopenal-dev libflac-dev libvorbis-dev libopus-dev libsdl2-dev libunwind-dev libassimp-dev assimp-utils

- name: Install macOS Dependencies
if: runner.os == 'MacOS'
run: brew update && brew install sdl2 assimp
run: brew update && brew install sdl2 assimp openal-soft opus

- name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ imgui.ini

build/
bundle/
install/

assets
4 changes: 2 additions & 2 deletions crogine.sln
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@ Global
{B1559428-CDF8-4797-8766-0EA62BDD6D1B}.Debug|Any CPU.ActiveCfg = Debug|Win32
{B1559428-CDF8-4797-8766-0EA62BDD6D1B}.Debug|ARM.ActiveCfg = Debug|Win32
{B1559428-CDF8-4797-8766-0EA62BDD6D1B}.Debug|ARM64.ActiveCfg = Debug|Win32
{B1559428-CDF8-4797-8766-0EA62BDD6D1B}.Debug|x64.ActiveCfg = DebugGNS|x64
{B1559428-CDF8-4797-8766-0EA62BDD6D1B}.Debug|x64.Build.0 = DebugGNS|x64
{B1559428-CDF8-4797-8766-0EA62BDD6D1B}.Debug|x64.ActiveCfg = Debug|x64
{B1559428-CDF8-4797-8766-0EA62BDD6D1B}.Debug|x64.Build.0 = Debug|x64
{B1559428-CDF8-4797-8766-0EA62BDD6D1B}.Debug|x86.ActiveCfg = Debug|Win32
{B1559428-CDF8-4797-8766-0EA62BDD6D1B}.Debug|x86.Build.0 = Debug|Win32
{B1559428-CDF8-4797-8766-0EA62BDD6D1B}.DebugASan|Any CPU.ActiveCfg = DebugASan|Win32
Expand Down
39 changes: 30 additions & 9 deletions crogine/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
cmake_minimum_required(VERSION 3.5.0)

#required for std::filesystem

if(APPLE)
#required for std::filesystem
SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version")

#force macOS to use homebrew installed libs, eg OpenAL
SET(CMAKE_PREFIX_PATH
"/opt/homebrew"
"/opt/homebrew/opt/openal-soft/include"
"/opt/homebrew/opt/openal-soft/lib"
"/usr/local"
"/usr/local/opt/openal-soft/include"
"/usr/local/opt/openal-soft/lib")
SET(CMAKE_FIND_FRAMEWORK LAST)
endif()

project(crogine)
Expand Down Expand Up @@ -32,6 +43,10 @@ if(CMAKE_COMPILER_IS_GNUCXX)
endif()
endif()

if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-potentially-evaluated-expression")
endif()

if(USE_OPENAL)
add_definitions(-DAL_AUDIO)
else()
Expand Down Expand Up @@ -71,12 +86,13 @@ SET (OpenGL_GL_PREFERENCE "GLVND")
find_package(SDL2 REQUIRED)
find_package(Freetype REQUIRED)
find_package(OpenGL REQUIRED)
find_package(OPUS REQUIRED)

if(USE_OPENAL)
#use mojo AL on mac
if(NOT APPLE)
#we were using mojoal on mac but now trying to get openal-soft to work from brew
#if(NOT APPLE)
find_package(OpenAL REQUIRED)
endif()
#endif()
else()
find_package(SDL2_mixer REQUIRED)
endif()
Expand All @@ -91,21 +107,25 @@ endif()
include_directories(
${SDL2_INCLUDE_DIR}
${FREETYPE_INCLUDE_DIRS}
${OPUS_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/crogine/include)

if(MSVC)
include_directories(${CMAKE_SOURCE_DIR}/extlibs/openal/include ${DBGHELP_INCLUDE_DIR})
elseif(LINUX)
include_directories(${LIBUNWIND_INCLUDE_DIRS})
elseif(APPLE)
include_directories(/usr/local/opt/openal-soft/include)
link_directories(/usr/local/opt/openal-soft/lib)
endif()

SET(PROJECT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
include(${PROJECT_DIR}/CMakeLists.txt)

if(USE_OPENAL)
if(NOT APPLE)
#if(NOT APPLE)
include_directories(${OPENAL_INCLUDE_DIR})
endif()
#endif()
SET(PROJECT_SRC ${PROJECT_SRC} ${project_src_openal})
else()
include_directories(${SDL2_MIXER_INCLUDE_DIR})
Expand All @@ -120,7 +140,7 @@ else()
SET(PROJECT_SRC ${PROJECT_SRC} ${project_src_nix})
endif()

# add the Resourcepath source, mojoal source and GL41 loader for apple, else load GL46
# add the Resourcepath source, and GL41 loader for apple, else load GL46
if (APPLE)
set(PROJECT_SRC ${PROJECT_SRC} ${project_src_macos})
else()
Expand All @@ -140,12 +160,13 @@ if(NOT TARGET crogine)
target_link_libraries(${PROJECT_NAME}
${SDL2_LIBRARY}
${FREETYPE_LIBRARIES}
${OPUS_LIBRARIES}
${OPENGL_LIBRARIES})

if(USE_OPENAL)
if(NOT APPLE)
#if(NOT APPLE)
target_link_libraries(${PROJECT_NAME} ${OPENAL_LIBRARY})
endif()
#endif()
else()
target_link_libraries(${PROJECT_NAME} ${SDL2_MIXER_LIBRARY})
endif()
Expand Down
54 changes: 54 additions & 0 deletions crogine/cmake/modules/FindOPUS.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# - FindOpus.cmake
# Find the native opus includes and libraries
#
# OPUS_INCLUDE_DIRS - where to find opus/opus.h, etc.
# OPUS_LIBRARIES - List of libraries when using libopus(file).
# OPUS_FOUND - True if libopus found.

if(OPUS_INCLUDE_DIR AND OPUS_LIBRARY)
# Already in cache, be silent
set(OPUS_FIND_QUIETLY TRUE)
endif(OPUS_INCLUDE_DIR AND OPUS_LIBRARY)


SET(SEARCH_PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/sw # Fink
/opt/homebrew
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
../extlibs/opus
../extlibs/opus/include
../extlibs/opus/lib/x64
)


find_path(OPUS_INCLUDE_DIR
NAMES opus.h
PATH_SUFFIXES opus
PATHS ${SEARCH_PATHS}
)

# MSVC built opus may be named opus_static
# The provided project files name the library with the lib prefix.
find_library(OPUS_LIBRARY
NAMES opus opus_static libopus libopus_static
PATHS ${SEARCH_PATHS}
)


# Handle the QUIETLY and REQUIRED arguments and set OPUS_FOUND
# to TRUE if all listed variables are TRUE.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OPUS DEFAULT_MSG
OPUS_LIBRARY OPUS_INCLUDE_DIR
)

if(OPUS_FOUND)
set(OPUS_LIBRARIES ${OPUS_LIBRARY})
set(OPUS_INCLUDE_DIRS ${OPUS_INCLUDE_DIR})
endif(OPUS_FOUND)
4 changes: 4 additions & 0 deletions crogine/cmake/modules/FindOpenAL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ find_path(OPENAL_INCLUDE_DIR al.h
HINTS
ENV OPENALDIR
PATHS
/opt/homebrew
/usr/local
~/Library/Frameworks
/Library/Frameworks
/opt
Expand All @@ -78,6 +80,8 @@ find_library(OPENAL_LIBRARY
HINTS
ENV OPENALDIR
PATHS
/opt/homebrew
/usr/local
~/Library/Frameworks
/Library/Frameworks
/opt
Expand Down
132 changes: 66 additions & 66 deletions crogine/cmake/modules/FindSDL2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -68,97 +68,97 @@
message("<FindSDL2.cmake>")

SET(SDL2_SEARCH_PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
../extlibs/sdl2
${SDL2_PATH}
${SDL2_PATH}
)

FIND_PATH(SDL2_INCLUDE_DIR SDL.h
HINTS
$ENV{SDL2DIR}
PATH_SUFFIXES include/SDL2 include
PATHS ${SDL2_SEARCH_PATHS}
HINTS
$ENV{SDL2DIR}
PATH_SUFFIXES include/SDL2 include
PATHS ${SDL2_SEARCH_PATHS}
)

FIND_LIBRARY(SDL2_LIBRARY_TEMP
NAMES SDL2
HINTS
$ENV{SDL2DIR}
PATH_SUFFIXES lib64 lib lib/x64 lib/x86
PATHS ${SDL2_SEARCH_PATHS}
NAMES SDL2
HINTS
$ENV{SDL2DIR}
PATH_SUFFIXES lib64 lib lib/x64 lib/x86
PATHS ${SDL2_SEARCH_PATHS}
)

IF(NOT SDL2_BUILDING_LIBRARY)
IF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework")
# Non-OS X framework versions expect you to also dynamically link to
# SDL2main. This is mainly for Windows and OS X. Other (Unix) platforms
# seem to provide SDL2main for compatibility even though they don't
# necessarily need it.
FIND_LIBRARY(SDL2MAIN_LIBRARY
NAMES SDL2main
HINTS
$ENV{SDL2DIR}
PATH_SUFFIXES lib64 lib lib/x64 lib/x86
PATHS ${SDL2_SEARCH_PATHS}
)
ENDIF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework")
IF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework")
# Non-OS X framework versions expect you to also dynamically link to
# SDL2main. This is mainly for Windows and OS X. Other (Unix) platforms
# seem to provide SDL2main for compatibility even though they don't
# necessarily need it.
FIND_LIBRARY(SDL2MAIN_LIBRARY
NAMES SDL2main
HINTS
$ENV{SDL2DIR}
PATH_SUFFIXES lib64 lib lib/x64 lib/x86
PATHS ${SDL2_SEARCH_PATHS}
)
ENDIF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework")
ENDIF(NOT SDL2_BUILDING_LIBRARY)

# SDL2 may require threads on your system.
# The Apple build may not need an explicit flag because one of the
# frameworks may already provide it.
# But for non-OSX systems, I will use the CMake Threads package.
IF(NOT APPLE)
FIND_PACKAGE(Threads)
FIND_PACKAGE(Threads)
ENDIF(NOT APPLE)

# MinGW needs an additional link flag, -mwindows
# It's total link flags should look like -lmingw32 -lSDL2main -lSDL2 -mwindows
IF(MINGW)
SET(MINGW32_LIBRARY mingw32 "-mwindows" CACHE STRING "mwindows for MinGW")
SET(MINGW32_LIBRARY mingw32 "-mwindows" CACHE STRING "mwindows for MinGW")
ENDIF(MINGW)

IF(SDL2_LIBRARY_TEMP)
# For SDL2main
IF(NOT SDL2_BUILDING_LIBRARY)
IF(SDL2MAIN_LIBRARY)
SET(SDL2_LIBRARY_TEMP ${SDL2MAIN_LIBRARY} ${SDL2_LIBRARY_TEMP})
ENDIF(SDL2MAIN_LIBRARY)
ENDIF(NOT SDL2_BUILDING_LIBRARY)

# For OS X, SDL2 uses Cocoa as a backend so it must link to Cocoa.
# CMake doesn't display the -framework Cocoa string in the UI even
# though it actually is there if I modify a pre-used variable.
# I think it has something to do with the CACHE STRING.
# So I use a temporary variable until the end so I can set the
# "real" variable in one-shot.
IF(APPLE)
SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} "-framework Cocoa")
ENDIF(APPLE)

# For threads, as mentioned Apple doesn't need this.
# In fact, there seems to be a problem if I used the Threads package
# and try using this line, so I'm just skipping it entirely for OS X.
IF(NOT APPLE)
SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} ${CMAKE_THREAD_LIBS_INIT})
ENDIF(NOT APPLE)

# For MinGW library
IF(MINGW)
SET(SDL2_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL2_LIBRARY_TEMP})
ENDIF(MINGW)

# Set the final string here so the GUI reflects the final state.
SET(SDL2_LIBRARY ${SDL2_LIBRARY_TEMP} CACHE STRING "Where the SDL2 Library can be found")
# Set the temp variable to INTERNAL so it is not seen in the CMake GUI
SET(SDL2_LIBRARY_TEMP "${SDL2_LIBRARY_TEMP}" CACHE INTERNAL "")
# For SDL2main
IF(NOT SDL2_BUILDING_LIBRARY)
IF(SDL2MAIN_LIBRARY)
SET(SDL2_LIBRARY_TEMP ${SDL2MAIN_LIBRARY} ${SDL2_LIBRARY_TEMP})
ENDIF(SDL2MAIN_LIBRARY)
ENDIF(NOT SDL2_BUILDING_LIBRARY)

# For OS X, SDL2 uses Cocoa as a backend so it must link to Cocoa.
# CMake doesn't display the -framework Cocoa string in the UI even
# though it actually is there if I modify a pre-used variable.
# I think it has something to do with the CACHE STRING.
# So I use a temporary variable until the end so I can set the
# "real" variable in one-shot.
IF(APPLE)
SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} "-framework Cocoa")
ENDIF(APPLE)

# For threads, as mentioned Apple doesn't need this.
# In fact, there seems to be a problem if I used the Threads package
# and try using this line, so I'm just skipping it entirely for OS X.
IF(NOT APPLE)
SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} ${CMAKE_THREAD_LIBS_INIT})
ENDIF(NOT APPLE)

# For MinGW library
IF(MINGW)
SET(SDL2_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL2_LIBRARY_TEMP})
ENDIF(MINGW)

# Set the final string here so the GUI reflects the final state.
SET(SDL2_LIBRARY ${SDL2_LIBRARY_TEMP} CACHE STRING "Where the SDL2 Library can be found")
# Set the temp variable to INTERNAL so it is not seen in the CMake GUI
SET(SDL2_LIBRARY_TEMP "${SDL2_LIBRARY_TEMP}" CACHE INTERNAL "")
ENDIF(SDL2_LIBRARY_TEMP)

message("</FindSDL2.cmake>")
Expand Down
2 changes: 1 addition & 1 deletion crogine/include/crogine/audio/AudioSource.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ namespace cro
/*!
\brief Attempts to load the file at the given path.
*/
virtual bool loadFromFile(const std::string&) = 0;
virtual bool loadFromFile(const std::string&) { return false; };

protected:
void setID(std::int32_t id) { m_id = id; }
Expand Down
Loading

0 comments on commit 595254c

Please sign in to comment.