all: Enable/disable debug symbols/optimization in COMMON_FLAGS
This commit is contained in:
parent
d07b00a892
commit
7b8260f3f6
@ -36,6 +36,12 @@ set(COMMON_FLAGS -Wall -Wextra -Werror -Wvla
|
||||
-fno-asynchronous-unwind-tables -fno-omit-frame-pointer
|
||||
-std=c++20 -fno-rtti -fno-exceptions)
|
||||
|
||||
if(LUNA_NO_OPTIMIZATIONS)
|
||||
set(COMMON_FLAGS ${COMMON_FLAGS} -ggdb)
|
||||
else()
|
||||
set(COMMON_FLAGS ${COMMON_FLAGS} -Os)
|
||||
endif()
|
||||
|
||||
add_subdirectory(libluna)
|
||||
add_subdirectory(libos)
|
||||
add_subdirectory(libc)
|
||||
|
@ -85,12 +85,8 @@ if("${LUNA_ARCH}" MATCHES "x86_64")
|
||||
target_link_options(moon PRIVATE -mno-red-zone)
|
||||
endif()
|
||||
|
||||
if(MOON_DEBUG_SYMBOLS)
|
||||
message(STATUS "Building Moon with debug symbols")
|
||||
target_compile_options(moon PRIVATE -ggdb)
|
||||
if(MOON_DEBUG)
|
||||
include(debug.cmake)
|
||||
else()
|
||||
target_compile_options(moon PRIVATE -Os)
|
||||
endif()
|
||||
|
||||
target_link_options(moon PRIVATE -lgcc -Wl,--build-id=none -z max-page-size=0x1000 -mcmodel=kernel)
|
||||
|
@ -42,12 +42,6 @@ target_include_directories(bare_libc PUBLIC include/)
|
||||
|
||||
target_compile_options(bare_libc PRIVATE ${COMMON_FLAGS})
|
||||
|
||||
if(LUNA_DEBUG_SYMBOLS)
|
||||
target_compile_options(bare_libc PRIVATE -ggdb)
|
||||
else()
|
||||
target_compile_options(bare_libc PRIVATE -Os)
|
||||
endif()
|
||||
|
||||
target_link_options(bare_libc PRIVATE -nostdlib)
|
||||
|
||||
set_target_properties(bare_libc PROPERTIES CXX_STANDARD 20)
|
||||
|
@ -51,12 +51,3 @@ target_compile_options(luna-freestanding PRIVATE -mno-80387 -mno-mmx -mno-sse -m
|
||||
target_compile_definitions(luna-freestanding PUBLIC ARCH_X86_64)
|
||||
target_compile_definitions(luna PUBLIC ARCH_X86_64)
|
||||
endif()
|
||||
|
||||
if(LUNA_DEBUG_SYMBOLS)
|
||||
message(STATUS "Building Luna with debug symbols")
|
||||
target_compile_options(luna PRIVATE -ggdb)
|
||||
target_compile_options(luna-freestanding PRIVATE -ggdb)
|
||||
else()
|
||||
target_compile_options(luna PRIVATE -Os)
|
||||
target_compile_options(luna-freestanding PRIVATE -Os)
|
||||
endif()
|
||||
|
@ -15,10 +15,3 @@ target_include_directories(os PUBLIC ${LUNA_BASE}/usr/include)
|
||||
if("${LUNA_ARCH}" MATCHES "x86_64")
|
||||
target_compile_definitions(os PUBLIC ARCH_X86_64)
|
||||
endif()
|
||||
|
||||
if(LUNA_DEBUG_SYMBOLS)
|
||||
message(STATUS "Building libOS with debug symbols")
|
||||
target_compile_options(os PRIVATE -ggdb)
|
||||
else()
|
||||
target_compile_options(os PRIVATE -Os)
|
||||
endif()
|
||||
|
@ -11,7 +11,7 @@ tools/full-clean.sh
|
||||
|
||||
tools/install-headers.sh
|
||||
|
||||
cmake -S . -B $LUNA_BUILD_DIR -DMOON_DEBUG_SYMBOLS=ON -DLUNA_DEBUG_SYMBOLS=ON -G "$LUNA_CMAKE_GENERATOR_NAME"
|
||||
cmake -S . -B $LUNA_BUILD_DIR -DLUNA_NO_OPTIMIZATIONS=ON -DMOON_DEBUG=ON -G "$LUNA_CMAKE_GENERATOR_NAME"
|
||||
cmake --build $LUNA_BUILD_DIR
|
||||
cmake --install $LUNA_BUILD_DIR
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user