Initial Commit

This commit is contained in:
Aaron Helton
2022-01-01 18:42:29 -05:00
commit 35886611bf
9 changed files with 109 additions and 0 deletions

9
.gitignore vendored Normal file
View File

@@ -0,0 +1,9 @@
.clangd/
.idea/
cmake-build-*/
build/
bin/
*.o
*.exe
*.so
compile_commands.json

30
CMakeLists.txt Normal file
View File

@@ -0,0 +1,30 @@
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(EmberLibPlus CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
# Export compile commands by default.
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
# I shamelessly stole this from https://blog.kitware.com/cmake-and-the-default-build-type/
# Set a default build type if none was specified
set(default_build_type "Release")
if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
set(default_build_type "Debug")
endif()
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
add_definitions(-DHAVE_CONFIG_H)
set(CONFIG_HEADER ${CMAKE_CURRENT_BINARY_DIR/config.h})
add_subdirectory(src)
add_subdirectory(demo)

23
cmake/config.h.in Normal file
View File

@@ -0,0 +1,23 @@
/*-*- mode:C; -*- */
/* config.h. Generated from build/cmake/config.h.in by cmake configure */
/*
* Ensure we have C99-style int64_t, etc, all defined
*/
#cmakedefine HAVE_INTMAX_T
#cmakedefine HAVE_UINTMAX_T
/* Define to 'int' if <sys/types.h> doesn't define. */
#cmakedefine pid_t ${pid_t}
/* Define intmax_t and uintmax_t if they are not already defined */
#if !defined(HAVE_INTMAX_T)
typedef int64_t intmax_t;
#define INTMAX_MIN INT64_MIN
#define INTMAX_MAX INT64_MAX
#endif
#if !defined(HAVE_UINTMAX_T)
typedef uint64_t uintmax_t;
#endif

11
demo/CMakeLists.txt Normal file
View File

@@ -0,0 +1,11 @@
set(DEMO_SOURCES demo.cpp)
add_executable(demo EXCLUDE_FROM_ALL ${DEMO_SOURCES})
target_link_libraries(demo PRIVATE EmberLibPlus)
target_include_directories(demo PRIVATE ${EmberLibPlus_INCLUDE_DIRS})
add_custom_command(
TARGET demo POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/Test.txt ${CMAKE_CURRENT_BINARY_DIR}/Test.txt
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/Test.txt
)

3
demo/Test.txt Normal file
View File

@@ -0,0 +1,3 @@
This is a test file.
It contains 3 lines of text.
This is a haiku

10
demo/demo.cpp Normal file
View File

@@ -0,0 +1,10 @@
/*
* Created by Aaron Helton on 01/01/22
*/
#include <EmberLibPlus/Util/SQLite.hpp>
int main(int argc, char **argv)
{
print_hello();
return 0;
}

View File

@@ -0,0 +1,10 @@
//
// Created by Aaron Helton on 1/1/22.
//
#ifndef EMBERLIB_SQLITE_HPP
#define EMBERLIB_SQLITE_HPP
void print_hello();
#endif //EMBERLIB_SQLITE_HPP

5
src/CMakeLists.txt Normal file
View File

@@ -0,0 +1,5 @@
set(sources
Util/SQLite/SQLiteDB.cpp)
add_library(EmberLibPlus STATIC ${headers} ${sources})
target_include_directories(EmberLibPlus PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../include)

View File

@@ -0,0 +1,8 @@
#include <EmberLibPlus/Util/SQLite.hpp>
#include <iostream>
void print_hello()
{
std::cout << "Hello, World! Fuck you." << std::endl;
}