Mercurial > malikania
annotate libcommon/CMakeLists.txt @ 98:f4d23ad4aa27
Common: refactoring class mlk::size
1. Make uniform size representation in JSON format:
{
"width": 100,
"height": 200
}
The Javascript API was using this form while an array was used in loaders.
2. Create brand new functions in util::json to parse mlk::size objects,
Updated util::json::require_(u)int as well.
3. Add new tests for mlk::size object,
4. Get rid of utilities in loader as they are in util::json instead.
author | David Demelier <markand@malikania.fr> |
---|---|
date | Tue, 04 Jul 2017 13:23:15 +0200 |
parents | 301599387b40 |
children | 0addfab87b17 |
rev | line source |
---|---|
33
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
30
diff
changeset
|
1 # |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
30
diff
changeset
|
2 # CMakeLists.txt -- CMake build system for malikania |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
30
diff
changeset
|
3 # |
76 | 4 # Copyright (c) 2013-2017 Malikania Authors |
33
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
30
diff
changeset
|
5 # |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
30
diff
changeset
|
6 # Permission to use, copy, modify, and/or distribute this software for any |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
30
diff
changeset
|
7 # purpose with or without fee is hereby granted, provided that the above |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
30
diff
changeset
|
8 # copyright notice and this permission notice appear in all copies. |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
30
diff
changeset
|
9 # |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
30
diff
changeset
|
10 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
30
diff
changeset
|
11 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
30
diff
changeset
|
12 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
30
diff
changeset
|
13 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
30
diff
changeset
|
14 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
30
diff
changeset
|
15 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
30
diff
changeset
|
16 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
30
diff
changeset
|
17 # |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
30
diff
changeset
|
18 |
67
913f59490e2d
CMake: add mlk prefixes to libraries
David Demelier <markand@malikania.fr>
parents:
64
diff
changeset
|
19 project(libmlk-common) |
49
2804ae55c70f
CMake: big cleanup, closes #598
David Demelier <markand@malikania.fr>
parents:
42
diff
changeset
|
20 |
33
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
30
diff
changeset
|
21 set( |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
30
diff
changeset
|
22 HEADERS |
67
913f59490e2d
CMake: add mlk prefixes to libraries
David Demelier <markand@malikania.fr>
parents:
64
diff
changeset
|
23 ${libmlk-common_SOURCE_DIR}/malikania/game.hpp |
913f59490e2d
CMake: add mlk prefixes to libraries
David Demelier <markand@malikania.fr>
parents:
64
diff
changeset
|
24 ${libmlk-common_SOURCE_DIR}/malikania/id.hpp |
81
301599387b40
Common: remove class prefix in resources_locator|loader
David Demelier <markand@malikania.fr>
parents:
76
diff
changeset
|
25 ${libmlk-common_SOURCE_DIR}/malikania/loader.hpp |
301599387b40
Common: remove class prefix in resources_locator|loader
David Demelier <markand@malikania.fr>
parents:
76
diff
changeset
|
26 ${libmlk-common_SOURCE_DIR}/malikania/locator.hpp |
98
f4d23ad4aa27
Common: refactoring class mlk::size
David Demelier <markand@malikania.fr>
parents:
81
diff
changeset
|
27 ${libmlk-common_SOURCE_DIR}/malikania/size.hpp |
67
913f59490e2d
CMake: add mlk prefixes to libraries
David Demelier <markand@malikania.fr>
parents:
64
diff
changeset
|
28 ${libmlk-common_SOURCE_DIR}/malikania/util.hpp |
33
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
30
diff
changeset
|
29 ) |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
30
diff
changeset
|
30 |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
30
diff
changeset
|
31 set( |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
30
diff
changeset
|
32 SOURCES |
81
301599387b40
Common: remove class prefix in resources_locator|loader
David Demelier <markand@malikania.fr>
parents:
76
diff
changeset
|
33 ${libmlk-common_SOURCE_DIR}/malikania/loader.cpp |
301599387b40
Common: remove class prefix in resources_locator|loader
David Demelier <markand@malikania.fr>
parents:
76
diff
changeset
|
34 ${libmlk-common_SOURCE_DIR}/malikania/locator.cpp |
67
913f59490e2d
CMake: add mlk prefixes to libraries
David Demelier <markand@malikania.fr>
parents:
64
diff
changeset
|
35 ${libmlk-common_SOURCE_DIR}/malikania/util.cpp |
33
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
30
diff
changeset
|
36 ) |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
30
diff
changeset
|
37 |
49
2804ae55c70f
CMake: big cleanup, closes #598
David Demelier <markand@malikania.fr>
parents:
42
diff
changeset
|
38 if (WITH_BACKEND MATCHES "SDL") |
33
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
30
diff
changeset
|
39 find_package(SDL2 REQUIRED) |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
30
diff
changeset
|
40 |
67
913f59490e2d
CMake: add mlk prefixes to libraries
David Demelier <markand@malikania.fr>
parents:
64
diff
changeset
|
41 list(APPEND HEADERS ${libmlk-common_SOURCE_DIR}/malikania/${WITH_BACKEND_DIR}/sdl_util.hpp) |
913f59490e2d
CMake: add mlk prefixes to libraries
David Demelier <markand@malikania.fr>
parents:
64
diff
changeset
|
42 list(APPEND SOURCES ${libmlk-common_SOURCE_DIR}/malikania/${WITH_BACKEND_DIR}/sdl_util.cpp) |
33
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
30
diff
changeset
|
43 list(APPEND INCLUDES ${SDL2_INCLUDE_DIRS}) |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
30
diff
changeset
|
44 list(APPEND LIBRARIES ${SDL2_LIBRARIES}) |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
30
diff
changeset
|
45 endif () |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
30
diff
changeset
|
46 |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
30
diff
changeset
|
47 if (WIN32) |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
30
diff
changeset
|
48 list(APPEND LIBRARIES ws2_32) |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
30
diff
changeset
|
49 endif () |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
30
diff
changeset
|
50 |
49
2804ae55c70f
CMake: big cleanup, closes #598
David Demelier <markand@malikania.fr>
parents:
42
diff
changeset
|
51 malikania_define_library( |
67
913f59490e2d
CMake: add mlk prefixes to libraries
David Demelier <markand@malikania.fr>
parents:
64
diff
changeset
|
52 PROJECT libmlk-common |
913f59490e2d
CMake: add mlk prefixes to libraries
David Demelier <markand@malikania.fr>
parents:
64
diff
changeset
|
53 TARGET libmlk-common |
33
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
30
diff
changeset
|
54 SOURCES ${HEADERS} ${SOURCES} |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
30
diff
changeset
|
55 FLAGS "MALIKANIA_COMMON_BUILD" |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
30
diff
changeset
|
56 PUBLIC_INCLUDES |
55
576c35ccdff6
Common: add Boost include directories
David Demelier <markand@malikania.fr>
parents:
49
diff
changeset
|
57 ${Boost_INCLUDE_DIRS} |
33
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
30
diff
changeset
|
58 ${INCLUDES} |
67
913f59490e2d
CMake: add mlk prefixes to libraries
David Demelier <markand@malikania.fr>
parents:
64
diff
changeset
|
59 $<BUILD_INTERFACE:${libmlk-common_SOURCE_DIR}/malikania> |
913f59490e2d
CMake: add mlk prefixes to libraries
David Demelier <markand@malikania.fr>
parents:
64
diff
changeset
|
60 $<BUILD_INTERFACE:${libmlk-common_SOURCE_DIR}> |
41
3645200f46bf
Misc: switch to Boost.Timer, closes #586
David Demelier <markand@malikania.fr>
parents:
39
diff
changeset
|
61 LIBRARIES |
3645200f46bf
Misc: switch to Boost.Timer, closes #586
David Demelier <markand@malikania.fr>
parents:
39
diff
changeset
|
62 json |
3645200f46bf
Misc: switch to Boost.Timer, closes #586
David Demelier <markand@malikania.fr>
parents:
39
diff
changeset
|
63 ${Boost_LIBRARIES} |
3645200f46bf
Misc: switch to Boost.Timer, closes #586
David Demelier <markand@malikania.fr>
parents:
39
diff
changeset
|
64 ${LIBRARIES} |
33
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
30
diff
changeset
|
65 ) |