BuildSystem: Cleanup cmake files

This commit is contained in:
Bananymous 2024-09-05 12:52:25 +03:00
parent 0bb44d7b75
commit f30947336a
10 changed files with 17 additions and 21 deletions

View File

@ -6,7 +6,10 @@ set(BAN_SOURCES
) )
add_library(ban ${BAN_SOURCES}) add_library(ban ${BAN_SOURCES})
target_link_options(ban PRIVATE -nolibc)
banan_link_library(ban libc) banan_link_library(ban libc)
set_target_properties(ban PROPERTIES OUTPUT_NAME libban)
banan_install_headers(ban) banan_install_headers(ban)
install(TARGETS ban OPTIONAL) install(TARGETS ban OPTIONAL)

View File

@ -25,6 +25,9 @@ set(CMAKE_INSTALL_SYSCONF ${BANAN_ETC})
set(CMAKE_INSTALL_MESSAGE NEVER) set(CMAKE_INSTALL_MESSAGE NEVER)
set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY True) set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY True)
set(CMAKE_STATIC_LIBRARY_PREFIX "")
set(CMAKE_SHARED_LIBRARY_PREFIX "")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")

View File

@ -191,12 +191,12 @@ target_compile_options(kernel PRIVATE
-Wall -Wextra -Werror -Wstack-usage=1024 -Wall -Wextra -Werror -Wstack-usage=1024
) )
# This might not work with other toolchains # C++ specific
target_compile_options(kernel PRIVATE $<$<COMPILE_LANGUAGE:CXX>: target_compile_options(kernel PRIVATE
-Wno-literal-suffix -Wno-literal-suffix
-Wno-invalid-offsetof -Wno-invalid-offsetof
-fno-rtti -fno-rtti
-fno-exceptions> -fno-exceptions
) )
if(ENABLE_KERNEL_UBSAN) if(ENABLE_KERNEL_UBSAN)
@ -213,8 +213,9 @@ endif()
target_link_options(kernel PRIVATE -ffreestanding -nostdlib -orphan-handling=error) target_link_options(kernel PRIVATE -ffreestanding -nostdlib -orphan-handling=error)
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -print-file-name=crtbegin.o OUTPUT_VARIABLE CRTBEGIN OUTPUT_STRIP_TRAILING_WHITESPACE) get_target_property(KERNEL_COMPILE_OPTIONS kernel COMPILE_OPTIONS)
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -print-file-name=crtend.o OUTPUT_VARIABLE CRTEND OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND ${CMAKE_CXX_COMPILER} ${KERNEL_COMPILE_OPTIONS} -print-file-name=crtbegin.o OUTPUT_VARIABLE CRTBEGIN OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${CMAKE_CXX_COMPILER} ${KERNEL_COMPILE_OPTIONS} -print-file-name=crtend.o OUTPUT_VARIABLE CRTEND OUTPUT_STRIP_TRAILING_WHITESPACE)
add_custom_command( add_custom_command(
TARGET kernel PRE_LINK TARGET kernel PRE_LINK

View File

@ -76,8 +76,8 @@ banan_install_headers(objlibc)
add_library(libc-static STATIC $<TARGET_OBJECTS:objlibc>) add_library(libc-static STATIC $<TARGET_OBJECTS:objlibc>)
add_library(libc-shared SHARED $<TARGET_OBJECTS:objlibc>) add_library(libc-shared SHARED $<TARGET_OBJECTS:objlibc>)
target_link_options(libc-static PRIVATE -nolibc) target_link_options(libc-static PRIVATE -nostdlib)
target_link_options(libc-shared PRIVATE -nolibc) target_link_options(libc-shared PRIVATE -nostdlib)
install(TARGETS libc-static OPTIONAL) install(TARGETS libc-static OPTIONAL)
install(TARGETS libc-shared OPTIONAL) install(TARGETS libc-shared OPTIONAL)
@ -86,6 +86,3 @@ set_target_properties(libc-static PROPERTIES OUTPUT_NAME libc)
set_target_properties(libc-shared PROPERTIES OUTPUT_NAME libc) set_target_properties(libc-shared PROPERTIES OUTPUT_NAME libc)
add_library(libc ALIAS libc-static) add_library(libc ALIAS libc-static)
set(CMAKE_STATIC_LIBRARY_PREFIX "")
set(CMAKE_SHARED_LIBRARY_PREFIX "")

View File

@ -9,5 +9,3 @@ banan_link_library(libfont ban)
banan_install_headers(libfont) banan_install_headers(libfont)
install(TARGETS libfont OPTIONAL) install(TARGETS libfont OPTIONAL)
set(CMAKE_STATIC_LIBRARY_PREFIX "")

View File

@ -10,5 +10,3 @@ banan_link_library(libgui libc)
banan_install_headers(libgui) banan_install_headers(libgui)
install(TARGETS libgui OPTIONAL) install(TARGETS libgui OPTIONAL)
set(CMAKE_STATIC_LIBRARY_PREFIX "")

View File

@ -11,5 +11,3 @@ banan_link_library(libimage ban)
banan_install_headers(libimage) banan_install_headers(libimage)
install(TARGETS libimage OPTIONAL) install(TARGETS libimage OPTIONAL)
set(CMAKE_STATIC_LIBRARY_PREFIX "")

View File

@ -4,10 +4,8 @@ set(LIBINPUT_SOURCES
) )
add_library(libinput ${LIBINPUT_SOURCES}) add_library(libinput ${LIBINPUT_SOURCES})
banan_include_headers(libinput ban) banan_link_library(libinput ban)
banan_link_library(libinput libc) banan_link_library(libinput libc)
banan_install_headers(libinput) banan_install_headers(libinput)
install(TARGETS libinput OPTIONAL) install(TARGETS libinput OPTIONAL)
set(CMAKE_STATIC_LIBRARY_PREFIX "")

View File

@ -4,7 +4,7 @@ set(SOURCES
) )
add_executable(Terminal ${SOURCES}) add_executable(Terminal ${SOURCES})
banan_include_headers(Terminal ban) banan_link_library(Terminal ban)
banan_link_library(Terminal libc) banan_link_library(Terminal libc)
banan_link_library(Terminal libfont) banan_link_library(Terminal libfont)
banan_link_library(Terminal libgui) banan_link_library(Terminal libgui)

View File

@ -6,8 +6,8 @@ set(SOURCES
) )
add_executable(WindowServer ${SOURCES}) add_executable(WindowServer ${SOURCES})
banan_include_headers(WindowServer ban)
banan_include_headers(WindowServer libgui) banan_include_headers(WindowServer libgui)
banan_link_library(WindowServer ban)
banan_link_library(WindowServer libc) banan_link_library(WindowServer libc)
banan_link_library(WindowServer libfont) banan_link_library(WindowServer libfont)
banan_link_library(WindowServer libimage) banan_link_library(WindowServer libimage)