Compare commits
5
Commits
dd2dcf4a28
...
c5d5ffc1eb
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c5d5ffc1eb | ||
|
|
45fba7f693 | ||
|
|
0863c113be | ||
|
|
1149d9f926 | ||
|
|
d8ce499e1e |
@@ -0,0 +1,39 @@
|
||||
# -*- yaml -*-
|
||||
|
||||
---
|
||||
BasedOnStyle: WebKit
|
||||
IndentWidth: 4
|
||||
---
|
||||
Language: Cpp
|
||||
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignEscapedNewlines: Left
|
||||
AlignOperands: Align
|
||||
AlignTrailingComments: true
|
||||
|
||||
AllowAllArgumentsOnNextLine: false
|
||||
AllowAllConstructorInitializersOnNextLine: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
AllowShortLambdasOnASingleLine: All
|
||||
|
||||
AlwaysBreakTemplateDeclarations: Yes
|
||||
IndentPPDirectives: BeforeHash
|
||||
|
||||
BraceWrapping:
|
||||
AfterEnum: false
|
||||
AfterFunction: true
|
||||
BeforeCatch: true
|
||||
BeforeElse: true
|
||||
BeforeLambdaBody: false
|
||||
SplitEmptyRecord: false
|
||||
BreakBeforeBraces: Custom
|
||||
BreakInheritanceList: BeforeComma
|
||||
|
||||
SpaceAfterTemplateKeyword: false
|
||||
SpaceInEmptyBlock: false
|
||||
NamespaceIndentation: None
|
||||
FixNamespaceComments: true
|
||||
Standard: c++20
|
||||
TabWidth: 4
|
||||
UseTab: AlignWithSpaces
|
||||
...
|
||||
@@ -0,0 +1,7 @@
|
||||
# Directories
|
||||
|
||||
.cache/
|
||||
.clangd/
|
||||
build/
|
||||
|
||||
# Files
|
||||
@@ -0,0 +1,94 @@
|
||||
# ------------------------------------------
|
||||
# User config between these lines
|
||||
|
||||
# Set project name
|
||||
set(PROJECT "garbage")
|
||||
|
||||
# Unit tests
|
||||
option(GARBAGE_BUILD_TESTS "Build the GarbAGE test programs" ON)
|
||||
|
||||
# ------------------------------------------
|
||||
|
||||
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
|
||||
project(${PROJECT} CXX)
|
||||
|
||||
# ------------------------------------------
|
||||
# Setup C++ compiler
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
# Compiler flags used for all build types
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic")
|
||||
# -Wall = All warnings about contructions that are easily avoidable
|
||||
# -Wextra = Extra warning flags not covered by -Wall
|
||||
# -Wpedantic = Warnings for compiler extensions not part of the standard
|
||||
|
||||
# Set default build type if not specified
|
||||
set(DEFAULT_BUILD_TYPE Release)
|
||||
if(EXISTS ${CMAKE_SOURCE_DIR}/.git)
|
||||
set(DEFAULT_BUILD_TYPE Debug)
|
||||
endif()
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE ${DEFAULT_BUILD_TYPE})
|
||||
endif()
|
||||
|
||||
# Set build type specific compiler flags
|
||||
message("--- ${CMAKE_BUILD_TYPE} ---")
|
||||
if(${CMAKE_BUILD_TYPE} STREQUAL Debug)
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Og -g -pg")
|
||||
# -Og = Optimizations that do not interfere with debugging
|
||||
# -g = Produce debugging information in OS's native format
|
||||
# -pg = Generate profile information for analysis with gprof
|
||||
# $ gprof <PROJECT> gmon.out > profile-data.txt
|
||||
elseif(${CMAKE_BUILD_TYPE} STREQUAL Release)
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
|
||||
# -O3 = Optimizations that increase compilation time and performance
|
||||
endif()
|
||||
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
# ------------------------------------------
|
||||
# Library
|
||||
|
||||
set(RUC_BUILD_TESTS OFF)
|
||||
add_subdirectory("vendor/ruc")
|
||||
|
||||
# ------------------------------------------
|
||||
# Application target
|
||||
|
||||
# Define source files
|
||||
file(GLOB_RECURSE PROJECT_SOURCES "src/*.cpp")
|
||||
set(PROJECT_SOURCES ${PROJECT_SOURCES})
|
||||
|
||||
add_executable(${PROJECT} ${PROJECT_SOURCES})
|
||||
target_include_directories(${PROJECT} PRIVATE
|
||||
"src"
|
||||
"vendor/ruc/src")
|
||||
target_link_libraries(${PROJECT} ruc)
|
||||
|
||||
# ------------------------------------------
|
||||
# Execute target
|
||||
|
||||
add_custom_target(run
|
||||
COMMAND ${PROJECT})
|
||||
add_dependencies(run ${PROJECT})
|
||||
|
||||
# ------------------------------------------
|
||||
# Unit test target
|
||||
|
||||
if (GARBAGE_BUILD_TESTS)
|
||||
# Define test source files
|
||||
file(GLOB_RECURSE TEST_SOURCES "test/*.cpp")
|
||||
set(TEST_SOURCES ${TEST_SOURCES} ${PROJECT_SOURCES})
|
||||
list(REMOVE_ITEM TEST_SOURCES "${CMAKE_SOURCE_DIR}/src/main.cpp")
|
||||
|
||||
add_executable(${PROJECT}-unit-test ${TEST_SOURCES})
|
||||
target_include_directories(${PROJECT}-unit-test PRIVATE
|
||||
"src"
|
||||
"test"
|
||||
"vendor/ruc/src"
|
||||
"vendor/ruc/test")
|
||||
target_link_libraries(${PROJECT}-unit-test ruc-test)
|
||||
endif()
|
||||
@@ -0,0 +1,6 @@
|
||||
#+TITLE: GarbAGE (Garbage Accurate GameBoy Emulator)
|
||||
#+AUTHOR: Riyyi
|
||||
#+LANGUAGE: en
|
||||
#+OPTIONS: toc:nil
|
||||
|
||||
Accurate GameBoy Emulator.
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
build/compile_commands.json
|
||||
@@ -0,0 +1,12 @@
|
||||
#include <cstdio>
|
||||
|
||||
#include "ruc/timer.h"
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
ruc::Timer t;
|
||||
|
||||
printf("%fms\n", t.elapsedNanoseconds() / 1000000.0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Riyyi
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "macro.h"
|
||||
#include "testcase.h"
|
||||
#include "testsuite.h"
|
||||
|
||||
// -----------------------------------------
|
||||
|
||||
TEST_CASE(Thing)
|
||||
{
|
||||
int a = 5;
|
||||
EXPECT_EQ(a, 5);
|
||||
}
|
||||
Reference in New Issue
Block a user