diff --git a/.gitignore b/.gitignore index 9cb5f02e..0b0d2ecf 100644 --- a/.gitignore +++ b/.gitignore @@ -122,4 +122,7 @@ docker/__pycache__ docker-compose.override.yml !*Test.bin -# !cmake/* Why was this directory excluded? + +# CMake scripts +!cmake/* +!cmake/toolchains/* diff --git a/cmake/toolchains/linux-clang.cmake b/cmake/toolchains/linux-clang.cmake new file mode 100644 index 00000000..abcd681c --- /dev/null +++ b/cmake/toolchains/linux-clang.cmake @@ -0,0 +1,14 @@ +# Try and find a clang-16 install, falling back to a generic clang install otherwise +find_program(CLANG_C_COMPILER clang-16 | clang REQUIRED) +find_program(CLANG_CXX_COMPILER clang++-16 | clang++ REQUIRED) + +# Debug messages +message("CLANG_C_COMPILER = ${CLANG_C_COMPILER}") +message("CLANG_CXX_COMPILER = ${CLANG_CXX_COMPILER}") + +# Set compilers to clang +set(CMAKE_C_COMPILER ${CLANG_C_COMPILER}) +set(CMAKE_CXX_COMPILER ${CLANG_CXX_COMPILER}) + +# Set linker to lld +add_link_options("-fuse-ld=lld") diff --git a/cmake/toolchains/linux-gcc.cmake b/cmake/toolchains/linux-gcc.cmake new file mode 100644 index 00000000..c4e0891b --- /dev/null +++ b/cmake/toolchains/linux-gcc.cmake @@ -0,0 +1,11 @@ +# Try and find a gcc/g++ install, falling back to a generic clang install otherwise +find_program(GNU_C_COMPILER gcc REQUIRED) +find_program(GNU_CXX_COMPILER g++ REQUIRED) + +# Debug messages +message("GNU_C_COMPILER = ${GNU_C_COMPILER}") +message("GNU_CXX_COMPILER = ${GNU_C_COMPILER}") + +# Set compilers to clang +set(CMAKE_C_COMPILER ${GNU_C_COMPILER}) +set(CMAKE_CXX_COMPILER ${GNU_CXX_COMPILER})