mitchellhansen 4 years ago
parent 2e2fb9ffd2
commit f83e5290dd

@ -10,10 +10,16 @@ project(${PNAME})
# Set up variables, and find SFML # Set up variables, and find SFML
if (WIN32) if (WIN32)
set(SFML_ROOT root CACHE STRING "User specified path") set(SFML_ROOT root CACHE STRING "User specified path")
set(SFML_INCLUDE_DIR ${SFML_ROOT}/include) set(SFML_INCLUDE_DIR ${SFML_ROOT}/include)
endif() 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(SFML_COMPONENTS graphics window system network audio)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
find_package(SFML 2.1 COMPONENTS ${SFML_COMPONENTS} REQUIRED) find_package(SFML 2.1 COMPONENTS ${SFML_COMPONENTS} REQUIRED)
@ -48,12 +54,12 @@ foreach (source IN ITEMS ${SOURCES})
get_filename_component(filename ${source} DIRECTORY) get_filename_component(filename ${source} DIRECTORY)
STRING(REGEX REPLACE "/" "\\\\" filename ${filename}) STRING(REGEX REPLACE "/" "\\\\" filename ${filename})
string(REGEX MATCHALL "src(.*)" substrings ${filename}) string(REGEX MATCHALL "src(.*)" substrings ${filename})
list(GET substrings 0 substring) list(GET substrings 0 substring)
SOURCE_GROUP(${substring} FILES ${source}) SOURCE_GROUP(${substring} FILES ${source})
endif() endif()
endforeach() endforeach()
@ -63,12 +69,12 @@ foreach (source IN ITEMS ${HEADERS})
get_filename_component(filename ${source} DIRECTORY) get_filename_component(filename ${source} DIRECTORY)
STRING(REGEX REPLACE "/" "\\\\" filename ${filename}) STRING(REGEX REPLACE "/" "\\\\" filename ${filename})
string(REGEX MATCHALL "include(.*)" substrings ${filename}) string(REGEX MATCHALL "include(.*)" substrings ${filename})
list(GET substrings 0 substring) list(GET substrings 0 substring)
SOURCE_GROUP(${substring} FILES ${source}) SOURCE_GROUP(${substring} FILES ${source})
endif() endif()
endforeach() endforeach()
@ -78,16 +84,18 @@ foreach (source IN ITEMS ${KERNELS})
get_filename_component(filename ${source} DIRECTORY) get_filename_component(filename ${source} DIRECTORY)
STRING(REGEX REPLACE "/" "\\\\" filename ${filename}) STRING(REGEX REPLACE "/" "\\\\" filename ${filename})
string(REGEX MATCHALL "kernels(.*)" substrings ${filename}) string(REGEX MATCHALL "kernels(.*)" substrings ${filename})
list(GET substrings 0 substring) list(GET substrings 0 substring)
SOURCE_GROUP(${substring} FILES ${source}) SOURCE_GROUP(${substring} FILES ${source})
endif() endif()
endforeach() endforeach()
# Link CL, GL, and SFML # Link CL, GL, and SFML
target_link_libraries (${PNAME} stdc++fs)
target_link_libraries (${PNAME} ${SFML_LIBRARIES} ${SFML_DEPENDENCIES}) target_link_libraries (${PNAME} ${SFML_LIBRARIES} ${SFML_DEPENDENCIES})
target_link_libraries (${PNAME} ${OpenCL_LIBRARY}) target_link_libraries (${PNAME} ${OpenCL_LIBRARY})
target_link_libraries (${PNAME} ${OPENGL_LIBRARIES}) target_link_libraries (${PNAME} ${OPENGL_LIBRARIES})
@ -97,5 +105,4 @@ if (NOT WIN32)
endif() endif()
# Setup to use C++14 # Setup to use C++14
set_property(TARGET ${PNAME} PROPERTY CXX_STANDARD 14) set_property(TARGET ${PNAME} PROPERTY CXX_STANDARD 17)

@ -5,7 +5,7 @@
#include <experimental/filesystem> #include <experimental/filesystem>
#include <vector> #include <vector>
#include <SFML/Graphics.hpp> #include <SFML/Graphics.hpp>
#include <cstring>
struct pattern_info { struct pattern_info {
std::string title; std::string title;
@ -32,4 +32,4 @@ private:
std::vector<const char*> pattern_list; std::vector<const char*> pattern_list;
}; };

@ -8,9 +8,11 @@ Decoder::Decoder() {
for (std::experimental::filesystem::directory_entry p : std::experimental::filesystem::directory_iterator("../assets/patterns/")) { for (std::experimental::filesystem::directory_entry p : std::experimental::filesystem::directory_iterator("../assets/patterns/")) {
// good lord c++ // good lord c++
std::string s = p.path().generic_string(); 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); memcpy((void*)char_shit, s.c_str(), s.size()+1);
delete char_shit;
pattern_list.push_back(char_shit); pattern_list.push_back(char_shit);
} }

Loading…
Cancel
Save