Skip to content

Commit

Permalink
Cmake update (#166)
Browse files Browse the repository at this point in the history
* * Adding option to cmake.sh for g++

* * Update cmake.sh to only ldconfig if not MAC

* * Updated cmake.sh script to parallelize properly on Mac and Linux
* Moved cmake.sh script to scripts directory instead of scripts/linux since it covers both mac and linux
  • Loading branch information
jredmondson committed Jan 1, 2024
1 parent 155a109 commit 64d8d37
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions scripts/linux/cmake.sh → scripts/cmake.sh
Expand Up @@ -12,6 +12,7 @@ SSL='OFF'
CLEAN=0
PREREQS=0
MAC=0
PROCESSES=1

echo "Parsing args..."
for var in "$@"
Expand Down Expand Up @@ -48,6 +49,7 @@ do
echo " clang build using clang++ and clang"
echo " clean run 'make clean' before builds (default)"
echo " docs generate API documentation"
echo " mac build for MacOS (needs to be native/host OS)"
echo " gcc use gcc/g++"
echo " tests build test executables"
echo " ssl build with SSL support"
Expand All @@ -57,6 +59,12 @@ do
done


if [ $MAC -eq 1 ]; then
PROCESSES=$(sysctl -n hw.ncpu)
else
PROCESSES=$(nproc)
fi

echo SCRIPT_PATH=$SCRIPT_PATH
echo MADARA_PATH=$MADARA_PATH

Expand Down Expand Up @@ -90,10 +98,11 @@ if [ $PREREQS -eq 1 ]; then
fi
fi

echo "Building with $PROCESSES threads..."
echo cmake -DCMAKE_CXX_COMPILER=${CPP_COMPILER} -DCMAKE_C_COMPILER=${C_COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -Dmadara_TESTS=${TESTS} -Dmadara_SSL=${SSL} -D'CMAKE_INSTALL_PREFIX=/usr/local' -DCMAKE_PREFIX_PATH=$MADARA_PATH/install ..
cmake -D'CMAKE_INSTALL_PREFIX=/usr/local' -Dmadara_TESTS=$TESTS -Dmadara_SSL=$SSL -DCMAKE_PREFIX_PATH=$MADARA_PATH/install -DCMAKE_CXX_COMPILER=$CPP_COMPILER -DCMAKE_C_COMPILER=$C_COMPILER -DCMAKE_BUILD_TYPE=$BUILD_TYPE ..
cmake --build . --config debug -j$(nproc)
cmake --build . --config release
cmake --build . --config debug -j $PROCESSES
cmake --build . --config release -j $PROCESSES
sudo cmake --build . --target install --config release
sudo cmake --build . --target install --config debug

Expand Down

0 comments on commit 64d8d37

Please sign in to comment.