Skip to content

Commit

Permalink
Merge pull request #43 from RyanVreeke/master
Browse files Browse the repository at this point in the history
Updating Main Calvin-CS/TSGL from RyanVreeke/TSGL
  • Loading branch information
RyanVreeke authored Jul 21, 2021
2 parents 3c5e622 + 48ad015 commit 3d60020
Show file tree
Hide file tree
Showing 479 changed files with 6,977 additions and 16,506 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
[submodule "docs"]
path = docs
url = git@github.com:Calvin-CS/TSGL.git
branch = gh-pages
branch = master
Binary file modified MacBinInstaller/TSGL.dmg
Binary file not shown.
92 changes: 76 additions & 16 deletions install-mac → MacBinInstaller/install-mac
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ fi
if [ $(has brew) = 0 ]; then
echo "Installing Homebrew..."
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
export PATH=/usr/local/bin:$PATH
export PATH=/usr/bin:$PATH
else
echo "Homebrew detected."
export PATH=/usr/local/bin:$PATH
export PATH=/usr/bin:$PATH
fi

echo
Expand Down Expand Up @@ -70,6 +70,40 @@ brew install doxygen
echo "Installing cxxopts..."
brew install cxxopts

#glm
echo "Installing glm..."
brew install glm

####################################################################################

#redefine path variable and append to bashrc
tsglFile=/usr/local/lib/libtsgl.so

if [ -f "$tsglFile" ]
then
echo ""
echo "export PATH=/usr/local/bin:$PATH" >> ~/.bashrc
echo "export TSGL_HOME=/usr/local" >> ~/.bashrc
echo "export TSGL_DEFAULT_FONT=/include/TSGL/assets/freefont/FreeSansBold.ttf" >> ~/.bashrc

source ~/.profile
else
echo ""
fi

source ~/.profile
#change the call for assets and LFLAG directory
#cd src/examples
#grep -rli '/usr/include/TSGL/assets' * | xargs perl -i -pe's|/usr/include/TSGL/assets|/usr/local/include/TSGL/assets|g'

#grep -rli 'L/usr/lib' * | xargs perl -pi -e 's|L/usr/lib|L/usr/local/lib|g'
#cd -

#move stb to /usr/local/include
#sudo cp -r stb /usr/local/include

####################################################################################

#g++
gVers=$(g++ -v 2>&1)
gVeres=$(g++ -v 2>&1 | grep "gcc version" | cut -f 3 -d ' ' | tr -d .)
Expand All @@ -79,30 +113,33 @@ echo "$gVers" | grep "clang" > check.txt
version=490

#First, check if we need to move an existing g++ compiler
if [ -e /usr/local/bin/g++ ] && [ ! -e /usr/local/Cellar/gcc49 ];
if [ -e /usr/bin/g++ ] && [ ! -e /usr/Cellar/gcc49 ];
then
sudo mv /usr/local/bin/g++ /usr/local/bin/g++old
sudo mv /usr/local/bin/gcc /usr/local/bin/gccold

echo ""
#sudo mv /usr/bin/g++ /usr/bin/g++old
#sudo mv /usr/bin/gcc /usr/bin/gccold
fi

#Now check if we need to install gcc10
if grep --quiet clang check.txt; then
echo "Installing g++...this may take a while!"
brew install gcc
sudo rm /usr/local/bin/gcc
sudo rm /usr/local/bin/g++
sudo ln -s /usr/local/Cellar/gcc/10.2.0/bin/gcc-10 /usr/local/bin/gcc
sudo ln -s /usr/local/Cellar/gcc/10.2.0/bin/g++-10 /usr/local/bin/g++
#sudo rm /usr/bin/gcc
#sudo rm /usr/bin/g++
#sudo ln -s /usr/Cellar/gcc/10.2.0/bin/gcc-10 /usr/bin/gcc
#sudo ln -s /usr/Cellar/gcc/10.2.0/bin/g++-10 /usr/bin/g++
else
echo "Installing g++...this may take a while!"
brew install gcc
sudo rm /usr/local/bin/gcc
sudo rm /usr/local/bin/g++
sudo ln -s /usr/local/Cellar/gcc/10.2.0/bin/gcc-10 /usr/local/bin/gcc
sudo ln -s /usr/local/Cellar/gcc/10.2.0/bin/g++-10 /usr/local/bin/g++
#sudo rm /usr/bin/gcc
#sudo rm /usr/bin/g++
#sudo ln -s /usr/Cellar/gcc/10.2.0/bin/gcc-10 /usr/bin/gcc
#sudo ln -s /usr/Cellar/gcc/10.2.0/bin/g++-10 /usr/bin/g++
fi

#delete check.txt
rm check.txt

#Symlinks
echo "Fixing missing symlinks..."
if [ ! -e /usr/X11/lib/libX11.dylib ]; then
Expand All @@ -114,8 +151,8 @@ if [ ! -e /usr/X11/lib/libXrandr.dylib ]; then
fi

#Remove any broken symlinks before installing
sudo rm -f /usr/local/lib/libtsgl.*
sudo rm -rf /usr/local/include/TSGL
rm -f /usr/lib/libtsgl.*
rm -rf /usr/include/TSGL

#Build TSGL and install
echo "Building TSGL..."
Expand All @@ -131,4 +168,27 @@ sudo make install
echo

echo "Installation complete!"

echo
#checking update
echo "Checking for updates..."

TSGL_VERSION=$(git describe --tags --abbrev=0)
TSGL_LATEST_VERSION=$(git describe --tags $(git rev-list --tags --max-count=1))

if [ $TSGL_VERSION < $TSGL_LATEST_VERSION ]
then
echo ""
else
echo "Latest version $TSGL_LATEST_VERSION found. WARNING, If you have changed anything in the TSGL folder it may be overwritten during update. To keep your changes, please commit them before updating."
read -p "Do you want to install the update? This will replace all the files with the updated ones (y/n): " INPUT
if [ $INPUT == y ] || [ $INPUT == Y ]
then
echo "Updating TSGL..."
git remote add tsgl https://github.com/Calvin-CS/TSGL.git
git pull tsgl master
fi
echo "Latest version already installed"
fi

echo "Run \"./runtests\" to verify everything is working."
43 changes: 20 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ AR=ar
CC=g++
RM=rm -f
INSTALL=/usr/bin/install
PREFIX=/usr/local

SRC_PATH=src/TSGL/
TESTS_PATH=src/tests/
Expand Down Expand Up @@ -45,31 +44,18 @@ ifeq ($(UNAME), Darwin)
OS_EXTRA_LIB :=
OS_GL :=
OS_OMP := -fopenmp -lomp
OS_COMPILER := -std=c++0x
OS_COMPILER := -std=c++11
endif

CXXFLAGS=-O3 -g3 -ggdb3 \
-Wall -Wextra \
-D__GXX_EXPERIMENTAL_CXX0X__ \
-I/usr/local/include/Cellar/glfw3/3.3/include/ \
-I${SRC_PATH}/ \
-I/usr/include/ \
-I/usr/local/include/ \
-I/usr/local/include/freetype2 \
-I/usr/local/include/freetype2/freetype \
-I/opt/AMDAPP/include/ \
-I/usr/include/c++/4.6/ \
-I/usr/include/c++/4.6/x86_64-linux-gnu/ \
-I/usr/lib/gcc/x86_64-linux-gnu/9/include/ \
-I/usr/include/freetype2 \
-I/usr/include/freetype2/freetype \
-I./ \
$(OS_COMPILER) -fopenmp \
${NOWARN} -fpermissive
# -pedantic-errors
CXXFLAGS = -O3 -g3 -ggdb3 \
-I$(TSGL_HOME)/include \
-I${SRC_PATH} \
-Isrc \
-I$(TSGL_HOME)/include/freetype2 \

LFLAGS=-Llib/ \
-L/usr/local/lib \
-L/usr/lib \
-L$(TSGL_HOME)/lib \
${OS_EXTRA_LIB} \
-L/usr/X11/lib/ \
${OS_LDIRS} \
Expand Down Expand Up @@ -134,6 +120,9 @@ cleandocs:

# -include build/*.d


PREFIX=$(prefix)

#install
ifeq ($(UNAME), Linux)
install:
Expand All @@ -143,6 +132,9 @@ install:
install -m 0644 lib/libtsgl.a $(PREFIX)/lib
install -m 0755 lib/libtsgl.so $(PREFIX)/lib
cp -r src/TSGL $(PREFIX)/include
cp src/tsgl.h $(PREFIX)/include
cp -r assets/ $(PREFIX)/include/TSGL
cp -r src/stb/ $(PREFIX)/include
endif
ifeq ($(UNAME), CYGWIN_NT-10.0)
install:
Expand All @@ -152,6 +144,9 @@ install:
install -m 0644 lib/libtsgl.a $(PREFIX)/lib
install -m 0755 lib/libtsgl.dll $(PREFIX)/lib
cp -r src/TSGL $(PREFIX)/include
cp src/tsgl.h $(PREFIX)/include
cp -r assets/ $(PREFIX)/include/TSGL
cp -r src/stb/ $(PREFIX)/include
endif
ifeq ($(UNAME), Darwin)
install:
Expand All @@ -161,7 +156,9 @@ install:
install -m 0644 lib/libtsgl.a $(PREFIX)/lib
install -m 0755 lib/libtsgl.so $(PREFIX)/lib
cp -r src/TSGL $(PREFIX)/include
cp -r stb $(PREFIX)/include
cp src/tsgl.h $(PREFIX)/include
cp -r src/stb $(PREFIX)/include
cp -r assets $(PREFIX)/include/TSGL
endif

build/build: ${HEADERS} ${SOURCES} ${TESTS}
Expand Down
Loading

0 comments on commit 3d60020

Please sign in to comment.