Fixing up CMakeLists.txt

This commit is contained in:
Gregory Kenneth Bowne 2023-10-24 14:21:14 -07:00
parent debe0eaf4f
commit d9999d3ed3
7 changed files with 61 additions and 44 deletions

View File

@ -1,4 +1,7 @@
-std=c17
-Wall
-Wextra
-Wpedantic
-Werror
-O2
-I/path/to/include

View File

@ -1,6 +1,6 @@
CompileFlags:
Add: ["-std=c17"]
Remove: ["-Werror"]
Remove: ["-Wall -Wpedantic -Wextra -Werror"]
Index:
Background: true
OnDidChange: true

View File

@ -30,6 +30,7 @@
"C_Cpp_Runner.warnings": [
"-Wall",
"-Wextra",
"-Wextra",
"-Wpedantic"
],
"C_Cpp_Runner.enableWarnings": true,

View File

@ -3,7 +3,7 @@ project(ClassicOS
VERSION 0.0.1
DESCRIPTION "An x86 Operating System for your pleasure and enjoyment"
HOMEPAGE_URL "https://github.com/gbowne1/ClassicOS"
LANGUAGES C ASM_NASM)
LANGUAGES C)
# Source files
set(BOOT_SOURCE_FILES
@ -66,28 +66,39 @@ add_executable(ClassicOS
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if(WIN32)
# Define build steps for Windows
elseif(LINUX)
# Define build steps for other platforms
elseif(UNIX)
endif()
# Enable testing
enable_testing()
target_link_libraries(ClassicOS PRIVATE)
set(CMAKE_C_COMPILER gcc)
set(CMAKE_LINKER ld)
set(CMAKE_C_COMPILER /usr/bin/gcc)
set(CMAKE_LINKER /usr/bin/ld)
set(CMAKE_EXE_LINKER_FLAGS "-g -s")
# set(CMAKE_LINK_FLAGS) usage is deprecated, use CMAKE_EXE_LINKER_FLAGS).
set(CMAKE_LINK_FLAGS "${CMAKE_LINK_FLAGS} -e kernel_main")
set(CMAKE_CXX_FLAGS "-g -Wall")
set(CMAKE_C_FLAGS "-g -Wall -m32")
set(CMAKE_C_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS "-g Wall ")
set(CMAKE_C_FLAGS "-g -Wall")
set(CMAKE_C_FLAGS_DEBUG "-g -Wall")
set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_GDB_COMMAND gdb)
set(CMAKE_GDB_COMMAND "/usr/bin/gdb")
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
set(CMAKE_CXX_COMPILER g++)
set(CMAKE_ASM_COMPILER nasm)
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} --32")
set(CMAKE_ASM_COMPILER /usr/bin/nasm)
set(CMAKE_ASM_NASM_FLAGS "-f elf32 -g -F dwarf")
set(CMAKE_ASM_FLAGS "-m32 -g")
set(CMAKE_ASM_NASM_OBJECT_FORMAT bin)
set(CMAKE_HOST_SYSTEM_PROCESSOR x86_64)
set(CMAKE_SYSTEM_PROCESSOR i386)
set(CMAKE_SYSTEM_NAME None)
set(CMAKE_ASM_NASM_COMPILER nasm)
set(CMAKE_ASM_NASM_COMPILER user/bin/nasm)
set(CMAKE_C_STANDARD 17)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)

View File

@ -4,7 +4,7 @@ CXX = g++
AS = nasm
LD = ld
CFLAGS = -g -Wall
CXXFLAGS = -g -Wall
CXXFLAGS = -g -Wall -Werror -Wpedantic -Wextra
LDFLAGS = -T linker.ld
# Source files

View File

@ -0,0 +1,2 @@
CFLAGS=-Os -march=i386 -mtune=i386
LDFLAGS=-s

View File

@ -1,32 +1,32 @@
#include "audio.h"
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
// Audio controller base address
#define AUDIO_BASE_ADDRESS 0x0000
// Audio controller data port
#define AUDIO_DATA_PORT 0x00
// Audio controller command port
#define AUDIO_COMMAND_PORT 0x01
// Initialize the audio driver
void audio_init()
{
// Add any necessary initialization code here
}
// Play audio from a buffer
void audio_play(const uint8_t *buffer, size_t size)
{
// Add any necessary code to play audio from the buffer here
}
// Stop audio playback
void audio_stop()
{
// Add any necessary code to stop audio playback here
}
#include "audio.h"
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
// Audio controller base address
#define AUDIO_BASE_ADDRESS 0x0000
// Audio controller data port
#define AUDIO_DATA_PORT 0x00
// Audio controller command port
#define AUDIO_COMMAND_PORT 0x01
// Initialize the audio driver
void audio_init()
{
// Add any necessary initialization code here
}
// Play audio from a buffer
void audio_play(const uint8_t *buffer, size_t size)
{
// Add any necessary code to play audio from the buffer here
}
// Stop audio playback
void audio_stop()
{
// Add any necessary code to stop audio playback here
}