2014-05-20 18:35:27 +02:00
|
|
|
cmake_minimum_required(VERSION 2.6)
|
|
|
|
|
|
|
|
#
|
|
|
|
# Execute these commands in this directory:
|
|
|
|
#
|
|
|
|
# 1. mkdir build/; cd build/
|
|
|
|
#
|
|
|
|
# 2. Choose compiler:
|
|
|
|
# Build with native toolchain:
|
|
|
|
# cmake -DCMAKE_BUILD_TYPE=Debug ..
|
|
|
|
#
|
|
|
|
# Build with mingw:
|
|
|
|
# cmake -DCMAKE_TOOLCHAIN_FILE=../CMakeLists_mingw.txt -DCMAKE_BUILD_TYPE=Debug ..
|
|
|
|
#
|
|
|
|
# 3. make
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
# project title
|
|
|
|
set (PROJECT openrct2)
|
|
|
|
# OpenRCT2 resource directory
|
|
|
|
set (ORCT2_RESOURCE_DIR ${CMAKE_INSTALL_PREFIX}/share/${PROJECT}/)
|
|
|
|
|
|
|
|
project(${PROJECT})
|
|
|
|
|
|
|
|
add_definitions(-DORCT2_RESOURCE_DIR="${ORCT2_RESOURCE_DIR}")
|
2014-09-06 03:56:42 +02:00
|
|
|
add_definitions(-DHAVE_CONFIG_H)
|
2015-05-25 21:38:33 +02:00
|
|
|
add_definitions(-DCURL_STATICLIB)
|
|
|
|
#uncomment the line bellow if you don't want to build openrct2 with twitch integration
|
|
|
|
#add_definitions(-DDISABLE_HTTP -DDISABLE_TWITCH)
|
|
|
|
|
|
|
|
set(ORCALIBS_INCLUDE /usr/local/cross-tools/orcalibs/include)
|
|
|
|
set(JANSSON_INCLUDE /usr/local/cross-tools/orcalibs/include/jansson)
|
|
|
|
set(ORCALIBS_LIB_DIR /usr/local/cross-tools/orcalibs/lib)
|
|
|
|
set(ORCALIBS_LIB jansson curl ssl crypto ws2_32)
|
2014-05-20 18:35:27 +02:00
|
|
|
|
2014-10-06 20:41:43 +02:00
|
|
|
# include lib
|
|
|
|
include_directories("lib/")
|
2014-09-06 03:56:42 +02:00
|
|
|
# include speex header
|
2014-10-06 20:41:43 +02:00
|
|
|
include_directories("lib/libspeex/")
|
2014-05-24 13:22:01 +02:00
|
|
|
# add source files
|
2014-10-06 20:41:43 +02:00
|
|
|
file(GLOB_RECURSE ORCT2_SOURCES "src/*.c" "src/*.cpp" "lib/*.c")
|
2014-05-20 18:35:27 +02:00
|
|
|
|
|
|
|
if (UNIX)
|
|
|
|
# force 32bit build for now and set necessary flags to compile code as is
|
2014-05-24 13:22:01 +02:00
|
|
|
set(CMAKE_C_FLAGS "-m32 -masm=intel -std=gnu99")
|
2014-05-20 18:35:27 +02:00
|
|
|
set(CMAKE_LDFLAGS_FLAGS "-m32")
|
|
|
|
|
|
|
|
# find and include SDL2
|
|
|
|
INCLUDE(FindPkgConfig)
|
|
|
|
PKG_SEARCH_MODULE(SDL2 REQUIRED sdl2)
|
|
|
|
INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIRS})
|
|
|
|
endif (UNIX)
|
|
|
|
|
2015-05-25 21:38:33 +02:00
|
|
|
INCLUDE_DIRECTORIES(${ORCALIBS_INCLUDE} ${JANSSON_INCLUDE})
|
|
|
|
LINK_DIRECTORIES(${SDL2_LIBRARY_DIRS} ${ORCALIBS_LIB_DIR})
|
2014-05-24 13:22:01 +02:00
|
|
|
|
|
|
|
# build as library for now, replace with add_executable
|
|
|
|
add_library(${PROJECT} SHARED ${ORCT2_SOURCES})
|
|
|
|
|
|
|
|
# install into ${CMAKE_INSTALL_PREFIX}/bin/
|
|
|
|
#install (TARGETS ${PROJECT} DESTINATION bin)
|
|
|
|
|
|
|
|
# libopenrct2.dll -> openrct2.dll
|
|
|
|
set_target_properties(${PROJECT} PROPERTIES PREFIX "")
|
|
|
|
|
2015-05-25 21:38:33 +02:00
|
|
|
TARGET_LINK_LIBRARIES(${PROJECT} ${SDL2_LIBRARIES} ${ORCALIBS_LIB})
|
2014-05-20 18:35:27 +02:00
|
|
|
|
|
|
|
if (WIN32)
|
2014-08-27 05:48:47 +02:00
|
|
|
target_link_libraries(${PROJECT} winmm.lib -limm32 -lversion -ldsound)
|
2014-05-20 18:35:27 +02:00
|
|
|
endif (WIN32)
|
|
|
|
|