-
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
5 changed files
with
169 additions
and
4 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 |
---|---|---|
|
@@ -22,3 +22,7 @@ build/** | |
linuxbuild/ | ||
build/ | ||
.idea/ | ||
winbuild/ | ||
|
||
!Compile.sh | ||
!Compile.bat |
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 |
---|---|---|
@@ -0,0 +1,68 @@ | ||
@echo off | ||
setlocal enabledelayedexpansion | ||
|
||
REM Clear the screen | ||
cls | ||
|
||
REM Define the color codes | ||
set GREEN= | ||
set NC= | ||
|
||
REM Prompt the user to choose a compiler | ||
echo %GREEN%Select the compiler to use:%NC% | ||
echo 1^ ) MSBuild (default) | ||
echo 2^ ) MinGW | ||
echo 3^ ) Ninja | ||
set /p choice=Enter the number of your choice: | ||
|
||
REM Set the generator and compiler based on the user's choice | ||
if "%choice%"=="2" ( | ||
set "GENERATOR=MinGW Makefiles" | ||
set "COMPILER_OPTION=-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++" | ||
) else if "%choice%"=="3" ( | ||
set "GENERATOR=Ninja" | ||
set "COMPILER_OPTION=" | ||
) else ( | ||
set "GENERATOR=Visual Studio 17 2022" | ||
set "COMPILER_OPTION=-A x64" | ||
set "choice=1" | ||
) | ||
|
||
echo Using generator: %GENERATOR% | ||
|
||
REM Prompt the user to choose a build type | ||
echo %GREEN%Select the build type:%NC% | ||
echo 1^ ) Release (default) | ||
echo 2^ ) Debug | ||
set /p build_choice=Enter the number of your choice: | ||
|
||
REM Set the build type based on the user's choice | ||
if "%build_choice%"=="2" ( | ||
set "BUILD_TYPE=Debug" | ||
) else ( | ||
set "BUILD_TYPE=Release" | ||
) | ||
|
||
echo Build type: %BUILD_TYPE% | ||
|
||
REM Create the build directory if it doesn't exist | ||
if not exist "winbuild" ( | ||
mkdir winbuild | ||
) | ||
|
||
cd winbuild | ||
|
||
REM Get the number of processors | ||
for /f "tokens=2 delims==" %%a in ('wmic cpu get NumberOfLogicalProcessors /value') do set "NUM_PROCESSORS=%%a" | ||
|
||
REM Run CMake with the selected generator and build type | ||
cmake -G "%GENERATOR%" %COMPILER_OPTION% -DCMAKE_BUILD_TYPE=%BUILD_TYPE% .. | ||
|
||
REM Build the project | ||
if "%choice%"=="1" ( | ||
cmake --build . --config %BUILD_TYPE% -- /m:%NUM_PROCESSORS% | ||
) else ( | ||
cmake --build . --config %BUILD_TYPE% -- -j %NUM_PROCESSORS% | ||
) | ||
|
||
cd .. |
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 |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
clear | ||
|
||
# Define the color codes | ||
GREEN='\033[0;32m' | ||
NC='\033[0m' # No Color | ||
|
||
# Prompt the user to choose a compiler | ||
echo "${GREEN}Select the compiler to use:${NC}" | ||
echo "1) g++ (default)" | ||
echo "2) clang++" | ||
echo "3) clang++ 15" | ||
echo "4) clang++ 16" | ||
read -p "Enter the number of your choice: " choice | ||
|
||
# Set the compiler based on the user's choice | ||
case $choice in | ||
2) | ||
C_COMPILER=clang | ||
CXX_COMPILER=clang++ | ||
;; | ||
3) | ||
C_COMPILER=clang-15 | ||
CXX_COMPILER=clang++-15 | ||
;; | ||
4) | ||
C_COMPILER=clang-16 | ||
CXX_COMPILER=clang++-16 | ||
;; | ||
*) | ||
C_COMPILER=gcc | ||
CXX_COMPILER=g++ | ||
;; | ||
esac | ||
|
||
echo "Using C compiler: $C_COMPILER" | ||
echo "Using C++ compiler: $CXX_COMPILER" | ||
|
||
# Prompt the user to choose a build type | ||
echo "${GREEN}Select the build type:${NC}" | ||
echo "1) Release (default)" | ||
echo "2) Debug" | ||
read -p "Enter the number of your choice: " build_choice | ||
|
||
# Set the build type based on the user's choice | ||
case $build_choice in | ||
2) | ||
BUILD_TYPE=Debug | ||
;; | ||
*) | ||
BUILD_TYPE=Release | ||
;; | ||
esac | ||
|
||
echo "Build type: $BUILD_TYPE" | ||
|
||
# Create the build directory if it doesn't exist | ||
if [ ! -d "linuxbuild" ]; then | ||
mkdir linuxbuild | ||
fi | ||
|
||
cd linuxbuild | ||
|
||
# Run CMake with the selected compiler and build type | ||
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_C_COMPILER=$C_COMPILER -DCMAKE_CXX_COMPILER=$CXX_COMPILER .. | ||
|
||
# Build the project | ||
cmake --build . --config $BUILD_TYPE --clean-first -j 15 --verbose | ||
|
||
cd .. |
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
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