Skip to content

Commit

Permalink
Updates to 33 files to (hopefully) get VS 0.10.x working on Mac!
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengtuggy committed Jan 10, 2025
1 parent 4c142ee commit 1948199
Show file tree
Hide file tree
Showing 33 changed files with 271 additions and 249 deletions.
40 changes: 32 additions & 8 deletions engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,23 @@ INCLUDE_DIRECTORIES(${TST_INCLUDES})
IF (NOT DISABLE_CLIENT) ##########

#Find GL
SET(CMAKE_FIND_FRAMEWORK "FIRST")
FIND_PACKAGE(OpenGL REQUIRED)
IF (OPENGL_FOUND AND OPENGL_GLU_FOUND)
SET(TST_INCLUDES ${TST_INCLUDES} ${OPENGL_INCLUDE_DIR})
# SET(TST_LIBS ${TST_LIBS} "${OpenGL::GL}" "${OpenGL::GLU}")
MESSAGE("++ OpenGL found")
MESSAGE(STATUS "OpenGL found")
SET(CMAKE_FIND_FRAMEWORK "LAST")
FIND_FILE(VEGA_GLEXT_H_PATH glext.h PATH_SUFFIXES GL/ OpenGL/)
get_filename_component(VEGA_GLEXT_H_DIRECTORY ${VEGA_GLEXT_H_PATH} DIRECTORY)
MESSAGE(STATUS "Path to glext.h: ${VEGA_GLEXT_H_PATH}")
FIND_FILE(VEGA_GL_H_PATH gl.h PATH_SUFFIXES GL/ OpenGL/)
get_filename_component(VEGA_GL_H_DIRECTORY ${VEGA_GL_H_PATH} DIRECTORY)
MESSAGE(STATUS "Path to gl.h: ${VEGA_GL_H_PATH}")
FIND_FILE(VEGA_GLU_H_PATH glu.h PATH_SUFFIXES GL/ OpenGL/)
get_filename_component(VEGA_GLU_H_DIRECTORY ${VEGA_GLU_H_PATH} DIRECTORY)
MESSAGE(STATUS "Path to glu.h: ${VEGA_GLU_H_PATH}")
SET(TST_INCLUDES ${TST_INCLUDES} ${VEGA_GLEXT_H_DIRECTORY} ${VEGA_GL_H_DIRECTORY} ${VEGA_GLU_H_DIRECTORY})
ELSE (OPENGL_FOUND AND OPENGL_GLU_FOUND)
MESSAGE("!! Why you no have GL?")
MESSAGE(SEND_WARNING "Why you no have GL?")
ENDIF (OPENGL_FOUND AND OPENGL_GLU_FOUND)

# Workaround two oversights in FindGLUT (when trying to use freeglut on MacOS):
Expand All @@ -236,16 +246,22 @@ IF (NOT DISABLE_CLIENT) ##########
SET(OPENGL_LIBRARY_DIR "${OPENGL_INCLUDE_DIR}/GLUT")

#Find GLUT
SET(CMAKE_FIND_FRAMEWORK "FIRST")
FIND_PACKAGE(GLUT REQUIRED)
IF (GLUT_FOUND)
SET(TST_INCLUDES ${TST_INCLUDES} ${GLUT_INCLUDE_DIR})
MESSAGE(STATUS "GLUT found : ${GLUT_LIBRARIES}")
SET(CMAKE_FIND_FRAMEWORK "LAST")
FIND_FILE(VEGA_GLUT_H_PATH glut.h PATH_SUFFIXES GL/ GLUT/)
get_filename_component(VEGA_GLUT_H_DIRECTORY ${VEGA_GLUT_H_PATH} DIRECTORY)
MESSAGE(STATUS "Path to glut.h: ${VEGA_GLUT_H_PATH}")
SET(TST_INCLUDES ${TST_INCLUDES} ${VEGA_GLUT_H_DIRECTORY} ${GLUT_INCLUDE_DIR})
SET(TST_LIBS ${TST_LIBS} ${GLUT_LIBRARIES})
MESSAGE("++ GLUT found : ${GLUT_LIBRARIES}")
ELSE (GLUT_FOUND)
MESSAGE("!! I can't build this, missing GLUT")
MESSAGE(SEND_WARNING "I can't build this, missing GLUT")
ENDIF (GLUT_FOUND)

UNSET(OPENGL_LIBRARY_DIR)
SET(CMAKE_FIND_FRAMEWORK "LAST")

#Find OpenAL
FIND_PACKAGE(OpenAL REQUIRED)
Expand Down Expand Up @@ -916,6 +932,10 @@ TARGET_LINK_LIBRARIES(
SET_TARGET_PROPERTIES(vegastrike_python PROPERTIES PREFIX "")

ADD_LIBRARY(vegastrike-engine_com
${VEGA_GL_H_PATH}
${VEGA_GLU_H_PATH}
${VEGA_GLEXT_H_PATH}
${VEGA_GLUT_H_PATH}
${LIBPYTHON}
${LIBVS_LOGGING}
${LIBCONFIG}
Expand Down Expand Up @@ -946,6 +966,10 @@ IF (WIN32)
ENDIF()

SET(VEGASTRIKE_SOURCES
${VEGA_GL_H_PATH}
${VEGA_GLU_H_PATH}
${VEGA_GLEXT_H_PATH}
${VEGA_GLUT_H_PATH}
${LIBGUI_SOURCES}
${LIBNETCLIENT_SOURCES}
${LIBROOTCLIENT_SOURCES}
Expand Down Expand Up @@ -1051,7 +1075,7 @@ ENDIF (NOT DISABLE_CLIENT)
# Vssetup Sub build file
ADD_SUBDIRECTORY(setup)

# Add other utilies here
# Add other utilities here
ADD_SUBDIRECTORY(objconv)

## show debug output
Expand Down
8 changes: 5 additions & 3 deletions engine/objconv/asteroidgen.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/*
* Copyright (C) 2001-2022 Daniel Horn, pyramid3d, Stephen G. Tuggy,
* asteroidgen.cpp
*
* Copyright (C) 2001-2025 Daniel Horn, pyramid3d, Stephen G. Tuggy,
* and other Vega Strike contributors.
*
* https://github.com/vegastrike/Vega-Strike-Engine-Source
Expand All @@ -13,7 +15,7 @@
*
* Vega Strike is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
Expand All @@ -30,7 +32,7 @@
#define M_PI 3.14159265358979323846264338328
#endif
#include <float.h>
#ifdef __APPLE__
#if defined(__APPLE__) && defined (__MACH__)
#define sqrtf sqrt
#define cosf cos
#define sinf sin
Expand Down
16 changes: 7 additions & 9 deletions engine/objconv/basemaker/base_maker.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/*
* Copyright (C) 2001-2022 Daniel Horn, pyramid3d, Stephen G. Tuggy,
* base_maker.cpp
*
* Copyright (C) 2001-2025 Daniel Horn, pyramid3d, Stephen G. Tuggy,
* and other Vega Strike contributors.
*
* https://github.com/vegastrike/Vega-Strike-Engine-Source
Expand All @@ -13,7 +15,7 @@
*
* Vega Strike is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
Expand Down Expand Up @@ -46,13 +48,9 @@
#include <sys/stat.h> //for mkdir
#include <sys/types.h>

#if defined (__APPLE__) || defined (MACOSX)
#include <GLUT/glut.h>
#include <OpenGL/glext.h>
#else
#include <GL/glut.h>
#include <GL/glext.h>
#endif
// See https://github.com/vegastrike/Vega-Strike-Engine-Source/pull/851#discussion_r1589254766
#include <glut.h>
#include <glext.h>

/*
* Globals
Expand Down
8 changes: 5 additions & 3 deletions engine/objconv/basemaker/base_maker_texture.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/*
* Copyright (C) 2001-2022 Daniel Horn, pyramid3d, Stephen G. Tuggy,
* base_maker_texture.cpp
*
* Copyright (C) 2001-2025 Daniel Horn, pyramid3d, Stephen G. Tuggy,
* and other Vega Strike contributors.
*
* https://github.com/vegastrike/Vega-Strike-Engine-Source
Expand All @@ -13,7 +15,7 @@
*
* Vega Strike is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
Expand Down Expand Up @@ -325,7 +327,7 @@ void Texture::loadTexture(FILE *file, TextureTransform tt) {
handle = (unsigned int) -1;
return;
}
#ifdef __APPLE__
#if defined(__APPLE__) && defined (__MACH__)
glGenTextures( 1, (GLuint*) &handle );
#else
glGenTextures(1, &handle);
Expand Down
16 changes: 7 additions & 9 deletions engine/objconv/basemaker/sprite.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/*
* Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, Benjamen R. Meyer,
* sprite.h
*
* Copyright (C) 2001-2025 Daniel Horn, pyramid3d, Stephen G. Tuggy, Benjamen R. Meyer,
* and other Vega Strike contributors.
*
* https://github.com/vegastrike/Vega-Strike-Engine-Source
Expand All @@ -13,7 +15,7 @@
*
* Vega Strike is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
Expand All @@ -28,13 +30,9 @@
#include "gfx/hud.h"
#include "vs_globals.h"

#if defined (__APPLE__) || defined (MACOSX)
#include <GLUT/glut.h>
#include <OpenGL/glext.h>
#else
#include <GL/glut.h>
#include <GL/glext.h>
#endif
// See https://github.com/vegastrike/Vega-Strike-Engine-Source/pull/851#discussion_r1589254766
#include <glut.h>
#include <glext.h>

#include <iostream>
//#include <stdlib>
Expand Down
8 changes: 5 additions & 3 deletions engine/objconv/trisort.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/*
* Copyright (C) 2001-2022 Daniel Horn, pyramid3d, Stephen G. Tuggy,
* trisort.cpp
*
* Copyright (C) 2001-2025 Daniel Horn, pyramid3d, Stephen G. Tuggy,
* and other Vega Strike contributors.
*
* https://github.com/vegastrike/Vega-Strike-Engine-Source
Expand All @@ -13,7 +15,7 @@
*
* Vega Strike is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
Expand All @@ -29,7 +31,7 @@
#include <math.h>
#include "trisort.h"

#ifdef __APPLE__
#if defined(__APPLE__) && defined (__MACH__)
#define sqrtf sqrt
#endif

Expand Down
14 changes: 6 additions & 8 deletions engine/src/aldrv/al_globals.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
/**
/*
* al_globals.h
*
* Copyright (C) Daniel Horn
* Copyright (C) 2020 pyramid3d, Stephen G. Tuggy, and other Vega Strike
* contributors
* Copyright (C) 2023 Stephen G. Tuggy, Benjamen R. Meyer
* Copyright (C) 2001-2025 Daniel Horn, pyramid3d, Stephen G. Tuggy,
* Benjamen R. Meyer, and other Vega Strike contributors
*
* https://github.com/vegastrike/Vega-Strike-Engine-Source
*
Expand All @@ -17,11 +15,11 @@
*
* Vega Strike is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Vega Strike. If not, see <https://www.gnu.org/licenses/>.
* along with Vega Strike. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef VEGA_STRIKE_ENGINE_AL_GLOBALS_H
#define VEGA_STRIKE_ENGINE_AL_GLOBALS_H
Expand All @@ -33,7 +31,7 @@
#include <vector>

#ifdef HAVE_AL
#ifdef __APPLE__
#if defined(__APPLE__) && defined (__MACH__)
#include <al.h>
#else
#include <AL/al.h>
Expand Down
11 changes: 5 additions & 6 deletions engine/src/aldrv/al_init.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
/*
* al_init.cpp
*
* Copyright (C) Daniel Horn
* Copyright (C) 2020 pyramid3d, Stephen G. Tuggy, and other Vega Strike contributors
* Copyright (C) 2021-2022 Stephen G. Tuggy
* Copyright (C) 2001-2025 Daniel Horn, pyramid3d, Stephen G. Tuggy,
* and other Vega Strike contributors
*
* https://github.com/vegastrike/Vega-Strike-Engine-Source
*
Expand All @@ -16,16 +15,16 @@
*
* Vega Strike is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Vega Strike. If not, see <https://www.gnu.org/licenses/>.
* along with Vega Strike. If not, see <https://www.gnu.org/licenses/>.
*/


#ifdef HAVE_AL
#ifdef __APPLE__
#if defined(__APPLE__) && defined (__MACH__)
#include <al.h>
#include <alc.h>
#define KeyMap AppleKeyMap
Expand Down
11 changes: 5 additions & 6 deletions engine/src/aldrv/al_listen.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
/*
* al_listen.cpp
*
* Copyright (C) Daniel Horn
* Copyright (C) 2020 pyramid3d, Stephen G. Tuggy, and other Vega Strike contributors
* Copyright (C) 2021-2022 Stephen G. Tuggy
* Copyright (C) 2001-2025 Daniel Horn, pyramid3d, Stephen G. Tuggy,
* and other Vega Strike contributors
*
* https://github.com/vegastrike/Vega-Strike-Engine-Source
*
Expand All @@ -16,16 +15,16 @@
*
* Vega Strike is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Vega Strike. If not, see <https://www.gnu.org/licenses/>.
* along with Vega Strike. If not, see <https://www.gnu.org/licenses/>.
*/


#ifdef HAVE_AL
#ifdef __APPLE__
#if defined(__APPLE__) && defined (__MACH__)
#include <al.h>
#else
#include <AL/al.h>
Expand Down
12 changes: 5 additions & 7 deletions engine/src/aldrv/al_sound.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
/*
* al_sound.cpp
*
* Copyright (C) Daniel Horn
* Copyright (C) 2020 pyramid3d, Nachum Barcohen, Roy Falk, Stephen G. Tuggy,
* and other Vega Strike contributors
* Copyright (C) 2021-2022 Stephen G. Tuggy
* Copyright (C) 2001-2025 Daniel Horn, pyramid3d, Nachum Barcohen,
* Roy Falk, Stephen G. Tuggy, and other Vega Strike contributors
*
* https://github.com/vegastrike/Vega-Strike-Engine-Source
*
Expand All @@ -17,11 +15,11 @@
*
* Vega Strike is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Vega Strike. If not, see <https://www.gnu.org/licenses/>.
* along with Vega Strike. If not, see <https://www.gnu.org/licenses/>.
*/


Expand Down Expand Up @@ -182,7 +180,7 @@ void blutLoadWAVMemory(ALbyte *memory, ALenum
}
}

#ifdef __APPLE__
#if defined(__APPLE__) && defined (__MACH__)
#include <al.h>
#include <alc.h>
//#include <alut.h>
Expand Down
8 changes: 5 additions & 3 deletions engine/src/audio/renderers/OpenAL/OpenALRenderer.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/*
* Copyright (C) 2001-2022 Daniel Horn, pyramid3d, Stephen G. Tuggy,
* OpenALRenderer.cpp
*
* Copyright (C) 2001-2025 Daniel Horn, pyramid3d, Stephen G. Tuggy,
* and other Vega Strike contributors.
*
* https://github.com/vegastrike/Vega-Strike-Engine-Source
Expand All @@ -13,7 +15,7 @@
*
* Vega Strike is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
Expand Down Expand Up @@ -151,7 +153,7 @@ struct RendererData {
#ifdef _WIN32
deviceSpecifier = "DirectSound3D";
#else
#ifdef __APPLE__
#if defined(__APPLE__) && defined (__MACH__)
deviceSpecifier = "sdl";
#endif
#endif
Expand Down
Loading

0 comments on commit 1948199

Please sign in to comment.