cmake_minimum_required(VERSION 3.17)
project(AutoBackupScript VERSION 0.1.0 LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 20)
include_directories(headers)
set(SFML_DIR "c:/SFML/lib/cmake/SFML") # Pfad zum SFML CMake-Modul
add_subdirectory(TGUI)
# list of source files
set(SOURCES
#src/main.cpp
src/ScalableLoginScreen.cpp
)
# add executable
add_executable(AutoBackupScript ${SOURCES})
target_link_libraries(AutoBackupScript PRIVATE TGUI::TGUI)
# searching and linking sfml
find_package(SFML COMPONENTS system window graphics network audio REQUIRED)
if (SFML_FOUND)
target_link_libraries(AutoBackupScript PRIVATE sfml-system sfml-window sfml-graphics sfml-network sfml-audio)
endif()
add_custom_command(
TARGET AutoBackupScript POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE:tgui>" "."
VERBATIM)
# copying the Dll files in the build directory
if(WIN32)
file(GLOB BINARY_DEP_DLLS "c:/SFML/bin/*.dll")
file(COPY ${BINARY_DEP_DLLS} DESTINATION ${CMAKE_BINARY_DIR})
file(GLOB MINGW_DEP_DLLS "C:/mingw64/bin/*.dll")
file(COPY ${MINGW_DEP_DLLS} DESTINATION ${CMAKE_BINARY_DIR})
endif()
Quote0xc000012f seems to mean that the "Microsoft Visual C++ Redistributable" isn't installed, which is a bit weird in this case. To run any software that was build with Visual Studio, you need to have the redistributable installed for that Visual Studio version. It raises a question though: what code is built with Visual C++? You are building with MinGW, the precompiled SFML libraries were build with MinGW, and TGUI is being build together with your project and also with the MinGW compiler.It seems like it, but that is super confusing.
add_custom_command(
TARGET AutoBackupScript POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE:tgui>" "."
VERBATIM)
Quote from: texus on 28 March 2024, 08:39:33It's possible, but it's hard to say if you don't actually get an error message. Are the sfml and dll files placed next to the exe?
QuoteCould I be overlooking something, such as copying .dll files or a similar requirement?It's possible, but it's hard to say if you don't actually get an error message. Are the sfml and dll files placed next to the exe?
int main()
{
try
{
// <Put your existing code here>
return 0;
}
catch (const tgui::Exception& e)
{
std::cerr << "TGUI exception: " << e.what() << std::endl;
return 1;
}
}
Quote from: texus on 27 March 2024, 22:45:23Quoteis that something I should consider in general or is it more something for debugging?
It's only for debugging.
The higher the number, the faster the project will build (as the number indicates how many source files can be compiled simultaneously). At least as long as the number doesn't exceed the amount of CPU threads your processor has (a higher number will work but won't make it faster) and as long as you have sufficient RAM (which becomes important for very high values).
Setting it to 1 means that all operations are done sequentially and nothing is done in parallel. This makes building much slower, but then the logs will properly show you which step is being executed when the error happens.