-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
42 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,54 @@ | ||
#!/bin/bash | ||
|
||
# Update the package list | ||
apt-get update | ||
apt update | ||
apt -y install make cmake git clang gcc | ||
|
||
# Make a dir for gtest installation | ||
mkdir /home/googletest | ||
mkdir /home/googletest/googletest | ||
mkdir /home/googletest/googletest_build | ||
|
||
cd /home/googletest/googletest_build | ||
# Install the libgtest-dev package | ||
apt-get install libgtest-dev -y | ||
|
||
sudo apt-get install check | ||
|
||
# Navigate to the gtest source directory | ||
cd /usr/src/googletest/googletest | ||
cd /home/googletest | ||
git clone https://github.com/google/googletest | ||
|
||
# Create a build directory and navigate to it | ||
mkdir build | ||
cd build | ||
|
||
# Run CMake to configure the build | ||
cmake .. | ||
|
||
# Build the Google Test library | ||
cd googletest_build | ||
cmake -DCMAKE_INSTALL_PREFIX:PATH=/home/googletest ../googletest | ||
make | ||
make install | ||
|
||
# Copy the generated library files to /usr/lib/ | ||
cp libgtest* /usr/lib/ | ||
|
||
# Return to the parent directory | ||
cd .. | ||
|
||
# Remove the build directory | ||
rm -rf build | ||
|
||
# Create the /usr/local/lib/googletest directory | ||
mkdir /usr/local/lib/googletest | ||
|
||
# Create symbolic links for libgtest.a and libgtest_main.a in /usr/local/lib/googletest | ||
ln -s /usr/lib/libgtest.a /usr/local/lib/googletest/libgtest.a | ||
ln -s /usr/lib/libgtest_main.a /usr/local/lib/googletest/libgtest_main.a | ||
|
||
# Print a message to indicate that the setup is complete | ||
# Install the libgtest-dev package | ||
#apt-get install libgtest-dev -y | ||
# | ||
#sudo apt-get install check | ||
# | ||
## Navigate to the gtest source directory | ||
#cd /usr/src/googletest/googletest | ||
# | ||
## Create a build directory and navigate to it | ||
#mkdir build | ||
#cd build | ||
# | ||
## Run CMake to configure the build | ||
#cmake .. | ||
# | ||
## Build the Google Test library | ||
#make | ||
# | ||
## Copy the generated library files to /usr/lib/ | ||
#cp libgtest* /usr/lib/ | ||
# | ||
## Return to the parent directory | ||
#cd .. | ||
# | ||
## Remove the build directory | ||
#rm -rf build | ||
# | ||
## Create the /usr/local/lib/googletest directory | ||
#mkdir /usr/local/lib/googletest | ||
# | ||
## Create symbolic links for libgtest.a and libgtest_main.a in /usr/local/lib/googletest | ||
#ln -s /usr/lib/libgtest.a /usr/local/lib/googletest/libgtest.a | ||
#ln -s /usr/lib/libgtest_main.a /usr/local/lib/googletest/libgtest_main.a | ||
# | ||
## Print a message to indicate that the setup is complete | ||
echo "Google Test (gtest) setup is complete." |