Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - sweet_weakness

Pages: [1]
1
General / Re: MinGW + SFML + CLion (Windows 10)
« on: April 09, 2020, 05:25:30 pm »
Hey there,
i use a similar setup as you (but mingw-w64 instead of mingw). I had also some trouble getting newest SFML version to run with CMAKE and CLION. However with Laurents help i was able to get it to run. Here the whole process is described in detail, it may be helpful for you.

https://en.sfml-dev.org/forums/index.php?topic=26960.0

Thanks. Is it normal that I need to add .dll's myself (I mean to copy .dll's in my cmake-build folder)? I thought that it has to do it itself after compiling project.

2
General / Re: MinGW + SFML + CLion (Windows 10)
« on: April 07, 2020, 09:31:57 pm »
What if you move the add_executable() below the searching for SFML?
I don't know when exactly CMake resolves the include directories, but maybe if they're missing when you add an executable, then they won't be seen by your source code?

Any ideas?)

3
General / Re: MinGW + SFML + CLion (Windows 10)
« on: April 04, 2020, 11:41:50 am »
That didn't help. Btw, yesterday i got 0x0000...00135 exit code (using this CMake).

Code: [Select]
cmake_minimum_required(VERSION 3.1)

project(MyGame)

## If you want to link SFML statically
# set(SFML_STATIC_LIBRARIES TRUE)

## In most cases better set in the CMake cache
set(SFML_DIR "${CMAKE_SOURCE_DIR}/SFML-2.5.1/lib/cmake/SFML")

find_package(SFML 2.5.1 COMPONENTS graphics REQUIRED)
add_executable(MyGame main.cpp)
target_link_libraries(MyGame sfml-graphics)

When i set static libs on true, I get same error (can't find SFML/Graphics.hpp etc)

4
General / Re: MinGW + SFML + CLion (Windows 10)
« on: April 03, 2020, 04:27:15 pm »
See the following thread on how to write CMake for SFML from SFML 2.5.1 onwards: https://en.sfml-dev.org/forums/index.php?topic=24070.0

I tried everything even it. It works only if i merge sfml and mingw folders.

5
General / MinGW + SFML + CLion (Windows 10)
« on: April 03, 2020, 01:47:15 pm »
Hello, I tried everything to set it up, but it didn't help. I use MinGW 32-bit (I ve downloaded it from link on sfml download page) and SFML for MinGW 32-bit. Here are my CMake and code (default).



#include <SFML/Graphics.hpp>


int main()
{
    sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
    sf::CircleShape shape(100.f);
    shape.setFillColor(sf::Color::Green);


    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }


        window.clear();
        window.draw(shape);
        window.display();
    }


    return 0;
}
 



cmake_minimum_required(VERSION 3.14)
set(PROJECT_NAME MyGame)


project(${PROJECT_NAME})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -static")


set(CMAKE_CXX_STANDARD 17)


set(SOURCE_FILES main.cpp)


if (CMAKE_BUILD_TYPE STREQUAL "Release")
    add_executable(${PROJECT_NAME} WIN32 ${SOURCE_FILES})
else ()
    add_executable(${PROJECT_NAME} ${SOURCE_FILES})
endif ()


set(SFML_ROOT "${CMAKE_SOURCE_DIR}/SFML-2.5.1")
set(SFML_DIR "${CMAKE_SOURCE_DIR}/SFML-2.5.1/lib/cmake/SFML")
#set(SFML_STATIC_LIBRARIES TRUE)


set(CMAKE_MODULE_PATH "${SFML_ROOT}/lib/cmake/SFML")
find_package(SFML 2 REQUIRED COMPONENTS audio graphics window system)
if (SFML_FOUND)
    include_directories(${SFML_INCLUDE_DIR})
    link_directories(${SFML_LINK_DIR})
    target_link_libraries(${PROJECT_NAME} ${SFML_LIBRARIES} ${SFML_DEPENDENCIES})
else ()
    message("SFML NOT FOUND")
endif()
 


I've tried everything; I need SFML libs folder in my project folder.

====================[ Build | MyGame | Release ]================================
"C:\Program Files\JetBrains\CLion\bin\cmake\win\bin\cmake.exe" --build "D:\JetBrains Projects\CLion Projects\MyGame\cmake-build-release" --target MyGame -- -j 4
-- Found SFML 2.5.1 in D:/JetBrains Projects/CLion Projects/MyGame/SFML-2.5.1/lib/cmake/SFML
-- Configuring done
-- Generating done
-- Build files have been written to: D:/JetBrains Projects/CLion Projects/MyGame/cmake-build-release
[ 50%] Building CXX object CMakeFiles/MyGame.dir/main.cpp.obj
D:\JetBrains Projects\CLion Projects\MyGame\main.cpp:1:10: fatal error: SFML/Graphics.hpp: No such file or directory
 #include <SFML/Graphics.hpp>
          ^~~~~~~~~~~~~~~~~~~
compilation terminated.
mingw32-make.exe[3]: *** [CMakeFiles\MyGame.dir\build.make:62: CMakeFiles/MyGame.dir/main.cpp.obj] Error 1
mingw32-make.exe[2]: *** [CMakeFiles\Makefile2:72: CMakeFiles/MyGame.dir/all] Error 2
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:84: CMakeFiles/MyGame.dir/rule] Error 2
mingw32-make.exe: *** [Makefile:117: MyGame] Error 2
 

Pages: [1]
anything