forked from OpenRCT2/OpenRCT2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
60 lines (45 loc) · 1.45 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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}")
# include lodepng header
include_directories("lodepng/")
# add source files
file(GLOB_RECURSE ORCT2_SOURCES "src/*.c" "lodepng/*.c")
if (UNIX)
# force 32bit build for now and set necessary flags to compile code as is
set(CMAKE_C_FLAGS "-m32 -masm=intel -std=gnu99")
set(CMAKE_LDFLAGS_FLAGS "-m32")
# find and include SDL2
INCLUDE(FindPkgConfig)
PKG_SEARCH_MODULE(SDL2 REQUIRED sdl2)
INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIRS})
endif (UNIX)
LINK_DIRECTORIES(${SDL2_LIBRARY_DIRS})
# 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 "")
TARGET_LINK_LIBRARIES(${PROJECT} ${SDL2_LIBRARIES})
if (WIN32)
target_link_libraries(${PROJECT} winmm.lib -limm32 -lversion -ldsound)
endif (WIN32)