Store project style settings in VCS.

I'm sick of getting my settings stomped on every god damn time I open CLion.
This commit is contained in:
Kyle Isom 2023-10-11 19:25:24 -07:00
parent 187ff6cb01
commit fd6e0c6899
12 changed files with 148 additions and 71 deletions

2
.gitignore vendored
View File

@ -1,7 +1,7 @@
.cmake .cmake
.idea
.trunk .trunk
.vc .vc
.vs
.vscode .vscode
*.a *.a

8
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@ -0,0 +1,29 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<Objective-C>
<option name="FUNCTION_BRACE_PLACEMENT" value="2" />
</Objective-C>
<files>
<extensions>
<pair source="cc" header="h" fileNamingConvention="PASCAL_CASE" />
<pair source="c" header="h" fileNamingConvention="NONE" />
<pair source="cu" header="cuh" fileNamingConvention="NONE" />
<pair source="ixx" header="" fileNamingConvention="NONE" />
<pair source="mxx" header="" fileNamingConvention="NONE" />
<pair source="cppm" header="" fileNamingConvention="NONE" />
<pair source="ccm" header="" fileNamingConvention="NONE" />
<pair source="cxxm" header="" fileNamingConvention="NONE" />
<pair source="c++m" header="" fileNamingConvention="NONE" />
</extensions>
</files>
<codeStyleSettings language="ObjectiveC">
<option name="ALIGN_GROUP_FIELD_DECLARATIONS" value="true" />
<indentOptions>
<option name="INDENT_SIZE" value="8" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="8" />
<option name="USE_TAB_CHARACTER" value="true" />
</indentOptions>
</codeStyleSettings>
</code_scheme>
</component>

View File

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>

2
.idea/kge.iml Normal file
View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<module classpath="CMake" type="CPP_MODULE" version="4" />

9
.idea/misc.xml Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
<component name="CidrRootsConfiguration">
<libraryRoots>
<file path="$PROJECT_DIR$/ext" />
</libraryRoots>
</component>
</project>

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/kge.iml" filepath="$PROJECT_DIR$/.idea/kge.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -44,20 +44,20 @@ anonymousName()
Buffer::Buffer() Buffer::Buffer()
: name(anonymousName()), path(std::nullopt), file(std::nullopt) : name(anonymousName())
{ {
} }
Buffer::Buffer(std::string fName) Buffer::Buffer(std::string fName)
: name(std::move(fName)), path(std::nullopt), file(std::nullopt) : name(std::move(fName))
{ {
} }
Buffer::Buffer(std::string fName, std::string fPath) Buffer::Buffer(std::string fName, std::string fPath)
: name(std::move(fName)), path(std::move(fPath)), file(std::nullopt) : name(std::move(fName)), path(std::move(fPath))
{ {
if (this->path) { if (this->path) {
this->file = OptFile(File(this->path.value())); this->file = OptFile(File(this->path.value()));

View File

@ -9,10 +9,12 @@
#define KEPP_FRAME_H #define KEPP_FRAME_H
#include <cstdint>
#include <vector> #include <vector>
#include "Defs.h" #include "Defs.h"
#include "File.h" #include "File.h"
#include "Cursor.h"
typedef std::vector<std::vector<uint8_t>> BufferContents; typedef std::vector<std::vector<uint8_t>> BufferContents;
@ -50,6 +52,7 @@ private:
std::string name; std::string name;
OptString path; OptString path;
OptFile file; OptFile file;
Cursor cursor;
BufferContents contents; BufferContents contents;
}; };

View File

@ -1,9 +1,9 @@
cmake_minimum_required(VERSION 3.22) cmake_minimum_required(VERSION 3.22)
project(kge project(kge
DESCRIPTION "kyle's editor" DESCRIPTION "kyle's editor"
LANGUAGES CXX LANGUAGES CXX
VERSION 0.0.1) VERSION 0.0.1)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_VERBOSE_MAKEFILES TRUE) set(CMAKE_VERBOSE_MAKEFILES TRUE)
@ -20,98 +20,104 @@ string(TIMESTAMP TODAY "%Y%m%d")
set(BUILD_GUI OFF CACHE BOOL "Disable building the graphical version.") set(BUILD_GUI OFF CACHE BOOL "Disable building the graphical version.")
if (CMAKE_HOST_UNIX) if (CMAKE_HOST_UNIX)
message(STATUS "Build system is POSIX.") message(STATUS "Build system is POSIX.")
endif() else ()
message(STATUS "Build system is NOT POSIX.")
endif ()
if(MSVC) if (MSVC)
add_compile_options("/W4" "$<$<CONFIG:RELEASE>:/O2>") add_compile_options("/W4" "$<$<CONFIG:RELEASE>:/O2>")
else() else ()
add_compile_options( add_compile_options(
"-Wall" "-Wall"
"-Wextra" "-Wextra"
"-Werror" "-Werror"
"-static" "-static"
"$<$<CONFIG:DEBUG>:-g>" "$<$<CONFIG:DEBUG>:-g>"
"$<$<CONFIG:RELEASE>:-O2>") "$<$<CONFIG:RELEASE>:-O2>")
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
add_compile_options("-stdlib=libc++") add_compile_options("-stdlib=libc++")
else() else ()
# nothing special for gcc at the moment # nothing special for gcc at the moment
endif() endif ()
endif() endif ()
add_compile_definitions(KGE_PLATFORM=${CMAKE_HOST_SYSTEM_NAME}) add_compile_definitions(KGE_PLATFORM=${CMAKE_HOST_SYSTEM_NAME})
add_compile_definitions(KGE_VERSION=${PROJECT_VERSION}) add_compile_definitions(KGE_VERSION=${PROJECT_VERSION})
message(STATUS "Build system: ${CMAKE_HOST_SYSTEM_NAME}") message(STATUS "Build system: ${CMAKE_HOST_SYSTEM_NAME}")
if(${BUILD_GUI}) if (${BUILD_GUI})
include(cmake/imgui.cmake) include(cmake/imgui.cmake)
endif() endif ()
##################### #####################
### BUILD TARGETS ### ### BUILD TARGETS ###
##################### #####################
set(HEADER_FILES set(HEADER_FILES
Defs.h Defs.h
Buffer.h Buffer.h
File.h File.h
Cursor.h Cursor.h
) )
set(SOURCE_FILES set(SOURCE_FILES
Defs.cc Defs.cc
Buffer.cc Buffer.cc
File.cc File.cc
Cursor.cc Cursor.cc
) )
add_executable(ke main.cc ${SOURCE_FILES} ${HEADER_FILES}) add_executable(ke main.cc ${SOURCE_FILES} ${HEADER_FILES})
add_custom_target(manpages) if (CMAKE_HOST_UNIX)
configure_file(docs/ke.md ke.1.scdoc @ONLY) add_custom_target(manpages)
add_custom_command(TARGET manpages COMMAND scdoc < ke.1.scdoc > ke.1 configure_file(docs/ke.md ke.1.scdoc @ONLY)
OUTPUTS ${CMAKE_CURRENT_BINARY_DIR}/ke.1) add_custom_command(TARGET manpages COMMAND scdoc < ke.1.scdoc > ke.1
add_dependencies(ke manpages) OUTPUTS ${CMAKE_CURRENT_BINARY_DIR}/ke.1)
add_dependencies(ke manpages)
endif ()
if(${BUILD_GUI}) if (${BUILD_GUI})
configure_file(resources/kge.desktop.in kge.desktop @ONLY) configure_file(resources/kge.desktop.in kge.desktop @ONLY)
add_executable(kge gmain.cc ${SOURCE_FILES} ${HEADER_FILES}) add_executable(kge gmain.cc ${SOURCE_FILES} ${HEADER_FILES})
target_link_libraries(kge imgui) target_link_libraries(kge imgui)
add_dependencies(kge ke) add_dependencies(kge ke)
configure_file(docs/kge.md kge.1.scdoc @ONLY) if (CMAKE_HOST_UNIX)
add_custom_command(TARGET manpages COMMAND scdoc < kge.1.scdoc > kge.1 configure_file(docs/kge.md kge.1.scdoc @ONLY)
OUTPUTS ${CMAKE_CURRENT_BINARY_DIR}/kge.1) add_custom_command(TARGET manpages COMMAND scdoc < kge.1.scdoc > kge.1
OUTPUTS ${CMAKE_CURRENT_BINARY_DIR}/kge.1)
add_dependencies(kge manpages) add_dependencies(kge manpages)
endif() endif ()
endif ()
####################### #######################
### INSTALL TARGETS ### ### INSTALL TARGETS ###
####################### #######################
install(TARGETS ke install(TARGETS ke
DESTINATION bin DESTINATION bin
COMPONENT nox) COMPONENT nox)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ke.1 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ke.1
DESTINATION share/man/man1 DESTINATION share/man/man1
COMPONENT nox) COMPONENT nox)
if(${BUILD_GUI}) if (${BUILD_GUI})
install(TARGETS kge install(TARGETS kge
DESTINATION bin DESTINATION bin
COMPONENT nox COMPONENT nox
COMPONENT gui) COMPONENT gui)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kge.desktop install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kge.desktop
DESTINATION share/applications DESTINATION share/applications
COMPONENT gui) COMPONENT gui)
install(FILES resources/kge.png install(FILES resources/kge.png
DESTINATION share/${PROJECT_NAME} DESTINATION share/${PROJECT_NAME}
COMPONENT gui) COMPONENT gui)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kge.1 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kge.1
DESTINATION share/man/man1 DESTINATION share/man/man1
COMPONENT gui) COMPONENT gui)
endif() endif ()
include(cmake/packaging.cmake) include(cmake/packaging.cmake)

View File

@ -32,7 +32,8 @@
/// Cursors represent a position in a Buffer. /// Cursors represent a position in a Buffer.
class Cursor { class Cursor {
public: public:
Cursor(size_t _x, size_t _y) : x(_x), y(_y) {}; Cursor() : x(0), y(0) {}
Cursor(size_t _x, size_t _y) : x(_x), y(_y) {}
size_t X() const { return this->x; } size_t X() const { return this->x; }
size_t Y() const { return this->y; } size_t Y() const { return this->y; }