Skip to content

Commit 80f232f

Browse files
committed
Add G++7 into Travis build env
1 parent b4c5cc4 commit 80f232f

File tree

3 files changed

+221
-2
lines changed

3 files changed

+221
-2
lines changed

.travis.yml

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
language: cpp
2-
dist: xenial
2+
dist: trusty
33
sudo: required
44

55
compiler:
@@ -8,7 +8,17 @@ compiler:
88
os:
99
- linux
1010

11+
addons:
12+
apt:
13+
sources:
14+
- ubuntu-toolchain-r-test
15+
packages:
16+
- gcc-7
17+
- g++-7
18+
1119
before_script:
20+
- export CC=gcc-7
21+
- export CXX=g++-7
1222
- sudo apt install wget unzip
1323
- version="3.2.1"
1424
- wget "https://github.com/glfw/glfw/releases/download/${version}/glfw-${version}.zip"

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ cmake_minimum_required (VERSION 3.8)
55
set (CMAKE_CXX_STANDARD 17)
66

77
project ("RubeusCore")
8-
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "/usr/share/SFML/cmake/Modules/")
8+
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "./cmake_modules/")
99
set(SFML_STATIC false)
1010

1111
if (WIN32)

cmake_modules/FindSFML.cmake

+209
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
# This script locates the SFML library
2+
# ------------------------------------
3+
#
4+
# Usage
5+
# -----
6+
#
7+
# When you try to locate the SFML libraries, you must specify which modules you want to use (system, window, graphics, network, audio, main).
8+
# If none is given, the SFML_LIBRARIES variable will be empty and you'll end up linking to nothing.
9+
# example:
10+
# find_package(SFML COMPONENTS graphics window system) // find the graphics, window and system modules
11+
#
12+
# You can enforce a specific version, either MAJOR.MINOR or only MAJOR.
13+
# If nothing is specified, the version won't be checked (ie. any version will be accepted).
14+
# example:
15+
# find_package(SFML COMPONENTS ...) // no specific version required
16+
# find_package(SFML 2 COMPONENTS ...) // any 2.x version
17+
# find_package(SFML 2.4 COMPONENTS ...) // version 2.4 or greater
18+
#
19+
# By default, the dynamic libraries of SFML will be found. To find the static ones instead,
20+
# you must set the SFML_STATIC_LIBRARIES variable to TRUE before calling find_package(SFML ...).
21+
# In case of static linking, the SFML_STATIC macro will also be defined by this script.
22+
# example:
23+
# set(SFML_STATIC_LIBRARIES TRUE)
24+
# find_package(SFML 2 COMPONENTS network system)
25+
#
26+
# On Mac OS X if SFML_STATIC_LIBRARIES is not set to TRUE then by default CMake will search for frameworks unless
27+
# CMAKE_FIND_FRAMEWORK is set to "NEVER" for example. Please refer to CMake documentation for more details.
28+
# Moreover, keep in mind that SFML frameworks are only available as release libraries unlike dylibs which
29+
# are available for both release and debug modes.
30+
#
31+
# If SFML is not installed in a standard path, you can use the SFML_ROOT CMake (or environment) variable
32+
# to tell CMake where SFML is.
33+
#
34+
# Output
35+
# ------
36+
#
37+
# This script defines the following variables:
38+
# - For each specified module XXX (system, window, graphics, network, audio, main):
39+
# - SFML_XXX_LIBRARY_DEBUG: the name of the debug library of the xxx module (set to SFML_XXX_LIBRARY_RELEASE is no debug version is found)
40+
# - SFML_XXX_LIBRARY_RELEASE: the name of the release library of the xxx module (set to SFML_XXX_LIBRARY_DEBUG is no release version is found)
41+
# - SFML_XXX_LIBRARY: the name of the library to link to for the xxx module (includes both debug and optimized names if necessary)
42+
# - SFML_XXX_FOUND: true if either the debug or release library of the xxx module is found
43+
# - SFML_LIBRARIES: the list of all libraries corresponding to the required modules
44+
# - SFML_FOUND: true if all the required modules are found
45+
# - SFML_INCLUDE_DIR: the path where SFML headers are located (the directory containing the SFML/Config.hpp file)
46+
#
47+
# example:
48+
# find_package(SFML 2 COMPONENTS system window graphics audio REQUIRED)
49+
# include_directories(${SFML_INCLUDE_DIR})
50+
# add_executable(myapp ...)
51+
# target_link_libraries(myapp ${SFML_LIBRARIES})
52+
53+
# define the SFML_STATIC macro if static build was chosen
54+
if(SFML_STATIC_LIBRARIES)
55+
add_definitions(-DSFML_STATIC)
56+
endif()
57+
58+
# deduce the libraries suffix from the options
59+
set(FIND_SFML_LIB_SUFFIX "")
60+
if(SFML_STATIC_LIBRARIES)
61+
set(FIND_SFML_LIB_SUFFIX "${FIND_SFML_LIB_SUFFIX}-s")
62+
endif()
63+
64+
# find the SFML include directory
65+
find_path(SFML_INCLUDE_DIR SFML/Config.hpp
66+
PATH_SUFFIXES include
67+
PATHS
68+
${SFML_ROOT}
69+
$ENV{SFML_ROOT}
70+
~/Library/Frameworks
71+
/Library/Frameworks
72+
/usr/local/
73+
/usr/
74+
/sw # Fink
75+
/opt/local/ # DarwinPorts
76+
/opt/csw/ # Blastwave
77+
/opt/)
78+
79+
# check the version number
80+
set(SFML_VERSION_OK TRUE)
81+
if(SFML_FIND_VERSION AND SFML_INCLUDE_DIR)
82+
# extract the major and minor version numbers from SFML/Config.hpp
83+
# we have to handle framework a little bit differently :
84+
if("${SFML_INCLUDE_DIR}" MATCHES "SFML.framework")
85+
set(SFML_CONFIG_HPP_INPUT "${SFML_INCLUDE_DIR}/Headers/Config.hpp")
86+
else()
87+
set(SFML_CONFIG_HPP_INPUT "${SFML_INCLUDE_DIR}/SFML/Config.hpp")
88+
endif()
89+
FILE(READ "${SFML_CONFIG_HPP_INPUT}" SFML_CONFIG_HPP_CONTENTS)
90+
STRING(REGEX MATCH ".*#define SFML_VERSION_MAJOR ([0-9]+).*#define SFML_VERSION_MINOR ([0-9]+).*" SFML_CONFIG_HPP_CONTENTS "${SFML_CONFIG_HPP_CONTENTS}")
91+
STRING(REGEX REPLACE ".*#define SFML_VERSION_MAJOR ([0-9]+).*" "\\1" SFML_VERSION_MAJOR "${SFML_CONFIG_HPP_CONTENTS}")
92+
STRING(REGEX REPLACE ".*#define SFML_VERSION_MINOR ([0-9]+).*" "\\1" SFML_VERSION_MINOR "${SFML_CONFIG_HPP_CONTENTS}")
93+
math(EXPR SFML_REQUESTED_VERSION "${SFML_FIND_VERSION_MAJOR} * 10 + ${SFML_FIND_VERSION_MINOR}")
94+
95+
# if we could extract them, compare with the requested version number
96+
if (SFML_VERSION_MAJOR)
97+
# transform version numbers to an integer
98+
math(EXPR SFML_VERSION "${SFML_VERSION_MAJOR} * 10 + ${SFML_VERSION_MINOR}")
99+
100+
# compare them
101+
if(SFML_VERSION LESS SFML_REQUESTED_VERSION)
102+
set(SFML_VERSION_OK FALSE)
103+
endif()
104+
else()
105+
# SFML version is < 2.0
106+
if (SFML_REQUESTED_VERSION GREATER 19)
107+
set(SFML_VERSION_OK FALSE)
108+
set(SFML_VERSION_MAJOR 1)
109+
set(SFML_VERSION_MINOR x)
110+
endif()
111+
endif()
112+
endif()
113+
114+
# find the requested modules
115+
set(SFML_FOUND TRUE) # will be set to false if one of the required modules is not found
116+
set(FIND_SFML_LIB_PATHS
117+
${SFML_ROOT}
118+
$ENV{SFML_ROOT}
119+
~/Library/Frameworks
120+
/Library/Frameworks
121+
/usr/local
122+
/usr
123+
/sw
124+
/opt/local
125+
/opt/csw
126+
/opt)
127+
foreach(FIND_SFML_COMPONENT ${SFML_FIND_COMPONENTS})
128+
string(TOLOWER ${FIND_SFML_COMPONENT} FIND_SFML_COMPONENT_LOWER)
129+
string(TOUPPER ${FIND_SFML_COMPONENT} FIND_SFML_COMPONENT_UPPER)
130+
set(FIND_SFML_COMPONENT_NAME sfml-${FIND_SFML_COMPONENT_LOWER}${FIND_SFML_LIB_SUFFIX})
131+
132+
# no suffix for sfml-main, it is always a static library
133+
if(FIND_SFML_COMPONENT_LOWER STREQUAL "main")
134+
set(FIND_SFML_COMPONENT_NAME sfml-${FIND_SFML_COMPONENT_LOWER})
135+
endif()
136+
137+
# debug library
138+
find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG
139+
NAMES ${FIND_SFML_COMPONENT_NAME}-d
140+
PATH_SUFFIXES lib64 lib
141+
PATHS ${FIND_SFML_LIB_PATHS})
142+
143+
# release library
144+
find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE
145+
NAMES ${FIND_SFML_COMPONENT_NAME}
146+
PATH_SUFFIXES lib64 lib
147+
PATHS ${FIND_SFML_LIB_PATHS})
148+
149+
if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG OR SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE)
150+
# library found
151+
set(SFML_${FIND_SFML_COMPONENT_UPPER}_FOUND TRUE)
152+
153+
# if both are found, set SFML_XXX_LIBRARY to contain both
154+
if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG AND SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE)
155+
set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY debug ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG}
156+
optimized ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE})
157+
endif()
158+
159+
# if only one debug/release variant is found, set the other to be equal to the found one
160+
if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG AND NOT SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE)
161+
# debug and not release
162+
set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG})
163+
set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG})
164+
endif()
165+
if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE AND NOT SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG)
166+
# release and not debug
167+
set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE})
168+
set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE})
169+
endif()
170+
else()
171+
# library not found
172+
set(SFML_FOUND FALSE)
173+
set(SFML_${FIND_SFML_COMPONENT_UPPER}_FOUND FALSE)
174+
set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY "")
175+
set(FIND_SFML_MISSING "${FIND_SFML_MISSING} SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY")
176+
endif()
177+
178+
# mark as advanced
179+
MARK_AS_ADVANCED(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY
180+
SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE
181+
SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG)
182+
183+
# add to the global list of libraries
184+
set(SFML_LIBRARIES ${SFML_LIBRARIES} "${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY}")
185+
endforeach()
186+
187+
# handle errors
188+
if(NOT SFML_VERSION_OK)
189+
# SFML version not ok
190+
set(FIND_SFML_ERROR "SFML found but version too low (requested: ${SFML_FIND_VERSION}, found: ${SFML_VERSION_MAJOR}.${SFML_VERSION_MINOR})")
191+
set(SFML_FOUND FALSE)
192+
elseif(NOT SFML_FOUND)
193+
# include directory or library not found
194+
set(FIND_SFML_ERROR "Could NOT find SFML (missing: ${FIND_SFML_MISSING})")
195+
endif()
196+
if (NOT SFML_FOUND)
197+
if(SFML_FIND_REQUIRED)
198+
# fatal error
199+
message(FATAL_ERROR ${FIND_SFML_ERROR})
200+
elseif(NOT SFML_FIND_QUIETLY)
201+
# error but continue
202+
message("${FIND_SFML_ERROR}")
203+
endif()
204+
endif()
205+
206+
# handle success
207+
if(SFML_FOUND)
208+
message(STATUS "Found SFML ${SFML_VERSION_MAJOR}.${SFML_VERSION_MINOR} in ${SFML_INCLUDE_DIR}")
209+
endif()

0 commit comments

Comments
 (0)