From 2ef93a3c0712c4e4d2dbb84ae8fa65b29b2b905b Mon Sep 17 00:00:00 2001 From: Brian Gianforcaro Date: Tue, 27 Apr 2021 00:25:02 -0700 Subject: [PATCH] Build: Use variables when concatenating Toolchain paths. Make this stuff a bit easier to maintain by using the root level variables to build up the Toolchain paths. Also leave a note for future editors of BuildIt.sh to give them warning about the other changes they'll need to make. --- CMakeLists.txt | 5 ++++- Kernel/CMakeLists.txt | 10 +++++----- Toolchain/BuildIt.sh | 2 ++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d9e1907af01520..14faf9ce4a7225 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -113,8 +113,11 @@ set(CMAKE_INSTALL_DATAROOTDIR ${CMAKE_BINARY_DIR}/Root/res) if (${CMAKE_HOST_SYSTEM_NAME} MATCHES SerenityOS) message("Good job on building cmake!") + set(GCC_VERSION 10.2.0) else() - set(TOOLCHAIN_PATH ${CMAKE_SOURCE_DIR}/Toolchain/Local/${SERENITY_ARCH}/bin) + set(GCC_VERSION 10.3.0) + set(TOOLCHAIN_ROOT ${CMAKE_SOURCE_DIR}/Toolchain/Local/${SERENITY_ARCH}/) + set(TOOLCHAIN_PATH ${TOOLCHAIN_ROOT}/bin) set(TOOLCHAIN_PREFIX ${TOOLCHAIN_PATH}/${SERENITY_ARCH}-pc-serenity-) set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}gcc) diff --git a/Kernel/CMakeLists.txt b/Kernel/CMakeLists.txt index 3b9e4311ef3704..2445bf11112332 100644 --- a/Kernel/CMakeLists.txt +++ b/Kernel/CMakeLists.txt @@ -349,12 +349,12 @@ add_library(kernel_heap STATIC ${KERNEL_HEAP_SOURCES}) file(GENERATE OUTPUT linker.ld INPUT linker.ld) if (${CMAKE_HOST_SYSTEM_NAME} MATCHES SerenityOS) - include_directories(/usr/local/include/c++/10.2.0/) + include_directories(/usr/local/include/c++/${GCC_VERSION}/) else() - include_directories(../Toolchain/Local/${SERENITY_ARCH}/Kernel/${SERENITY_ARCH}-pc-serenity/include/c++/10.3.0/) - include_directories(../Toolchain/Local/${SERENITY_ARCH}/Kernel/${SERENITY_ARCH}-pc-serenity/include/c++/10.3.0/${SERENITY_ARCH}-pc-serenity/) - link_directories(../Toolchain/Local/${SERENITY_ARCH}/Kernel/${SERENITY_ARCH}-pc-serenity/lib) - link_directories(../Toolchain/Local/${SERENITY_ARCH}/Kernel/lib/gcc/${SERENITY_ARCH}-pc-serenity/10.3.0/) + include_directories(${TOOLCHAIN_ROOT}/Kernel/${SERENITY_ARCH}-pc-serenity/include/c++/${GCC_VERSION}/) + include_directories(${TOOLCHAIN_ROOT}/Kernel/${SERENITY_ARCH}-pc-serenity/include/c++/${GCC_VERSION}/${SERENITY_ARCH}-pc-serenity/) + link_directories(${TOOLCHAIN_ROOT}/Kernel/${SERENITY_ARCH}-pc-serenity/lib) + link_directories(${TOOLCHAIN_ROOT}/Kernel/lib/gcc/${SERENITY_ARCH}-pc-serenity/${GCC_VERSION}/) endif() add_executable(Kernel ${SOURCES}) diff --git a/Toolchain/BuildIt.sh b/Toolchain/BuildIt.sh index 68069a3c1752dd..fa7a52be65f251 100755 --- a/Toolchain/BuildIt.sh +++ b/Toolchain/BuildIt.sh @@ -77,6 +77,8 @@ BINUTILS_NAME="binutils-$BINUTILS_VERSION" BINUTILS_PKG="${BINUTILS_NAME}.tar.gz" BINUTILS_BASE_URL="http://ftp.gnu.org/gnu/binutils" +# Note: If you bump the gcc version, you also have to update the matching +# GCC_VERSION variable in the project's root CMakeLists.txt GCC_VERSION="10.3.0" GCC_MD5SUM="87910940d70e845f2bf1a57997b6220c" GCC_NAME="gcc-$GCC_VERSION"