Change qmake to cmake and build sfml statically
This commit is contained in:
parent
8f8c2918f3
commit
a624b4f5f5
|
@ -1 +1,2 @@
|
|||
*.user
|
||||
SFML-2.5.1
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(sliding-puzzle LANGUAGES CXX)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(SOURCES application.cpp board.cpp main.cpp)
|
||||
set(HEADER_FILES application.h board.h filepath_util.h output_util.h)
|
||||
|
||||
set(SFML_STATIC_LIBRARIES TRUE) #set to FALSE if you have sfml installed from package manager and you don't want to link it statically
|
||||
|
||||
# STATIC #
|
||||
# You need to build SFML from sources with cmake
|
||||
if (SFML_STATIC_LIBRARIES)
|
||||
set(SFML_LIB_DIR
|
||||
${CMAKE_SOURCE_DIR}/SFML-2.5.1/lib/libsfml-graphics.so
|
||||
${CMAKE_SOURCE_DIR}/SFML-2.5.1/lib/libsfml-system.so
|
||||
${CMAKE_SOURCE_DIR}/SFML-2.5.1/lib/libsfml-window.so)
|
||||
set(SFML_INCL_DIR ${CMAKE_SOURCE_DIR}/SFML-2.5.1/include)
|
||||
|
||||
include_directories(${SFML_INCL_DIR})
|
||||
|
||||
add_executable(sliding-puzzle ${SOURCES} ${HEADER_FILES} )
|
||||
target_link_libraries(sliding-puzzle ${SFML_LIB_DIR})
|
||||
endif()
|
||||
|
||||
# DYNAMIC #
|
||||
# You only need to install SFML from your package manager
|
||||
if (NOT SFML_STATIC_LIBRARIES)
|
||||
find_package(SFML REQUIRED graphics window system)
|
||||
include_directories(${SFML_INCLUDE_DIR})
|
||||
add_executable(sliding-puzzle ${SOURCES} ${HEADER_FILES} )
|
||||
target_link_libraries(sliding-puzzle ${SFML_LIBRARIES} ${SFML_DEPENDENCIES})
|
||||
endif()
|
|
@ -1,4 +1,5 @@
|
|||
#include <SFML/Window/Event.hpp>
|
||||
#include <SFML/System/Time.hpp>
|
||||
#include "application.h"
|
||||
|
||||
// Hardcoded for now
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
TEMPLATE = app
|
||||
QMAKE_CXXFLAGS = -Wall -Werror -Wextra -Wpedantic -Wconversion -std=c++17 -O2 -g
|
||||
CONFIG += c++17
|
||||
CONFIG -= app_bundle
|
||||
CONFIG -= qt
|
||||
|
||||
SOURCES += \
|
||||
board.cpp \
|
||||
application.cpp \
|
||||
main.cpp
|
||||
|
||||
HEADERS += \
|
||||
board.h \
|
||||
filepath_util.h \
|
||||
application.h \
|
||||
output_util.h
|
||||
|
||||
unix:LIBS += -lsfml-graphics -lsfml-audio -lsfml-window -lsfml-system
|
Loading…
Reference in New Issue