-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
101 lines (83 loc) · 3.27 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
89
90
91
92
93
94
95
96
97
98
99
100
101
#
# SuperTux - squirrel library build script
# Copyright (C) 2006 Christoph Sommer <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
SET(CMAKE_MACOSX_RPATH ON)
## Apply patch that fixes some Coverity errors
## Apply coverity patch to Squirrel?
SET(APPLY_COVERITY_PATCH FALSE)
SET(WORKING_DIR WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
IF(APPLY_COVERITY_PATCH)
FIND_PROGRAM(PATCH_EXECUTABLE patch)
IF(PATCH_EXECUTABLE)
SET(PATCH_COMMAND git apply --whitespace=fix --inaccurate-eof)
# Find patch files
FILE(GLOB_RECURSE PATCH_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/patches/*.patch
${CMAKE_CURRENT_SOURCE_DIR}/patches/*.diff)
# Execute patch files
FOREACH(file ${PATCH_FILES})
MESSAGE(STATUS "Found patch file ${file}.")
EXECUTE_PROCESS(COMMAND ${PATCH_COMMAND} ${CMAKE_CURRENT_SOURCE_DIR}/${file} ${WORKING_DIR})
ENDFOREACH(file)
ENDIF(PATCH_EXECUTABLE)
ENDIF(APPLY_COVERITY_PATCH)
## Add include/ to include directories
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include/ ${CMAKE_CURRENT_BINARY_DIR})
## Fix Windows exports
INCLUDE (GenerateExportHeader)
## build list of source files
FILE(GLOB SQUIRREL_SOURCES squirrel/*.cpp sqstdlib/*.cpp sqstdlib/*.c)
FILE(GLOB SQUIRREL_HEADERS include/*.h)
## Add in squirrel debug stuff
OPTION(ENABLE_SQDBG "Build squirrel script interpreter with debugging options" OFF)
IF(ENABLE_SQDBG)
INCLUDE_DIRECTORIES (${CMAKE_CURRENT_SOURCE_DIR}/squirrel/)
FILE(GLOB SQDBG_SOURCES sqdbg/*.cpp)
SET(SQUIRREL_SOURCES ${SQDBG_SOURCES} ${SQUIRREL_SOURCES})
ENDIF(ENABLE_SQDBG)
# the squirrel sources are out of our control so don't be too pedantic about
# them
SET(CMAKE_CXX_FLAGS "")
SET(CMAKE_C_FLAGS "")
## define a target for building the library
LIST(SORT SQUIRREL_SOURCES)
ADD_LIBRARY(squirrel ${SQUIRREL_SOURCES})
GENERATE_EXPORT_HEADER( squirrel
BASE_NAME squirrel
EXPORT_MACRO_NAME SQUIRREL_API
EXPORT_FILE_NAME squirrel_Export.h
STATIC_DEFINE squirrel_BUILT_AS_STATIC
)
# use standardized variable name
set(LIB_SUBDIR "lib${LIB_SUFFIX}"
CACHE STRING "Subdirectory of prefix into which libraries are installed (e.g., lib32, lib64)")
IF(SQUIRREL_IS_SUBPROJECT)
IF(BUILD_SHARED_LIBS)
INSTALL(TARGETS squirrel
RUNTIME DESTINATION bin
LIBRARY DESTINATION ${LIB_SUBDIR})
ENDIF()
ELSE()
INSTALL(TARGETS squirrel
RUNTIME DESTINATION bin
ARCHIVE DESTINATION ${LIB_SUBDIR}
LIBRARY DESTINATION ${LIB_SUBDIR}
COMPONENT squirrel)
INSTALL(FILES ${SQUIRREL_HEADERS} ${CMAKE_BINARY_DIR}/squirrel_Export.h
DESTINATION include)
ENDIF()