arm64: Fix a dump mistake with rounding modes.
[libretro-ppsspp.git] / CMakeLists.txt
blob4cefe5d54655c4bf3e3777479387b4931f874b31
1 # vim:noexpandtab:
2 cmake_minimum_required(VERSION 2.8.8)
3 project(PPSSPP)
4 enable_language(ASM)
5 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/CMakeTests)
7 add_definitions(-DPPSSPP)
9 if(CMAKE_SIZEOF_VOID_P EQUAL 8)
10         set(_ARCH_64 1)
11         add_definitions(-D_ARCH_64=1)
12 else()
13         set(_ARCH_32 1)
14         add_definitions(-D_ARCH_32=1)
15 endif()
17 # Detect CPU from CMAKE configuration. Toolchains should set this up
18 if(CMAKE_SYSTEM_PROCESSOR)
19         if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^arm")
20                 set(ARM ON)
21                 if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^armv7")
22                         set(ARMV7 ON)
23                 endif()
24         elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^x86" OR
25                 ${CMAKE_SYSTEM_PROCESSOR} MATCHES "^amd64" OR
26                 ${CMAKE_SYSTEM_PROCESSOR} MATCHES "i.86")
27                 set(X86 ON)
28         elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^mips")
29                 set(MIPS ON)
30         endif()
31 endif()
33 # Remove soon?
34 set(USE_FFMPEG ON)
36 if(ARM OR SIMULATOR)
37         set(USING_EGL ON)
38 endif()
40 if(EXISTS "/opt/vc/include/bcm_host.h")
41         message(STATUS "RaspberryPI VC Found")
42         set(RPI ON)
43 endif()
45 if(BB)
46         set(ARMV7 ON)
47         set(USING_FBDEV ON)
48 endif()
51 if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
52         set(LINUX ON)
53         add_definitions(-D__STDC_CONSTANT_MACROS)
54 endif()
56 if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
57         set(MACOSX ON)
58 endif()
60 if (X86 AND NOT MIPS)
61         if(_ARCH_64)
62                 add_definitions(-D_M_X64)
63         else()
64                 add_definitions(-D_M_IX86)
65         endif()
66 endif()
68 if(NOT DEFINED HEADLESS)
69         set(HEADLESS OFF)
70 endif()
72 # Doesn't link on some platforms
73 #if(NOT DEFINED UNITTEST)
74 #       set(UNITTEST OFF)
75 #endif()
77 # User-editable options (go into CMakeCache.txt)
78 # :: Processors
79 option(ARMV7 "Set to ON if targeting an ARMv7 processor" ${ARMV7})
80 option(ARM "Set to ON if targeting an ARM processor" ${ARM})
81 option(MIPS "Set to ON if targeting a MIPS processor" ${MIPS})
82 option(X86 "Set to ON if targeting an X86 processor" ${X86})
83 # :: Platforms
84 option(ANDROID "Set to ON if targeting an Android device" ${ANDROID})
85 option(BLACKBERRY "Set to ON if targeting a Blackberry device" ${BLACKBERRY})
86 option(IOS "Set to ON if targeting an iOS device" ${IOS})
87 option(MAEMO "Set to ON if targeting a Maemo (N900) device" ${MAEMO})
88 option(BB "Set to ON if targeting a Beaglebone/Beaglebone Black device" ${BB})
89 # :: Environments
90 option(USING_EGL "Set to ON if target environment uses EGL" ${USING_EGL})
91 option(USING_FBDEV "Set to ON if target environment uses fbdev (eg. Pandora)" ${USING_FBDEV})
92 option(USING_GLES2 "Set to ON if target device uses OpenGL ES 2.0" ${USING_GLES2})
93 # :: Frontends
94 option(USING_QT_UI "Set to ON if you wish to use the Qt frontend wrapper" ${USING_QT_UI})
95 option(MOBILE_DEVICE "Set to ON when targetting a mobile device" ${MOBILE_DEVICE})
96 option(HEADLESS "Set to OFF to not generate the PPSSPPHeadless target" ${HEADLESS})
97 option(UNITTEST "Set to ON to generate the unittest target" ${UNITTEST})
98 option(SIMULATOR "Set to ON when targeting an x86 simulator of an ARM platform" ${SIMULATOR})
99 # :: Options
100 option(USE_FFMPEG "Build with FFMPEG support" ${USE_FFMPEG})
101 option(USE_SYSTEM_FFMPEG "Dynamically link against system FFMPEG" ${USE_SYSTEM_FFMPEG})
103 if(ANDROID OR BLACKBERRY OR IOS)
104         if (NOT CMAKE_TOOLCHAIN_FILE)
105                 if (ANDROID)
106                         set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/android/android.toolchain.cmake)
107                 elseif(BLACKBERRY)
108                         set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/Blackberry/bb.toolchain.cmake)
109                 elseif(IOS)
110                         set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/ios/ios.toolchain.cmake)
111                 endif()
112                 message(FATAL_ERROR "CMAKE_TOOLCHAIN_FILE was not set!\n"
113                         "Delete the CMakeCache.txt file and CMakeFiles directory.\n"
114                         "Re-run ${CMAKE_COMMAND} with:\n"
115                         "\"-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}\"")
116         endif()
117         set(MOBILE_DEVICE ON)
118         set(USING_GLES2 ON)
119 endif()
121 if(ANDROID)
122         set(CoreLibName ppsspp_jni)
123         set(CoreLinkType SHARED)
124 else()
125         set(CoreLibName Core)
126         set(CoreLinkType STATIC)
127 endif()
129 include_directories(native)
131 if(RPI)
132         include_directories(/opt/vc/include /opt/vc/include/interface/vcos/pthreads)
133         link_directories(/opt/vc/lib)
134         set(OPENGL_LIBRARIES GLESv2 bcm_host)
135 elseif(USING_GLES2 AND NOT IOS)
136         set(OPENGL_LIBRARIES GLESv2)
137 elseif(NOT IOS)
138         include(FindOpenGL REQUIRED)
139 endif()
141 if(MAEMO)
142         #Maemo's gcc-4.7.2 is strict
143         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
144 endif()
146 if (NOT BLACKBERRY AND NOT ANDROID AND NOT IOS)
147         include(FindSDL2)
148 endif()
149 include(FindThreads)
151 if(APPLE)
152         find_library(COCOA_LIBRARY Cocoa)
153 endif()
155 # Needed for Globals.h
156 include_directories("${CMAKE_SOURCE_DIR}")
158 if(ARM)
159         add_definitions(-DARM)
160 endif()
161 if(MIPS)
162         add_definitions(-DMIPS)
163 endif()
165 if(ANDROID)
166         add_definitions(-DANDROID)
167 endif()
168 if(BLACKBERRY)
169         add_definitions(-DBLACKBERRY=${BLACKBERRY})
170 endif()
171 if(IOS)
172         add_definitions(-DIOS)
173 endif()
174 if(MAEMO)
175         add_definitions(-DMAEMO)
176 endif()
177 if(RPI)
178         add_definitions(-DRPI)
179 endif()
181 if(USING_EGL)
182         add_definitions(-DUSING_EGL)
183 endif()
184 if(USING_FBDEV)
185         add_definitions(-DUSING_FBDEV)
186 endif()
187 if(USING_GLES2)
188         add_definitions(-DUSING_GLES2)
189 endif()
190 if(MOBILE_DEVICE)
191         add_definitions(-DMOBILE_DEVICE)
192 endif()
194 if (NOT CMAKE_BUILD_TYPE)
195         message(STATUS "No build type selected, default to Release")
196         set(CMAKE_BUILD_TYPE "Release")
197 endif()
199 if(ARMV7)
200         message("Building for ARMv7, ${CMAKE_BUILD_TYPE}")
201 elseif(ARM)
202         message("Building for ARMv6, ${CMAKE_BUILD_TYPE}")
203 elseif(MIPS AND X86)
204         message("Building for MIPS in x86 mode, ${CMAKE_BUILD_TYPE}")
205 elseif(MIPS)
206         message("Buildings for MIPS, ${CMAKE_BUILD_TYPE}")
207 elseif(X86)
208         message("Building for x86, ${CMAKE_BUILD_TYPE}")
209 else()
210         message("Building for Generic, ${CMAKE_BUILD_TYPE}")
211 endif()
213 if(NOT MSVC)
214         set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -D_DEBUG")
215         set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -Os -D_NDEBUG")
216         set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -D_NDEBUG")
217         set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O2 -g -D_NDEBUG")
218         set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g -D_DEBUG")
219         set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} -Os -D_NDEBUG")
220         set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -D_NDEBUG")
221         set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -O2 -g -D_NDEBUG")
223         # Disable some warnings
224         add_definitions(-Wno-multichar)
225         add_definitions(-fno-strict-aliasing)
226         if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
227                 set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -parallel -fopenmp")
228         endif()
230         if(X86 AND NOT MIPS)
231                 # enable sse2 code generation
232                 add_definitions(-msse2)
233         endif()
235         if (BLACKBERRY AND ARM)
236                 set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=armv7-a -mfpu=neon -mcpu=cortex-a9")
237                 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=armv7-a -mfpu=neon -mcpu=cortex-a9")
238         endif()
240         if(IOS)
241                 add_definitions(-DGL_ETC1_RGB8_OES=0)
242                 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -U__STRICT_ANSI__")
243                 set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
244                 # armv7s (without resorting to FastMemory) is still a work in progress
245                 # comment out the next line to enable default/"standard" architectures (which is a fat armv7/armv7s binary)
246                 set(CMAKE_OSX_ARCHITECTURES "armv7")
247         elseif(APPLE)
248                 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -U__STRICT_ANSI__")
249                 # Karen/angelXwind: --macosx-version-min=10.7 is needed in order to produce binaries that OS X 10.7 Lion can execute. However, it seems that PPSSPP won't support 10.6 or lower without getting rid of -stdlib=libc++ ...which probably won't end well. So I guess PPSSPP will strictly be a 10.7+ app.
250                 # vit9696: OSX 10.6 builds are possible: http://forums.ppsspp.org/showthread.php?tid=1826&pid=18875#pid18875
251                 set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
252         else()
253                 if (NOT CMAKE_C_COMPILER_ID STREQUAL "Intel" AND NOT CMAKE_C_COMPILER_ID STREQUAL "Clang")
254                         add_definitions(-Wno-psabi)
255                 endif()
256                 if (BLACKBERRY)
257                         add_definitions(-D_XOPEN_SOURCE=600)
258                 else()
259                         add_definitions(-D_XOPEN_SOURCE=700)
260                 endif()
261                 add_definitions(-D_XOPEN_SOURCE_EXTENDED -D__BSD_VISIBLE=1)
262                 add_definitions(-D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64)
263         endif()
264         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
265 else()
266         # Disable warnings about MS-specific _s variants of libc functions
267         add_definitions(-D_CRT_SECURE_NO_WARNINGS)
268         set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
269         set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -D_NDEBUG")
270 endif()
272 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
273 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
275 if(ANDROID)
276         set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/android/libs/${ANDROID_ABI}")
277 endif()
279 # This sets up the MSVC project dirs according to the physical project dirs
280 macro(setup_target_project TargetName ProjectDir)
281         get_property(TargetSources TARGET "${TargetName}" PROPERTY SOURCES)
282         foreach(Source ${TargetSources})
283                 # Figure out the file's path relative to the ProjectDir
284                 # NOTE: &#$@ double-quoted regexps
285                 string(REGEX REPLACE "${ProjectDir}" "" RelativePath "${Source}")
286                 string(REGEX REPLACE "[\\\\/][^\\\\/]*$" "" RelativePath "${RelativePath}")
287                 string(REGEX REPLACE "^[\\\\/]" "" RelativePath "${RelativePath}")
288                 string(REGEX REPLACE "/" "\\\\\\\\" RelativePath "${RelativePath}")
289                 # put the source file in a source_group equivalent to the relative path
290                 source_group("${RelativePath}" FILES ${Source})
291         endforeach()
292 endmacro()
294 # Commented-out files are files that don't compile
295 # and were disabled in the original MSVC project anyway
297 set(CommonExtra)
298 if(ARM)
299         set(CommonExtra ${CommonExtra}
300                 Common/ArmCPUDetect.cpp
301                 Common/ArmThunk.cpp
302                 Common/ColorConvNEON.cpp)
303 elseif(X86)
304         set(CommonExtra ${CommonExtra}
305                 Common/ABI.cpp
306                 Common/ABI.h
307                 Common/CPUDetect.cpp
308                 Common/CPUDetect.h
309                 Common/Thunk.cpp
310                 Common/Thunk.h
311                 Common/x64Analyzer.cpp
312                 Common/x64Analyzer.h
313                 Common/x64Emitter.cpp
314                 Common/x64Emitter.h)
315 elseif(MIPS)
316         set(CommonExtra ${CommonExtra}
317                 Common/MipsCPUDetect.cpp
318                 Common/MipsEmitter.cpp
319                 Common/MipsEmitter.h)
320 else()
321         set(CommonExtra ${CommonExtra}
322                 Common/FakeCPUDetect.cpp
323                 Common/FakeEmitter.h)
324 endif()
326 if(UNITTEST)
327 set(CommonExtra ${CommonExtra}
328                 Common/Arm64Emitter.h
329                 Common/Arm64Emitter.cpp
330                 Common/ArmEmitter.h
331                 Common/ArmEmitter.cpp
332                 Core/Util/DisArm64.cpp)
333 else()
334 #Blackberry appears to depend on this being here, should clean it up.
335 set(CommonExtra ${CommonExtra}
336                 Common/ArmEmitter.h
337                 Common/ArmEmitter.cpp)
338 endif()
340 if(WIN32)
341         set(CommonExtra ${CommonExtra}
342                 Common/stdafx.cpp
343                 Common/stdafx.h)
344 endif()
346 add_library(Common STATIC
347         ${CommonExtra}
348         Common/ColorConv.cpp
349         Common/ColorConv.h
350         Common/ChunkFile.cpp
351         Common/ChunkFile.h
352         Common/ConsoleListener.cpp
353         Common/ConsoleListener.h
354         Common/Crypto/md5.cpp
355         Common/Crypto/md5.h
356         Common/Crypto/sha1.cpp
357         Common/Crypto/sha1.h
358         Common/Crypto/sha256.cpp
359         Common/Crypto/sha256.h
360         Common/FileUtil.cpp
361         Common/FileUtil.h
362         Common/KeyMap.cpp
363         Common/KeyMap.h
364         Common/LogManager.cpp
365         Common/LogManager.h
366         Common/MemArena.cpp
367         Common/MemArena.h
368         Common/MemoryUtil.cpp
369         Common/MemoryUtil.h
370         Common/Misc.cpp
371         Common/MsgHandler.cpp
372         Common/MsgHandler.h
373         Common/StringUtils.cpp
374         Common/StringUtils.h
375         Common/ThreadPools.cpp
376         Common/ThreadPools.h
377         Common/Timer.cpp
378         Common/Timer.h)
379 include_directories(Common)
380 setup_target_project(Common Common)
382 if(WIN32)
383         target_link_libraries(Common winmm)
384 endif()
386 if(NOT USING_GLES2)
387         include_directories(${OPENGL_INCLUDE_DIR})
389         add_definitions(-DGLEW_STATIC)
390         add_library(glew STATIC
391                 native/ext/glew/GL/glew.h
392                 native/ext/glew/GL/glxew.h
393                 native/ext/glew/GL/wglew.h
394                 native/ext/glew/glew.c)
395         target_link_libraries(glew ${OPENGL_LIBRARIES})
396         include_directories(native/ext/glew)
397         set(GLEW_LIBRARIES glew)
398 endif()
400 add_subdirectory(ext/snappy)
401 add_subdirectory(ext/udis86)
403 add_library(vjson STATIC
404         native/ext/vjson/json.cpp
405         native/ext/vjson/json.h
406         native/ext/vjson/block_allocator.cpp
407         native/ext/vjson/block_allocator.h
410 add_library(rg_etc1 STATIC
411         native/ext/rg_etc1/rg_etc1.cpp
412         native/ext/rg_etc1/rg_etc1.h)
413 include_directories(native/ext/rg_etc1)
415 add_library(stb_vorbis STATIC
416         native/ext/stb_vorbis/stb_vorbis.c
417         native/ext/stb_vorbis/stb_vorbis.h)
418 include_directories(native/ext/stb_vorbis)
420 if(USE_FFMPEG)
421         if(USE_SYSTEM_FFMPEG)
422                 include(FindFFMPEG)
423         else()
424                 set(FFMPEG_FOUND OFF)
425         endif()
426         if(NOT FFMPEG_FOUND)
427                 if(NOT DEFINED FFMPEG_BUILDDIR)
428                         if(ANDROID)
429                                 if(ARMV7)
430                                         set(PLATFORM_ARCH "android/armv7")
431                                 elseif(ARM)
432                                         set(PLATFORM_ARCH "android/arm")
433                                 elseif(X86)
434                                         set(PLATFORM_ARCH "android/x86")
435                                 endif()
436                         elseif(BLACKBERRY)
437                                 set(PLATFORM_ARCH "blackberry/armv7")
438                         elseif(IOS)
439                                 set(PLATFORM_ARCH "ios/universal")
440                         elseif(MACOSX)
441                                 set(PLATFORM_ARCH "macosx/x86_64")
442                         elseif(LINUX)
443                                 if(ARMV7)
444                                         set(PLATFORM_ARCH "linux/armv7")
445                                 elseif(ARM)
446                                         set(PLATFORM_ARCH "linux/arm")
447                                 elseif(MIPS)
448                                         set(PLATFORM_ARCH "linux/mips32")
449                                 elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
450                                         set(PLATFORM_ARCH "linux/x86_64")
451                                 else()
452                                         set(PLATFORM_ARCH "linux/x86")
453                                 endif()
454                         endif()
455                         # Using static libraries
456                         if (DEFINED PLATFORM_ARCH)
457                                 include_directories(ffmpeg/${PLATFORM_ARCH}/include)
458                                 link_directories(ffmpeg/${PLATFORM_ARCH}/lib)
459                                 set(FFMPEG_LIBRARIES libavformat.a libavcodec.a libavutil.a libswresample.a libswscale.a)
460                         else()
461                                 # Manual definition of system library locations by the user.
462                                 if (DEFINED FFMPEG_INCLUDE_PATH)
463                                         include_directories(ffmpeg ${FFMPEG_INCLUDE_PATH})
464                                 endif()
465                                 if (DEFINED AVFORMAT_PATH)
466                                         add_library(libavformat STATIC IMPORTED)
467                                         set_target_properties(libavformat PROPERTIES IMPORTED_LOCATION ${AVFORMAT_PATH})
468                                         SET (FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} libavformat)
469                                 endif()
470                                 if (DEFINED AVCODEC_PATH)
471                                         add_library(libavcodec STATIC IMPORTED)
472                                         set_target_properties(libavcodec PROPERTIES IMPORTED_LOCATION ${AVCODEC_PATH})
473                                         SET (FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} libavcodec)
474                                 endif()
475                                 if (DEFINED AVUTIL_PATH)
476                                         add_library(libavutil STATIC IMPORTED)
477                                         set_target_properties(libavutil PROPERTIES IMPORTED_LOCATION ${AVUTIL_PATH})
478                                         SET (FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} libavutil)
479                                 endif()
480                                 if (DEFINED SWRESAMPLE_PATH)
481                                         add_library(libswresample STATIC IMPORTED)
482                                         set_target_properties(libswresample PROPERTIES IMPORTED_LOCATION ${SWRESAMPLE_PATH})
483                                         SET (FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} libswresample)
484                                 endif()
485                                 if (DEFINED SWSCALE_PATH)
486                                         add_library(libswscale STATIC IMPORTED)
487                                         set_target_properties(libswscale PROPERTIES IMPORTED_LOCATION ${SWSCALE_PATH})
488                                         SET (FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} libswscale)
489                                 endif()
490                         endif(DEFINED PLATFORM_ARCH)
491                 else(NOT DEFINED FFMPEG_BUILDDIR)
492                         # Using shared libraries
493                         include_directories(ffmpeg ${FFMPEG_BUILDDIR})
495                         add_library(libavformat STATIC IMPORTED)
496                         set_target_properties(libavformat PROPERTIES IMPORTED_LOCATION ${FFMPEG_BUILDDIR}/libavformat/libavformat.a)
497                         add_library(libavcodec STATIC IMPORTED)
498                         set_target_properties(libavcodec PROPERTIES IMPORTED_LOCATION ${FFMPEG_BUILDDIR}/libavcodec/libavcodec.a)
499                         add_library(libavutil STATIC IMPORTED)
500                         set_target_properties(libavutil PROPERTIES IMPORTED_LOCATION ${FFMPEG_BUILDDIR}/libavutil/libavutil.a)
501                         add_library(libswresample STATIC IMPORTED)
502                         set_target_properties(libswresample PROPERTIES IMPORTED_LOCATION ${FFMPEG_BUILDDIR}/libswresample/libswresample.a)
503                         add_library(libswscale STATIC IMPORTED)
504                         set_target_properties(libswscale PROPERTIES IMPORTED_LOCATION ${FFMPEG_BUILDDIR}/libswscale/libswscale.a)
506                         SET (FFMPEG_LIBRARIES
507                                 libavformat
508                                 libavcodec
509                                 libavutil
510                                 libswresample
511                                 libswscale
512                         )
513                 endif(NOT DEFINED FFMPEG_BUILDDIR)
514         endif(NOT FFMPEG_FOUND)
516         find_library(ICONV_LIBRARY NAMES iconv)
517         if (ICONV_LIBRARY)
518                 set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${ICONV_LIBRARY})
519         endif()
521         if(APPLE)
522                 set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} bz2 "-framework CoreVideo")
523                 if (NOT IOS)
524                         set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} "-framework VideoDecodeAcceleration")
525                 endif()
526         endif(APPLE)
528         if(FFMPEG_FOUND)
529                 set(nativeExtraLibs ${nativeExtraLibs} ${FFMPEG_LIBRARIES})
530         else()
531                 set(LinkCommon ${LinkCommon} ${FFMPEG_LIBRARIES})
532         endif()
533         target_link_libraries(Common ${FFMPEG_LIBRARIES})
534         add_definitions(-DUSE_FFMPEG)
535 endif(USE_FFMPEG)
537 # Modification to show where we are pulling the ffmpeg libraries from.
538 if(USE_FFMPEG AND DEFINED FFMPEG_LIBRARIES)
539         message(STATUS "FFMPEG library locations:")
540         if(FFMPEG_FOUND)
541                 message(STATUS "libavcodec location: ${FFMPEG_avcodec_LIBRARY}")
542                 message(STATUS "libavformat location: ${FFMPEG_avformat_LIBRARY}")
543                 message(STATUS "libavutil location: ${FFMPEG_avutil_LIBRARY}")
544                 message(STATUS "libswresample location: ${FFMPEG_swresample_LIBRARY}")
545                 message(STATUS "libswscale location: ${FFMPEG_swscale_LIBRARY}")
546         elseif(DEFINED PLATFORM_ARCH)
547                 set(TEMP ${CMAKE_SOURCE_DIR}/ffmpeg/${PLATFORM_ARCH}/lib)
548                 message(STATUS "libavcodec location: ${TEMP}/libavcodec.a")
549                 message(STATUS "libavformat location: ${TEMP}/libavformat.a")
550                 message(STATUS "libavutil location: ${TEMP}/libavutil.a")
551                 message(STATUS "libswresample location: ${TEMP}/libswresample.a")
552                 message(STATUS "libswscale location: ${TEMP}/libswscale.a")
553         else()
554                 get_target_property(TEMP libavcodec IMPORTED_LOCATION)
555                 message(STATUS "libavcodec location: ${TEMP}")
556                 get_target_property(TEMP libavformat IMPORTED_LOCATION)
557                 message(STATUS "libavformat location: ${TEMP}")
558                 get_target_property(TEMP libavutil IMPORTED_LOCATION)
559                 message(STATUS "libavutil location: ${TEMP}")
560                 get_target_property(TEMP libswresample IMPORTED_LOCATION)
561                 message(STATUS "libswresample location: ${TEMP}")
562                 get_target_property(TEMP libswscale IMPORTED_LOCATION)
563                 message(STATUS "libswscale location: ${TEMP}")
564         endif()
565 else()
566         message(STATUS "ERROR: No FFMPEG library locations")
567 endif()
569 if(USE_FFMPEG AND NOT DEFINED FFMPEG_LIBRARIES)
570         message(WARNING "FFMPEG_BUILDDIR variable or manual path definition is required to enable FFmpeg. Disabling it.")
571         unset(USE_FFMPEG)
572 endif()
574 find_package(ZLIB)
575 if(ZLIB_FOUND)
576         include_directories(${ZLIB_INCLUDE_DIR})
577 else()
578         add_library(zlib STATIC
579                 ext/zlib/adler32.c
580                 ext/zlib/compress.c
581                 ext/zlib/crc32.c
582                 ext/zlib/crc32.h
583                 ext/zlib/deflate.c
584                 ext/zlib/deflate.h
585                 ext/zlib/gzclose.c
586                 ext/zlib/gzguts.h
587                 ext/zlib/gzlib.c
588                 ext/zlib/gzread.c
589                 ext/zlib/gzwrite.c
590                 ext/zlib/infback.c
591                 ext/zlib/inffast.c
592                 ext/zlib/inffast.h
593                 ext/zlib/inffixed.h
594                 ext/zlib/inflate.c
595                 ext/zlib/inflate.h
596                 ext/zlib/inftrees.c
597                 ext/zlib/inftrees.h
598                 ext/zlib/make_vms.com
599                 ext/zlib/trees.c
600                 ext/zlib/trees.h
601                 ext/zlib/uncompr.c
602                 ext/zlib/zconf.h
603                 ext/zlib/zlib.h
604                 ext/zlib/zutil.c
605                 ext/zlib/zutil.h
606         )
607         include_directories(ext/zlib)
608         set(ZLIB_LIBRARY zlib)
609 endif()
611 add_library(cityhash STATIC
612         native/ext/cityhash/city.cpp
613         native/ext/cityhash/city.h
614         native/ext/cityhash/citycrc.h
616 include_directories(ext/cityhash)
618 if (NOT MSVC)
619         # These can be fast even for debug.
620         set_target_properties(snappy PROPERTIES COMPILE_FLAGS "-O3")
621         set_target_properties(udis86 PROPERTIES COMPILE_FLAGS "-O3")
622         set_target_properties(cityhash PROPERTIES COMPILE_FLAGS "-O3")
623         if(NOT ZLIB_FOUND)
624                 set_target_properties(zlib PROPERTIES COMPILE_FLAGS "-O3")
625         endif()
626 endif()
629 add_library(libzip STATIC
630         native/ext/libzip/zip.h
631         native/ext/libzip/mkstemp.c
632         native/ext/libzip/zip_add.c
633         native/ext/libzip/zip_add_dir.c
634         native/ext/libzip/zip_close.c
635         native/ext/libzip/zip_delete.c
636         native/ext/libzip/zip_dirent.c
637         native/ext/libzip/zip_entry_free.c
638         native/ext/libzip/zip_entry_new.c
639         native/ext/libzip/zip_err_str.c
640         native/ext/libzip/zip_error.c
641         native/ext/libzip/zip_error_clear.c
642         native/ext/libzip/zip_error_get.c
643         native/ext/libzip/zip_error_get_sys_type.c
644         native/ext/libzip/zip_error_strerror.c
645         native/ext/libzip/zip_error_to_str.c
646         native/ext/libzip/zip_fclose.c
647         native/ext/libzip/zip_file_error_clear.c
648         native/ext/libzip/zip_file_error_get.c
649         native/ext/libzip/zip_file_get_offset.c
650         native/ext/libzip/zip_file_strerror.c
651         native/ext/libzip/zip_filerange_crc.c
652         native/ext/libzip/zip_fopen.c
653         native/ext/libzip/zip_fopen_index.c
654         native/ext/libzip/zip_fread.c
655         native/ext/libzip/zip_free.c
656         native/ext/libzip/zip_get_archive_comment.c
657         native/ext/libzip/zip_get_archive_flag.c
658         native/ext/libzip/zip_get_file_comment.c
659         native/ext/libzip/zip_get_name.c
660         native/ext/libzip/zip_get_num_files.c
661         native/ext/libzip/zip_memdup.c
662         native/ext/libzip/zip_name_locate.c
663         native/ext/libzip/zip_new.c
664         native/ext/libzip/zip_open.c
665         native/ext/libzip/zip_rename.c
666         native/ext/libzip/zip_replace.c
667         native/ext/libzip/zip_set_archive_comment.c
668         native/ext/libzip/zip_set_archive_flag.c
669         native/ext/libzip/zip_set_file_comment.c
670         native/ext/libzip/zip_set_name.c
671         native/ext/libzip/zip_source_buffer.c
672         native/ext/libzip/zip_source_file.c
673         native/ext/libzip/zip_source_filep.c
674         native/ext/libzip/zip_source_free.c
675         native/ext/libzip/zip_source_function.c
676         native/ext/libzip/zip_source_zip.c
677         native/ext/libzip/zip_stat.c
678         native/ext/libzip/zip_stat_index.c
679         native/ext/libzip/zip_stat_init.c
680         native/ext/libzip/zip_strerror.c
681         native/ext/libzip/zip_unchange.c
682         native/ext/libzip/zip_unchange_all.c
683         native/ext/libzip/zip_unchange_archive.c
684         native/ext/libzip/zip_unchange_data.c)
685 target_link_libraries(libzip ${ZLIB_LIBRARY})
686 include_directories(native/ext/libzip)
687 set(LIBZIP_LIBRARY libzip)
689 # FindPNG does a few things we don't want. So do it ourselves. Fixed to libpng17
690 find_path(PNG_PNG_INCLUDE_DIR NAMES "libpng17/png.h")
691 find_library(PNG_LIBRARY NAMES png17 libpng17)
692 find_package(PackageHandleStandardArgs)
693 find_package_handle_standard_args(PNG REQUIRED_VARS PNG_LIBRARY PNG_PNG_INCLUDE_DIR)
694 if (PNG_FOUND)
695         include_directories(${PNG_PNG_INCLUDE_DIR})
696 else()
697         if(ARM)
698                 file(GLOB PNG_ARM_INCLUDES native/ext/libpng17/arm/*)
699         endif()
700         add_library(png17 STATIC
701                 native/ext/libpng17/pngconf.h
702                 native/ext/libpng17/pngdebug.h
703                 native/ext/libpng17/png.c
704                 native/ext/libpng17/png.h
705                 native/ext/libpng17/pngerror.c
706                 native/ext/libpng17/pngget.c
707                 native/ext/libpng17/pnginfo.h
708                 native/ext/libpng17/pnglibconf.h
709                 native/ext/libpng17/pngmem.c
710                 native/ext/libpng17/pngpread.c
711                 native/ext/libpng17/pngpriv.h
712                 native/ext/libpng17/pngread.c
713                 native/ext/libpng17/pngrio.c
714                 native/ext/libpng17/pngrtran.c
715                 native/ext/libpng17/pngrutil.c
716                 native/ext/libpng17/pngset.c
717                 native/ext/libpng17/pngstruct.h
718                 native/ext/libpng17/pngtest.c
719                 native/ext/libpng17/pngtrans.c
720                 native/ext/libpng17/pngwio.c
721                 native/ext/libpng17/pngwrite.c
722                 native/ext/libpng17/pngwtran.c
723                 native/ext/libpng17/pngwutil.c
724                 ${PNG_ARM_INCLUDES} )
725         set(PNG_LIBRARY png17)
726         include_directories(native/ext)
727 endif()
729 set(nativeExtra)
730 set(nativeExtraLibs)
732 if(ARMV7)
733         if(BB)
734                 set (CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -march=armv7-a -mfpu=neon -mcpu=cortex-a8")
735         else()
736                 set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=armv7-a -mfpu=neon -mcpu=cortex-a9")
737                 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=armv7-a -mfpu=neon -mcpu=cortex-a9")
738                 set (CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -march=armv7-a -mfpu=neon -mcpu=cortex-a9")
739         endif()
740         set(nativeExtra ${nativeExtra}
741     native/math/fast/fast_matrix_neon.S)
742 endif()
743 if(X86 AND NOT MIPS)
744         set(nativeExtra ${nativeExtra}
745     native/math/fast/fast_matrix_sse.c)
746 endif()
749 if(ANDROID)
750         set(nativeExtra ${nativeExtra}
751                 native/base/NativeApp.h
752                 native/android/app-android.cpp
753                 native/android/native_audio.cpp
754                 native/android/native_audio.h)
756         add_library(native_audio SHARED
757                 native/android/native-audio-so.cpp
758                 native/android/native-audio-so.h)
759         target_link_libraries(native_audio OpenSLES log)
760         # No target
761 elseif(IOS)
762         set(nativeExtra ${nativeExtra}
763                 ios/main.mm
764                 ios/AppDelegate.mm
765                 ios/AppDelegate.h
766                 ios/ViewController.mm
767                 ios/ViewController.h
768                 ios/iOSCoreAudio.cpp
769                 ios/iOSCoreAudio.h
770                 ios/iCade/iCadeReaderView.h
771                 ios/iCade/iCadeReaderView.m
772                 ios/iCade/iCadeState.h)
773         set(nativeExtraLibs ${nativeExtraLibs} "-framework Foundation -framework AudioToolbox -framework CoreGraphics -framework QuartzCore -framework OpenGLES -framework UIKit -framework GLKit -framework OpenAL")
774         if(EXISTS "${CMAKE_IOS_SDK_ROOT}/System/Library/Frameworks/GameController.framework")
775                 set(nativeExtraLibs ${nativeExtraLibs} "-weak_framework GameController")
776         endif()
778         set_source_files_properties(ios/AppDelegate.mm PROPERTIES COMPILE_FLAGS -fobjc-arc)
779         set_source_files_properties(ios/ViewController.mm PROPERTIES COMPILE_FLAGS -fobjc-arc)
781         set(TargetBin PPSSPP)
782 elseif(USING_QT_UI)
783         # Currently unused
784         message(FATAL_ERROR "Cmake does not yet support Qt. Please use qmake instead.")
785         find_package(Qt4 COMPONENTS QtMultimedia QtOpenGL QtGui QtCore)
786         include(${QT_USE_FILE})
787         qt4_wrap_cpp(nativeQtHeader native/base/QtMain.h)
788         set(nativeExtra ${nativeExtra} native/base/QtMain.cpp ${nativeQtHeader})
789         if(NOT MOBILE_DEVICE)
790                 qt4_wrap_cpp(nativeQtHeader Qt/mainwindow.h)
791                 set(nativeExtra ${nativeExtra} Qt/mainwindow.cpp)
792         endif()
793         set(nativeExtraLibs ${nativeExtraLibs} ${QT_LIBRARIES})
794         set(TargetBin PPSSPPQt)
795         if(APPLE)
796                 set(nativeExtraLibs ${nativeExtraLibs} "-framework CoreFoundation")
797         endif()
798 elseif(BLACKBERRY)
799         unset(CMAKE_DL_LIBS)
800         set(nativeExtra ${nativeExtra} native/base/BlackberryMain.cpp native/base/BlackberryDisplay.cpp)
801         set(nativeExtraLibs ${nativeExtraLibs} OpenAL bps screen socket EGL)
802         set(TargetBin PPSSPPBlackberry)
803 elseif(SDL2_FOUND)
804         set(TargetBin PPSSPPSDL)
805         # Require SDL
806         include_directories(${SDL2_INCLUDE_DIR})
807         add_definitions(-DSDL)
808         set(nativeExtra ${nativeExtra}
809                 SDL/SDLJoystick.h
810                 SDL/SDLJoystick.cpp
811                 native/base/PCMain.cpp)
812         set(nativeExtraLibs ${nativeExtraLibs} ${SDL2_LIBRARY})
813         if(APPLE)
814                 set(nativeExtra ${nativeExtra} SDL/SDLMain.h SDL/SDLMain.mm)
815                 set(nativeExtraLibs ${nativeExtraLibs} ${COCOA_LIBRARY})
816         elseif(USING_EGL)
817                 set(nativeExtraLibs ${nativeExtraLibs} pthread EGL)
818         endif()
819         set(TargetBin PPSSPPSDL)
820 else()
821         message(FATAL_ERROR "Could not find SDL2. Failing.")
822 endif()
824 set(NativeAppSource
825         android/jni/TestRunner.cpp
826         UI/NativeApp.cpp
827         UI/BackgroundAudio.cpp
828         UI/DevScreens.cpp
829         UI/EmuScreen.cpp
830         UI/GameInfoCache.cpp
831         UI/MainScreen.cpp
832         UI/MiscScreens.cpp
833         UI/PauseScreen.cpp
834         UI/GameScreen.cpp
835         UI/GameSettingsScreen.cpp
836         UI/TiltAnalogSettingsScreen.cpp
837         UI/TiltEventProcessor.cpp
838         UI/TouchControlLayoutScreen.cpp
839         UI/TouchControlVisibilityScreen.cpp
840         UI/GamepadEmu.cpp
841         UI/OnScreenDisplay.cpp
842         UI/ControlMappingScreen.cpp
843         UI/ReportScreen.cpp
844         UI/SavedataScreen.cpp
845         UI/Store.cpp
846         UI/CwCheatScreen.cpp
847         UI/InstallZipScreen.cpp
848         UI/ui_atlas.cpp)
849 if(ANDROID)
850         if (ARM)
851                 set(NativeAppSource ${NativeAppSource} android/jni/ArmEmitterTest.cpp)
852         endif()
853         set(nativeExtra ${nativeExtra} ${NativeAppSource})
854 endif()
856 add_library(native STATIC
857         ${nativeExtra}
858         native/base/backtrace.cpp
859         native/base/backtrace.h
860         native/audio/mixer.cpp
861         native/audio/mixer.h
862         native/audio/wav_read.cpp
863         native/audio/wav_read.h
864         native/base/basictypes.h
865         native/base/buffer.cpp
866         native/base/buffer.h
867         native/base/color.h
868         native/base/colorutil.cpp
869         native/base/colorutil.h
870         native/base/display.cpp
871         native/base/display.h
872         native/base/error_context.cpp
873         native/base/error_context.h
874         native/base/fastlist.h
875         native/base/fastlist_test.cpp
876         native/base/functional.h
877         native/base/linked_ptr.h
878         native/base/logging.h
879         native/base/mutex.h
880         native/base/scoped_ptr.h
881         native/base/stats.h
882         native/base/stringutil.cpp
883         native/base/stringutil.h
884         native/base/timeutil.cpp
885         native/base/timeutil.h
886         native/data/compression.cpp
887         native/data/compression.h
888         native/ext/vjson/json.cpp
889         native/ext/vjson/json.h
890         native/ext/vjson/block_allocator.cpp
891         native/ext/vjson/block_allocator.h
892         native/file/chunk_file.cpp
893         native/file/chunk_file.h
894         native/file/dialog.cpp
895         native/file/dialog.h
896         native/file/easy_file.cpp
897         native/file/easy_file.h
898         native/file/fd_util.cpp
899         native/file/fd_util.h
900         native/file/file_util.cpp
901         native/file/file_util.h
902         native/file/ini_file.cpp
903         native/file/ini_file.h
904         native/file/path.cpp
905         native/file/path.h
906         native/file/vfs.h
907         native/file/zip_read.cpp
908         native/file/zip_read.h
909         native/gfx/gl_common.h
910         native/gfx/gl_debug_log.cpp
911         native/gfx/gl_debug_log.h
912         native/gfx/gl_lost_manager.cpp
913         native/gfx/gl_lost_manager.h
914         native/gfx/texture.cpp
915         native/gfx/texture.h
916         native/gfx/texture_atlas.cpp
917         native/gfx/texture_atlas.h
918 #       native/gfx/texture_dx11.cpp
919         native/gfx/texture_gen.cpp
920         native/gfx/texture_gen.h
921         native/gfx_es2/draw_buffer.cpp
922         native/gfx_es2/draw_buffer.h
923         native/gfx_es2/draw_text.cpp
924         native/gfx_es2/draw_text.h
925         native/gfx_es2/fbo.cpp
926         native/gfx_es2/fbo.h
927         native/gfx_es2/gl_state.cpp
928         native/gfx_es2/gl_state.h
929         native/gfx_es2/gpu_features.cpp
930         native/gfx_es2/gpu_features.h
931         native/gfx_es2/glsl_program.cpp
932         native/gfx_es2/glsl_program.h
933         native/gfx_es2/vertex_format.cpp
934         native/gfx_es2/vertex_format.h
935         native/gfx_es2/gl3stub.c
936         native/gfx_es2/gl3stub.h
937         native/i18n/i18n.cpp
938         native/i18n/i18n.h
939         native/image/png_load.cpp
940         native/image/png_load.h
941         native/image/zim_load.cpp
942         native/image/zim_load.h
943         native/image/zim_save.cpp
944         native/image/zim_save.h
945         native/input/gesture_detector.cpp
946         native/input/gesture_detector.h
947         native/input/keycodes.h
948         native/input/input_state.h
949         native/input/input_state.cpp
950         native/math/fast/fast_math.c
951         native/math/fast/fast_matrix.c
952         native/math/curves.cpp
953         native/math/curves.h
954         native/math/expression_parser.cpp
955         native/math/expression_parser.h
956         native/math/lin/aabb.cpp
957         native/math/lin/aabb.h
958         native/math/lin/matrix4x4.cpp
959         native/math/lin/matrix4x4.h
960         native/math/lin/plane.cpp
961         native/math/lin/plane.h
962         native/math/lin/quat.cpp
963         native/math/lin/quat.h
964         native/math/lin/ray.h
965         native/math/lin/vec3.cpp
966         native/math/lin/vec3.h
967         native/math/math_util.cpp
968         native/math/math_util.h
969         native/net/http_client.cpp
970         native/net/http_client.h
971         native/net/resolve.cpp
972         native/net/resolve.h
973         native/net/url.cpp
974         native/net/url.h
975         native/profiler/profiler.cpp
976         native/profiler/profiler.h
977         native/thin3d/thin3d.cpp
978         native/thin3d/thin3d.h
979         native/thin3d/thin3d_gl.cpp
980         native/thread/prioritizedworkqueue.cpp
981         native/thread/prioritizedworkqueue.h
982         native/thread/threadutil.cpp
983         native/thread/threadutil.h
984         native/thread/threadpool.cpp
985         native/thread/threadpool.h
986         native/ui/screen.cpp
987         native/ui/screen.h
988         native/ui/ui.cpp
989         native/ui/ui.h
990         native/ui/ui_context.cpp
991         native/ui/ui_context.h
992         native/ui/ui_screen.cpp
993         native/ui/ui_screen.h
994         native/ui/view.cpp
995         native/ui/view.h
996         native/ui/viewgroup.cpp
997         native/ui/viewgroup.h
998         native/ui/virtual_input.cpp
999         native/ui/virtual_input.h
1000         native/util/bits/bits.cpp
1001         native/util/bits/bits.h
1002         native/util/bits/hamming.h
1003         native/util/bits/varint.cpp
1004         native/util/bits/varint.h
1005         native/util/hash/hash.cpp
1006         native/util/hash/hash.h
1007         native/util/random/perlin.cpp
1008         native/util/random/perlin.h
1009         native/util/random/rng.h
1010         native/util/text/utf8.h
1011         native/util/text/utf8.cpp
1012         native/util/text/parsers.h
1013         native/util/text/parsers.cpp
1014         native/util/const_map.h
1015         native/ext/jpge/jpgd.cpp
1016         native/ext/jpge/jpgd.h
1017         native/ext/jpge/jpge.cpp
1018         native/ext/jpge/jpge.h)
1019 include_directories(native)
1021 if (LINUX AND NOT ANDROID)
1022         SET(RT_LIB rt)
1023 endif()
1025 target_link_libraries(native ${LIBZIP_LIBRARY} ${PNG_LIBRARY} rg_etc1 vjson stb_vorbis snappy udis86 ${RT_LIB} ${GLEW_LIBRARIES})
1027 if(ANDROID)
1028         target_link_libraries(native log EGL)
1029 elseif(WIN32)
1030         target_link_libraries(native ws2_32 winmm)
1031 endif()
1032 setup_target_project(native native)
1034 add_library(kirk STATIC
1035         ext/libkirk/AES.c
1036         ext/libkirk/AES.h
1037         ext/libkirk/amctrl.c
1038         ext/libkirk/amctrl.h
1039         ext/libkirk/SHA1.c
1040         ext/libkirk/SHA1.h
1041         ext/libkirk/bn.c
1042         ext/libkirk/ec.c
1043         ext/libkirk/kirk_engine.c
1044         ext/libkirk/kirk_engine.h)
1045 include_directories(ext/libkirk)
1047 add_library(sfmt19937 STATIC
1048         ext/sfmt19937/SFMT.c
1049         ext/sfmt19937/SFMT.h
1050         ext/sfmt19937/SFMT-common.h
1051         ext/sfmt19937/SFMT-params.h
1052         ext/sfmt19937/SFMT-params19937.h
1054 include_directories(ext/sfmt19937)
1056 add_library(xbrz STATIC
1057         ext/xbrz/xbrz.cpp
1058         ext/xbrz/xbrz.h
1060 include_directories(ext/xbrz)
1062 add_library(xxhash STATIC
1063         ext/xxhash.c
1064         ext/xxhash.h
1066 include_directories(ext/xxhash)
1068 set(CoreExtra)
1069 set(CoreExtraLibs)
1070 if(ARM)
1071         set(CoreExtra ${CoreExtra}
1072                 Core/MIPS/ARM/ArmAsm.cpp
1073                 Core/MIPS/ARM/ArmAsm.h
1074                 Core/MIPS/ARM/ArmCompALU.cpp
1075                 Core/MIPS/ARM/ArmCompBranch.cpp
1076                 Core/MIPS/ARM/ArmCompFPU.cpp
1077                 Core/MIPS/ARM/ArmCompLoadStore.cpp
1078                 Core/MIPS/ARM/ArmCompVFPU.cpp
1079                 Core/MIPS/ARM/ArmCompVFPUNEON.cpp
1080                 Core/MIPS/ARM/ArmCompVFPUNEONUtil.cpp
1081                 Core/MIPS/ARM/ArmCompReplace.cpp
1082                 Core/MIPS/ARM/ArmJit.cpp
1083                 Core/MIPS/ARM/ArmJit.h
1084                 Core/MIPS/ARM/ArmRegCache.cpp
1085                 Core/MIPS/ARM/ArmRegCache.h
1086                 Core/MIPS/ARM/ArmRegCacheFPU.cpp
1087                 Core/MIPS/ARM/ArmRegCacheFPU.h
1088                 GPU/Common/VertexDecoderArm.cpp
1089                 ext/disarm.cpp)
1090 elseif(ARM64)
1091   set(CoreExtra ${CoreExtra}
1092                 Core/MIPS/ARM64/Arm64Asm.cpp
1093                 Core/MIPS/ARM64/Arm64Asm.h
1094                 Core/MIPS/ARM64/Arm64CompALU.cpp
1095                 Core/MIPS/ARM64/Arm64CompBranch.cpp
1096                 Core/MIPS/ARM64/Arm64CompFPU.cpp
1097                 Core/MIPS/ARM64/Arm64CompLoadStore.cpp
1098                 Core/MIPS/ARM64/Arm64CompVFPU.cpp
1099                 Core/MIPS/ARM64/Arm64CompReplace.cpp
1100                 Core/MIPS/ARM64/Arm64Jit.cpp
1101                 Core/MIPS/ARM64/Arm64Jit.h
1102                 Core/MIPS/ARM64/Arm64RegCache.cpp
1103                 Core/MIPS/ARM64/Arm64RegCache.h
1104                 Core/MIPS/ARM64/Arm64RegCacheFPU.cpp
1105                 Core/MIPS/ARM64/Arm64RegCacheFPU.h
1106                 GPU/Common/VertexDecoderArm.cpp
1107                 Core/Util/DisArm64.cpp)
1108 elseif(X86)
1109         set(CoreExtra ${CoreExtra}
1110                 Core/MIPS/x86/Asm.cpp
1111                 Core/MIPS/x86/Asm.h
1112                 Core/MIPS/x86/CompALU.cpp
1113                 Core/MIPS/x86/CompBranch.cpp
1114                 Core/MIPS/x86/CompFPU.cpp
1115                 Core/MIPS/x86/CompLoadStore.cpp
1116                 Core/MIPS/x86/CompVFPU.cpp
1117                 Core/MIPS/x86/CompReplace.cpp
1118                 Core/MIPS/x86/Jit.cpp
1119                 Core/MIPS/x86/Jit.h
1120                 Core/MIPS/x86/JitSafeMem.cpp
1121                 Core/MIPS/x86/JitSafeMem.h
1122                 Core/MIPS/x86/RegCache.cpp
1123                 Core/MIPS/x86/RegCache.h
1124                 Core/MIPS/x86/RegCacheFPU.cpp
1125                 Core/MIPS/x86/RegCacheFPU.h
1126                 GPU/Common/VertexDecoderX86.cpp
1127                 ext/disarm.cpp)
1128 elseif(MIPS)
1129         set(CoreExtra ${CoreExtra}
1130                 Core/MIPS/MIPS/MipsJit.cpp
1131                 Core/MIPS/MIPS/MipsJit.h
1132                 GPU/Common/VertexDecoderFake.cpp
1133                 ext/disarm.cpp)
1134 else()
1135         set(CoreExtra ${CoreExtra}
1136                 Core/MIPS/fake/FakeJit.cpp
1137                 Core/MIPS/fake/FakeJit.h
1138                 GPU/Common/VertexDecoderFake.cpp
1139                 ext/disarm.cpp)
1140 endif()
1142 if(ARMV7)
1143         set(CORE_NEON Core/Util/AudioFormatNEON.cpp Core/Util/AudioFormatNEON.h)
1144 endif()
1146 # 'ppsspp_jni' on ANDROID, 'Core' everywhere else
1147 # SHARED on ANDROID, STATIC everywhere else
1148 add_library(${CoreLibName} ${CoreLinkType}
1149         ${CoreExtra}
1150         Core/Config.cpp
1151         Core/Config.h
1152         Core/Core.cpp
1153         Core/Core.h
1154         Core/CoreParameter.h
1155         Core/CoreTiming.cpp
1156         Core/CoreTiming.h
1157         Core/CwCheat.cpp
1158         Core/CwCheat.h
1159         Core/HDRemaster.cpp
1160         Core/HDRemaster.h
1161         Core/ThreadEventQueue.h
1162         Core/Debugger/Breakpoints.cpp
1163         Core/Debugger/Breakpoints.h
1164         Core/Debugger/DebugInterface.h
1165         Core/Debugger/SymbolMap.cpp
1166         Core/Debugger/SymbolMap.h
1167         Core/Debugger/DisassemblyManager.cpp
1168         Core/Debugger/DisassemblyManager.h
1169         Core/Dialog/PSPDialog.cpp
1170         Core/Dialog/PSPDialog.h
1171         Core/Dialog/PSPGamedataInstallDialog.cpp
1172         Core/Dialog/PSPGamedataInstallDialog.h
1173         Core/Dialog/PSPMsgDialog.cpp
1174         Core/Dialog/PSPMsgDialog.h
1175         Core/Dialog/PSPNetconfDialog.cpp
1176         Core/Dialog/PSPNetconfDialog.h
1177         Core/Dialog/PSPOskDialog.cpp
1178         Core/Dialog/PSPOskDialog.h
1179         Core/Dialog/PSPPlaceholderDialog.cpp
1180         Core/Dialog/PSPPlaceholderDialog.h
1181         Core/Dialog/PSPSaveDialog.cpp
1182         Core/Dialog/PSPSaveDialog.h
1183         Core/Dialog/PSPScreenshotDialog.cpp
1184         Core/Dialog/PSPScreenshotDialog.h
1185         Core/Dialog/SavedataParam.cpp
1186         Core/Dialog/SavedataParam.h
1187         Core/ELF/ElfReader.cpp
1188         Core/ELF/ElfReader.h
1189         Core/ELF/ElfTypes.h
1190         Core/ELF/PBPReader.cpp
1191         Core/ELF/PBPReader.h
1192         Core/ELF/PrxDecrypter.cpp
1193         Core/ELF/PrxDecrypter.h
1194         Core/ELF/ParamSFO.cpp
1195         Core/ELF/ParamSFO.h
1196         Core/FileSystems/tlzrc.cpp
1197         Core/FileSystems/BlockDevices.cpp
1198         Core/FileSystems/BlockDevices.h
1199         Core/FileSystems/DirectoryFileSystem.cpp
1200         Core/FileSystems/DirectoryFileSystem.h
1201         Core/FileSystems/FileSystem.h
1202         Core/FileSystems/FileSystem.cpp
1203         Core/FileSystems/ISOFileSystem.cpp
1204         Core/FileSystems/ISOFileSystem.h
1205         Core/FileSystems/MetaFileSystem.cpp
1206         Core/FileSystems/MetaFileSystem.h
1207         Core/FileSystems/VirtualDiscFileSystem.cpp
1208         Core/FileSystems/VirtualDiscFileSystem.h
1209         Core/Font/PGF.cpp
1210         Core/Font/PGF.h
1211         Core/HLE/FunctionWrappers.h
1212         Core/HLE/HLE.cpp
1213         Core/HLE/HLE.h
1214         Core/HLE/ReplaceTables.cpp
1215         Core/HLE/ReplaceTables.h
1216         Core/HLE/HLEHelperThread.cpp
1217         Core/HLE/HLEHelperThread.h
1218         Core/HLE/HLETables.cpp
1219         Core/HLE/HLETables.h
1220         Core/HLE/KernelWaitHelpers.h
1221         Core/HLE/__sceAudio.cpp
1222         Core/HLE/__sceAudio.h
1223         Core/HLE/sceAdler.cpp
1224         Core/HLE/sceAdler.h
1225         Core/HLE/sceAtrac.cpp
1226         Core/HLE/sceAtrac.h
1227         Core/HLE/sceAudio.cpp
1228         Core/HLE/sceAudiocodec.cpp
1229         Core/HLE/sceAudiocodec.h
1230         Core/HLE/sceAudioRouting.cpp
1231         Core/HLE/sceAudioRouting.h
1232         Core/HLE/sceAudio.h
1233         Core/HLE/sceCcc.h
1234         Core/HLE/sceCcc.cpp
1235         Core/HLE/sceChnnlsv.cpp
1236         Core/HLE/sceChnnlsv.h
1237         Core/HLE/sceCtrl.cpp
1238         Core/HLE/sceCtrl.h
1239         Core/HLE/sceDeflt.cpp
1240         Core/HLE/sceDeflt.h
1241         Core/HLE/sceDisplay.cpp
1242         Core/HLE/sceDisplay.h
1243         Core/HLE/sceDmac.cpp
1244         Core/HLE/sceDmac.h
1245         Core/HLE/sceG729.cpp
1246         Core/HLE/sceG729.h
1247         Core/HLE/sceGameUpdate.cpp
1248         Core/HLE/sceGameUpdate.h
1249         Core/HLE/sceGe.cpp
1250         Core/HLE/sceGe.h
1251         Core/HLE/sceFont.cpp
1252         Core/HLE/sceFont.h
1253         Core/HLE/sceHeap.cpp
1254         Core/HLE/sceHeap.h
1255         Core/HLE/sceHprm.cpp
1256         Core/HLE/sceHprm.h
1257         Core/HLE/sceHttp.cpp
1258         Core/HLE/sceHttp.h
1259         Core/HLE/sceImpose.cpp
1260         Core/HLE/sceImpose.h
1261         Core/HLE/sceIo.cpp
1262         Core/HLE/sceIo.h
1263         Core/HLE/sceJpeg.cpp
1264         Core/HLE/sceJpeg.h
1265         Core/HLE/sceKernel.cpp
1266         Core/HLE/sceKernel.h
1267         Core/HLE/sceKernelAlarm.cpp
1268         Core/HLE/sceKernelAlarm.h
1269         Core/HLE/sceKernelEventFlag.cpp
1270         Core/HLE/sceKernelEventFlag.h
1271         Core/HLE/sceKernelInterrupt.cpp
1272         Core/HLE/sceKernelInterrupt.h
1273         Core/HLE/sceKernelMbx.cpp
1274         Core/HLE/sceKernelMbx.h
1275         Core/HLE/sceKernelMemory.cpp
1276         Core/HLE/sceKernelMemory.h
1277         Core/HLE/sceKernelModule.cpp
1278         Core/HLE/sceKernelModule.h
1279         Core/HLE/sceKernelMsgPipe.cpp
1280         Core/HLE/sceKernelMsgPipe.h
1281         Core/HLE/sceKernelMutex.cpp
1282         Core/HLE/sceKernelMutex.h
1283         Core/HLE/sceKernelSemaphore.cpp
1284         Core/HLE/sceKernelSemaphore.h
1285         Core/HLE/sceKernelThread.cpp
1286         Core/HLE/sceKernelThread.h
1287         Core/HLE/sceKernelTime.cpp
1288         Core/HLE/sceKernelTime.h
1289         Core/HLE/sceKernelVTimer.cpp
1290         Core/HLE/sceKernelVTimer.h
1291         Core/HLE/sceMpeg.cpp
1292         Core/HLE/sceMpeg.h
1293         Core/HLE/sceNet.cpp
1294         Core/HLE/sceNet.h
1295         Core/HLE/sceNetAdhoc.cpp
1296         Core/HLE/sceNetAdhoc.h
1297         Core/HLE/proAdhoc.h
1298         Core/HLE/proAdhoc.cpp
1299         Core/HLE/proAdhocServer.h
1300         Core/HLE/proAdhocServer.cpp
1301         Core/HLE/sceOpenPSID.cpp
1302         Core/HLE/sceOpenPSID.h
1303         Core/HLE/sceP3da.cpp
1304         Core/HLE/sceP3da.h
1305         Core/HLE/sceMt19937.cpp
1306         Core/HLE/sceMt19937.h
1307         Core/HLE/sceMd5.cpp
1308         Core/HLE/sceMd5.h
1309         Core/HLE/sceMp4.cpp
1310         Core/HLE/sceMp4.h
1311         Core/HLE/sceMp3.cpp
1312         Core/HLE/sceMp3.h
1313         Core/HLE/sceParseHttp.cpp
1314         Core/HLE/sceParseHttp.h
1315         Core/HLE/sceParseUri.cpp
1316         Core/HLE/sceParseUri.h
1317         Core/HLE/scePower.cpp
1318         Core/HLE/scePower.h
1319         Core/HLE/scePsmf.cpp
1320         Core/HLE/scePsmf.h
1321         Core/HLE/sceRtc.cpp
1322         Core/HLE/sceRtc.h
1323         Core/HLE/sceSas.cpp
1324         Core/HLE/sceSas.h
1325         Core/HLE/sceSfmt19937.cpp
1326         Core/HLE/sceSfmt19937.h
1327         Core/HLE/sceSha256.cpp
1328         Core/HLE/sceSha256.h
1329         Core/HLE/sceSsl.cpp
1330         Core/HLE/sceSsl.h
1331         Core/HLE/sceUmd.cpp
1332         Core/HLE/sceUmd.h
1333         Core/HLE/sceUsb.cpp
1334         Core/HLE/sceUsb.h
1335         Core/HLE/sceUsbGps.cpp
1336         Core/HLE/sceUsbGps.h
1337         Core/HLE/sceUtility.cpp
1338         Core/HLE/sceUtility.h
1339         Core/HLE/sceVaudio.cpp
1340         Core/HLE/sceVaudio.h
1341         Core/HLE/scePspNpDrm_user.cpp
1342         Core/HLE/scePspNpDrm_user.h
1343         Core/HLE/sceNp.cpp
1344         Core/HLE/sceNp.h
1345         Core/HLE/scePauth.cpp
1346         Core/HLE/scePauth.h
1347         Core/HW/SimpleAudioDec.cpp
1348         Core/HW/SimpleAudioDec.h
1349         Core/HW/AsyncIOManager.cpp
1350         Core/HW/AsyncIOManager.h
1351         Core/HW/MediaEngine.cpp
1352         Core/HW/MediaEngine.h
1353         Core/HW/MpegDemux.cpp
1354         Core/HW/MpegDemux.h
1355         Core/HW/MemoryStick.cpp
1356         Core/HW/MemoryStick.h
1357         Core/HW/SasAudio.cpp
1358         Core/HW/SasAudio.h
1359         Core/HW/StereoResampler.cpp
1360         Core/HW/StereoResampler.h
1361         Core/Host.cpp
1362         Core/Host.h
1363         Core/Loaders.cpp
1364         Core/Loaders.h
1365         Core/MIPS/JitCommon/JitCommon.cpp
1366         Core/MIPS/JitCommon/JitCommon.h
1367         Core/MIPS/JitCommon/NativeJit.h
1368         Core/MIPS/JitCommon/JitBlockCache.cpp
1369         Core/MIPS/JitCommon/JitBlockCache.h
1370         Core/MIPS/JitCommon/JitState.cpp
1371         Core/MIPS/JitCommon/JitState.h
1372         Core/MIPS/MIPS.cpp
1373         Core/MIPS/MIPS.h
1374         Core/MIPS/MIPSAnalyst.cpp
1375         Core/MIPS/MIPSAnalyst.h
1376         Core/MIPS/MIPSCodeUtils.cpp
1377         Core/MIPS/MIPSCodeUtils.h
1378         Core/MIPS/MIPSDebugInterface.cpp
1379         Core/MIPS/MIPSDebugInterface.h
1380         Core/MIPS/MIPSDis.cpp
1381         Core/MIPS/MIPSDis.h
1382         Core/MIPS/MIPSDisVFPU.cpp
1383         Core/MIPS/MIPSDisVFPU.h
1384         Core/MIPS/MIPSInt.cpp
1385         Core/MIPS/MIPSInt.h
1386         Core/MIPS/MIPSIntVFPU.cpp
1387         Core/MIPS/MIPSIntVFPU.h
1388         Core/MIPS/MIPSStackWalk.cpp
1389         Core/MIPS/MIPSStackWalk.h
1390         Core/MIPS/MIPSTables.cpp
1391         Core/MIPS/MIPSTables.h
1392         Core/MIPS/MIPSVFPUUtils.cpp
1393         Core/MIPS/MIPSVFPUUtils.h
1394         Core/MIPS/MIPSAsm.cpp
1395         Core/MIPS/MIPSAsm.h
1396         Core/MemMap.cpp
1397         Core/MemMap.h
1398         Core/MemMapFunctions.cpp
1399         Core/MemMapHelpers.h
1400         Core/PSPLoaders.cpp
1401         Core/PSPLoaders.h
1402         Core/Reporting.cpp
1403         Core/Reporting.h
1404         Core/SaveState.cpp
1405         Core/SaveState.h
1406         Core/Screenshot.cpp
1407         Core/Screenshot.h
1408         Core/System.cpp
1409         Core/System.h
1410         Core/Util/AudioFormat.cpp
1411         Core/Util/AudioFormat.h
1412         Core/Util/GameManager.cpp
1413         Core/Util/GameManager.h
1414         Core/Util/BlockAllocator.cpp
1415         Core/Util/BlockAllocator.h
1416         Core/Util/PPGeDraw.cpp
1417         Core/Util/PPGeDraw.h
1418         Core/Util/ppge_atlas.cpp
1419         Core/Util/ppge_atlas.h
1420         ${CORE_NEON}
1421         $<TARGET_OBJECTS:GPU>
1422         Globals.h
1423         git-version.cpp)
1424 target_link_libraries(${CoreLibName} Common native kirk cityhash sfmt19937 xbrz xxhash
1425         ${CoreExtraLibs} ${GLEW_LIBRARIES} ${OPENGL_LIBRARIES} ${X11_LIBRARIES} ${CMAKE_DL_LIBS})
1426 setup_target_project(${CoreLibName} Core)
1428 # Generate git-version.cpp at build time.
1429 add_custom_target(GitVersion ALL
1430         DEPENDS something_that_never_exists)
1431 add_custom_command(OUTPUT something_that_never_exists
1432         COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}
1433                 -P ${CMAKE_CURRENT_SOURCE_DIR}/git-version.cmake)
1435 set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/git-version.cpp
1436         PROPERTIES GENERATED TRUE)
1437 add_dependencies(${CoreLibName} GitVersion)
1439 if(ARMV7)
1440         set(GPU_NEON GPU/Common/TextureDecoderNEON.cpp)
1441 endif()
1442 add_library(GPU OBJECT
1443         GPU/Common/DepalettizeShaderCommon.cpp
1444         GPU/Common/DepalettizeShaderCommon.h
1445         GPU/Common/FramebufferCommon.cpp
1446         GPU/Common/FramebufferCommon.h
1447         GPU/Common/GPUDebugInterface.h
1448         GPU/Common/DrawEngineCommon.cpp
1449         GPU/Common/DrawEngineCommon.h
1450         GPU/Common/SplineCommon.cpp
1451         GPU/Common/SplineCommon.h
1452         GPU/Common/SoftwareTransformCommon.cpp
1453         GPU/Common/SoftwareTransformCommon.h
1454         GPU/Common/VertexDecoderCommon.cpp
1455         GPU/Common/VertexDecoderCommon.h
1456         GPU/Common/TransformCommon.cpp
1457         GPU/Common/TransformCommon.h
1458         GPU/Common/IndexGenerator.cpp
1459         GPU/Common/IndexGenerator.h
1460         GPU/Common/TextureDecoder.cpp
1461         GPU/Common/TextureDecoder.h
1462         GPU/Common/TextureCacheCommon.cpp
1463         GPU/Common/TextureCacheCommon.h
1464         GPU/Common/TextureScalerCommon.cpp
1465         GPU/Common/TextureScalerCommon.h
1466         ${GPU_NEON}
1467         GPU/Common/PostShader.cpp
1468         GPU/Common/PostShader.h
1469         GPU/Common/SplineCommon.h
1470         GPU/Debugger/Breakpoints.cpp
1471         GPU/Debugger/Breakpoints.h
1472         GPU/Debugger/Stepping.cpp
1473         GPU/Debugger/Stepping.h
1474         GPU/GLES/DepalettizeShader.cpp
1475         GPU/GLES/DepalettizeShader.h
1476         GPU/GLES/GLES_GPU.cpp
1477         GPU/GLES/GLES_GPU.h
1478         GPU/GLES/FragmentShaderGenerator.cpp
1479         GPU/GLES/FragmentShaderGenerator.h
1480         GPU/GLES/FragmentTestCache.cpp
1481         GPU/GLES/FragmentTestCache.h
1482         GPU/GLES/Framebuffer.cpp
1483         GPU/GLES/Framebuffer.h
1484         GPU/GLES/ShaderManager.cpp
1485         GPU/GLES/ShaderManager.h
1486         GPU/GLES/StateMapping.cpp
1487         GPU/GLES/StateMapping.h
1488         GPU/GLES/StencilBuffer.cpp
1489         GPU/GLES/TextureCache.cpp
1490         GPU/GLES/TextureCache.h
1491         GPU/GLES/TextureScaler.cpp
1492         GPU/GLES/TextureScaler.h
1493         GPU/GLES/TransformPipeline.cpp
1494         GPU/GLES/TransformPipeline.h
1495         GPU/GLES/VertexShaderGenerator.cpp
1496         GPU/GLES/VertexShaderGenerator.h
1497         GPU/GPUInterface.h
1498         GPU/GeDisasm.cpp
1499         GPU/GeDisasm.h
1500         GPU/GPUCommon.cpp
1501         GPU/GPUCommon.h
1502         GPU/GPUState.cpp
1503         GPU/GPUState.h
1504         GPU/Math3D.cpp
1505         GPU/Math3D.h
1506         GPU/Null/NullGpu.cpp
1507         GPU/Null/NullGpu.h
1508         GPU/Software/Clipper.cpp
1509         GPU/Software/Clipper.h
1510         GPU/Software/Lighting.cpp
1511         GPU/Software/Lighting.h
1512         GPU/Software/Rasterizer.cpp
1513         GPU/Software/Rasterizer.h
1514         GPU/Software/SoftGpu.cpp
1515         GPU/Software/SoftGpu.h
1516         GPU/Software/TransformUnit.cpp
1517         GPU/Software/TransformUnit.h
1518         GPU/ge_constants.h)
1519 setup_target_project(GPU GPU)
1521 if(WIN32)
1522         add_executable(PPSSPPWindows WIN32
1523                 Windows/Breakpoints.h
1524                 Windows/DSoundStream.cpp
1525                 Windows/DSoundStream.h
1526                 Windows/Debugger/CPURegsInterface.h
1527                 Windows/Debugger/BreakpointWindow.cpp
1528                 Windows/Debugger/BreakpointWindow.h
1529                 Windows/Debugger/CtrlDisAsmView.cpp
1530                 Windows/Debugger/CtrlDisAsmView.h
1531                 Windows/Debugger/CtrlMemView.cpp
1532                 Windows/Debugger/CtrlMemView.h
1533                 Windows/Debugger/CtrlRegisterList.cpp
1534                 Windows/Debugger/CtrlRegisterList.h
1535                 Windows/Debugger/Debugger.h
1536                 Windows/Debugger/DebuggerShared.cpp
1537                 Windows/Debugger/DebuggerShared.h
1538                 Windows/Debugger/Debugger_Disasm.cpp
1539                 Windows/Debugger/Debugger_Disasm.h
1540                 Windows/Debugger/Debugger_MemoryDlg.cpp
1541                 Windows/Debugger/Debugger_MemoryDlg.h
1542                 Windows/Debugger/Debugger_Lists.cpp
1543                 Windows/Debugger/Debugger_Lists.h
1544                 Windows/Debugger/Debugger_Misc.cpp
1545                 Windows/Debugger/Debugger_Misc.h
1546 #               Windows/Debugger/Debugger_Profiler.cpp
1547 #               Windows/Debugger/Debugger_Profiler.h
1548                 Windows/Debugger/Debugger_SymbolMap.h
1549                 Windows/Debugger/Debugger_VFPUDlg.cpp
1550                 Windows/Debugger/Debugger_VFPUDlg.h
1551                 Windows/Debugger/SimpleELF.h
1552 #               Windows/DlgDynaView.cpp
1553 #               Windows/DlgDynaView.h
1554                 Windows/EmuThread.cpp
1555                 Windows/EmuThread.h
1556                 Windows/Globals.cpp
1557                 Windows/InputBox.cpp
1558                 Windows/InputBox.h
1559                 Windows/InputDevice.cpp
1560                 Windows/InputDevice.h
1561                 Windows/KeyboardDevice.cpp
1562                 Windows/KeyboardDevice.h
1563                 Windows/MIPSCompALU.h
1564                 Windows/MIPSCompBranch.h
1565                 Windows/OpenGLBase.cpp
1566                 Windows/OpenGLBase.h
1567                 Windows/W32Util/DialogManager.cpp
1568                 Windows/W32Util/DialogManager.h
1569                 Windows/W32Util/Misc.cpp
1570                 Windows/W32Util/Misc.h
1571                 Windows/W32Util/PropertySheet.cpp
1572                 Windows/W32Util/PropertySheet.h
1573                 Windows/W32Util/ShellUtil.cpp
1574                 Windows/W32Util/ShellUtil.h
1575                 Windows/W32Util/XPTheme.h
1576                 Windows/WindowsFileSystem.h
1577                 Windows/WindowsHost.cpp
1578                 Windows/WindowsHost.h
1579                 Windows/WndMainWindow.cpp
1580                 Windows/WndMainWindow.h
1581                 Windows/XPTheme.h
1582                 Windows/XinputDevice.cpp
1583                 Windows/XinputDevice.h
1584                 Windows/main.cpp
1585                 Windows/main.h
1586                 Windows/ppsspp.rc
1587                 Windows/resource.h
1588                 Windows/stdafx.cpp
1589                 Windows/stdafx.h)
1590         target_link_libraries(PPSSPPWindows ${CoreLibName}
1591                 kernel32 user32 gdi32 shell32 comctl32 dsound xinput)
1592         setup_target_project(PPSSPPWindows Windows)
1593 endif()
1595 set(NativeAssets
1596         android/assets/ui_atlas.zim
1597         assets/shaders
1598         assets/ppge_atlas.zim
1599         assets/langregion.ini
1600         assets/unknown.png)
1601 set(LinkCommon ${CoreLibName} ${CMAKE_THREAD_LIBS_INIT} ${nativeExtraLibs})
1604 if(HEADLESS)
1605         add_executable(PPSSPPHeadless
1606                 headless/Headless.cpp
1607                 UI/OnScreenDisplay.cpp
1608                 headless/StubHost.h
1609                 headless/Compare.cpp
1610                 headless/Compare.h)
1611         target_link_libraries(PPSSPPHeadless
1612                 ${COCOA_LIBRARY} ${LinkCommon})
1613         setup_target_project(PPSSPPHeadless headless)
1614 endif()
1616 if(UNITTEST)
1617         add_executable(unitTest
1618                 unittest/UnitTest.cpp
1619                 unittest/TestArmEmitter.cpp
1620                 unittest/TestArm64Emitter.cpp
1621                 unittest/TestX64Emitter.cpp
1622                 unittest/JitHarness.cpp
1623                 Core/MIPS/ARM/ArmRegCache.cpp
1624                 Core/MIPS/ARM/ArmRegCacheFPU.cpp
1625                 UI/OnScreenDisplay.cpp
1626         )
1627         target_link_libraries(unitTest
1628                 ${COCOA_LIBRARY} ${LinkCommon} Common)
1629         setup_target_project(unitTest unittest)
1630 endif()
1632 if (TargetBin)
1633         if (IOS OR APPLE)
1634                 if (APPLE AND NOT IOS)
1635                 set(ICON_PATH_ABS ${CMAKE_CURRENT_SOURCE_DIR}/assets/ppsspp.icns)
1636                 set( MACOSX_BUNDLE_ICON_FILE ppsspp.icns )
1637                 set_source_files_properties(${ICON_PATH_ABS} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
1638                 endif()
1640                 # TODO: there must a native way to copy these.
1641                 # Now this is very prone to errors when changes occur.
1642                 # Also better to have assets under Resources dir for OS X.
1643                 file(GLOB_RECURSE FLASH0_FILES flash0/*)
1644                 file(GLOB_RECURSE LANG_FILES lang/*)
1645                 file(GLOB_RECURSE SHADER_FILES assets/shaders/*)
1647                 if (APPLE AND NOT IOS)
1648                 set_source_files_properties(${NativeAssets} PROPERTIES MACOSX_PACKAGE_LOCATION "MacOS/assets")
1649                 set_source_files_properties(${FLASH0_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION "MacOS/assets/flash0/font")
1650                 set_source_files_properties(${LANG_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION "MacOS/assets/lang")
1651                 set_source_files_properties(${SHADER_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION "MacOS/assets/shaders")
1652                 endif()
1654                 add_executable(${TargetBin} MACOSX_BUNDLE ${ICON_PATH_ABS} ${NativeAssets} ${SHADER_FILES} ${FLASH0_FILES} ${LANG_FILES} ${NativeAppSource})
1655         else()
1656                 add_executable(${TargetBin} ${NativeAppSource})
1657         endif()
1658         target_link_libraries(${TargetBin} ${LinkCommon} Common)
1659 endif()
1661 # installs
1662 file(INSTALL ${NativeAssets} DESTINATION assets)
1663 file(INSTALL flash0 lang DESTINATION assets)
1665 if(APPLE AND NOT IOS)
1666         set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -F /Library/Frameworks")
1667 endif()
1669 # packaging and code signing
1670 if(IOS)
1671         add_dependencies(PPSSPP ${CoreLibName} GPU Common native)
1673         file(GLOB IOSAssets ios/assets/*.png)
1674         file(INSTALL ${IOSAssets} DESTINATION assets)
1675         if (IOS_DEBUG)
1676                 file(INSTALL pspautotests DESTINATION assets)
1677         endif()
1678         set(RSRC_XIB_FILES assets/Icon@2x.png)
1679         set_source_files_properties(${RSRC_XIB_FILES}
1680                 PROPERTIES MACOSX_PACKAGE_LOCATION Resources
1681         )
1682         set(APP_DIR_NAME \${TARGET_BUILD_DIR}/\${FULL_PRODUCT_NAME})
1683         add_custom_command(TARGET PPSSPP POST_BUILD
1684                 COMMAND tar -c -C . --exclude .DS_Store --exclude .git -H gnu assets | tar -x -C '${APP_DIR_NAME}'
1685         )
1686         # Force Xcode to relink the binary.
1687         add_custom_command(TARGET Core PRE_BUILD
1688                 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
1689                 COMMAND rm -f PPSSPP.build/{Debug,Release,MinSizeRel,RelWithDebInfo}-iphoneos/PPSSPP.build/Objects-normal/*/PPSSPP {Debug,Release,MinSizeRel,RelWithDebInfo}-iphoneos/PPSSPP.app/PPSSPP
1690         )
1691         set_target_properties(${TargetBin} PROPERTIES
1692                 MACOSX_BUNDLE_INFO_PLIST "../ios/PPSSPP-Info.plist"
1693                 XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "iPhone/iPad"
1694         XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES
1695         )
1696 endif()
1698 #include(CPack)