Skip to content

Commit

Permalink
rename build directory to tools
Browse files Browse the repository at this point in the history
  • Loading branch information
KRM7 committed Dec 30, 2023
1 parent 0bd126d commit 8af565f
Show file tree
Hide file tree
Showing 31 changed files with 46 additions and 52 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: setup-catch
env:
CXX: ${{ matrix.compiler.cxx }}
run: sudo bash ./install_catch.sh
run: sudo bash ../tools/install_catch.sh

- name: setup-build
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
run: brew update && brew install ${{ matrix.compiler.pkgs }}

- name: setup-catch
run: sudo bash ./install_catch.sh -DCMAKE_CXX_COMPILER=${{ matrix.compiler.cxx }} -DCMAKE_CXX_FLAGS="${{ matrix.compiler.extra-flags }}" -DCMAKE_EXE_LINKER_FLAGS="${{ matrix.compiler.linker-flags }}"
run: sudo bash ../tools/install_catch.sh -DCMAKE_CXX_COMPILER=${{ matrix.compiler.cxx }} -DCMAKE_CXX_FLAGS="${{ matrix.compiler.extra-flags }}" -DCMAKE_EXE_LINKER_FLAGS="${{ matrix.compiler.linker-flags }}"

- name: setup-build
run: cmake .. -DCMAKE_CXX_COMPILER=${{ matrix.compiler.cxx }} -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DGAPP_CXX_FLAGS="${{ matrix.compiler.extra-flags }}" -DCMAKE_EXE_LINKER_FLAGS="${{ matrix.compiler.linker-flags }}" -DGAPP_USE_WERROR=ON
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sanitizers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: setup-catch
env:
CXX: ${{ matrix.cxx }}
run: sudo bash ./install_catch.sh
run: sudo bash ../tools/install_catch.sh

- name: setup-build
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
CMAKE_GENERATOR: ${{ matrix.generator }}
CMAKE_GENERATOR_TOOLSET: ${{ matrix.compiler }}
CMAKE_GENERATOR_PLATFORM: ${{ matrix.platform }}
run: bash ./install_catch.sh
run: bash ../tools/install_catch.sh

- name: setup-build
env:
Expand Down
16 changes: 3 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,9 @@
*.hint

# Build results
[Dd]ebug/
[Rr]elease/
x64/
x86/
out/
build/*
!build/*.sh
!build/reflines/
!build/mo_results/
build/mo_results/*.txt
build/
install/
*.exe

# Doc outputs
Expand All @@ -26,7 +19,4 @@ docs/*.txt
refs/

# Test results
test/mo_results/*.txt

# Python
__pycache__/
tools/mo_results/*.txt
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ listed above, the steps for installing the library in Release config are:

```shell
git clone https://github.com/KRM7/gapp.git --branch v0.2.0
cd gapp/build
mkdir -p gapp/build && cd gapp/build
cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF
cmake --build . --config Release
sudo cmake --install . --config Release
Expand All @@ -74,7 +74,7 @@ will install all available configurations:

```shell
git clone https://github.com/KRM7/gapp.git --branch v0.2.0
sudo bash ./gapp/build/install.sh
sudo bash ./gapp/tools/install.sh
```

Once the library is installed, you can import it using `find_package` and then link
Expand Down
26 changes: 0 additions & 26 deletions build/install_catch.sh

This file was deleted.

6 changes: 3 additions & 3 deletions docs/install-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ The library uses CMake as its build system, which can also be used to install it
# Clone the repository
git clone https://github.com/KRM7/gapp.git --branch v0.2.0
# Go to the library's build directory
cd gapp/build
mkdir -p gapp/build && cd gapp/build
# Configure cmake with the relevant options
cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF
# Build the library
Expand All @@ -60,15 +60,15 @@ install the library in fewer steps:

```shell
git clone https://github.com/KRM7/gapp.git --branch v0.2.0
sudo bash gapp/build/install.sh
sudo bash gapp/tools/install.sh
```

The script will perform the installation steps detailed above for all 3 configurations of the library.
If you want to configure CMake differently from the default, you can pass arguments to the
install script as you would do to CMake, for example:

```shell
sudo bash gapp/build/install.sh -DBUILD_TESTING=ON
sudo bash gapp/tools/install.sh -DBUILD_TESTING=ON
```

### Install location
Expand Down
6 changes: 3 additions & 3 deletions test/integration/benchmark_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ auto invoke_timed(F&& f, Args&&... args)
auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(tend - tbegin).count();
double time_spent = duration / 1000.0;

return std::make_pair(result, time_spent);
return std::make_pair(std::move(result), time_spent);
}

template<typename T>
Expand Down Expand Up @@ -93,8 +93,8 @@ void benchmarkMoga(GA<T>& ga, size_t max_gen, const std::string& ga_name, F fitn
<< "\nTime taken: " << std::fixed << time_spent << "s\n\n";

std::string name = problem.substr(0, problem.find(','));
std::string pop_file = "mo_results/" + ga_name + "_" + name + "_last.txt";
std::string sol_file = "mo_results/" + ga_name + "_" + name + "_sols.txt";
std::string pop_file = "../tools/mo_results/" + ga_name + "_" + name + "_last.txt";
std::string sol_file = "../tools/mo_results/" + ga_name + "_" + name + "_sols.txt";

std::ofstream flast(pop_file);
std::ofstream fsols(sol_file);
Expand Down
3 changes: 2 additions & 1 deletion build/install.sh → tools/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ echo -e "Installing gapp...\n"

cmake --version

BUILD_DIR=$(dirname $(realpath "$0"))
BUILD_DIR=$(dirname $(realpath "$0"))/../build
echo -e "\nThe build directory is ${BUILD_DIR}.\n"
mkdir -p $BUILD_DIR

echo -e "Installing Debug configuration.\n"
cmake -S $BUILD_DIR/.. -B $BUILD_DIR -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=OFF "$@"
Expand Down
29 changes: 29 additions & 0 deletions tools/install_catch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

echo -e "Installing Catch2...\n"

cmake --version

BUILD_DIR=$(dirname $(realpath "$0"))/../build
echo -e "\nThe build directory is ${BUILD_DIR}.\n"
mkdir -p $BUILD_DIR

git clone -b v3.3.0 https://github.com/catchorg/Catch2.git $BUILD_DIR/Catch2
CATCH_BUILD_DIR=$BUILD_DIR/Catch2/build
echo -e "\nThe Catch build directory is ${CATCH_BUILD_DIR}.\n"
mkdir -p $CATCH_BUILD_DIR

echo -e "Installing Debug configuration.\n"
cmake -S $CATCH_BUILD_DIR/.. -B $CATCH_BUILD_DIR -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=OFF "$@"
cmake --build $CATCH_BUILD_DIR --config Debug --parallel
cmake --install $CATCH_BUILD_DIR --config Debug

echo -e "Installing RelWithDebInfo configuration.\n"
cmake -S $CATCH_BUILD_DIR/.. -B $CATCH_BUILD_DIR -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TESTING=OFF "$@"
cmake --build $CATCH_BUILD_DIR --config RelWithDebInfo --parallel
cmake --install $CATCH_BUILD_DIR --config RelWithDebInfo

echo -e "Installing Release configuration.\n"
cmake -S $CATCH_BUILD_DIR/.. -B $CATCH_BUILD_DIR -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF "$@"
cmake --build $CATCH_BUILD_DIR --config Release --parallel
cmake --install $CATCH_BUILD_DIR --config Release
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 8af565f

Please sign in to comment.