diff --git a/builder b/builder index a4ec7aa..758f850 100755 --- a/builder +++ b/builder @@ -155,8 +155,8 @@ function popd_build() { function build-gen() { pushed_build info "Running: " - info "cmake -G Ninja ${CMAKEARGS[*]} ${CMAKEARGS_DEBUG[*]}" "$@" "$ME" - cmake -G Ninja "${CMAKEARGS[@]}" "${CMAKEARGS_DEBUG[@]}" "$@" "$ME" + info "cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE=$ME/cmake/toolchains/linux.cmake" "$ME" "${CMAKEARGS[*]} ${CMAKEARGS_DEBUG[*]}" "$@" + cmake -G Ninja "-DCMAKE_TOOLCHAIN_FILE=$ME/cmake/toolchains/linux.cmake" "$ME" "${CMAKEARGS[@]}" "${CMAKEARGS_DEBUG[@]}" "$@" popd_build } diff --git a/cmake/toolchains/linux.cmake b/cmake/toolchains/linux.cmake new file mode 100644 index 0000000..ec874f8 --- /dev/null +++ b/cmake/toolchains/linux.cmake @@ -0,0 +1,38 @@ +# Serene Programming Language +# +# Copyright (c) 2019-2023 Sameer Rahmani +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, version 2. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_PROCESSOR x86_64) + +set(triple x86_64-unknown-linux-gnu) + +set(CMAKE_C_COMPILER "${SERENE_TOOLCHAIN_PATH}/bin/clang") +set(CMAKE_C_COMPILER_TARGET ${triple}) + +set(CMAKE_CXX_COMPILER "${SERENE_TOOLCHAIN_PATH}/bin/clang++") +set(CMAKE_CXX_COMPILER_TARGET ${triple}) + +# where is the target environment located +set(CMAKE_FIND_ROOT_PATH "${SERENE_TOOLCHAIN_PATH}") + +# adjust the default behavior of the FIND_XXX() commands: +# search programs in the host environment +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) + +# search headers and libraries in the target environment +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + +message(">>>> ${CMAKE_C_COMPILER} -- ${SERENE_TOOLCHAIN_PATH}")