From 16b40a59ada041c6d1106a7cd563bf77825a8bcb Mon Sep 17 00:00:00 2001 From: Greg Bowne Date: Thu, 13 Jul 2023 18:07:53 -0700 Subject: [PATCH] Adding the rest of the initial files and cleaning up CMakeLists.txt --- ,vscode/settings.json | 3 +- .clang-format | 28 +++++++++++++ .vs/ProjectSettings.json | 17 ++++++++ .vs/appsettings.json | 13 ------ .vs/launch.vs.json | 33 +++++++++++++++ .vs/tasks.vs.json | 25 ++++++++++++ CMakeLists.txt | 18 ++++++++- build/CMakeCache.txt | 65 ++++++++++++++++++++++++++++++ build/CMakeFiles/cmake.check_cache | 1 + src/boot/grub/grub.cfg | 0 src/boot/grub/menu.lst | 0 11 files changed, 188 insertions(+), 15 deletions(-) create mode 100644 .clang-format create mode 100644 .vs/ProjectSettings.json delete mode 100644 .vs/appsettings.json create mode 100644 .vs/launch.vs.json create mode 100644 .vs/tasks.vs.json create mode 100644 build/CMakeCache.txt create mode 100644 build/CMakeFiles/cmake.check_cache create mode 100644 src/boot/grub/grub.cfg create mode 100644 src/boot/grub/menu.lst diff --git a/,vscode/settings.json b/,vscode/settings.json index 6eab8c7..03a3695 100644 --- a/,vscode/settings.json +++ b/,vscode/settings.json @@ -103,5 +103,6 @@ "*.hpp": "hpp", "*.asm": "asm" }, - "C_Cpp.default.intelliSenseMode": "linux-clang-x86" + "C_Cpp.default.intelliSenseMode": "linux-clang-x86", + "cmake.cmakePath": "/usr/bin/cmake" } \ No newline at end of file diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..56cce94 --- /dev/null +++ b/.clang-format @@ -0,0 +1,28 @@ +--- +Language: Cpp +BasedOnStyle: LLVM +IndentWidth: 4 +UseTab: Never +TabWidth: 4 +BreakBeforeBraces: Allman +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false +AllowShortFunctionsOnASingleLine: false +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: true +AlignConsecutiveDeclarations: true +AlignConsecutiveMacros: true +AlignEscapedNewlines: Left +AlignOperands: true +AlignTrailingComments: true +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortEnumsOnASingleLine: false +AllowShortNamespaceContentsOnASingleLine: false +AllowShortTemplateFunctionsOnASingleLine: false +AllowShortTypeConstraintsOnASingleLine: false +AllowShortVariablesOnASingleLine: false +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: true diff --git a/.vs/ProjectSettings.json b/.vs/ProjectSettings.json new file mode 100644 index 0000000..e8283b1 --- /dev/null +++ b/.vs/ProjectSettings.json @@ -0,0 +1,17 @@ +{ + "BuildOptions": { + "Platform": "x86", + "Configuration": "Debug", + "OptimizationLevel": "None", + "AdditionalCompilerOptions": "-m32", + "AdditionalLinkerOptions": "-m32" + }, + "DebuggingOptions": { + "DebuggerType": "NativeOnly", + "EnableUnmanagedDebugging": true + }, + "DeploymentOptions": { + "TargetArchitecture": "x86", + "TargetOperatingSystem": "Windows" + } +} \ No newline at end of file diff --git a/.vs/appsettings.json b/.vs/appsettings.json deleted file mode 100644 index aef2386..0000000 --- a/.vs/appsettings.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Error", - "Microsoft": "Warning" - }, - "Console": { - "LogLevel": { - "Microsoft": "Information" - } - } - } -} \ No newline at end of file diff --git a/.vs/launch.vs.json b/.vs/launch.vs.json new file mode 100644 index 0000000..d993e7c --- /dev/null +++ b/.vs/launch.vs.json @@ -0,0 +1,33 @@ +{ + "version": "0.2.1", + "configurations": [ + { + "name": "Debug NASM Program", + "projectTarget": "MyProject", + "args": [], + "program": "${workspaceFolder}/build/MyProject", + "cwd": "${workspaceFolder}/build", + "environment": [ + { + "name": "PATH", + "value": "/path/to/nasm:/path/to/qemu:/path/to/gnu-ld:/path/to/dd:/path/to/clang:/path/to/gcc:/path/to/gnu-gdb:/path/to/lldb:${env:PATH}" + } + ], + "type": "cppdbg", + "request": "launch", + "launchCompleteCommand": "exec-run", + "miDebuggerPath": "/path/to/gnu-gdb", + "miDebuggerArgs": "--interpreter=mi2", + "stopAtEntry": false, + "externalConsole": true, + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + } + ] +} \ No newline at end of file diff --git a/.vs/tasks.vs.json b/.vs/tasks.vs.json new file mode 100644 index 0000000..c8faac6 --- /dev/null +++ b/.vs/tasks.vs.json @@ -0,0 +1,25 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Build", + "type": "shell", + "command": "nasm -f elf32 -o main.o main.asm && gcc -m32 -o main main.o", + "group": { + "kind": "build", + "isDefault": true + }, + "problemMatcher": [] + }, + { + "label": "Run", + "type": "shell", + "command": "qemu-system-i386 -kernel main", + "group": { + "kind": "test", + "isDefault": true + }, + "problemMatcher": [] + } + ] +} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index e3046bb..87f8aa6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1 +1,17 @@ -cmake -DCMAKE_LINKER=/usr/bin/ld -DCMAKE_CXX_LINK_EXECUTABLE=" -o " \ No newline at end of file +cmake_minimum_required(VERSION 3.13.4) +project(my_project C) + +add_subdirectory(foo) +add_subdirectory(bar) + +add_library(foo foo.c) +target_include_directories(foo PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) + +add_subdirectory(tests) + +add_executable(foo_test foo_tests.c) +target_link_libraries(foo_test foo) + +add_executable(${PROJECT_NAME} ${SOURCE_FILES} ${HEADER_FILES}) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) + diff --git a/build/CMakeCache.txt b/build/CMakeCache.txt new file mode 100644 index 0000000..dcd3e1c --- /dev/null +++ b/build/CMakeCache.txt @@ -0,0 +1,65 @@ +# This is the CMakeCache file. +# For build in directory: /media/gbowne1/18656299-5992-400a-a7a4-b6ffc4b0612f/Documents/ClassicOS/build +# It was generated by CMake: /usr/bin/cmake +# You can edit this file to change values found and used by cmake. +# If you do not want to change any of the values, simply exit the editor. +# If you do want to change a value, simply edit, save, and exit the editor. +# The syntax for the file is as follows: +# KEY:TYPE=VALUE +# KEY is the name of a variable in the cache. +# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!. +# VALUE is the current value for the KEY. + +######################## +# EXTERNAL cache entries +######################## + +//No help, variable specified on the command line. +CMAKE_BUILD_TYPE:STRING=Debug + +//No help, variable specified on the command line. +CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/clang++ + +//No help, variable specified on the command line. +CMAKE_C_COMPILER:FILEPATH=/usr/bin/clang + +//No help, variable specified on the command line. +CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE + + +######################## +# INTERNAL cache entries +######################## + +//This is the directory where this CMakeCache.txt was created +CMAKE_CACHEFILE_DIR:INTERNAL=/media/gbowne1/18656299-5992-400a-a7a4-b6ffc4b0612f/Documents/ClassicOS/build +//Major version of cmake used to create the current loaded cache +CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3 +//Minor version of cmake used to create the current loaded cache +CMAKE_CACHE_MINOR_VERSION:INTERNAL=13 +//Patch version of cmake used to create the current loaded cache +CMAKE_CACHE_PATCH_VERSION:INTERNAL=4 +//Path to CMake executable. +CMAKE_COMMAND:INTERNAL=/usr/bin/cmake +//Path to cpack program executable. +CMAKE_CPACK_COMMAND:INTERNAL=/usr/bin/cpack +//Path to ctest program executable. +CMAKE_CTEST_COMMAND:INTERNAL=/usr/bin/ctest +//Name of external makefile project generator. +CMAKE_EXTRA_GENERATOR:INTERNAL= +//Name of generator. +CMAKE_GENERATOR:INTERNAL=Unix Makefiles +//Generator instance identifier. +CMAKE_GENERATOR_INSTANCE:INTERNAL= +//Name of generator platform. +CMAKE_GENERATOR_PLATFORM:INTERNAL= +//Name of generator toolset. +CMAKE_GENERATOR_TOOLSET:INTERNAL= +//Source directory with the top level CMakeLists.txt file for this +// project +CMAKE_HOME_DIRECTORY:INTERNAL=/media/gbowne1/18656299-5992-400a-a7a4-b6ffc4b0612f/Documents/ClassicOS +//number of local generators +CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=1 +//Path to CMake installation. +CMAKE_ROOT:INTERNAL=/usr/share/cmake-3.13 + diff --git a/build/CMakeFiles/cmake.check_cache b/build/CMakeFiles/cmake.check_cache new file mode 100644 index 0000000..3dccd73 --- /dev/null +++ b/build/CMakeFiles/cmake.check_cache @@ -0,0 +1 @@ +# This file is generated by cmake for dependency checking of the CMakeCache.txt file diff --git a/src/boot/grub/grub.cfg b/src/boot/grub/grub.cfg new file mode 100644 index 0000000..e69de29 diff --git a/src/boot/grub/menu.lst b/src/boot/grub/menu.lst new file mode 100644 index 0000000..e69de29