build: Fixed build dependencies
Signed-off-by: Max Logaev <maxlogaev@proton.me>
This commit is contained in:
@@ -7,7 +7,7 @@ include(ExternalProject)
|
||||
# Number of threads for build
|
||||
set(JOBS 6)
|
||||
|
||||
# Installation directory for GCC and Binutils"
|
||||
# Installation directory for GCC and Binutils
|
||||
if(NOT DEFINED ENV{SDK_TOOLCHAIN_DIR})
|
||||
message(FATAL_ERROR "The environment variable SDK_TOOLCHAIN_DIR is not set!")
|
||||
endif()
|
||||
@@ -16,7 +16,7 @@ set(SDK_TOOLCHAIN_DIR $ENV{SDK_TOOLCHAIN_DIR})
|
||||
|
||||
message(STATUS "SDK_TOOLCHAIN_DIR=${SDK_TOOLCHAIN_DIR}")
|
||||
|
||||
# Directory for installing ports"
|
||||
# Directory for installing ports
|
||||
if(NOT DEFINED ENV{SDK_SYSROOT_DIR})
|
||||
message(FATAL_ERROR "The environment variable SDK_SYSROOT_DIR is not set!")
|
||||
endif()
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# Rules for building libraries
|
||||
|
||||
# Copy NewLib headers to sysroot dir
|
||||
add_custom_target(copy-newlib-headers
|
||||
COMMAND
|
||||
add_custom_target(newlib-headers
|
||||
COMMAND
|
||||
${CMAKE_COMMAND} -E copy_directory
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/newlib/libc/include"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/newlib/libc/include"
|
||||
"${SDK_SYSROOT_DIR}/include"
|
||||
COMMENT "Copying all Newlib headers to ${SDK_SYSROOT_DIR}/include"
|
||||
)
|
||||
@@ -12,9 +12,11 @@ add_custom_target(copy-newlib-headers
|
||||
# Pseudo libc (kos-crt-stub)
|
||||
ExternalProject_Add(
|
||||
kos-crt-stub
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/kos-crt-stub
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/kos-crt-stub
|
||||
CMAKE_ARGS
|
||||
-DCMAKE_C_COMPILER=i586-kolibrios-gcc
|
||||
-DCMAKE_C_COMPILER_WORKS=1
|
||||
-DCMAKE_INSTALL_PREFIX=${SDK_SYSROOT_DIR}
|
||||
BUILD_ALWAYS TRUE
|
||||
DEPENDS gcc
|
||||
)
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
# Rules for building tests
|
||||
|
||||
# Pseudo libc (kos-crt-stub)
|
||||
ExternalProject_Add(
|
||||
test-hello
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/hello
|
||||
CMAKE_ARGS
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/hello
|
||||
CMAKE_ARGS
|
||||
-DCMAKE_C_COMPILER=i586-kolibrios-gcc
|
||||
-DCMAKE_C_COMPILER_WORKS=1
|
||||
-DCMAKE_INSTALL_PREFIX=${SDK_SYSROOT_DIR}
|
||||
BUILD_ALWAYS TRUE
|
||||
DEPENDS
|
||||
gcc
|
||||
kos-crt-stub
|
||||
)
|
||||
|
||||
@@ -2,4 +2,4 @@ cmake_minimum_required(VERSION 3.31)
|
||||
|
||||
project(hello)
|
||||
add_executable(hello hello.c)
|
||||
install(TARGETS hello DESTINATION bin)
|
||||
install(TARGETS hello DESTINATION tests)
|
||||
|
||||
@@ -36,24 +36,17 @@ ExternalProject_Add(
|
||||
--disable-nls
|
||||
--enable-shared
|
||||
--enable-languages=c
|
||||
BUILD_COMMAND
|
||||
BUILD_COMMAND
|
||||
make -j${JOBS} all-gcc all-target-libgcc
|
||||
INSTALL_COMMAND
|
||||
make install-strip-gcc install-target-libgcc
|
||||
DEPENDS
|
||||
binutils
|
||||
DEPENDS binutils
|
||||
)
|
||||
|
||||
add_dependencies(gcc copy-newlib-headers)
|
||||
add_dependencies(gcc newlib-headers)
|
||||
|
||||
# Copy kos-app.lds
|
||||
add_custom_target(copy-kos-app-lds
|
||||
COMMAND
|
||||
${CMAKE_COMMAND} -E copy
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/kos-app.lds"
|
||||
"${SDK_TOOLCHAIN_DIR}/i586-kolibrios/lib/"
|
||||
file(
|
||||
COPY "${CMAKE_CURRENT_SOURCE_DIR}/kos-app.lds"
|
||||
DESTINATION "${SDK_TOOLCHAIN_DIR}/i586-kolibrios/lib/"
|
||||
)
|
||||
|
||||
# Toolchain
|
||||
add_custom_target(toolchain)
|
||||
add_dependencies(toolchain gcc copy-kos-app-lds kos-crt-stub)
|
||||
|
||||
Reference in New Issue
Block a user