diff --git a/CMakeLists.txt b/CMakeLists.txt index 12a61c6..ac9d80b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.18) +cmake_minimum_required(VERSION 3.20 FATAL_ERROR) project(sfml-widgets VERSION 1.1.0) # ############################################################################## @@ -14,11 +14,10 @@ set(DEMO_EXE "demo_widgets") ##### (MACOS) # set(SFML_HOME "/Library/Frameworks/SFML.framework/") -# set(SFML_DIR ${SFML_HOME}/lib/cmake/SFML) - set(ENABLE_DEMO TRUE) -# FIND SFML precompiled libs +# FIND SFML precompiled libs & headers +# set(SFML_DIR ${SFML_HOME}/lib/cmake/SFML) find_package(SFML 2.6 REQUIRED COMPONENTS "graphics" "window" "system") find_package(OpenGL REQUIRED) @@ -32,7 +31,7 @@ endif() # ############################################################################## # Configure build for SFML Widgets library -file(GLOB_RECURSE SFML_WIDGETS_SRC src/Gui/*.cpp src/Gui/**/*.cpp) +file(GLOB_RECURSE SFML_WIDGETS_SRC src/Gui/*.cpp) add_library(sfml-widgets ${SFML_WIDGETS_SRC}) target_link_libraries(sfml-widgets PUBLIC sfml-graphics sfml-window sfml-system) target_include_directories(sfml-widgets PUBLIC ${CMAKE_SOURCE_DIR}/src/) @@ -52,7 +51,7 @@ if(ENABLE_DEMO) file(GLOB DEMO_SRC demo/*.cpp demo/*.mm) if(WIN32) - add_executable(${DEMO_EXE} WIN32 ${DEMO_SRC}) + add_executable(${DEMO_EXE} WIN32 ${DEMO_SRC} ${CMAKE_SOURCE_DIR}/demo/resources/win-icon.rc) target_link_libraries(${DEMO_EXE} PRIVATE sfml-widgets sfml-main OpenGL::GL sfml-graphics sfml-window sfml-system) @@ -75,8 +74,7 @@ if(ENABLE_DEMO) ##################################################### if(NOT APPLE) add_custom_command(TARGET ${DEMO_EXE} - POST_BUILD - COMMAND + POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/demo/resources $/resources) endif() diff --git a/README.md b/README.md index f869f30..59d0186 100644 --- a/README.md +++ b/README.md @@ -14,11 +14,10 @@ A simple GUI module for SFML. ## Requirements: - [Download SFML 2.6.x](https://www.sfml-dev.org/download.php) for your platform -- Download latest [CMake Installer](https://cmake.org/download/) +- Latest [CMake Installer](https://cmake.org/download/) - version 3.20 or higher ### Windows: - Visual Studio 2022 or later (select complete "**Desktop C++ Development**" workload) -- Windows SDK. - CMake for VS2022 (download using Visual Studio installer). ### MacOS @@ -70,14 +69,14 @@ int main() { sf::RenderWindow app(sf::VideoMode(800, 600), "SFML Widgets", sf::Style::Close); - //set FPS limit + //Set FPS limit //app.setFramerateLimit(60); // Declare menu gui::Menu menu(app); - gui::Theme::loadFont("resources/tahoma.ttf"); //TODO handle error - gui::Theme::loadTexture("resources/texture-default.png"); //TODO handle error + gui::Theme::loadFont("resources/tahoma.ttf"); + gui::Theme::loadTexture("resources/texture-default.png"); // Create some button widget gui::Button* button = new gui::Button("My button"); diff --git a/demo/resources/win-icon.ico b/demo/resources/win-icon.ico new file mode 100644 index 0000000..dce6b2e Binary files /dev/null and b/demo/resources/win-icon.ico differ diff --git a/demo/resources/win-icon.rc b/demo/resources/win-icon.rc new file mode 100644 index 0000000..b4044ff --- /dev/null +++ b/demo/resources/win-icon.rc @@ -0,0 +1 @@ +IDI_ICON1 ICON DISCARDABLE "win-icon.ico" \ No newline at end of file