2016-10-31 19:47:47 +00:00
|
|
|
cmake_minimum_required(VERSION 3.3 FATAL_ERROR)
|
2014-01-09 23:04:39 +00:00
|
|
|
project(CloonelJump CXX)
|
|
|
|
|
2014-08-25 15:32:48 +00:00
|
|
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/include")
|
|
|
|
|
|
|
|
include(TargetArch)
|
2016-11-11 19:37:35 +00:00
|
|
|
include(CTest)
|
2014-08-25 15:32:48 +00:00
|
|
|
|
2016-10-31 19:47:47 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -Wconversion")
|
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wextra -pedantic -Wconversion -DWITH_DEBUG_VISUALS -O0")
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall -Wextra -pedantic -Wconversion -O3")
|
2014-08-25 15:32:48 +00:00
|
|
|
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g -O0")
|
|
|
|
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3")
|
|
|
|
|
|
|
|
target_architecture(TARGET_ARCH)
|
|
|
|
message (STATUS "Target architecture: ${TARGET_ARCH}")
|
2014-01-09 23:04:39 +00:00
|
|
|
|
2014-08-04 16:57:14 +00:00
|
|
|
option(WITH_BUILTIN_PHYSFS "Force using the version of PhysFS accompanying the code even if a system library is available" OFF)
|
2014-08-06 15:44:28 +00:00
|
|
|
option(FORCE_OPENGLES "Try to chose the openGL ES renderer if available. Enable this on Raspberry Pi" OFF)
|
2014-08-06 19:04:57 +00:00
|
|
|
option(RASPBERRY_PI "Compile for Raspberry Pi" OFF)
|
2014-08-06 15:44:28 +00:00
|
|
|
|
2014-08-25 15:32:48 +00:00
|
|
|
if (TARGET_ARCH MATCHES "^x86_64$")
|
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -msse3")
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -msse3")
|
|
|
|
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -msse3")
|
|
|
|
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -msse3")
|
|
|
|
endif (TARGET_ARCH MATCHES "^x86_64$")
|
|
|
|
|
2014-08-06 19:04:57 +00:00
|
|
|
if (FORCE_OPENGLES OR RASPBERRY_PI)
|
2014-08-06 15:44:28 +00:00
|
|
|
add_definitions(-DFORCE_OPENGLES)
|
2014-08-06 19:04:57 +00:00
|
|
|
if (RASPBERRY_PI)
|
|
|
|
add_definitions(-DRASPBERRY_PI)
|
|
|
|
endif(RASPBERRY_PI)
|
|
|
|
endif (FORCE_OPENGLES OR RASPBERRY_PI)
|
2014-08-04 16:57:14 +00:00
|
|
|
|
2014-01-09 23:04:39 +00:00
|
|
|
include(FindPkgConfig)
|
|
|
|
PKG_SEARCH_MODULE(SDL2 REQUIRED sdl2)
|
|
|
|
|
2014-02-21 20:28:34 +00:00
|
|
|
find_package(PNG REQUIRED)
|
2014-07-30 11:46:50 +00:00
|
|
|
find_package(Boost 1.55.0 REQUIRED)
|
2014-08-04 16:57:14 +00:00
|
|
|
if (NOT WITH_BUILTIN_PHYSFS)
|
|
|
|
find_package(PhysFS 2.0.3)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (PHYSFS_FOUND)
|
|
|
|
message(STATUS "Using system's PhysFS, set WITH_BUILTIN_PHYSFS to on to override this")
|
|
|
|
else(PHYSFS_FOUND)
|
|
|
|
message(STATUS "Using internal PhysFS")
|
|
|
|
set(PHYSFS_INCLUDE_DIR "lib/physfs-2.0.3")
|
|
|
|
set(PHYSFS_LIBRARY "physfs")
|
|
|
|
endif(PHYSFS_FOUND)
|
2014-02-21 20:28:34 +00:00
|
|
|
|
2014-07-17 14:53:14 +00:00
|
|
|
add_definitions(
|
|
|
|
${PNG_DEFINITIONS}
|
2014-08-06 15:44:28 +00:00
|
|
|
# -DWITH_VERBOSE_OBS_MANAGER
|
2014-07-31 22:50:49 +00:00
|
|
|
-DWITH_VERBOSE_COLLIDER
|
2014-07-17 14:53:14 +00:00
|
|
|
)
|
2014-02-21 20:28:34 +00:00
|
|
|
|
2014-08-06 19:04:57 +00:00
|
|
|
if (RASPBERRY_PI)
|
|
|
|
message(STATUS "Will build for Raspberry Pi")
|
|
|
|
include_directories(SYSTEM
|
|
|
|
/opt/vc/include
|
2014-08-07 09:29:04 +00:00
|
|
|
/opt/vc/include/interface/vcos/pthreads
|
|
|
|
/opt/vc/include/interface/vmcs_host/linux
|
2014-08-06 19:04:57 +00:00
|
|
|
)
|
|
|
|
link_directories(
|
|
|
|
/opt/vc/lib
|
|
|
|
)
|
|
|
|
endif (RASPBERRY_PI)
|
|
|
|
|
2014-01-09 23:04:39 +00:00
|
|
|
include_directories(SYSTEM
|
|
|
|
${SDL2_INCLUDE_DIR}
|
2014-02-21 20:28:34 +00:00
|
|
|
${PNG_INCLUDE_DIRS}
|
2014-07-05 18:49:18 +00:00
|
|
|
${Boost_INCLUDE_DIRS}
|
2016-10-31 18:41:50 +00:00
|
|
|
lib/tree-3.1/src
|
2014-01-09 23:04:39 +00:00
|
|
|
)
|
|
|
|
include_directories(
|
|
|
|
src
|
2014-07-05 16:48:04 +00:00
|
|
|
src/movers
|
2014-01-09 23:04:39 +00:00
|
|
|
include
|
|
|
|
"${PROJECT_BINARY_DIR}"
|
2014-08-04 16:57:14 +00:00
|
|
|
${PHYSFS_INCLUDE_DIR}
|
2016-11-02 17:25:40 +00:00
|
|
|
lib/vectorwrapper/include
|
2014-01-09 23:04:39 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
configure_file(
|
|
|
|
"${PROJECT_SOURCE_DIR}/src/${PROJECT_NAME}Config.h.in"
|
|
|
|
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.h"
|
|
|
|
)
|
|
|
|
|
2014-08-04 16:57:14 +00:00
|
|
|
if (NOT PHYSFS_FOUND)
|
|
|
|
add_subdirectory(lib/physfs-2.0.3)
|
|
|
|
endif(NOT PHYSFS_FOUND)
|
2014-02-12 23:01:29 +00:00
|
|
|
|
2014-01-09 23:04:39 +00:00
|
|
|
add_executable(${PROJECT_NAME}
|
|
|
|
src/main.cpp
|
2014-02-08 22:11:26 +00:00
|
|
|
src/texture.cpp
|
|
|
|
src/sdlerror.cpp
|
|
|
|
src/sdlmain.cpp
|
2014-02-08 23:32:11 +00:00
|
|
|
src/gamebase.cpp
|
2014-02-11 23:27:55 +00:00
|
|
|
src/character.cpp
|
|
|
|
src/placeable.cpp
|
2014-02-12 23:01:29 +00:00
|
|
|
src/physicsfswrapper.cpp
|
2014-02-21 20:28:34 +00:00
|
|
|
src/gameplayscene.cpp
|
2014-07-05 16:48:04 +00:00
|
|
|
src/movers/mover.cpp
|
|
|
|
src/movers/moveroneshot.cpp
|
|
|
|
src/movers/moversine.cpp
|
2014-02-21 20:28:34 +00:00
|
|
|
src/gameplaysceneclassic.cpp
|
2014-07-05 16:48:04 +00:00
|
|
|
src/movers/moverrelative.cpp
|
2014-02-23 18:32:47 +00:00
|
|
|
src/inputbag.cpp
|
2014-07-05 16:48:04 +00:00
|
|
|
src/movers/moverleftright.cpp
|
2014-03-06 10:42:56 +00:00
|
|
|
src/tiledwallpaper.cpp
|
2014-03-12 10:04:22 +00:00
|
|
|
src/drawable.cpp
|
2014-03-19 16:31:10 +00:00
|
|
|
src/sizeratio.cpp
|
|
|
|
src/sizenotifiable.cpp
|
2014-07-28 09:00:55 +00:00
|
|
|
src/horzcollisionbar.cpp
|
2014-03-26 09:44:01 +00:00
|
|
|
src/platform.cpp
|
2014-07-16 21:42:37 +00:00
|
|
|
src/vectormath.cpp
|
2014-08-13 20:51:08 +00:00
|
|
|
src/platformspawner.cpp
|
2014-07-05 18:33:16 +00:00
|
|
|
src/movers/moverworld.cpp
|
2014-07-16 21:42:37 +00:00
|
|
|
src/line.cpp
|
2014-07-28 09:00:55 +00:00
|
|
|
src/collider.cpp
|
2014-08-13 20:45:37 +00:00
|
|
|
src/platformset.cpp
|
2014-08-19 19:49:08 +00:00
|
|
|
src/drawableline.cpp
|
2014-01-09 23:04:39 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
target_link_libraries(${PROJECT_NAME}
|
|
|
|
${SDL2_LIBRARIES}
|
2014-08-04 16:57:14 +00:00
|
|
|
${PHYSFS_LIBRARY}
|
2014-02-21 20:28:34 +00:00
|
|
|
${PNG_LIBRARIES}
|
2014-01-09 23:04:39 +00:00
|
|
|
)
|
2014-08-06 19:04:57 +00:00
|
|
|
|
2016-11-02 17:25:40 +00:00
|
|
|
target_compile_definitions(${PROJECT_NAME}
|
|
|
|
PRIVATE VWR_STATIC_CAST_RESULTS
|
|
|
|
PRIVATE VWR_SIZE_TYPE=uint32_t
|
|
|
|
)
|
|
|
|
|
2014-08-06 19:04:57 +00:00
|
|
|
if (RASPBERRY_PI)
|
|
|
|
target_link_libraries(${PROJECT_NAME}
|
|
|
|
bcm_host
|
|
|
|
)
|
|
|
|
endif(RASPBERRY_PI)
|
2016-10-31 19:47:47 +00:00
|
|
|
|
2016-11-11 19:37:35 +00:00
|
|
|
if (BUILD_TESTING)
|
|
|
|
add_subdirectory(test/unit)
|
|
|
|
endif()
|
2016-10-31 19:47:47 +00:00
|
|
|
target_compile_features(${PROJECT_NAME}
|
|
|
|
PRIVATE cxx_nullptr
|
|
|
|
PRIVATE cxx_range_for
|
|
|
|
PRIVATE cxx_lambdas
|
|
|
|
PRIVATE cxx_decltype_auto
|
|
|
|
PRIVATE cxx_defaulted_functions
|
|
|
|
PRIVATE cxx_deleted_functions
|
|
|
|
PRIVATE cxx_auto_type
|
|
|
|
PRIVATE cxx_decltype_incomplete_return_types
|
|
|
|
PRIVATE cxx_defaulted_move_initializers
|
|
|
|
PRIVATE cxx_noexcept
|
|
|
|
PRIVATE cxx_rvalue_references
|
|
|
|
PRIVATE cxx_delegating_constructors
|
|
|
|
)
|