MyCurry/CMakeLists.txt

121 lines
3.4 KiB
Text
Raw Normal View History

2016-10-23 22:48:30 +00:00
cmake_minimum_required(VERSION 3.2)
project(mycurry CXX)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/include")
include(TargetArch)
include(FindPkgConfig)
set(common_gcc_flags "-Wall -Wextra -pedantic -Wconversion")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${common_gcc_flags} -O0")
2016-10-23 22:48:30 +00:00
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${common_gcc_flags}")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${common_gcc_flags} -O0")
2016-10-23 22:48:30 +00:00
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${common_gcc_flags}")
option(CURRY_FORCE_OPENGLES "Try to chose the openGL ES renderer if available. Enable this on Raspberry Pi" OFF)
option(CURRY_RASPBERRY_PI "Compile for Raspberry Pi" OFF)
2016-10-26 22:06:59 +00:00
set(MYCURRY_RESOURCES_PATH "${CMAKE_CURRENT_SOURCE_DIR}" CACHE STRING "Path to the program's resources")
2016-10-23 22:48:30 +00:00
target_architecture(TARGET_ARCH)
message (STATUS "Target architecture: ${TARGET_ARCH}")
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$")
if (CURRY_FORCE_OPENGLES OR CURRY_RASPBERRY_PI)
add_definitions(-DFORCE_OPENGLES)
if (CURRY_RASPBERRY_PI)
add_definitions(-DRASPBERRY_PI)
endif(CURRY_RASPBERRY_PI)
endif (CURRY_FORCE_OPENGLES OR CURRY_RASPBERRY_PI)
PKG_SEARCH_MODULE(SDL2 REQUIRED sdl2)
2016-10-26 22:06:59 +00:00
PKG_SEARCH_MODULE(SDL2IMAGE REQUIRED SDL2_image>=2.0.0)
2016-10-23 22:48:30 +00:00
find_package(PNG REQUIRED)
find_package(Boost 1.55.0 REQUIRED)
if (CURRY_RASPBERRY_PI)
message(STATUS "Will build for Raspberry Pi")
include_directories(SYSTEM
/opt/vc/include
/opt/vc/include/interface/vcos/pthreads
/opt/vc/include/interface/vmcs_host/linux
)
link_directories(
/opt/vc/lib
)
endif (CURRY_RASPBERRY_PI)
add_executable(${PROJECT_NAME}
src/csvloader.cpp
2016-10-23 22:48:30 +00:00
src/main.cpp
src/sdlmain.cpp
src/ingamescene.cpp
src/sizenotifiable.cpp
src/sizeratio.cpp
2016-10-25 22:50:14 +00:00
src/gamescenebase.cpp
src/worldgrid.cpp
src/worldviewport.cpp
src/inputbag.cpp
src/tileiterator.cpp
2016-10-26 22:06:59 +00:00
src/texture.cpp
2016-10-28 19:06:19 +00:00
src/movingobject.cpp
src/character.cpp
src/rect_to_sdl.cpp
src/worldsizenotifiable.cpp
src/worlditems.cpp
src/moveable.cpp
2016-10-23 22:48:30 +00:00
)
target_include_directories(${PROJECT_NAME} SYSTEM
PRIVATE ${SDL2_INCLUDE_DIR}
2016-10-26 22:06:59 +00:00
PRIVATE ${SDL2IMAGE_INCLUDE_DIRS}
2016-10-23 22:48:30 +00:00
PRIVATE ${PNG_INCLUDE_DIRS}
PRIVATE ${Boost_INCLUDE_DIRS}
PRIVATE lib/tree-2.81/src
)
target_include_directories(${PROJECT_NAME}
PRIVATE src
PRIVATE lib/vectorwrapper/include
2016-10-24 23:28:05 +00:00
PRIVATE lib/DeathHandler
2016-10-26 22:06:59 +00:00
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
2016-10-23 22:48:30 +00:00
)
target_link_libraries(${PROJECT_NAME}
PRIVATE ${SDL2_LIBRARIES}
2016-10-26 22:06:59 +00:00
PRIVATE ${SDL2IMAGE_LIBRARIES}
2016-10-23 22:48:30 +00:00
PRIVATE ${PNG_LIBRARIES}
)
if (CURRY_RASPBERRY_PI)
target_link_libraries(${PROJECT_NAME}
PRIVATE bcm_host
)
endif(CURRY_RASPBERRY_PI)
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_defaulted_move_initializers
PRIVATE cxx_noexcept
PRIVATE cxx_rvalue_references
)
target_compile_definitions(${PROJECT_NAME}
PRIVATE ${PNG_DEFINITIONS}
2016-11-08 19:15:19 +00:00
PRIVATE VWR_WITH_IMPLICIT_CONVERSIONS=1
2017-01-27 19:37:20 +00:00
PRIVATE VWR_EXTRA_ACCESSORS
2016-10-23 22:48:30 +00:00
)
2016-10-26 22:06:59 +00:00
configure_file(src/${PROJECT_NAME}Config.h.in ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.h)