source: branches/work_304/CMakeLists.txt @ 331

Revision 331, 20.1 KB checked in by jls17, 6 years ago (diff)
  • removed the resources from the executable (imgaes, css, javascript are already placed in a separate archive next to the executable)
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}")
26
27## *** taken from http://stackoverflow.com/questions/148570/using-pre-compiled-headers-with-cmake ***
28## To use it, the PrecompiledSource file shouldn't be specified in SourceVar array. Otherwise the
29## file specific precompiled properties will get overwritten.
30MACRO(ADD_MSVC_PRECOMPILED_HEADER PrecompiledHeader PrecompiledSource SourcesVar)
31  IF(MSVC)
32        MESSAGE(STATUS "Setting up precompiler header support")
33    GET_FILENAME_COMPONENT(PrecompiledBasename ${PrecompiledHeader} NAME_WE)
34    SET(PrecompiledBinary "${CMAKE_CURRENT_BINARY_DIR}/${PrecompiledBasename}.pch")
35    SET(Sources ${${SourcesVar}})
36
37    SET_SOURCE_FILES_PROPERTIES(${PrecompiledSource}
38                                PROPERTIES COMPILE_FLAGS "/Yc\"${PrecompiledHeader}\" /Fp\"${PrecompiledBinary}\""
39                                           OBJECT_OUTPUTS "${PrecompiledBinary}")
40                                                                                   
41    SET_SOURCE_FILES_PROPERTIES(${Sources}
42                                PROPERTIES COMPILE_FLAGS "/Yu\"${PrecompiledBinary}\" /FI\"${PrecompiledBinary}\" /Fp\"${PrecompiledBinary}\""
43                                           OBJECT_DEPENDS "${PrecompiledBinary}") 
44    # Add precompiled header to SourcesVar
45    LIST(APPEND ${SourcesVar} ${PrecompiledSource})
46  ENDIF(MSVC)
47ENDMACRO(ADD_MSVC_PRECOMPILED_HEADER)
48
49# configurable variables for cmakegui
50IF(NOT DEFINED ARINSIDE_BETA)
51        SET(ARINSIDE_BETA CACHE BOOL "When enabled, appends 'Beta' to the version string.")
52ENDIF(NOT DEFINED ARINSIDE_BETA)       
53
54IF (NOT DEFINED AR_INCLUDE_PATH)
55        SET(AR_INCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../api810" CACHE PATH "Path to the arapi root dir where 'include' and 'lib' is located.")
56ENDIF(NOT DEFINED AR_INCLUDE_PATH)
57
58IF(NOT EXISTS ${AR_INCLUDE_PATH})
59  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}
60use 'cmake -DAR_INCLUDE_PATH=/path/to/ars/api/dir'")
61ENDIF(NOT EXISTS ${AR_INCLUDE_PATH})
62
63if (NOT DEFINED ZLIB_INCLUDE_PATH)
64  SET(ZLIB_INCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../libs/zlib" CACHE PATH "Path to the zlib include/lib directories.")
65ENDIF(NOT DEFINED ZLIB_INCLUDE_PATH)
66
67IF(NOT DEFINED ARINSIDE_TARGET_ARCHITECTURE)
68        SET(ARINSIDE_TARGET_ARCHITECTURE ${CMAKE_SIZEOF_VOID_P})
69ENDIF(NOT DEFINED ARINSIDE_TARGET_ARCHITECTURE)
70
71INCLUDE_DIRECTORIES(${AR_INCLUDE_PATH}/include tinyxml/ tclap/ thirdparty/ ./ ${ZLIB_INCLUDE_PATH}/include)
72
73INCLUDE (CheckIncludeFiles)
74CHECK_INCLUDE_FILES("unistd.h" HAVE_UNISTD_H)
75CHECK_INCLUDE_FILES("strings.h" HAVE_STRINGS_H)
76
77CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
78CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/FileSystemUtilTest.h.in ${CMAKE_CURRENT_BINARY_DIR}/FileSystemUtilTest.h)
79
80ADD_DEFINITIONS(-DAR_STRICT_ANSI -D_CRT_SECURE_NO_DEPRECATE)
81IF(ARINSIDE_BETA)
82        ADD_DEFINITIONS(-D_ARINSIDE_BETA)
83ENDIF(ARINSIDE_BETA)
84
85SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
86SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
87
88MESSAGE(STATUS "Is GNU CXX? -- ${CMAKE_COMPILER_IS_GNUCXX}")
89IF(UNIX AND CMAKE_COMPILER_IS_GNUCXX AND ARINSIDE_TARGET_ARCHITECTURE EQUAL 4 AND CMAKE_SIZEOF_VOID_P EQUAL 8)
90        # use special compiler and linker flags on *nix platforms when doing 32bit cross-compile
91        ADD_DEFINITIONS(-m32)
92        SET(CMAKE_EXE_LINKER_FLAGS -m32)
93ENDIF(UNIX AND CMAKE_COMPILER_IS_GNUCXX AND ARINSIDE_TARGET_ARCHITECTURE EQUAL 4 AND CMAKE_SIZEOF_VOID_P EQUAL 8)
94
95SET (ARINSIDE_SRCS
96 core/ARContainer.cpp core/ARGlobalField.cpp core/ARServerObject.cpp core/ARMessageObject.cpp
97 core/ARObject.cpp core/ARProplistHelper.cpp core/ARGroup.cpp core/ARAssignHelper.cpp
98 core/ARDayStructHelper.cpp core/ARFilter.cpp core/ARVui.cpp core/AREscalation.cpp core/ARQualification.cpp
99 core/ARServerInfo.cpp core/ARSchema.cpp core/ChangeHistoryEntry.cpp core/ARField.cpp core/ARUser.cpp
100 core/ARImage.cpp core/ARCharMenu.cpp core/ARRole.cpp core/ARActiveLink.cpp core/ARValue.cpp
101 core/ARSetFieldHelper.cpp core/ARHandle.cpp core/AREnum.cpp
102 doc/DocFieldDetails.cpp doc/DocFilterActionStruct.cpp doc/DocAlActionStruct.cpp doc/DocBase.cpp
103 doc/DocUserDetails.cpp doc/DocVuiDetails.cpp doc/DocWebserviceDetails.cpp doc/DocMain.cpp
104 doc/DocActionSetFieldsHelper.cpp doc/DocFilterGuideDetails.cpp doc/DocAlDetails.cpp
105 doc/DocCharMenuDetails.cpp doc/DocContainerHelper.cpp doc/DocRoleDetails.cpp doc/DocAnalyzer.cpp
106 doc/DocSchemaDetails.cpp doc/DocValidator.cpp doc/DocFilterDetails.cpp doc/DocImageDetails.cpp
107 doc/DocActionOpenWindowHelper.cpp doc/DocPacklistDetails.cpp doc/DocApplicationDetails.cpp
108 doc/DocGroupDetails.cpp doc/MessageItem.cpp doc/DocEscalationDetails.cpp doc/DocSummaryInfo.cpp
109 doc/DocAlGuideDetails.cpp doc/DocCustomWorkflow.cpp doc/DocOverlayHelper.cpp
110 lists/ARActiveLinkList.cpp lists/ARContainerList.cpp lists/AREscalationList.cpp lists/ARFieldList.cpp
111 lists/ARFilterList.cpp lists/ARGroupList.cpp lists/ARImageList.cpp lists/ARMenuList.cpp lists/ARRoleList.cpp
112 lists/ARSchemaList.cpp lists/ARUserList.cpp lists/ARVUIList.cpp lists/BlackList.cpp lists/ARListHelpers.cpp
113 lists/ARServerInfoList.cpp
114 output/Table.cpp output/TableCell.cpp output/WebControl.cpp output/AlTable.cpp output/EscalTable.cpp
115 output/UList.cpp output/FilterTable.cpp output/IFileStructure.cpp output/CsvPage.cpp output/ObjectTable.cpp
116 output/FileNaming.cpp output/TableRow.cpp output/SchemaTable.cpp output/RoleTable.cpp output/ContainerTable.cpp
117 output/WebPage.cpp output/TableColumn.cpp output/NavigationPage.cpp output/GroupTable.cpp output/ImageTable.cpp
118 output/UListItem.cpp output/MenuTable.cpp output/UserTable.cpp output/WebUtil.cpp output/TabControl.cpp
119 output/webpage/HtmlReferenceList.cpp output/webpage/HtmlReferenceListImpl.cpp
120 scan/ScanActiveLinks.cpp scan/ScanContainers.cpp scan/ScanEscalations.cpp scan/ScanFields.cpp scan/ScanFilters.cpp
121 scan/ScanImages.cpp scan/ScanMain.cpp scan/ScanMenus.cpp scan/ScanSchema.cpp
122 tinyxml/tinyxml.cpp tinyxml/tinystr.cpp tinyxml/tinyxmlerror.cpp tinyxml/tinyxmlparser.cpp
123 util/AppTimer.cpp util/BlackListItem.cpp util/CommandLineValidator.cpp util/RefItem.cpp
124 util/ResourceFileLocatorAndExtractor.cpp util/UntarStream.cpp util/Util.cpp
125 AppConfig.cpp AppConfigReader.cpp ARInside.cpp ConfigFile.cpp FileSystemUtil.cpp gzstream.cpp Main.cpp
126)
127
128SET(ARINSIDE_MAIN_SRCS ARInsideMain.cpp ARInsideMain.h)
129SET(ARINSIDE_TEST_SRCS ARInsideTest.cpp ARInsideTest.h
130 AppConfigReaderTest.cpp FileSystemUtilTest.cpp RapidJSONTests.cpp
131 lists/ARListHelpersTest.cpp
132 output/webpage/HtmlReferenceListImplTest.cpp
133 util/CommandLineValidatorTest.cpp util/UntarStreamTest.cpp util/UntarStreamTest.h
134)
135
136IF(NOT MSVC)
137        SET (ARINSIDE_SRCS ${ARINSIDE_SRCS} stdafx.cpp)
138ENDIF(NOT MSVC)
139
140# set link libraries for project
141IF(UNIX)
142        FIND_PACKAGE(Threads)
143        LINK_LIBRARIES(${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT})
144
145        ## solaris / aix specific libs
146        IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS" OR CMAKE_SYSTEM_NAME STREQUAL "AIX")
147                LINK_LIBRARIES(nsl)
148        ENDIF(CMAKE_SYSTEM_NAME STREQUAL "SunOS" OR CMAKE_SYSTEM_NAME STREQUAL "AIX")
149
150        IF(CMAKE_SYSTEM_NAME STREQUAL "AIX")
151                LINK_LIBRARIES(tli)
152        ENDIF(CMAKE_SYSTEM_NAME STREQUAL "AIX")
153       
154        IF(ARINSIDE_TARGET_ARCHITECTURE EQUAL 4 AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
155                ADD_DEFINITIONS(-malign-double)
156        ENDIF(ARINSIDE_TARGET_ARCHITECTURE EQUAL 4 AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
157ENDIF(UNIX)
158
159SET(ARINSIDE_ARAPI_ICUDATABMC_LIBNAME "icudatabmc")
160SET(ARINSIDE_ARAPI_ICUI18NBMC_LIBNAME "icui18nbmc")
161SET(ARINSIDE_ARAPI_ICUUCBMC_LIBNAME "icuucbmc")
162IF(WIN32)
163        SET(ARINSIDE_ARAPI_LIB arapi81_build001 arapi80_build001 arapi7604_build002 arapi7603_build001 arapi75 arapi71 arapi70)
164        SET(ZLIB_LIBNAMES zlibwapi)
165        SET(ARINSIDE_ADDITIONAL_LIBS shlwapi.lib)
166ELSE(WIN32)
167        SET(ARINSIDE_ARAPI_LIB ar)
168        SET(ZLIB_LIBNAMES z)
169ENDIF(WIN32)
170
171# set special library suffixes, compiler- and linker flags for 64-bit builds
172IF(ARINSIDE_TARGET_ARCHITECTURE EQUAL 8)
173        MESSAGE(STATUS "Building for 64 bit platform")
174        SET(TEMP_ARAPI_LIBS "")
175       
176        IF(CMAKE_SYSTEM_NAME STREQUAL "Windows")
177                SET(LIBAR_SUFFIX "_win64")
178        ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
179                SET(LIBAR_SUFFIX "_lx64")
180                IF(CMAKE_SIZEOF_VOID_P EQUAL 4) ## if we target 64-bit but the default is 32-bit, add some special flags
181                        ADD_DEFINITIONS(-m64)
182                        SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m64")
183                ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 4)
184        ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
185                SET(LIBAR_SUFFIX "_solsp64")
186                IF(CMAKE_SIZEOF_VOID_P EQUAL 4) ## if we target 64-bit but the default is 32-bit, add some special flags
187                        ADD_DEFINITIONS(-m64)
188                        SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m64")
189                ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 4)
190        ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "AIX")
191                SET(LIBAR_SUFFIX "_aixp64")
192                IF(CMAKE_SIZEOF_VOID_P EQUAL 4) ## if we target 64-bit but the default is 32-bit, add some special flags
193                        ADD_DEFINITIONS(-maix64 -mminimal-toc)
194                        SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-brtl -maix64")
195                ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 4)
196        ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Windows")
197       
198        FOREACH(TEMP_ARAPI_LIB_NAME ${ARINSIDE_ARAPI_LIB})
199                LIST(APPEND TEMP_ARAPI_LIBS "${TEMP_ARAPI_LIB_NAME}${LIBAR_SUFFIX}")
200        ENDFOREACH()
201        SET(ARINSIDE_ARAPI_LIB ${TEMP_ARAPI_LIBS})
202       
203        SET(ARINSIDE_ARAPI_ICUDATABMC_LIBNAME "${ARINSIDE_ARAPI_ICUDATABMC_LIBNAME}${LIBAR_SUFFIX}")
204        SET(ARINSIDE_ARAPI_ICUI18NBMC_LIBNAME "${ARINSIDE_ARAPI_ICUI18NBMC_LIBNAME}${LIBAR_SUFFIX}")
205        SET(ARINSIDE_ARAPI_ICUUCBMC_LIBNAME "${ARINSIDE_ARAPI_ICUUCBMC_LIBNAME}${LIBAR_SUFFIX}")
206       
207        SET(ZLIB_LIB_PATH "${ZLIB_INCLUDE_PATH}/lib64")
208ELSE(ARINSIDE_TARGET_ARCHITECTURE EQUAL 8)
209        MESSAGE(STATUS "Building for 32 bit platform")
210        SET(ZLIB_LIB_PATH "${ZLIB_INCLUDE_PATH}/lib")
211ENDIF(ARINSIDE_TARGET_ARCHITECTURE EQUAL 8)
212
213FIND_LIBRARY(ARS_API_LIB NAMES ${ARINSIDE_ARAPI_LIB} PATHS ${AR_INCLUDE_PATH}/lib)
214FIND_LIBRARY(ARS_API_ICUDATABMC_LIB NAMES ${ARINSIDE_ARAPI_ICUDATABMC_LIBNAME} PATHS ${AR_INCLUDE_PATH}/lib)
215FIND_LIBRARY(ARS_API_ICUI18NBMC_LIB NAMES ${ARINSIDE_ARAPI_ICUI18NBMC_LIBNAME} PATHS ${AR_INCLUDE_PATH}/lib)
216FIND_LIBRARY(ARS_API_ICUUCBMC_LIB NAMES ${ARINSIDE_ARAPI_ICUUCBMC_LIBNAME} PATHS ${AR_INCLUDE_PATH}/lib)
217FIND_LIBRARY(ZLIB_LIB NAMES ${ZLIB_LIBNAMES} PATHS ${ZLIB_LIB_PATH})
218
219# check that necessary libs were found
220MESSAGE(STATUS "libar: (${ARINSIDE_ARAPI_LIB}) -- ${ARS_API_LIB}")
221IF (NOT ARS_API_LIB)
222        MESSAGE(FATAL_ERROR "Could not find ${ARINSIDE_ARAPI_LIB} in '${AR_INCLUDE_PATH}'! Please check or specify AR_INCLUDE_PATH variable")
223ENDIF (NOT ARS_API_LIB)
224
225IF (NOT ZLIB_LIB)
226        MESSAGE(FATAL_ERROR "Could not find ${ZLIB_LIBNAMES} in '${ZLIB_LIB_PATH}'! Please check or specify ZLIB_INCLUDE_PATH variable")
227ENDIF (NOT ZLIB_LIB)
228
229MESSAGE(STATUS "icudatabmc: (${ARINSIDE_ARAPI_ICUDATABMC_LIBNAME}) -- ${ARS_API_ICUDATABMC_LIB}")
230IF(ARS_API_ICUDATABMC_LIB)
231        LINK_LIBRARIES(${ARS_API_ICUDATABMC_LIB})
232ENDIF(ARS_API_ICUDATABMC_LIB)
233
234MESSAGE(STATUS "icui18nbmc: (${ARINSIDE_ARAPI_ICUI18NBMC_LIBNAME}) -- ${ARS_API_ICUI18NBMC_LIB}")
235IF(ARS_API_ICUI18NBMC_LIB)
236        LINK_LIBRARIES(${ARS_API_ICUI18NBMC_LIB})
237ENDIF(ARS_API_ICUI18NBMC_LIB)
238
239MESSAGE(STATUS "icuucbmc: (${ARINSIDE_ARAPI_ICUUCBMC_LIBNAME}) -- ${ARS_API_ICUUCBMC_LIB}")
240IF(ARS_API_ICUUCBMC_LIB)
241        LINK_LIBRARIES(${ARS_API_ICUUCBMC_LIB})
242ENDIF(ARS_API_ICUUCBMC_LIB)
243
244# now generate and import resources
245ADD_CUSTOM_TARGET(arinsideresdir ALL
246        COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/img
247        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/active_link.gif ${CMAKE_BINARY_DIR}/img
248        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/al_guide.gif ${CMAKE_BINARY_DIR}/img
249        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/application.gif ${CMAKE_BINARY_DIR}/img
250        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/ars_edit.gif ${CMAKE_BINARY_DIR}/img
251        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/chapter.gif ${CMAKE_BINARY_DIR}/img
252        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/disabled.gif ${CMAKE_BINARY_DIR}/img
253        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/doc.gif ${CMAKE_BINARY_DIR}/img
254        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/down.gif ${CMAKE_BINARY_DIR}/img
255        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/edit.gif ${CMAKE_BINARY_DIR}/img
256        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/empty_list.gif ${CMAKE_BINARY_DIR}/img
257        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/escalation.gif ${CMAKE_BINARY_DIR}/img
258        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/filter.gif ${CMAKE_BINARY_DIR}/img
259        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/filter_guide.gif ${CMAKE_BINARY_DIR}/img
260        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/folder.gif ${CMAKE_BINARY_DIR}/img
261        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/group.gif ${CMAKE_BINARY_DIR}/img
262        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/hidden.gif ${CMAKE_BINARY_DIR}/img
263        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/image.gif ${CMAKE_BINARY_DIR}/img
264        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/info.gif ${CMAKE_BINARY_DIR}/img
265        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/menu.gif ${CMAKE_BINARY_DIR}/img
266        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/next.gif ${CMAKE_BINARY_DIR}/img
267        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/packing_list.gif ${CMAKE_BINARY_DIR}/img
268        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/prev.gif ${CMAKE_BINARY_DIR}/img
269        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/schema.gif ${CMAKE_BINARY_DIR}/img
270        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/search.gif ${CMAKE_BINARY_DIR}/img
271        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/server.gif ${CMAKE_BINARY_DIR}/img
272        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/sort_asc.gif ${CMAKE_BINARY_DIR}/img
273        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/sort_desc.gif ${CMAKE_BINARY_DIR}/img
274        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/up.gif ${CMAKE_BINARY_DIR}/img
275        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/user.gif ${CMAKE_BINARY_DIR}/img
276        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/visible.gif ${CMAKE_BINARY_DIR}/img
277        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/webservice.gif ${CMAKE_BINARY_DIR}/img
278        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/script.js ${CMAKE_BINARY_DIR}/img
279        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/sortscript.js ${CMAKE_BINARY_DIR}/img
280        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/tabscript.js ${CMAKE_BINARY_DIR}/img
281        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/schema_page.js ${CMAKE_BINARY_DIR}/img
282        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/arshelper.js ${CMAKE_BINARY_DIR}/img
283        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/jquery/jquery-ui-custom.css ${CMAKE_BINARY_DIR}/img
284        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/jquery/jquery-ui.js ${CMAKE_BINARY_DIR}/img
285        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/jquery/jquery.address.min.js ${CMAKE_BINARY_DIR}/img
286        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/jquery/jquery.js ${CMAKE_BINARY_DIR}/img
287        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/jquery/jquery.timers.js ${CMAKE_BINARY_DIR}/img
288        COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/img/images
289        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/jquery/images/ui-bg_glass_75_e6e6e6_1x400.png ${CMAKE_BINARY_DIR}/img/images
290        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/jquery/images/ui-bg_glass_65_ffffff_1x400.png ${CMAKE_BINARY_DIR}/img/images
291)
292
293ADD_CUSTOM_TARGET(arinsideres ALL
294        COMMAND ${CMAKE_COMMAND} -E tar "czf" "${arinside_BINARY_DIR}/arires.tgz" img WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" DEPENDS arinsideresdir
295)
296
297ADD_MSVC_PRECOMPILED_HEADER("stdafx.h" "stdafx.cpp" ARINSIDE_SRCS)
298
299# generate svnrev.h file
300FIND_PACKAGE(Subversion)
301IF(Subversion_FOUND)
302        Subversion_WC_INFO(${PROJECT_SOURCE_DIR} ARINSIDE)
303ELSE(Subversion_FOUND)
304        SET(ARINSIDE_WC_REVISION SVNMISS)
305ENDIF(Subversion_FOUND)
306FILE(READ ${PROJECT_SOURCE_DIR}/svnrev_template.h SVNREV_TEMPLATE)
307STRING(REPLACE "$WCREV$" ${ARINSIDE_WC_REVISION} SVNREV_TEMPLATE "${SVNREV_TEMPLATE}")
308FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/svnrev.h ${SVNREV_TEMPLATE})
309INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
310
311# now setup testing ... http://stackoverflow.com/questions/9689183/cmake-googletest
312INCLUDE(ExternalProject)
313SET_DIRECTORY_PROPERTIES(PROPERTIES EP_PREFIX ${CMAKE_BINARY_DIR}/thirdparty)
314ExternalProject_Add(
315        googletest
316        URL http://googletest.googlecode.com/files/gtest-1.6.0.zip
317        TIMEOUT 10
318        # Force separate output paths for debug and release builds to allow easy
319        # identification of correct lib in subsequent TARGET_LINK_LIBRARIES commands
320        CMAKE_ARGS -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG:PATH=DebugLibs
321                           -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE:PATH=ReleaseLibs
322                           -Dgtest_force_shared_crt=ON
323        # Disable install step
324        INSTALL_COMMAND ""
325        # Wrap download, configure and build steps in a script to log output
326        ###These LOG_XXX params are only supported in cmake2.8.3+ and are disabled here to get backwards compatibility with 2.8.0
327        #LOG_DOWNLOAD ON
328        #LOG_CONFIGURE ON
329        #LOG_BUILD ON
330)
331       
332ExternalProject_Get_Property(googletest source_dir)
333INCLUDE_DIRECTORIES(${source_dir}/include)
334ExternalProject_Get_Property(googletest binary_dir)
335SET(GTEST_BINARY_DIR ${binary_dir})
336ENABLE_TESTING()
337
338LINK_DIRECTORIES(${GTEST_BINARY_DIR})
339
340# setup output target
341ADD_LIBRARY(arinsidelib ${ARINSIDE_SRCS} ${ARINSIDE_RESOURCE_OBJECTS})
342ADD_EXECUTABLE(arinside ${ARINSIDE_MAIN_SRCS})
343ADD_EXECUTABLE(arinsidetest ${ARINSIDE_TEST_SRCS})
344
345# dependencies
346ADD_DEPENDENCIES(arinsidetest arinsidelib googletest)
347ADD_DEPENDENCIES(arinside arinsidelib arinsideres)
348
349# reference the needed libraries
350TARGET_LINK_LIBRARIES(arinside ${ARS_API_LIB} ${ZLIB_LIB} ${ARINSIDE_ADDITIONAL_LIBS} arinsidelib)
351TARGET_LINK_LIBRARIES(arinsidetest ${ARS_API_LIB} ${ZLIB_LIB} ${ARINSIDE_ADDITIONAL_LIBS} arinsidelib)
352IF(MSVC)
353        TARGET_LINK_LIBRARIES(arinsidetest
354                debug ${GTEST_BINARY_DIR}/DebugLibs/${CMAKE_FIND_LIBRARY_PREFIXES}gtest${CMAKE_FIND_LIBRARY_SUFFIXES}
355                optimized ${GTEST_BINARY_DIR}/ReleaseLibs/${CMAKE_FIND_LIBRARY_PREFIXES}gtest${CMAKE_FIND_LIBRARY_SUFFIXES}
356        )
357ELSE(MSVC)
358        TARGET_LINK_LIBRARIES(arinsidetest gtest)
359ENDIF(MSVC)
360
361ADD_TEST(NAME test COMMAND arinsidetest)
362#INSTALL(TARGETS arinside DESTINATION bin)
Note: See TracBrowser for help on using the repository browser.