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 -std=c17
-Wall -Wall
-Wextra
-Wpedantic
-Werror
-O2 -O2
-I/path/to/include -I/path/to/include

View File

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

View File

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

View File

@ -3,7 +3,7 @@ project(ClassicOS
VERSION 0.0.1 VERSION 0.0.1
DESCRIPTION "An x86 Operating System for your pleasure and enjoyment" DESCRIPTION "An x86 Operating System for your pleasure and enjoyment"
HOMEPAGE_URL "https://github.com/gbowne1/ClassicOS" HOMEPAGE_URL "https://github.com/gbowne1/ClassicOS"
LANGUAGES C ASM_NASM) LANGUAGES C)
# Source files # Source files
set(BOOT_SOURCE_FILES set(BOOT_SOURCE_FILES
@ -66,28 +66,39 @@ add_executable(ClassicOS
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) 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
enable_testing() enable_testing()
target_link_libraries(ClassicOS PRIVATE) target_link_libraries(ClassicOS PRIVATE)
set(CMAKE_C_COMPILER gcc) set(CMAKE_C_COMPILER /usr/bin/gcc)
set(CMAKE_LINKER ld) set(CMAKE_LINKER /usr/bin/ld)
set(CMAKE_EXE_LINKER_FLAGS "-g -s") 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_LINK_FLAGS "${CMAKE_LINK_FLAGS} -e kernel_main")
set(CMAKE_CXX_FLAGS "-g -Wall") set(CMAKE_CXX_FLAGS "-g Wall ")
set(CMAKE_C_FLAGS "-g -Wall -m32") set(CMAKE_C_FLAGS "-g -Wall")
set(CMAKE_C_FLAGS_DEBUG "-g") set(CMAKE_C_FLAGS_DEBUG "-g -Wall")
set(CMAKE_BUILD_TYPE Debug) 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_FLAGS_DEBUG "-g -O0")
set(CMAKE_CXX_COMPILER g++) set(CMAKE_CXX_COMPILER g++)
set(CMAKE_ASM_COMPILER nasm) set(CMAKE_ASM_COMPILER /usr/bin/nasm)
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} --32") 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_ASM_NASM_OBJECT_FORMAT bin)
set(CMAKE_HOST_SYSTEM_PROCESSOR x86_64)
set(CMAKE_SYSTEM_PROCESSOR i386) set(CMAKE_SYSTEM_PROCESSOR i386)
set(CMAKE_SYSTEM_NAME None) 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_C_STANDARD 17)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src) set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)

View File

@ -4,7 +4,7 @@ CXX = g++
AS = nasm AS = nasm
LD = ld LD = ld
CFLAGS = -g -Wall CFLAGS = -g -Wall
CXXFLAGS = -g -Wall CXXFLAGS = -g -Wall -Werror -Wpedantic -Wextra
LDFLAGS = -T linker.ld LDFLAGS = -T linker.ld
# Source files # 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 "audio.h"
#include <stdbool.h> #include <stdbool.h>
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
// Audio controller base address // Audio controller base address
#define AUDIO_BASE_ADDRESS 0x0000 #define AUDIO_BASE_ADDRESS 0x0000
// Audio controller data port // Audio controller data port
#define AUDIO_DATA_PORT 0x00 #define AUDIO_DATA_PORT 0x00
// Audio controller command port // Audio controller command port
#define AUDIO_COMMAND_PORT 0x01 #define AUDIO_COMMAND_PORT 0x01
// Initialize the audio driver // Initialize the audio driver
void audio_init() void audio_init()
{ {
// Add any necessary initialization code here // Add any necessary initialization code here
} }
// Play audio from a buffer // Play audio from a buffer
void audio_play(const uint8_t *buffer, size_t size) void audio_play(const uint8_t *buffer, size_t size)
{ {
// Add any necessary code to play audio from the buffer here // Add any necessary code to play audio from the buffer here
} }
// Stop audio playback // Stop audio playback
void audio_stop() void audio_stop()
{ {
// Add any necessary code to stop audio playback here // Add any necessary code to stop audio playback here
} }