1
1
Fork 0
mirror of https://github.com/QB64Official/qb64.git synced 2024-06-30 22:40:37 +00:00

Merge pull request #40 from QB64Team/Pirachy/Fixed-Compiling-on-macOS-for-those-with-both-Apple-Clang-and-Homebrew-GCC

Explicitly uses Apple's clang/clang++ where applicable.
This commit is contained in:
Fellippe Heitor 2020-02-20 22:06:35 -03:00 committed by GitHub
commit 4c54dbd798
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 69 additions and 69 deletions

View file

@ -28,7 +28,7 @@ cp -r internal/source/* internal/temp/
cd internal/c
echo -n "Bootstrapping QB64..."
if [[ $OS == "osx" ]]; then
g++ -w qbx.cpp libqb/os/osx/libqb_setup.o parts/video/font/ttf/os/osx/src.o -framework GLUT -framework OpenGL -framework Cocoa -lcurses -o ../../qb64_bootstrap
clang++ -w qbx.cpp libqb/os/osx/libqb_setup.o parts/video/font/ttf/os/osx/src.o -framework GLUT -framework OpenGL -framework Cocoa -lcurses -o ../../qb64_bootstrap
else
g++ -w qbx.cpp libqb/os/lnx/libqb_setup.o parts/video/font/ttf/os/lnx/src.o parts/core/os/lnx/src.a -lGL -lGLU -lX11 -lcurses -lpthread -ldl -lrt -D FREEGLUT_STATIC -DDEPENDENCY_USER_MODS -o ../../qb64_bootstrap
fi

View file

@ -1,3 +1,3 @@
setup_osx.command
setup_macos.command
internal/c/c_compiler
qb64_start_osx.command

View file

@ -1,5 +1,5 @@
cd "$(dirname "$0")"
g++ -c -w -Wall ../../../libqb.mm -D DEPENDENCY_AUDIO_OUT -D DEPENDENCY_AUDIO_DECODE -D DEPENDENCY_AUDIO_CONVERSION -o libqb_test_only.o
clang++ -c -w -Wall ../../../libqb.mm -D DEPENDENCY_AUDIO_OUT -D DEPENDENCY_AUDIO_DECODE -D DEPENDENCY_AUDIO_CONVERSION -o libqb_test_only.o
echo "Press any key to continue"
Pause()
{

View file

@ -1,3 +1,3 @@
cd "$(dirname "$0")"
g++ -c -w -Wall ../../../libqb.mm -D DEPENDENCY_LOADFONT -o libqb_setup.o
clang++ -c -w -Wall ../../../libqb.mm -D DEPENDENCY_LOADFONT -o libqb_setup.o

View file

@ -1,4 +1,4 @@
g++ -w qbx.cpp -framework OpenGL -framework IOKit -framework GLUT -framework OpenGL -framework Cocoa -o
clang++ -w qbx.cpp -framework OpenGL -framework IOKit -framework GLUT -framework OpenGL -framework Cocoa -o
(below for reference purposes only, above is minimum viable)
g++ -w qbx.cpp -framework ApplicationServices -framework OpenGL -framework IOKit -framework CoreServices -framework CoreFoundation -framework GLUT -framework OpenGL -framework Cocoa -o
clang++ -w qbx.cpp -framework ApplicationServices -framework OpenGL -framework IOKit -framework CoreServices -framework CoreFoundation -framework GLUT -framework OpenGL -framework Cocoa -o

View file

@ -1,5 +1,5 @@
cd "$(dirname "$0")"
gcc -c ../../src/resample.c -o temp/resample.o
clang -c ../../src/resample.c -o temp/resample.o
ar rcs src.a temp/resample.o
echo "Press any key to continue..."
Pause()

View file

@ -1,5 +1,5 @@
cd "$(dirname "$0")"
gcc -c ../../src/minimp3.c -o temp/minimp3.o
clang -c ../../src/minimp3.c -o temp/minimp3.o
ar rcs src.a temp/minimp3.o
echo "Press any key to continue..."
Pause()

View file

@ -1,5 +1,5 @@
cd "$(dirname "$0")"
gcc -c ../../src/stb_vorbis.c -o src.o
clang -c ../../src/stb_vorbis.c -o src.o
echo "Press any key to continue..."
Pause()
{

View file

@ -1,32 +1,32 @@
cd "$(dirname "$0")"
gcc -s -c -w -Wall ../../src/coreaudio.c -D AL_LIBTYPE_STATIC -o temp/coreaudio.o
gcc -s -c -w -Wall ../../src/helpers.c -D AL_LIBTYPE_STATIC -o temp/helpers.o
gcc -s -c -w -Wall ../../src/bs2b.c -D AL_LIBTYPE_STATIC -o temp/bs2b.o
gcc -s -c -w -Wall ../../src/alAuxEffectSlot.c -D AL_LIBTYPE_STATIC -o temp/alAuxEffectSlot.o
gcc -s -c -w -Wall ../../src/alBuffer.c -D AL_LIBTYPE_STATIC -o temp/alBuffer.o
gcc -s -c -w -Wall ../../src/ALc.c -D AL_LIBTYPE_STATIC -o temp/ALc.o
gcc -s -c -w -Wall ../../src/alcConfig.c -D AL_LIBTYPE_STATIC -o temp/alcConfig.o
gcc -s -c -w -Wall ../../src/alcDedicated.c -D AL_LIBTYPE_STATIC -o temp/alcDedicated.o
gcc -s -c -w -Wall ../../src/alcEcho.c -D AL_LIBTYPE_STATIC -o temp/alcEcho.o
gcc -s -c -w -Wall ../../src/alcModulator.c -D AL_LIBTYPE_STATIC -o temp/alcModulator.o
gcc -s -c -w -Wall ../../src/alcReverb.c -D AL_LIBTYPE_STATIC -o temp/alcReverb.o
gcc -s -c -w -Wall ../../src/alcRing.c -D AL_LIBTYPE_STATIC -o temp/alcRing.o
gcc -s -c -w -Wall ../../src/alcThread.c -D AL_LIBTYPE_STATIC -o temp/alcThread.o
gcc -s -c -w -Wall ../../src/alEffect.c -D AL_LIBTYPE_STATIC -o temp/alEffect.o
gcc -s -c -w -Wall ../../src/alError.c -D AL_LIBTYPE_STATIC -o temp/alError.o
gcc -s -c -w -Wall ../../src/alExtension.c -D AL_LIBTYPE_STATIC -o temp/alExtension.o
gcc -s -c -w -Wall ../../src/alFilter.c -D AL_LIBTYPE_STATIC -o temp/alFilter.o
gcc -s -c -w -Wall ../../src/alListener.c -D AL_LIBTYPE_STATIC -o temp/alListener.o
gcc -s -c -w -Wall ../../src/alSource.c -D AL_LIBTYPE_STATIC -o temp/alSource.o
gcc -s -c -w -Wall ../../src/alState.c -D AL_LIBTYPE_STATIC -o temp/alState.o
gcc -s -c -w -Wall ../../src/alThunk.c -D AL_LIBTYPE_STATIC -o temp/alThunk.o
gcc -s -c -w -Wall ../../src/ALu.c -D AL_LIBTYPE_STATIC -o temp/ALu.o
gcc -s -c -w -Wall ../../src/hrtf.c -D AL_LIBTYPE_STATIC -o temp/hrtf.o
gcc -s -c -w -Wall ../../src/loopback.c -D AL_LIBTYPE_STATIC -o temp/loopback.o
gcc -s -c -w -Wall ../../src/mixer.c -D AL_LIBTYPE_STATIC -o temp/mixer.o
gcc -s -c -w -Wall ../../src/null.c -D AL_LIBTYPE_STATIC -o temp/null.o
gcc -s -c -w -Wall ../../src/panning.c -D AL_LIBTYPE_STATIC -o temp/panning.o
gcc -s -c -w -Wall ../../src/wave.c -D AL_LIBTYPE_STATIC -o temp/wave.o
clang -s -c -w -Wall ../../src/coreaudio.c -D AL_LIBTYPE_STATIC -o temp/coreaudio.o
clang -s -c -w -Wall ../../src/helpers.c -D AL_LIBTYPE_STATIC -o temp/helpers.o
clang -s -c -w -Wall ../../src/bs2b.c -D AL_LIBTYPE_STATIC -o temp/bs2b.o
clang -s -c -w -Wall ../../src/alAuxEffectSlot.c -D AL_LIBTYPE_STATIC -o temp/alAuxEffectSlot.o
clang -s -c -w -Wall ../../src/alBuffer.c -D AL_LIBTYPE_STATIC -o temp/alBuffer.o
clang -s -c -w -Wall ../../src/ALc.c -D AL_LIBTYPE_STATIC -o temp/ALc.o
clang -s -c -w -Wall ../../src/alcConfig.c -D AL_LIBTYPE_STATIC -o temp/alcConfig.o
clang -s -c -w -Wall ../../src/alcDedicated.c -D AL_LIBTYPE_STATIC -o temp/alcDedicated.o
clang -s -c -w -Wall ../../src/alcEcho.c -D AL_LIBTYPE_STATIC -o temp/alcEcho.o
clang -s -c -w -Wall ../../src/alcModulator.c -D AL_LIBTYPE_STATIC -o temp/alcModulator.o
clang -s -c -w -Wall ../../src/alcReverb.c -D AL_LIBTYPE_STATIC -o temp/alcReverb.o
clang -s -c -w -Wall ../../src/alcRing.c -D AL_LIBTYPE_STATIC -o temp/alcRing.o
clang -s -c -w -Wall ../../src/alcThread.c -D AL_LIBTYPE_STATIC -o temp/alcThread.o
clang -s -c -w -Wall ../../src/alEffect.c -D AL_LIBTYPE_STATIC -o temp/alEffect.o
clang -s -c -w -Wall ../../src/alError.c -D AL_LIBTYPE_STATIC -o temp/alError.o
clang -s -c -w -Wall ../../src/alExtension.c -D AL_LIBTYPE_STATIC -o temp/alExtension.o
clang -s -c -w -Wall ../../src/alFilter.c -D AL_LIBTYPE_STATIC -o temp/alFilter.o
clang -s -c -w -Wall ../../src/alListener.c -D AL_LIBTYPE_STATIC -o temp/alListener.o
clang -s -c -w -Wall ../../src/alSource.c -D AL_LIBTYPE_STATIC -o temp/alSource.o
clang -s -c -w -Wall ../../src/alState.c -D AL_LIBTYPE_STATIC -o temp/alState.o
clang -s -c -w -Wall ../../src/alThunk.c -D AL_LIBTYPE_STATIC -o temp/alThunk.o
clang -s -c -w -Wall ../../src/ALu.c -D AL_LIBTYPE_STATIC -o temp/ALu.o
clang -s -c -w -Wall ../../src/hrtf.c -D AL_LIBTYPE_STATIC -o temp/hrtf.o
clang -s -c -w -Wall ../../src/loopback.c -D AL_LIBTYPE_STATIC -o temp/loopback.o
clang -s -c -w -Wall ../../src/mixer.c -D AL_LIBTYPE_STATIC -o temp/mixer.o
clang -s -c -w -Wall ../../src/null.c -D AL_LIBTYPE_STATIC -o temp/null.o
clang -s -c -w -Wall ../../src/panning.c -D AL_LIBTYPE_STATIC -o temp/panning.o
clang -s -c -w -Wall ../../src/wave.c -D AL_LIBTYPE_STATIC -o temp/wave.o
ar rcs src.a temp/alAuxEffectSlot.o temp/alBuffer.o temp/ALc.o temp/alcConfig.o temp/alcDedicated.o temp/alcEcho.o temp/alcModulator.o temp/alcReverb.o temp/alcRing.o temp/alcThread.o temp/alEffect.o temp/alError.o temp/alExtension.o temp/alFilter.o temp/alListener.o temp/coreaudio.o temp/alSource.o temp/alState.o temp/alThunk.o temp/ALu.o temp/hrtf.o temp/loopback.o temp/mixer.o temp/null.o temp/panning.o temp/wave.o temp/helpers.o temp/bs2b.o
echo "Press any key to continue..."
Pause()
@ -44,28 +44,28 @@ Pause
####### added for OSX (above)
gcc -s -c -w -Wall ../../src/coreaudio.c -D AL_LIBTYPE_STATIC -o temp/coreaudio.o
clang -s -c -w -Wall ../../src/coreaudio.c -D AL_LIBTYPE_STATIC -o temp/coreaudio.o
###### removed for osx
gcc -s -c -w -Wall ../../src/alsa.c -D AL_LIBTYPE_STATIC -o temp/alsa.o
clang -s -c -w -Wall ../../src/alsa.c -D AL_LIBTYPE_STATIC -o temp/alsa.o
####Compiled but unrequired (using ALSA instead)####
gcc -s -c -w -Wall ../../src/oss.c -D AL_LIBTYPE_STATIC -o temp/oss.o
clang -s -c -w -Wall ../../src/oss.c -D AL_LIBTYPE_STATIC -o temp/oss.o
temp/oss.o
gcc -s -c -w -Wall ../../src/pulseaudio.c -D AL_LIBTYPE_STATIC -o temp/pulseaudio.o
clang -s -c -w -Wall ../../src/pulseaudio.c -D AL_LIBTYPE_STATIC -o temp/pulseaudio.o
temp/pulseaudio.o
####These all failed to compile in Ubuntu####
gcc -s -c -w -Wall ../../src/solaris.c -D AL_LIBTYPE_STATIC -o temp/solaris.o
gcc -s -c -w -Wall ../../src/sndio.c -D AL_LIBTYPE_STATIC -o temp/sndio.o
gcc -s -c -w -Wall ../../src/portaudio.c -D AL_LIBTYPE_STATIC -o temp/portaudio.o
gcc -s -c -w -Wall ../../src/coreaudio.c -D AL_LIBTYPE_STATIC -o temp/coreaudio.o
gcc -s -c -w -Wall ../../src/opensl.c -D AL_LIBTYPE_STATIC -o temp/opensl.o
clang -s -c -w -Wall ../../src/solaris.c -D AL_LIBTYPE_STATIC -o temp/solaris.o
clang -s -c -w -Wall ../../src/sndio.c -D AL_LIBTYPE_STATIC -o temp/sndio.o
clang -s -c -w -Wall ../../src/portaudio.c -D AL_LIBTYPE_STATIC -o temp/portaudio.o
clang -s -c -w -Wall ../../src/coreaudio.c -D AL_LIBTYPE_STATIC -o temp/coreaudio.o
clang -s -c -w -Wall ../../src/opensl.c -D AL_LIBTYPE_STATIC -o temp/opensl.o
####These are Windows specific####
gcc -s -c -w -Wall ../../src/dsound.c -D AL_LIBTYPE_STATIC -o temp/dsound.o
gcc -s -c -w -Wall ../../src/mmdevapi.c -D AL_LIBTYPE_STATIC -o temp/mmdevapi.o
gcc -s -c -w -Wall ../../src/winmm.c -D AL_LIBTYPE_STATIC -o temp/winmm.o
clang -s -c -w -Wall ../../src/dsound.c -D AL_LIBTYPE_STATIC -o temp/dsound.o
clang -s -c -w -Wall ../../src/mmdevapi.c -D AL_LIBTYPE_STATIC -o temp/mmdevapi.o
clang -s -c -w -Wall ../../src/winmm.c -D AL_LIBTYPE_STATIC -o temp/winmm.o

View file

@ -1,6 +1,6 @@
cd "$(dirname "$0")"
gcc -s -c -w -Wall ../../src/Gamepad_macosx.c -o temp/Gamepad_macosx.o
gcc -s -c -w -Wall ../../src/Gamepad_private.c -o temp/Gamepad_private.o
clang -s -c -w -Wall ../../src/Gamepad_macosx.c -o temp/Gamepad_macosx.o
clang -s -c -w -Wall ../../src/Gamepad_private.c -o temp/Gamepad_private.o
ar rcs src.a temp/Gamepad_private.o temp/Gamepad_macosx.o
echo "Press any key to continue..."
Pause()

View file

@ -1,5 +1,5 @@
cd "$(dirname "$0")"
g++ -s -c -w -Wall ../../src/freetypeamalgam.c -o src.o
clang++ -s -c -w -Wall ../../src/freetypeamalgam.c -o src.o
echo "Press any key to continue..."
Pause()
{

View file

@ -1,2 +1,2 @@
cd "$(dirname "$0")"
g++ -s -c -w -Wall ../../src/freetypeamalgam.c -o src.o
clang++ -s -c -w -Wall ../../src/freetypeamalgam.c -o src.o

View file

@ -1,32 +1,32 @@
cd "$(dirname "$0")"
rm libqb/os/win/*.o
rm libqb/os/lnx/*.o
rm libqb/os/osx/*.o
rm parts/core/os/win/src.a
rm parts/core/os/lnx/src.a
rm parts/core/os/osx/src.a
rm parts/core/os/win/temp/*.o
rm parts/core/os/lnx/temp/*.o
rm parts/core/os/osx/temp/*.o
rm parts/audio/decode/mp3/os/win/src.a
rm parts/audio/decode/mp3/os/lnx/src.a
rm parts/audio/decode/mp3/os/osx/src.a
rm parts/audio/decode/mp3/os/win/temp/*.o
rm parts/audio/decode/mp3/os/lnx/temp/*.o
rm parts/audio/decode/mp3/os/osx/temp/*.o
rm parts/audio/decode/ogg/os/win/src.o
rm parts/audio/decode/ogg/os/lnx/src.o
rm parts/audio/decode/ogg/os/osx/src.o
rm parts/audio/decode/ogg/os/win/temp/*.o
rm parts/audio/decode/ogg/os/lnx/temp/*.o
rm parts/audio/decode/ogg/os/osx/temp/*.o
rm parts/audio/conversion/os/win/src.a
rm parts/audio/conversion/os/lnx/src.a
rm parts/audio/conversion/os/osx/src.a
rm parts/audio/conversion/os/win/temp/*.o
rm parts/audio/conversion/os/lnx/temp/*.o
rm parts/audio/conversion/os/osx/temp/*.o
rm parts/audio/out/os/win/src.a
rm parts/audio/out/os/lnx/src.a
rm parts/audio/out/os/osx/src.a
rm parts/audio/out/os/win/temp/*.o
rm parts/audio/out/os/lnx/temp/*.o
rm parts/audio/out/os/osx/temp/*.o
rm parts/video/font/ttf/os/win/src.o
rm parts/video/font/ttf/os/lnx/src.o
rm parts/video/font/ttf/os/osx/src.o

View file

@ -1,5 +1,5 @@
cd "$(dirname "$0")"
./qb64 &
osascript -e 'tell application "Terminal" to close (every window whose name contains "qb64_start_osx.command")' &
osascript -e 'tell application "Terminal" to close (every window whose name contains "qb64_start_macos.command")' &
osascript -e 'if (count the windows of application "Terminal") is 0 then tell application "Terminal" to quit' &
exit

View file

@ -14,8 +14,8 @@ find . -type f -iname "*.a" -exec rm -f {} \;
find . -type f -iname "*.o" -exec rm -f {} \;
rm ./internal/temp/*
if [ -z "$(which g++)" ]; then
echo "GNU C++ compiler not detected (g++)"
if [ -z "$(which clang++)" ]; then
echo "Apple's C++ compiler not found."
echo "Attempting to install Apple's Command Line Tools for Xcode..."
echo "After installation is finished, run this setup script again."
xcode-select --install
@ -48,7 +48,7 @@ popd >/dev/null
echo "Building 'QB64' (~3 min)"
cp ./internal/source/* ./internal/temp/
pushd internal/c >/dev/null
g++ -w qbx.cpp libqb/os/osx/libqb_setup.o parts/video/font/ttf/os/osx/src.o -framework GLUT -framework OpenGL -framework Cocoa -o ../../qb64
clang++ -w qbx.cpp libqb/os/osx/libqb_setup.o parts/video/font/ttf/os/osx/src.o -framework GLUT -framework OpenGL -framework Cocoa -o ../../qb64
popd >/dev/null
echo ""