source: branches/work_320/CMakeLists.txt @ 679

Revision 666, 19.4 KB checked in by jls17, 5 years ago (diff)
  • added crash dump support by using breakpad (for now only on windows/linux; solaris will follow)
Line 
1###############################################################################
2## Copyright (C) 2011 John Luthgers | jls17
3##
4## This file is part of ARInside.
5##
6##    ARInside is free software: you can redistribute it and/or modify
7##    it under the terms of the GNU General Public License as published by
8##    the Free Software Foundation, version 2 of the License.
9##
10##    ARInside is distributed in the hope that it will be useful,
11##    but WITHOUT ANY WARRANTY; without even the implied warranty of
12##    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13##    GNU General Public License for more details.
14##
15##    You should have received a copy of the GNU General Public License
16##    along with ARInside.  If not, see <http://www.gnu.org/licenses/>.
17###############################################################################
18CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
19PROJECT(arinside)
20
21#SET(CMAKE_VERBOSE_MAKEFILE 1)       # OR USE AT CMD-LINE: -DCMAKE_VERBOSE_MAKEFILE=1       ## for verbose makefiles
22#SET(CMAKE_BUILD_TYPE Debug)         # OR USE AT CMD-LINE: -DCMAKE_BUILD_TYPE=Debug         ## for debug builds
23#SET(ARINSIDE_TARGET_ARCHITECTURE 4) # OR USE AT CMD-LINE: -DARINSIDE_TARGET_ARCHITECTURE=4 ## for 32bit build on 64bit platform
24
25MESSAGE(STATUS "System Name: ${CMAKE_SYSTEM_NAME}")
26INCLUDE(project.cmake/msvc_pch_support.cmake)
27
28#define project names
29SET(MAIN_PROJECT_NAME "ARInside")
30SET(LIB_PROJECT_NAME "ARInsideLib")
31SET(TEST_PROJECT_NAME "ARInsideTest")
32SET(RES_PROJECT_NAME "ARInsideRes")
33IF(UNIX)
34  STRING(TOLOWER ${MAIN_PROJECT_NAME} MAIN_PROJECT_NAME)
35  STRING(TOLOWER ${LIB_PROJECT_NAME} LIB_PROJECT_NAME)
36  STRING(TOLOWER ${TEST_PROJECT_NAME} TEST_PROJECT_NAME)
37  STRING(TOLOWER ${RES_PROJECT_NAME} RES_PROJECT_NAME)
38ENDIF(UNIX)
39
40# configurable variables for cmakegui
41IF(NOT DEFINED ARINSIDE_BETA)
42        SET(ARINSIDE_BETA CACHE BOOL "When enabled, appends 'Beta' to the version string.")
43ENDIF(NOT DEFINED ARINSIDE_BETA)       
44
45IF (NOT DEFINED AR_INCLUDE_PATH)
46        SET(AR_INCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../api810" CACHE PATH "Path to the arapi root dir where 'include' and 'lib' is located.")
47ENDIF(NOT DEFINED AR_INCLUDE_PATH)
48
49IF(NOT EXISTS ${AR_INCLUDE_PATH})
50  MESSAGE(FATAL_ERROR "ARAPI include directory not found! Please set the AR_INCLUDE_PATH variable to the api root, where the directories 'include' and 'lib' are located. Current directory: ${AR_INCLUDE_PATH}
51use 'cmake -DAR_INCLUDE_PATH=/path/to/ars/api/dir'")
52ENDIF(NOT EXISTS ${AR_INCLUDE_PATH})
53
54if (NOT DEFINED ZLIB_INCLUDE_PATH)
55  SET(ZLIB_INCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../libs/zlib" CACHE PATH "Path to the zlib include/lib directories.")
56ENDIF(NOT DEFINED ZLIB_INCLUDE_PATH)
57
58IF(NOT DEFINED ARINSIDE_TARGET_ARCHITECTURE)
59        SET(ARINSIDE_TARGET_ARCHITECTURE ${CMAKE_SIZEOF_VOID_P})
60ENDIF(NOT DEFINED ARINSIDE_TARGET_ARCHITECTURE)
61
62INCLUDE(TestBigEndian)
63TEST_BIG_ENDIAN(RAPIDJSON_USE_BIG_ENDIAN)
64IF(${RAPIDJSON_USE_BIG_ENDIAN})
65     ADD_DEFINITIONS(-DRAPIDJSON_ENDIAN=1)
66ENDIF(${RAPIDJSON_USE_BIG_ENDIAN})
67
68IF(CMAKE_SYSTEM_NAME STREQUAL "Windows" OR CMAKE_SYSTEM_NAME STREQUAL "Linux")
69        SET(ARINSIDE_BREAKPAD_SUPPORT 1 CACHE BOOL "Turns on/off breakpad-support to generate a mini dump during crash.")
70        MESSAGE(STATUS "breakpad support -- enabled")
71ELSE(CMAKE_SYSTEM_NAME STREQUAL "Windows" OR CMAKE_SYSTEM_NAME STREQUAL "Linux")
72        MESSAGE(STATUS "breakpad support -- disabled")
73ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Windows" OR CMAKE_SYSTEM_NAME STREQUAL "Linux")
74
75INCLUDE_DIRECTORIES(${AR_INCLUDE_PATH}/include thirdparty/ ./ ${ZLIB_INCLUDE_PATH}/include ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/breakpad/src/)
76
77INCLUDE (CheckIncludeFiles)
78CHECK_INCLUDE_FILES("unistd.h" HAVE_UNISTD_H)
79CHECK_INCLUDE_FILES("strings.h" HAVE_STRINGS_H)
80
81CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
82CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/FileSystemUtilTest.h.in ${CMAKE_CURRENT_BINARY_DIR}/FileSystemUtilTest.h)
83
84ADD_DEFINITIONS(-DAR_STRICT_ANSI -D_CRT_SECURE_NO_DEPRECATE -DARINSIDE_ENABLE_ZLIB_SUPPORT)
85IF(ARINSIDE_BETA)
86        ADD_DEFINITIONS(-D_ARINSIDE_BETA)
87ENDIF(ARINSIDE_BETA)
88IF(ARINSIDE_BREAKPAD_SUPPORT)
89        ADD_DEFINITIONS(-DARINSIDE_BREAKPAD_SUPPORT)
90ENDIF(ARINSIDE_BREAKPAD_SUPPORT)
91
92SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
93SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
94
95MESSAGE(STATUS "Is GNU CXX? -- ${CMAKE_COMPILER_IS_GNUCXX}")
96IF(UNIX AND CMAKE_COMPILER_IS_GNUCXX AND ARINSIDE_TARGET_ARCHITECTURE EQUAL 4 AND CMAKE_SIZEOF_VOID_P EQUAL 8)
97        # use special compiler and linker flags on *nix platforms when doing 32bit cross-compile
98        ADD_DEFINITIONS(-m32)
99        SET(CMAKE_EXE_LINKER_FLAGS -m32)
100ENDIF(UNIX AND CMAKE_COMPILER_IS_GNUCXX AND ARINSIDE_TARGET_ARCHITECTURE EQUAL 4 AND CMAKE_SIZEOF_VOID_P EQUAL 8)
101
102INCLUDE(project.cmake/files.cmake)
103
104IF(CMAKE_COMPILER_IS_GNUCC)
105        SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
106ENDIF(CMAKE_COMPILER_IS_GNUCC)
107
108# set link libraries for project
109IF(UNIX)
110        FIND_PACKAGE(Threads)
111        LINK_LIBRARIES(${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT})
112
113        ## solaris / aix specific libs
114        IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS" OR CMAKE_SYSTEM_NAME STREQUAL "AIX")
115                LINK_LIBRARIES(nsl)
116        ENDIF(CMAKE_SYSTEM_NAME STREQUAL "SunOS" OR CMAKE_SYSTEM_NAME STREQUAL "AIX")
117
118        IF(CMAKE_SYSTEM_NAME STREQUAL "AIX")
119                LINK_LIBRARIES(tli)
120        ENDIF(CMAKE_SYSTEM_NAME STREQUAL "AIX")
121       
122        IF(ARINSIDE_TARGET_ARCHITECTURE EQUAL 4 AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
123                ADD_DEFINITIONS(-malign-double)
124        ENDIF(ARINSIDE_TARGET_ARCHITECTURE EQUAL 4 AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
125ENDIF(UNIX)
126
127SET(ARINSIDE_ARAPI_ICUDATABMC_LIBNAME "icudatabmc")
128SET(ARINSIDE_ARAPI_ICUI18NBMC_LIBNAME "icui18nbmc")
129SET(ARINSIDE_ARAPI_ICUUCBMC_LIBNAME "icuucbmc")
130IF(WIN32)
131        SET(ARINSIDE_ARAPI_LIB arapi81_build001 arapi80_build001 arapi7604_build002 arapi7603_build001 arapi75 arapi71 arapi70)
132        SET(ZLIB_LIBNAMES zlibwapi)
133        SET(ARINSIDE_ADDITIONAL_LIBS shlwapi.lib)
134ELSE(WIN32)
135        SET(ARINSIDE_ARAPI_LIB ar)
136        SET(ZLIB_LIBNAMES z)
137ENDIF(WIN32)
138
139# set special library suffixes, compiler- and linker flags for 64-bit builds
140IF(ARINSIDE_TARGET_ARCHITECTURE EQUAL 8)
141        MESSAGE(STATUS "Building for 64 bit platform")
142        SET(TEMP_ARAPI_LIBS "")
143       
144        IF(CMAKE_SYSTEM_NAME STREQUAL "Windows")
145                SET(LIBAR_SUFFIX "_win64")
146        ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
147                SET(LIBAR_SUFFIX "_lx64")
148                IF(CMAKE_SIZEOF_VOID_P EQUAL 4) ## if we target 64-bit but the default is 32-bit, add some special flags
149                        ADD_DEFINITIONS(-m64)
150                        SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m64")
151                ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 4)
152        ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
153                SET(LIBAR_SUFFIX "_solsp64")
154                IF(CMAKE_SIZEOF_VOID_P EQUAL 4) ## if we target 64-bit but the default is 32-bit, add some special flags
155                        ADD_DEFINITIONS(-m64)
156                        SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m64")
157                ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 4)
158        ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "AIX")
159                SET(LIBAR_SUFFIX "_aixp64")
160                IF(CMAKE_SIZEOF_VOID_P EQUAL 4) ## if we target 64-bit but the default is 32-bit, add some special flags
161                        ADD_DEFINITIONS(-maix64 -mminimal-toc)
162                        SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-brtl -maix64")
163                ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 4)
164        ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Windows")
165       
166        FOREACH(TEMP_ARAPI_LIB_NAME ${ARINSIDE_ARAPI_LIB})
167                LIST(APPEND TEMP_ARAPI_LIBS "${TEMP_ARAPI_LIB_NAME}${LIBAR_SUFFIX}")
168        ENDFOREACH()
169        SET(ARINSIDE_ARAPI_LIB ${TEMP_ARAPI_LIBS})
170       
171        SET(ARINSIDE_ARAPI_ICUDATABMC_LIBNAME "${ARINSIDE_ARAPI_ICUDATABMC_LIBNAME}${LIBAR_SUFFIX}")
172        SET(ARINSIDE_ARAPI_ICUI18NBMC_LIBNAME "${ARINSIDE_ARAPI_ICUI18NBMC_LIBNAME}${LIBAR_SUFFIX}")
173        SET(ARINSIDE_ARAPI_ICUUCBMC_LIBNAME "${ARINSIDE_ARAPI_ICUUCBMC_LIBNAME}${LIBAR_SUFFIX}")
174       
175        SET(ZLIB_LIB_PATH "${ZLIB_INCLUDE_PATH}/lib64")
176ELSE(ARINSIDE_TARGET_ARCHITECTURE EQUAL 8)
177        MESSAGE(STATUS "Building for 32 bit platform")
178        SET(ZLIB_LIB_PATH "${ZLIB_INCLUDE_PATH}/lib")
179ENDIF(ARINSIDE_TARGET_ARCHITECTURE EQUAL 8)
180
181FIND_LIBRARY(ARS_API_LIB NAMES ${ARINSIDE_ARAPI_LIB} PATHS ${AR_INCLUDE_PATH}/lib)
182FIND_LIBRARY(ARS_API_ICUDATABMC_LIB NAMES ${ARINSIDE_ARAPI_ICUDATABMC_LIBNAME} PATHS ${AR_INCLUDE_PATH}/lib)
183FIND_LIBRARY(ARS_API_ICUI18NBMC_LIB NAMES ${ARINSIDE_ARAPI_ICUI18NBMC_LIBNAME} PATHS ${AR_INCLUDE_PATH}/lib)
184FIND_LIBRARY(ARS_API_ICUUCBMC_LIB NAMES ${ARINSIDE_ARAPI_ICUUCBMC_LIBNAME} PATHS ${AR_INCLUDE_PATH}/lib)
185FIND_LIBRARY(ZLIB_LIB NAMES ${ZLIB_LIBNAMES} PATHS ${ZLIB_LIB_PATH})
186
187# check that necessary libs were found
188MESSAGE(STATUS "libar: (${ARINSIDE_ARAPI_LIB}) -- ${ARS_API_LIB}")
189IF (NOT ARS_API_LIB)
190        MESSAGE(FATAL_ERROR "Could not find ${ARINSIDE_ARAPI_LIB} in '${AR_INCLUDE_PATH}'! Please check or specify AR_INCLUDE_PATH variable")
191ENDIF (NOT ARS_API_LIB)
192
193IF (NOT ZLIB_LIB)
194        MESSAGE(FATAL_ERROR "Could not find ${ZLIB_LIBNAMES} in '${ZLIB_LIB_PATH}'! Please check or specify ZLIB_INCLUDE_PATH variable")
195ENDIF (NOT ZLIB_LIB)
196
197MESSAGE(STATUS "icudatabmc: (${ARINSIDE_ARAPI_ICUDATABMC_LIBNAME}) -- ${ARS_API_ICUDATABMC_LIB}")
198IF(ARS_API_ICUDATABMC_LIB)
199        LINK_LIBRARIES(${ARS_API_ICUDATABMC_LIB})
200ENDIF(ARS_API_ICUDATABMC_LIB)
201
202MESSAGE(STATUS "icui18nbmc: (${ARINSIDE_ARAPI_ICUI18NBMC_LIBNAME}) -- ${ARS_API_ICUI18NBMC_LIB}")
203IF(ARS_API_ICUI18NBMC_LIB)
204        LINK_LIBRARIES(${ARS_API_ICUI18NBMC_LIB})
205ENDIF(ARS_API_ICUI18NBMC_LIB)
206
207MESSAGE(STATUS "icuucbmc: (${ARINSIDE_ARAPI_ICUUCBMC_LIBNAME}) -- ${ARS_API_ICUUCBMC_LIB}")
208IF(ARS_API_ICUUCBMC_LIB)
209        LINK_LIBRARIES(${ARS_API_ICUUCBMC_LIB})
210ENDIF(ARS_API_ICUUCBMC_LIB)
211
212# now generate and import resources
213ADD_CUSTOM_TARGET(resource_directory ALL
214        COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/img
215        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/active_link.gif ${CMAKE_BINARY_DIR}/img
216        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/al_guide.gif ${CMAKE_BINARY_DIR}/img
217        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/application.gif ${CMAKE_BINARY_DIR}/img
218        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/ars_edit.gif ${CMAKE_BINARY_DIR}/img
219        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/chapter.gif ${CMAKE_BINARY_DIR}/img
220        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/custom.gif ${CMAKE_BINARY_DIR}/img
221        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/disabled.gif ${CMAKE_BINARY_DIR}/img
222        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/doc.gif ${CMAKE_BINARY_DIR}/img
223        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/down.gif ${CMAKE_BINARY_DIR}/img
224        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/edit.gif ${CMAKE_BINARY_DIR}/img
225        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/empty_list.gif ${CMAKE_BINARY_DIR}/img
226        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/escalation.gif ${CMAKE_BINARY_DIR}/img
227        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/filter.gif ${CMAKE_BINARY_DIR}/img
228        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/filter_guide.gif ${CMAKE_BINARY_DIR}/img
229        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/folder.gif ${CMAKE_BINARY_DIR}/img
230        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/group.gif ${CMAKE_BINARY_DIR}/img
231        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/hidden.gif ${CMAKE_BINARY_DIR}/img
232        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/image.gif ${CMAKE_BINARY_DIR}/img
233        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/info.gif ${CMAKE_BINARY_DIR}/img
234        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/menu.gif ${CMAKE_BINARY_DIR}/img
235        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/next.gif ${CMAKE_BINARY_DIR}/img
236        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/object_list.js ${CMAKE_BINARY_DIR}/img
237        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/overlay.gif ${CMAKE_BINARY_DIR}/img
238        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/packing_list.gif ${CMAKE_BINARY_DIR}/img
239        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/prev.gif ${CMAKE_BINARY_DIR}/img
240        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/role.gif ${CMAKE_BINARY_DIR}/img
241        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/schema.gif ${CMAKE_BINARY_DIR}/img
242        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/schema_display.gif ${CMAKE_BINARY_DIR}/img
243        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/schema_join.gif ${CMAKE_BINARY_DIR}/img
244        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/schema_vendor.gif ${CMAKE_BINARY_DIR}/img
245        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/schema_view.gif ${CMAKE_BINARY_DIR}/img
246        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/search.gif ${CMAKE_BINARY_DIR}/img
247        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/server.gif ${CMAKE_BINARY_DIR}/img
248        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/sort_asc.gif ${CMAKE_BINARY_DIR}/img
249        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/sort_desc.gif ${CMAKE_BINARY_DIR}/img
250        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/up.gif ${CMAKE_BINARY_DIR}/img
251        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/user.gif ${CMAKE_BINARY_DIR}/img
252        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/visible.gif ${CMAKE_BINARY_DIR}/img
253        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/webservice.gif ${CMAKE_BINARY_DIR}/img
254        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/script.js ${CMAKE_BINARY_DIR}/img
255        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/sortscript.js ${CMAKE_BINARY_DIR}/img
256        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/tabscript.js ${CMAKE_BINARY_DIR}/img
257        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/schema_page.js ${CMAKE_BINARY_DIR}/img
258        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/arshelper.js ${CMAKE_BINARY_DIR}/img
259        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/schemaList.js ${CMAKE_BINARY_DIR}/img
260        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/actlinkList.js ${CMAKE_BINARY_DIR}/img
261        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/filterList.js ${CMAKE_BINARY_DIR}/img
262        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/escalationList.js ${CMAKE_BINARY_DIR}/img
263        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/menuList.js ${CMAKE_BINARY_DIR}/img
264        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/containerList.js ${CMAKE_BINARY_DIR}/img
265        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/imageList.js ${CMAKE_BINARY_DIR}/img
266        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/groupList.js ${CMAKE_BINARY_DIR}/img
267        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/roleList.js ${CMAKE_BINARY_DIR}/img
268        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/style.css ${CMAKE_BINARY_DIR}/img
269        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/jquery/jquery-ui-custom.css ${CMAKE_BINARY_DIR}/img
270        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/jquery/jquery-ui.js ${CMAKE_BINARY_DIR}/img
271        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/jquery/jquery.address.min.js ${CMAKE_BINARY_DIR}/img
272        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/jquery/jquery.js ${CMAKE_BINARY_DIR}/img
273        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/jquery/jquery.timers.js ${CMAKE_BINARY_DIR}/img
274        COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/img/images
275        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/jquery/images/ui-bg_glass_75_e6e6e6_1x400.png ${CMAKE_BINARY_DIR}/img/images
276        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/jquery/images/ui-bg_glass_65_ffffff_1x400.png ${CMAKE_BINARY_DIR}/img/images
277)
278
279ADD_CUSTOM_TARGET(${RES_PROJECT_NAME} ALL
280        COMMAND ${CMAKE_COMMAND} -E tar "czf" "${arinside_BINARY_DIR}/arires.tgz" img WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" DEPENDS resource_directory
281)
282
283ADD_CUSTOM_TARGET(gtestzippedsource ALL
284        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/gtest-1.6.0.zip ${CMAKE_BINARY_DIR}/thirdparty/src/
285)
286
287# generate svnrev.h file
288#FIND_PACKAGE(Subversion)
289IF(Subversion_FOUND)
290        Subversion_WC_INFO(${PROJECT_SOURCE_DIR} ARINSIDE)
291ELSE(Subversion_FOUND)
292        SET(ARINSIDE_WC_REVISION SVNMISS)
293ENDIF(Subversion_FOUND)
294FILE(READ ${PROJECT_SOURCE_DIR}/svnrev_template.h SVNREV_TEMPLATE)
295STRING(REPLACE "$WCREV$" ${ARINSIDE_WC_REVISION} SVNREV_TEMPLATE "${SVNREV_TEMPLATE}")
296FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/svnrev.h ${SVNREV_TEMPLATE})
297INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
298
299# now setup testing ... http://stackoverflow.com/questions/9689183/cmake-googletest
300INCLUDE(ExternalProject)
301SET_DIRECTORY_PROPERTIES(PROPERTIES EP_PREFIX ${CMAKE_BINARY_DIR}/thirdparty)
302ExternalProject_Add(
303        googletest
304        DEPENDS gtestzippedsource
305        URL gtest-1.6.0.zip
306        TIMEOUT 10
307        # Force separate output paths for debug and release builds to allow easy
308        # identification of correct lib in subsequent TARGET_LINK_LIBRARIES commands
309        CMAKE_ARGS -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG:PATH=DebugLibs
310                           -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE:PATH=ReleaseLibs
311                           -Dgtest_force_shared_crt=ON
312        # Disable install step
313        INSTALL_COMMAND ""
314        # Wrap download, configure and build steps in a script to log output
315        ###These LOG_XXX params are only supported in cmake2.8.3+ and are disabled here to get backwards compatibility with 2.8.0
316        #LOG_DOWNLOAD ON
317        #LOG_CONFIGURE ON
318        #LOG_BUILD ON
319)
320       
321ExternalProject_Get_Property(googletest source_dir)
322INCLUDE_DIRECTORIES(${source_dir}/include)
323ExternalProject_Get_Property(googletest binary_dir)
324SET(GTEST_BINARY_DIR ${binary_dir})
325ENABLE_TESTING()
326
327# Add compiler flag for MSVC 2012
328if(MSVC_VERSION EQUAL 1700)
329  add_definitions(-D_VARIADIC_MAX=10)
330endif()
331
332LINK_DIRECTORIES(${GTEST_BINARY_DIR})
333
334# setup output target
335ADD_LIBRARY(${LIB_PROJECT_NAME} ${ARINSIDE_SRCS} ${ARINSIDE_RESOURCE_OBJECTS})
336ADD_EXECUTABLE(${MAIN_PROJECT_NAME} ${ARINSIDE_MAIN_FILES})
337ADD_EXECUTABLE(${TEST_PROJECT_NAME} ${ARINSIDE_TEST_SRCS})
338
339SET_TARGET_PROPERTIES(${MAIN_PROJECT_NAME} PROPERTIES COMPILE_DEFINITIONS "_UNICODE;UNICODE")
340
341# dependencies
342ADD_DEPENDENCIES(${TEST_PROJECT_NAME} ${LIB_PROJECT_NAME} googletest)
343ADD_DEPENDENCIES(${MAIN_PROJECT_NAME} ${LIB_PROJECT_NAME} ${RES_PROJECT_NAME})
344
345# reference the needed libraries
346TARGET_LINK_LIBRARIES(${MAIN_PROJECT_NAME} ${ARS_API_LIB} ${ZLIB_LIB} ${ARINSIDE_ADDITIONAL_LIBS} ${LIB_PROJECT_NAME})
347TARGET_LINK_LIBRARIES(${TEST_PROJECT_NAME} ${ARS_API_LIB} ${ZLIB_LIB} ${ARINSIDE_ADDITIONAL_LIBS} ${LIB_PROJECT_NAME})
348IF(MSVC)
349        TARGET_LINK_LIBRARIES(${TEST_PROJECT_NAME}
350                debug ${GTEST_BINARY_DIR}/DebugLibs/${CMAKE_FIND_LIBRARY_PREFIXES}gtest${CMAKE_FIND_LIBRARY_SUFFIXES}
351                optimized ${GTEST_BINARY_DIR}/ReleaseLibs/${CMAKE_FIND_LIBRARY_PREFIXES}gtest${CMAKE_FIND_LIBRARY_SUFFIXES}
352        )
353ELSE(MSVC)
354        TARGET_LINK_LIBRARIES(${TEST_PROJECT_NAME} gtest)
355ENDIF(MSVC)
356
357ADD_TEST(NAME test COMMAND ${TEST_PROJECT_NAME})
358#INSTALL(TARGETS arinside DESTINATION bin)
Note: See TracBrowser for help on using the repository browser.