Skip to content

Commit

Permalink
build: put conan-generated Find<lib>.cmake files in a separate direct…
Browse files Browse the repository at this point in the history
…ory in build/ and split up into Debug and Release

Now the generated cmake files are put in build/Debug/generators/ and build/Release/generators/ respectively
  • Loading branch information
Taepper committed Oct 24, 2024
1 parent a4a8f1a commit 62deb14
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 22 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
name: Configure and run clang-tidy on changed files
run: |
mv /src/build .
cmake -DBUILD_WITH_CLANG_TIDY=on -D CMAKE_BUILD_TYPE=Debug -B build
cmake -DBUILD_WITH_CLANG_TIDY=on -D CMAKE_BUILD_TYPE=Debug -B build/Debug
echo "Successfully configured cmake"
files=""
PAGE=1
Expand All @@ -110,7 +110,7 @@ jobs:
echo "Check ending for file: $file"
if [[ $file == *.cpp ]]; then
echo "Now linting the file: $file"
echo "cmake --build build --target ${file%.cpp}.o"
cmake --build build --target ${file%.cpp}.o
echo "cmake --build build/Debug --target ${file%.cpp}.o"
cmake --build build/Debug --target ${file%.cpp}.o
fi
done
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
endif ()

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/build/")

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_BINARY_DIR}/generators/")

# ---------------------------------------------------------------------------
# Logging
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ COPY . ./

RUN \
python3 ./build_with_conan.py --release --parallel 4\
&& cp build/silo_test . \
&& cp build/siloApi .
&& cp build/Release/silo_test . \
&& cp build/Release/siloApi .


FROM ubuntu:22.04 AS server
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile_dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
mv conanprofile.docker conanprofile; \
fi

RUN conan install . --build=missing --profile ./conanprofile --profile:build ./conanprofile --output-folder=build
RUN conan install . --build=missing --profile ./conanprofile --profile:build ./conanprofile --output-folder=build/Release/generators
2 changes: 1 addition & 1 deletion Dockerfile_linter_dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
mv conanprofile.docker conanprofile; \
fi

RUN conan install . --build=missing --profile ./conanprofile --profile:build ./conanprofile --output-folder=build -s build_type=Debug
RUN conan install . --build=missing --profile ./conanprofile --profile:build ./conanprofile --output-folder=build/Debug/generators -s build_type=Debug
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ located in the corresponding source folder.
To run all tests, run

```shell
build/silo_test
build/Release/silo_test
```

For linting we use clang-tidy. The config is stored in `.clang-tidy`.
Expand Down
28 changes: 15 additions & 13 deletions build_with_conan.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,34 +18,36 @@ def run_cmd(context: str, cmd: str):
raise Exception(f"{context} command failed.")

def main(args):
build_folder = "build"

if args.clean:
print("----------------------------------")
print("cleaning build directory...")
print("----------------------------------")
clean_build_folder(build_folder)

os.makedirs(build_folder, exist_ok=True)

cmake_options = []
conan_options = []
if args.build_with_clang_tidy:
cmake_options.append("-D BUILD_WITH_CLANG_TIDY=ON")

if args.release:
build_folder = "build/Release"
cmake_options.append("-D CMAKE_BUILD_TYPE=Release")
conan_options.append("--output-folder=build/Release/generators")
else:
build_folder = "build/Debug"
cmake_options.append("-D CMAKE_BUILD_TYPE=Debug")
conan_options.append("-s build_type=Debug")
conan_options.append("--output-folder=build/Debug/generators")

if args.clean:
print("----------------------------------")
print(f"cleaning build directory {build_folder}")
print("----------------------------------")
clean_build_folder(build_folder)

os.makedirs(build_folder, exist_ok=True)

run_cmd("Conan install",
"conan install . --build=missing --profile ./conanprofile --profile:build ./conanprofile --output-folder=build " + " ".join(
"conan install . --build=missing --profile ./conanprofile --profile:build ./conanprofile " + " ".join(
conan_options))

run_cmd("CMake", "cmake " + " ".join(cmake_options) + " -B build")
run_cmd("CMake", "cmake " + " ".join(cmake_options) + f" -B {build_folder}")

run_cmd("CMake build", f"cmake --build build --parallel {args.parallel}")
run_cmd("CMake build", f"cmake --build {build_folder} --parallel {args.parallel}")


if __name__ == "__main__":
Expand Down

0 comments on commit 62deb14

Please sign in to comment.