From f83e5290dd1632d12396ff7c964263b990b26cde Mon Sep 17 00:00:00 2001 From: mitchellhansen Date: Sat, 22 Aug 2020 19:06:05 -0700 Subject: [PATCH] . --- CMakeLists.txt | 39 +++++++++++++++++++++++---------------- include/Decoder.h | 4 ++-- src/Decoder.cpp | 4 +++- 3 files changed, 28 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b8997c8..15961db 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,10 +10,16 @@ project(${PNAME}) # Set up variables, and find SFML if (WIN32) - set(SFML_ROOT root CACHE STRING "User specified path") - set(SFML_INCLUDE_DIR ${SFML_ROOT}/include) + set(SFML_ROOT root CACHE STRING "User specified path") + set(SFML_INCLUDE_DIR ${SFML_ROOT}/include) endif() +# You're probably going to need to change these paths +if (UNIX) + set(OpenCL_INCLUDE_DIR /usr/include/CL) + set(OpenCL_LIBRARY /usr/lib/x86_64-linux-gnu/libOpenCL.so.1) +endif (UNIX) + set(SFML_COMPONENTS graphics window system network audio) set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) find_package(SFML 2.1 COMPONENTS ${SFML_COMPONENTS} REQUIRED) @@ -48,12 +54,12 @@ foreach (source IN ITEMS ${SOURCES}) get_filename_component(filename ${source} DIRECTORY) STRING(REGEX REPLACE "/" "\\\\" filename ${filename}) - + string(REGEX MATCHALL "src(.*)" substrings ${filename}) list(GET substrings 0 substring) - - SOURCE_GROUP(${substring} FILES ${source}) - + + SOURCE_GROUP(${substring} FILES ${source}) + endif() endforeach() @@ -63,12 +69,12 @@ foreach (source IN ITEMS ${HEADERS}) get_filename_component(filename ${source} DIRECTORY) STRING(REGEX REPLACE "/" "\\\\" filename ${filename}) - + string(REGEX MATCHALL "include(.*)" substrings ${filename}) list(GET substrings 0 substring) - - SOURCE_GROUP(${substring} FILES ${source}) - + + SOURCE_GROUP(${substring} FILES ${source}) + endif() endforeach() @@ -78,16 +84,18 @@ foreach (source IN ITEMS ${KERNELS}) get_filename_component(filename ${source} DIRECTORY) STRING(REGEX REPLACE "/" "\\\\" filename ${filename}) - + string(REGEX MATCHALL "kernels(.*)" substrings ${filename}) list(GET substrings 0 substring) - - SOURCE_GROUP(${substring} FILES ${source}) - + + SOURCE_GROUP(${substring} FILES ${source}) + endif() endforeach() + # Link CL, GL, and SFML +target_link_libraries (${PNAME} stdc++fs) target_link_libraries (${PNAME} ${SFML_LIBRARIES} ${SFML_DEPENDENCIES}) target_link_libraries (${PNAME} ${OpenCL_LIBRARY}) target_link_libraries (${PNAME} ${OPENGL_LIBRARIES}) @@ -97,5 +105,4 @@ if (NOT WIN32) endif() # Setup to use C++14 -set_property(TARGET ${PNAME} PROPERTY CXX_STANDARD 14) - +set_property(TARGET ${PNAME} PROPERTY CXX_STANDARD 17) diff --git a/include/Decoder.h b/include/Decoder.h index 659dc7a..5dc2604 100644 --- a/include/Decoder.h +++ b/include/Decoder.h @@ -5,7 +5,7 @@ #include #include #include - +#include struct pattern_info { std::string title; @@ -32,4 +32,4 @@ private: std::vector pattern_list; -}; \ No newline at end of file +}; diff --git a/src/Decoder.cpp b/src/Decoder.cpp index 3bae600..ef68192 100644 --- a/src/Decoder.cpp +++ b/src/Decoder.cpp @@ -8,9 +8,11 @@ Decoder::Decoder() { for (std::experimental::filesystem::directory_entry p : std::experimental::filesystem::directory_iterator("../assets/patterns/")) { // good lord c++ std::string s = p.path().generic_string(); - const char* char_shit = new const char[s.size() + 1]; + const char* char_shit = new char[s.size() + 1]; memcpy((void*)char_shit, s.c_str(), s.size()+1); + delete char_shit; + pattern_list.push_back(char_shit); }