diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-02-08 00:19:24 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-02-08 00:19:24 -0500 |
commit | bc63fa57ced1c7329f7fdcfd168eaf7e290158bc (patch) | |
tree | f3e8fc58c98590efed0c8e192dfdc80fd1e44f11 | |
parent | 003c00be8bda97b20c6aab408b6bfe57563b2b61 (diff) | |
download | therapy-bc63fa57ced1c7329f7fdcfd168eaf7e290158bc.tar.gz therapy-bc63fa57ced1c7329f7fdcfd168eaf7e290158bc.tar.bz2 therapy-bc63fa57ced1c7329f7fdcfd168eaf7e290158bc.zip |
Modernized CMake files
Also removed an unnecessary cmake package helper.
-rw-r--r-- | CMakeLists.txt | 35 | ||||
-rw-r--r-- | cmake/FindMxml.cmake | 31 | ||||
-rw-r--r-- | tools/mapedit/CMakeLists.txt | 27 |
3 files changed, 17 insertions, 76 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 14278cb..567936a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -1,32 +1,18 @@ | |||
1 | cmake_minimum_required(VERSION 2.6) | 1 | cmake_minimum_required (VERSION 3.1) |
2 | project(Aromatherapy) | 2 | project (Aromatherapy) |
3 | 3 | ||
4 | # Use our modified FindSDL2* modules | 4 | set(CMAKE_BUILD_TYPE Debug) |
5 | |||
6 | # Set directory to look for package helpers. | ||
5 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${Aromatherapy_SOURCE_DIR}/cmake") | 7 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${Aromatherapy_SOURCE_DIR}/cmake") |
6 | # Set an output directory for our binaries | ||
7 | set(BIN_DIR ${Aromatherapy_SOURCE_DIR}/bin) | ||
8 | 8 | ||
9 | # Bump up warning levels appropriately for clang, gcc & msvc | 9 | # Get dependencies. |
10 | # Also set debug/optimization flags depending on the build type. IDE users choose this when | ||
11 | # selecting the build mode in their IDE | ||
12 | if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") | ||
13 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -std=c++11") | ||
14 | set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG} -g") | ||
15 | set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE} -O2") | ||
16 | elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC") | ||
17 | if (CMAKE_CXX_FLAGS MATCHES "/W[0-4]") | ||
18 | string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") | ||
19 | else() | ||
20 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") | ||
21 | endif() | ||
22 | endif() | ||
23 | 10 | ||
24 | find_package(PkgConfig) | 11 | find_package(PkgConfig) |
12 | pkg_check_modules(GLFW REQUIRED glfw3) | ||
25 | 13 | ||
26 | # Look up SDL2 and add the include directory to our include path | ||
27 | find_package(OpenGL REQUIRED) | 14 | find_package(OpenGL REQUIRED) |
28 | find_package(GLEW REQUIRED) | 15 | find_package(GLEW REQUIRED) |
29 | pkg_check_modules(GLFW REQUIRED glfw3) | ||
30 | find_package(portaudio REQUIRED) | 16 | find_package(portaudio REQUIRED) |
31 | find_package(libsndfile REQUIRED) | 17 | find_package(libsndfile REQUIRED) |
32 | find_package(libxml2 REQUIRED) | 18 | find_package(libxml2 REQUIRED) |
@@ -52,8 +38,6 @@ link_directories( | |||
52 | ${GLFW_LIBRARY_DIRS} | 38 | ${GLFW_LIBRARY_DIRS} |
53 | ) | 39 | ) |
54 | 40 | ||
55 | # include_directories(${SDL2_INCLUDE_DIR}) | ||
56 | set(CMAKE_BUILD_TYPE Debug) | ||
57 | add_executable(Aromatherapy | 41 | add_executable(Aromatherapy |
58 | src/main.cpp | 42 | src/main.cpp |
59 | src/map.cpp | 43 | src/map.cpp |
@@ -69,9 +53,12 @@ add_executable(Aromatherapy | |||
69 | src/components/physics_body.cpp | 53 | src/components/physics_body.cpp |
70 | src/components/player_physics.cpp | 54 | src/components/player_physics.cpp |
71 | src/components/player_sprite.cpp | 55 | src/components/player_sprite.cpp |
56 | src/components/pondering.cpp | ||
72 | src/components/simple_collider.cpp | 57 | src/components/simple_collider.cpp |
73 | src/components/static_image.cpp | 58 | src/components/static_image.cpp |
74 | src/components/user_movement.cpp | 59 | src/components/user_movement.cpp |
75 | ) | 60 | ) |
61 | |||
62 | set_property(TARGET Aromatherapy PROPERTY CXX_STANDARD 11) | ||
63 | set_property(TARGET Aromatherapy PROPERTY CXX_STANDARD_REQUIRED ON) | ||
76 | target_link_libraries(Aromatherapy ${ALL_LIBS}) | 64 | target_link_libraries(Aromatherapy ${ALL_LIBS}) |
77 | install(TARGETS Aromatherapy RUNTIME DESTINATION ${BIN_DIR}) | ||
diff --git a/cmake/FindMxml.cmake b/cmake/FindMxml.cmake deleted file mode 100644 index 49daa4f..0000000 --- a/cmake/FindMxml.cmake +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | # - Try to find Motif (or lesstif) | ||
2 | # Once done this will define: | ||
3 | # MXML_FOUND - system has MXML | ||
4 | # MXML_INCLUDE_DIR - incude paths to use Motif | ||
5 | # MXML_LIBRARIES - Link these to use Motif | ||
6 | |||
7 | SET(MXML_FOUND 0) | ||
8 | |||
9 | IF(UNIX) | ||
10 | FIND_PATH(MXML_INCLUDE_DIR | ||
11 | mxml.h | ||
12 | /usr/include | ||
13 | ) | ||
14 | |||
15 | FIND_LIBRARY(MXML_LIBRARIES | ||
16 | mxml | ||
17 | /usr/lib | ||
18 | ) | ||
19 | |||
20 | ENDIF(UNIX) | ||
21 | |||
22 | # handle the QUIETLY and REQUIRED arguments and set MXML_FOUND to TRUE if | ||
23 | # all listed variables are TRUE | ||
24 | INCLUDE(FindPackageHandleStandardArgs) | ||
25 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(MXML DEFAULT_MSG MXML_LIBRARIES MXML_INCLUDE_DIR) | ||
26 | |||
27 | |||
28 | MARK_AS_ADVANCED( | ||
29 | MXML_INCLUDE_DIR | ||
30 | MXML_LIBRARIES | ||
31 | ) \ No newline at end of file | ||
diff --git a/tools/mapedit/CMakeLists.txt b/tools/mapedit/CMakeLists.txt index b225834..4ce9133 100644 --- a/tools/mapedit/CMakeLists.txt +++ b/tools/mapedit/CMakeLists.txt | |||
@@ -1,26 +1,9 @@ | |||
1 | cmake_minimum_required(VERSION 2.6) | 1 | cmake_minimum_required (VERSION 3.1) |
2 | project(AromatherapyMapEditor) | 2 | project (AromatherapyMapEditor) |
3 | 3 | ||
4 | # Set directory to look for package helpers. | ||
4 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${AromatherapyMapEditor_SOURCE_DIR}/cmake") | 5 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${AromatherapyMapEditor_SOURCE_DIR}/cmake") |
5 | # Set an output directory for our binaries | ||
6 | set(BIN_DIR ${AromatherapyMapEditor_SOURCE_DIR}/bin) | ||
7 | 6 | ||
8 | # Bump up warning levels appropriately for clang, gcc & msvc | ||
9 | # Also set debug/optimization flags depending on the build type. IDE users choose this when | ||
10 | # selecting the build mode in their IDE | ||
11 | if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") | ||
12 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -std=c++11") | ||
13 | set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG} -g -O0") | ||
14 | set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE} -O2") | ||
15 | elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC") | ||
16 | if (CMAKE_CXX_FLAGS MATCHES "/W[0-4]") | ||
17 | string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") | ||
18 | else() | ||
19 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") | ||
20 | endif() | ||
21 | endif() | ||
22 | |||
23 | # Look up SDL2 and add the include directory to our include path | ||
24 | find_package(wxWidgets REQUIRED core base) | 7 | find_package(wxWidgets REQUIRED core base) |
25 | include(${wxWidgets_USE_FILE}) | 8 | include(${wxWidgets_USE_FILE}) |
26 | 9 | ||
@@ -48,5 +31,7 @@ add_executable(AromatherapyMapEditor | |||
48 | src/undo.cpp | 31 | src/undo.cpp |
49 | src/mapselect_combo.cpp | 32 | src/mapselect_combo.cpp |
50 | ) | 33 | ) |
34 | |||
35 | set_property(TARGET AromatherapyMapEditor PROPERTY CXX_STANDARD 11) | ||
36 | set_property(TARGET AromatherapyMapEditor PROPERTY CXX_STANDARD_REQUIRED ON) | ||
51 | target_link_libraries(AromatherapyMapEditor ${ALL_LIBS}) | 37 | target_link_libraries(AromatherapyMapEditor ${ALL_LIBS}) |
52 | install(TARGETS AromatherapyMapEditor RUNTIME DESTINATION ${BIN_DIR}) | ||