-
Notifications
You must be signed in to change notification settings - Fork 7
/
CMakeLists.txt
88 lines (70 loc) · 2.17 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
cmake_minimum_required(VERSION 2.8)
project(love)
FILE(
GLOB SOURCE_FILES
src/audio/*.h
src/audio/*.c
src/filesystem/*.h
src/filesystem/*.c
src/graphics/*.h
src/graphics/*.c
src/image/*.h
src/image/*.c
src/luaapi/*.h
src/luaapi/*.c
src/math/*.h
src/math/*.c
src/timer/*.h
src/timer/*.c
src/*.c
src/*.h
)
set(love_package "love")
set(love_creator "Muresan Vlad")
set(love_copyright "Copyright (c) 2015, ${love_creator}.")
INCLUDE(FindPkgConfig)
PKG_SEARCH_MODULE(SDL2 REQUIRED sdl2)
INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIRS})
include_directories(src/3rdparty/glew/include)
add_executable(
love
${SOURCE_FILES}
src/3rdparty/glew/src/glew.c
src/3rdparty/stb/stb_image.c
src/3rdparty/stb/stb_vorbis.c
src/3rdparty/stb/stb_vorbis.h
)
#freetype
add_subdirectory(src/3rdparty/freetype)
set(FREETYPE_INCLUDE_DIR src/3rdparty/freetype/include)
set(FREETYPE_LIBRARIES freetype)
include_directories(src/3rdparty/freetype/include)
if(APPLE)
target_link_libraries(love ${OPENGL_LIBRARIES} ${SDL2_LIBRARIES} ${FREETYPE_LIBRARIES})
endif()
if(UNIX)
target_link_libraries(love dl ${OPENGL_LIBRARIES} ${SDL2_LIBRARIES} ${FREETYPE_LIBRARIES})
endif()
IF(WIN32)
FIND_PACKAGE(OpenGL REQUIRED)
LINK_DIRECTORIES("$ENV{DXSDK_DIR}/Lib/$ENV{PROCESSOR_ARCHITECTURE}")
SET(SDL_BUILDING_LIBRARY ON)
SET(USE_NETWORKING FALSE)
IF(SSE2_TRUE)
SET(SSE_FLAG /arch:SSE2)
ELSEIF(SSE_TRUE)
SET(SSE_FLAG /arch:SSE)
ENDIF()
SET(flag_var "/MD")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /EHsc /nologo /GR /FC /DWIN32 /D_MBCS")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /Z7 /W4 /Od /MDd /D_DEBUG /D__Debug__")
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /W1 /O2 /Ot /MD /DNDEBUG /fp:fast ${SSE_FLAG}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /nologo /GR /FC /DWIN32 /D_MBCS")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Z7 /W4 /Od /MDd /D_DEBUG /D__Debug__")
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /W1 /O2 /Ot /MD /DNDEBUG /fp:fast ${SSE_FLAG}")
SET(FREETYPE_LIBRARY "freetype")
SET(OPENAL_LIBRARY "OpenAL32")
ENDIF(WIN32)
if(WIN32)
target_link_libraries(love ws2_32.lib ${OPENGL_LIBRARIES} ${SDL2_LIBRARIES} ${FREETYPE_LIBRARIES})
endif()