Skip to content

Commit

Permalink
Added fix for simlifying running cmake from build.sh
Browse files Browse the repository at this point in the history
Signed-off-by: Oleksandr Ismailov <[email protected]>
  • Loading branch information
alexismailov2 committed Apr 25, 2024
1 parent 1892a9b commit 4cd48c2
Showing 1 changed file with 51 additions and 48 deletions.
99 changes: 51 additions & 48 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,32 +83,33 @@ update_cpu_count() {
fi
}

build_tools() {
[ "$TOOLS_DONE" -eq 1 ] && return
cd $PROJ_PATH/tools

if [[ $MAKE_TOOL == "cmake" ]]; then
mkdir -p build && cd build && cmake ..
TOOL_PATH=$PROJ_PATH/tools/build
fi

make -j $CPU_COUNT
cd $PROJ_PATH
TOOLS_DONE=1
}

build_examples() {
[ "$EXAMPLES_DONE" -eq 1 ] && return
cd $PROJ_PATH/examples

if [[ $MAKE_TOOL == "cmake" ]]; then
mkdir -p build && cd build && cmake ..
fi

make -j $CPU_COUNT
cd $PROJ_PATH
EXAMPLES_DONE=1
}
#build_tools() {
# [ "$TOOLS_DONE" -eq 1 ] && return
# cd $PROJ_PATH/tools
#
# if [[ $MAKE_TOOL == "cmake" ]]; then
# cmake -Bbuild #mkdir -p build && cd build && cmake ..
# TOOL_PATH=$PROJ_PATH/tools/build
# fi
#
# cmake --build build --target install
# #make -j $CPU_COUNT
# cd $PROJ_PATH
# TOOLS_DONE=1
#}

#build_examples() {
# [ "$EXAMPLES_DONE" -eq 1 ] && return
# cd $PROJ_PATH/examples
#
# if [[ $MAKE_TOOL == "cmake" ]]; then
# mkdir -p build && cd build && cmake ..
# fi
#
# make -j $CPU_COUNT
# cd $PROJ_PATH
# EXAMPLES_DONE=1
#}

build_library() {
cd $PROJ_PATH/misc
Expand All @@ -119,8 +120,9 @@ build_library() {
make -j $CPU_COUNT
LIB_PATH=$PROJ_PATH
elif [[ $MAKE_TOOL == "cmake" ]]; then
mkdir -p build && cd build
cmake .. && make -j $CPU_COUNT
cmake -Bbuild -DCMAKE_INSTALL_PREFIX=./install && cmake --build build --target install
#mkdir -p build && cd build
#cmake .. && make -j $CPU_COUNT
LIB_PATH=$PROJ_PATH/build
elif [[ $MAKE_TOOL == "smake" ]]; then
smake . && make -j $CPU_COUNT
Expand All @@ -134,18 +136,18 @@ build_library() {
cd $PROJ_PATH
}

install_tools() {
build_tools
cd $TOOL_PATH
sudo make install
cd $PROJ_PATH
}
#install_tools() {
# build_tools
# cd $TOOL_PATH
# sudo make install
# cd $PROJ_PATH
#}

install_library() {
cd $LIB_PATH
sudo make install
cd $PROJ_PATH
}
#install_library() {
# cd $LIB_PATH
# sudo make install
# cd $PROJ_PATH
#}

if [[ $USE_SSL == "yes" ]]; then
echo "Checking OpenSSL libraries."
Expand All @@ -171,17 +173,18 @@ clean_project
build_library

for arg in "$@"; do
if [[ $arg == "--examples" ]]; then
build_examples
fi

if [[ $arg == "--tools" ]]; then
build_tools
fi
# if [[ $arg == "--examples" ]]; then
# build_examples
# fi
#
# if [[ $arg == "--tools" ]]; then
# build_tools
# fi

if [[ $arg == "--install" ]]; then
install_library
install_tools
cmake -Bbuild -DCMAKE_INSTALL_PREFIX=./libxutils && cmake --build build --target install
#install_library
#install_tools
fi
done

Expand Down

0 comments on commit 4cd48c2

Please sign in to comment.