Merge pull request #90 from gizmo98/patch-2
[libretro-ppsspp.git] / CMakeLists.txt
blob07ee2c1d5d7d508f4dfd683a74839154cc6a8b2c
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/ThreadSafeList.h
378         Common/Timer.cpp
379         Common/Timer.h)
380 include_directories(Common)
381 setup_target_project(Common Common)
383 if(WIN32)
384         target_link_libraries(Common winmm)
385 endif()
387 if(NOT USING_GLES2)
388         include_directories(${OPENGL_INCLUDE_DIR})
390         add_definitions(-DGLEW_STATIC)
391         add_library(glew STATIC
392                 native/ext/glew/GL/glew.h
393                 native/ext/glew/GL/glxew.h
394                 native/ext/glew/GL/wglew.h
395                 native/ext/glew/glew.c)
396         target_link_libraries(glew ${OPENGL_LIBRARIES})
397         include_directories(native/ext/glew)
398         set(GLEW_LIBRARIES glew)
399 endif()
401 add_subdirectory(ext/snappy)
402 add_subdirectory(ext/udis86)
404 add_library(vjson STATIC
405         native/ext/vjson/json.cpp
406         native/ext/vjson/json.h
407         native/ext/vjson/block_allocator.cpp
408         native/ext/vjson/block_allocator.h
411 add_library(rg_etc1 STATIC
412         native/ext/rg_etc1/rg_etc1.cpp
413         native/ext/rg_etc1/rg_etc1.h)
414 include_directories(native/ext/rg_etc1)
416 add_library(stb_vorbis STATIC
417         native/ext/stb_vorbis/stb_vorbis.c
418         native/ext/stb_vorbis/stb_vorbis.h)
419 include_directories(native/ext/stb_vorbis)
421 if(USE_FFMPEG)
422         if(USE_SYSTEM_FFMPEG)
423                 include(FindFFMPEG)
424         else()
425                 set(FFMPEG_FOUND OFF)
426         endif()
427         if(NOT FFMPEG_FOUND)
428                 if(NOT DEFINED FFMPEG_BUILDDIR)
429                         if(ANDROID)
430                                 if(ARMV7)
431                                         set(PLATFORM_ARCH "android/armv7")
432                                 elseif(ARM)
433                                         set(PLATFORM_ARCH "android/arm")
434                                 elseif(X86)
435                                         set(PLATFORM_ARCH "android/x86")
436                                 endif()
437                         elseif(BLACKBERRY)
438                                 set(PLATFORM_ARCH "blackberry/armv7")
439                         elseif(IOS)
440                                 set(PLATFORM_ARCH "ios/universal")
441                         elseif(MACOSX)
442                                 set(PLATFORM_ARCH "macosx/x86_64")
443                         elseif(LINUX)
444                                 if(ARMV7)
445                                         set(PLATFORM_ARCH "linux/armv7")
446                                 elseif(ARM)
447                                         set(PLATFORM_ARCH "linux/arm")
448                                 elseif(MIPS)
449                                         set(PLATFORM_ARCH "linux/mips32")
450                                 elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
451                                         set(PLATFORM_ARCH "linux/x86_64")
452                                 else()
453                                         set(PLATFORM_ARCH "linux/x86")
454                                 endif()
455                         endif()
456                         # Using static libraries
457                         if (DEFINED PLATFORM_ARCH)
458                                 include_directories(ffmpeg/${PLATFORM_ARCH}/include)
459                                 link_directories(ffmpeg/${PLATFORM_ARCH}/lib)
460                                 set(FFMPEG_LIBRARIES libavformat.a libavcodec.a libavutil.a libswresample.a libswscale.a)
461                         else()
462                                 # Manual definition of system library locations by the user.
463                                 if (DEFINED FFMPEG_INCLUDE_PATH)
464                                         include_directories(ffmpeg ${FFMPEG_INCLUDE_PATH})
465                                 endif()
466                                 if (DEFINED AVFORMAT_PATH)
467                                         add_library(libavformat STATIC IMPORTED)
468                                         set_target_properties(libavformat PROPERTIES IMPORTED_LOCATION ${AVFORMAT_PATH})
469                                         SET (FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} libavformat)
470                                 endif()
471                                 if (DEFINED AVCODEC_PATH)
472                                         add_library(libavcodec STATIC IMPORTED)
473                                         set_target_properties(libavcodec PROPERTIES IMPORTED_LOCATION ${AVCODEC_PATH})
474                                         SET (FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} libavcodec)
475                                 endif()
476                                 if (DEFINED AVUTIL_PATH)
477                                         add_library(libavutil STATIC IMPORTED)
478                                         set_target_properties(libavutil PROPERTIES IMPORTED_LOCATION ${AVUTIL_PATH})
479                                         SET (FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} libavutil)
480                                 endif()
481                                 if (DEFINED SWRESAMPLE_PATH)
482                                         add_library(libswresample STATIC IMPORTED)
483                                         set_target_properties(libswresample PROPERTIES IMPORTED_LOCATION ${SWRESAMPLE_PATH})
484                                         SET (FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} libswresample)
485                                 endif()
486                                 if (DEFINED SWSCALE_PATH)
487                                         add_library(libswscale STATIC IMPORTED)
488                                         set_target_properties(libswscale PROPERTIES IMPORTED_LOCATION ${SWSCALE_PATH})
489                                         SET (FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} libswscale)
490                                 endif()
491                         endif(DEFINED PLATFORM_ARCH)
492                 else(NOT DEFINED FFMPEG_BUILDDIR)
493                         # Using shared libraries
494                         include_directories(ffmpeg ${FFMPEG_BUILDDIR})
496                         add_library(libavformat STATIC IMPORTED)
497                         set_target_properties(libavformat PROPERTIES IMPORTED_LOCATION ${FFMPEG_BUILDDIR}/libavformat/libavformat.a)
498                         add_library(libavcodec STATIC IMPORTED)
499                         set_target_properties(libavcodec PROPERTIES IMPORTED_LOCATION ${FFMPEG_BUILDDIR}/libavcodec/libavcodec.a)
500                         add_library(libavutil STATIC IMPORTED)
501                         set_target_properties(libavutil PROPERTIES IMPORTED_LOCATION ${FFMPEG_BUILDDIR}/libavutil/libavutil.a)
502                         add_library(libswresample STATIC IMPORTED)
503                         set_target_properties(libswresample PROPERTIES IMPORTED_LOCATION ${FFMPEG_BUILDDIR}/libswresample/libswresample.a)
504                         add_library(libswscale STATIC IMPORTED)
505                         set_target_properties(libswscale PROPERTIES IMPORTED_LOCATION ${FFMPEG_BUILDDIR}/libswscale/libswscale.a)
507                         SET (FFMPEG_LIBRARIES
508                                 libavformat
509                                 libavcodec
510                                 libavutil
511                                 libswresample
512                                 libswscale
513                         )
514                 endif(NOT DEFINED FFMPEG_BUILDDIR)
515         endif(NOT FFMPEG_FOUND)
517         find_library(ICONV_LIBRARY NAMES iconv)
518         if (ICONV_LIBRARY)
519                 set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${ICONV_LIBRARY})
520         endif()
522         if(APPLE)
523                 set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} bz2 "-framework CoreVideo")
524                 if (NOT IOS)
525                         set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} "-framework VideoDecodeAcceleration")
526                 endif()
527         endif(APPLE)
529         if(FFMPEG_FOUND)
530                 set(nativeExtraLibs ${nativeExtraLibs} ${FFMPEG_LIBRARIES})
531         else()
532                 set(LinkCommon ${LinkCommon} ${FFMPEG_LIBRARIES})
533         endif()
534         target_link_libraries(Common ${FFMPEG_LIBRARIES})
535         add_definitions(-DUSE_FFMPEG)
536 endif(USE_FFMPEG)
538 # Modification to show where we are pulling the ffmpeg libraries from.
539 if(USE_FFMPEG AND DEFINED FFMPEG_LIBRARIES)
540         message(STATUS "FFMPEG library locations:")
541         if(FFMPEG_FOUND)
542                 message(STATUS "libavcodec location: ${FFMPEG_avcodec_LIBRARY}")
543                 message(STATUS "libavformat location: ${FFMPEG_avformat_LIBRARY}")
544                 message(STATUS "libavutil location: ${FFMPEG_avutil_LIBRARY}")
545                 message(STATUS "libswresample location: ${FFMPEG_swresample_LIBRARY}")
546                 message(STATUS "libswscale location: ${FFMPEG_swscale_LIBRARY}")
547         elseif(DEFINED PLATFORM_ARCH)
548                 set(TEMP ${CMAKE_SOURCE_DIR}/ffmpeg/${PLATFORM_ARCH}/lib)
549                 message(STATUS "libavcodec location: ${TEMP}/libavcodec.a")
550                 message(STATUS "libavformat location: ${TEMP}/libavformat.a")
551                 message(STATUS "libavutil location: ${TEMP}/libavutil.a")
552                 message(STATUS "libswresample location: ${TEMP}/libswresample.a")
553                 message(STATUS "libswscale location: ${TEMP}/libswscale.a")
554         else()
555                 get_target_property(TEMP libavcodec IMPORTED_LOCATION)
556                 message(STATUS "libavcodec location: ${TEMP}")
557                 get_target_property(TEMP libavformat IMPORTED_LOCATION)
558                 message(STATUS "libavformat location: ${TEMP}")
559                 get_target_property(TEMP libavutil IMPORTED_LOCATION)
560                 message(STATUS "libavutil location: ${TEMP}")
561                 get_target_property(TEMP libswresample IMPORTED_LOCATION)
562                 message(STATUS "libswresample location: ${TEMP}")
563                 get_target_property(TEMP libswscale IMPORTED_LOCATION)
564                 message(STATUS "libswscale location: ${TEMP}")
565         endif()
566 else()
567         message(STATUS "ERROR: No FFMPEG library locations")
568 endif()
570 if(USE_FFMPEG AND NOT DEFINED FFMPEG_LIBRARIES)
571         message(WARNING "FFMPEG_BUILDDIR variable or manual path definition is required to enable FFmpeg. Disabling it.")
572         unset(USE_FFMPEG)
573 endif()
575 find_package(ZLIB)
576 if(ZLIB_FOUND)
577         include_directories(${ZLIB_INCLUDE_DIR})
578 else()
579         add_library(zlib STATIC
580                 ext/zlib/adler32.c
581                 ext/zlib/compress.c
582                 ext/zlib/crc32.c
583                 ext/zlib/crc32.h
584                 ext/zlib/deflate.c
585                 ext/zlib/deflate.h
586                 ext/zlib/gzclose.c
587                 ext/zlib/gzguts.h
588                 ext/zlib/gzlib.c
589                 ext/zlib/gzread.c
590                 ext/zlib/gzwrite.c
591                 ext/zlib/infback.c
592                 ext/zlib/inffast.c
593                 ext/zlib/inffast.h
594                 ext/zlib/inffixed.h
595                 ext/zlib/inflate.c
596                 ext/zlib/inflate.h
597                 ext/zlib/inftrees.c
598                 ext/zlib/inftrees.h
599                 ext/zlib/make_vms.com
600                 ext/zlib/trees.c
601                 ext/zlib/trees.h
602                 ext/zlib/uncompr.c
603                 ext/zlib/zconf.h
604                 ext/zlib/zlib.h
605                 ext/zlib/zutil.c
606                 ext/zlib/zutil.h
607         )
608         include_directories(ext/zlib)
609         set(ZLIB_LIBRARY zlib)
610 endif()
612 add_library(cityhash STATIC
613         native/ext/cityhash/city.cpp
614         native/ext/cityhash/city.h
615         native/ext/cityhash/citycrc.h
617 include_directories(ext/cityhash)
619 if (NOT MSVC)
620         # These can be fast even for debug.
621         set_target_properties(snappy PROPERTIES COMPILE_FLAGS "-O3")
622         set_target_properties(udis86 PROPERTIES COMPILE_FLAGS "-O3")
623         set_target_properties(cityhash PROPERTIES COMPILE_FLAGS "-O3")
624         if(NOT ZLIB_FOUND)
625                 set_target_properties(zlib PROPERTIES COMPILE_FLAGS "-O3")
626         endif()
627 endif()
630 add_library(libzip STATIC
631         native/ext/libzip/zip.h
632         native/ext/libzip/mkstemp.c
633         native/ext/libzip/zip_add.c
634         native/ext/libzip/zip_add_dir.c
635         native/ext/libzip/zip_close.c
636         native/ext/libzip/zip_delete.c
637         native/ext/libzip/zip_dirent.c
638         native/ext/libzip/zip_entry_free.c
639         native/ext/libzip/zip_entry_new.c
640         native/ext/libzip/zip_err_str.c
641         native/ext/libzip/zip_error.c
642         native/ext/libzip/zip_error_clear.c
643         native/ext/libzip/zip_error_get.c
644         native/ext/libzip/zip_error_get_sys_type.c
645         native/ext/libzip/zip_error_strerror.c
646         native/ext/libzip/zip_error_to_str.c
647         native/ext/libzip/zip_fclose.c
648         native/ext/libzip/zip_file_error_clear.c
649         native/ext/libzip/zip_file_error_get.c
650         native/ext/libzip/zip_file_get_offset.c
651         native/ext/libzip/zip_file_strerror.c
652         native/ext/libzip/zip_filerange_crc.c
653         native/ext/libzip/zip_fopen.c
654         native/ext/libzip/zip_fopen_index.c
655         native/ext/libzip/zip_fread.c
656         native/ext/libzip/zip_free.c
657         native/ext/libzip/zip_get_archive_comment.c
658         native/ext/libzip/zip_get_archive_flag.c
659         native/ext/libzip/zip_get_file_comment.c
660         native/ext/libzip/zip_get_name.c
661         native/ext/libzip/zip_get_num_files.c
662         native/ext/libzip/zip_memdup.c
663         native/ext/libzip/zip_name_locate.c
664         native/ext/libzip/zip_new.c
665         native/ext/libzip/zip_open.c
666         native/ext/libzip/zip_rename.c
667         native/ext/libzip/zip_replace.c
668         native/ext/libzip/zip_set_archive_comment.c
669         native/ext/libzip/zip_set_archive_flag.c
670         native/ext/libzip/zip_set_file_comment.c
671         native/ext/libzip/zip_set_name.c
672         native/ext/libzip/zip_source_buffer.c
673         native/ext/libzip/zip_source_file.c
674         native/ext/libzip/zip_source_filep.c
675         native/ext/libzip/zip_source_free.c
676         native/ext/libzip/zip_source_function.c
677         native/ext/libzip/zip_source_zip.c
678         native/ext/libzip/zip_stat.c
679         native/ext/libzip/zip_stat_index.c
680         native/ext/libzip/zip_stat_init.c
681         native/ext/libzip/zip_strerror.c
682         native/ext/libzip/zip_unchange.c
683         native/ext/libzip/zip_unchange_all.c
684         native/ext/libzip/zip_unchange_archive.c
685         native/ext/libzip/zip_unchange_data.c)
686 target_link_libraries(libzip ${ZLIB_LIBRARY})
687 include_directories(native/ext/libzip)
688 set(LIBZIP_LIBRARY libzip)
690 # FindPNG does a few things we don't want. So do it ourselves. Fixed to libpng17
691 find_path(PNG_PNG_INCLUDE_DIR NAMES "libpng17/png.h")
692 find_library(PNG_LIBRARY NAMES png17 libpng17)
693 find_package(PackageHandleStandardArgs)
694 find_package_handle_standard_args(PNG REQUIRED_VARS PNG_LIBRARY PNG_PNG_INCLUDE_DIR)
695 if (PNG_FOUND)
696         include_directories(${PNG_PNG_INCLUDE_DIR})
697 else()
698         if(ARM)
699                 file(GLOB PNG_ARM_INCLUDES native/ext/libpng17/arm/*)
700         endif()
701         add_library(png17 STATIC
702                 native/ext/libpng17/pngconf.h
703                 native/ext/libpng17/pngdebug.h
704                 native/ext/libpng17/png.c
705                 native/ext/libpng17/png.h
706                 native/ext/libpng17/pngerror.c
707                 native/ext/libpng17/pngget.c
708                 native/ext/libpng17/pnginfo.h
709                 native/ext/libpng17/pnglibconf.h
710                 native/ext/libpng17/pngmem.c
711                 native/ext/libpng17/pngpread.c
712                 native/ext/libpng17/pngpriv.h
713                 native/ext/libpng17/pngread.c
714                 native/ext/libpng17/pngrio.c
715                 native/ext/libpng17/pngrtran.c
716                 native/ext/libpng17/pngrutil.c
717                 native/ext/libpng17/pngset.c
718                 native/ext/libpng17/pngstruct.h
719                 native/ext/libpng17/pngtest.c
720                 native/ext/libpng17/pngtrans.c
721                 native/ext/libpng17/pngwio.c
722                 native/ext/libpng17/pngwrite.c
723                 native/ext/libpng17/pngwtran.c
724                 native/ext/libpng17/pngwutil.c
725                 ${PNG_ARM_INCLUDES} )
726         set(PNG_LIBRARY png17)
727         include_directories(native/ext)
728 endif()
730 set(nativeExtra)
731 set(nativeExtraLibs)
733 if(ARMV7)
734         if(BB)
735                 set (CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -march=armv7-a -mfpu=neon -mcpu=cortex-a8")
736         else()
737                 set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=armv7-a -mfpu=neon -mcpu=cortex-a9")
738                 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=armv7-a -mfpu=neon -mcpu=cortex-a9")
739                 set (CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -march=armv7-a -mfpu=neon -mcpu=cortex-a9")
740         endif()
741         set(nativeExtra ${nativeExtra}
742     native/math/fast/fast_matrix_neon.S)
743 endif()
744 if(X86 AND NOT MIPS)
745         set(nativeExtra ${nativeExtra}
746     native/math/fast/fast_matrix_sse.c)
747 endif()
750 if(ANDROID)
751         set(nativeExtra ${nativeExtra}
752                 native/base/NativeApp.h
753                 native/android/app-android.cpp
754                 native/android/native_audio.cpp
755                 native/android/native_audio.h)
757         add_library(native_audio SHARED
758                 native/android/native-audio-so.cpp
759                 native/android/native-audio-so.h)
760         target_link_libraries(native_audio OpenSLES log)
761         # No target
762 elseif(IOS)
763         set(nativeExtra ${nativeExtra}
764                 ios/main.mm
765                 ios/AppDelegate.mm
766                 ios/AppDelegate.h
767                 ios/ViewController.mm
768                 ios/ViewController.h
769                 ios/iOSCoreAudio.cpp
770                 ios/iOSCoreAudio.h
771                 ios/iCade/iCadeReaderView.h
772                 ios/iCade/iCadeReaderView.m
773                 ios/iCade/iCadeState.h)
774         set(nativeExtraLibs ${nativeExtraLibs} "-framework Foundation -framework AudioToolbox -framework CoreGraphics -framework QuartzCore -framework OpenGLES -framework UIKit -framework GLKit -framework OpenAL")
775         if(EXISTS "${CMAKE_IOS_SDK_ROOT}/System/Library/Frameworks/GameController.framework")
776                 set(nativeExtraLibs ${nativeExtraLibs} "-weak_framework GameController")
777         endif()
779         set_source_files_properties(ios/AppDelegate.mm PROPERTIES COMPILE_FLAGS -fobjc-arc)
780         set_source_files_properties(ios/ViewController.mm PROPERTIES COMPILE_FLAGS -fobjc-arc)
782         set(TargetBin PPSSPP)
783 elseif(USING_QT_UI)
784         # Currently unused
785         message(FATAL_ERROR "Cmake does not yet support Qt. Please use qmake instead.")
786         find_package(Qt4 COMPONENTS QtMultimedia QtOpenGL QtGui QtCore)
787         include(${QT_USE_FILE})
788         qt4_wrap_cpp(nativeQtHeader native/base/QtMain.h)
789         set(nativeExtra ${nativeExtra} native/base/QtMain.cpp ${nativeQtHeader})
790         if(NOT MOBILE_DEVICE)
791                 qt4_wrap_cpp(nativeQtHeader Qt/mainwindow.h)
792                 set(nativeExtra ${nativeExtra} Qt/mainwindow.cpp)
793         endif()
794         set(nativeExtraLibs ${nativeExtraLibs} ${QT_LIBRARIES})
795         set(TargetBin PPSSPPQt)
796         if(APPLE)
797                 set(nativeExtraLibs ${nativeExtraLibs} "-framework CoreFoundation")
798         endif()
799 elseif(BLACKBERRY)
800         unset(CMAKE_DL_LIBS)
801         set(nativeExtra ${nativeExtra} native/base/BlackberryMain.cpp native/base/BlackberryDisplay.cpp)
802         set(nativeExtraLibs ${nativeExtraLibs} OpenAL bps screen socket EGL)
803         set(TargetBin PPSSPPBlackberry)
804 elseif(SDL2_FOUND)
805         set(TargetBin PPSSPPSDL)
806         # Require SDL
807         include_directories(${SDL2_INCLUDE_DIR})
808         add_definitions(-DSDL)
809         set(nativeExtra ${nativeExtra}
810                 SDL/SDLJoystick.h
811                 SDL/SDLJoystick.cpp
812                 native/base/PCMain.cpp)
813         set(nativeExtraLibs ${nativeExtraLibs} ${SDL2_LIBRARY})
814         if(APPLE)
815                 set(nativeExtra ${nativeExtra} SDL/SDLMain.h SDL/SDLMain.mm)
816                 set(nativeExtraLibs ${nativeExtraLibs} ${COCOA_LIBRARY})
817         elseif(USING_EGL)
818                 set(nativeExtraLibs ${nativeExtraLibs} pthread EGL)
819         endif()
820         set(TargetBin PPSSPPSDL)
821 else()
822         message(FATAL_ERROR "Could not find SDL2. Failing.")
823 endif()
825 set(NativeAppSource
826         android/jni/TestRunner.cpp
827         UI/NativeApp.cpp
828         UI/BackgroundAudio.cpp
829         UI/DevScreens.cpp
830         UI/EmuScreen.cpp
831         UI/GameInfoCache.cpp
832         UI/MainScreen.cpp
833         UI/MiscScreens.cpp
834         UI/PauseScreen.cpp
835         UI/GameScreen.cpp
836         UI/GameSettingsScreen.cpp
837         UI/TiltAnalogSettingsScreen.cpp
838         UI/TiltEventProcessor.cpp
839         UI/TouchControlLayoutScreen.cpp
840         UI/TouchControlVisibilityScreen.cpp
841         UI/GamepadEmu.cpp
842         UI/OnScreenDisplay.cpp
843         UI/ControlMappingScreen.cpp
844         UI/ReportScreen.cpp
845         UI/SavedataScreen.cpp
846         UI/Store.cpp
847         UI/CwCheatScreen.cpp
848         UI/InstallZipScreen.cpp
849         UI/ui_atlas.cpp)
850 if(ANDROID)
851         if (ARM)
852                 set(NativeAppSource ${NativeAppSource} android/jni/ArmEmitterTest.cpp)
853         endif()
854         set(nativeExtra ${nativeExtra} ${NativeAppSource})
855 endif()
857 add_library(native STATIC
858         ${nativeExtra}
859         native/base/backtrace.cpp
860         native/base/backtrace.h
861         native/audio/mixer.cpp
862         native/audio/mixer.h
863         native/audio/wav_read.cpp
864         native/audio/wav_read.h
865         native/base/basictypes.h
866         native/base/buffer.cpp
867         native/base/buffer.h
868         native/base/color.h
869         native/base/colorutil.cpp
870         native/base/colorutil.h
871         native/base/display.cpp
872         native/base/display.h
873         native/base/error_context.cpp
874         native/base/error_context.h
875         native/base/fastlist.h
876         native/base/fastlist_test.cpp
877         native/base/functional.h
878         native/base/linked_ptr.h
879         native/base/logging.h
880         native/base/mutex.h
881         native/base/scoped_ptr.h
882         native/base/stats.h
883         native/base/stringutil.cpp
884         native/base/stringutil.h
885         native/base/timeutil.cpp
886         native/base/timeutil.h
887         native/data/compression.cpp
888         native/data/compression.h
889         native/ext/vjson/json.cpp
890         native/ext/vjson/json.h
891         native/ext/vjson/block_allocator.cpp
892         native/ext/vjson/block_allocator.h
893         native/file/chunk_file.cpp
894         native/file/chunk_file.h
895         native/file/dialog.cpp
896         native/file/dialog.h
897         native/file/easy_file.cpp
898         native/file/easy_file.h
899         native/file/fd_util.cpp
900         native/file/fd_util.h
901         native/file/file_util.cpp
902         native/file/file_util.h
903         native/file/ini_file.cpp
904         native/file/ini_file.h
905         native/file/path.cpp
906         native/file/path.h
907         native/file/vfs.h
908         native/file/zip_read.cpp
909         native/file/zip_read.h
910         native/gfx/gl_common.h
911         native/gfx/gl_debug_log.cpp
912         native/gfx/gl_debug_log.h
913         native/gfx/gl_lost_manager.cpp
914         native/gfx/gl_lost_manager.h
915         native/gfx/texture.cpp
916         native/gfx/texture.h
917         native/gfx/texture_atlas.cpp
918         native/gfx/texture_atlas.h
919 #       native/gfx/texture_dx11.cpp
920         native/gfx/texture_gen.cpp
921         native/gfx/texture_gen.h
922         native/gfx_es2/draw_buffer.cpp
923         native/gfx_es2/draw_buffer.h
924         native/gfx_es2/draw_text.cpp
925         native/gfx_es2/draw_text.h
926         native/gfx_es2/fbo.cpp
927         native/gfx_es2/fbo.h
928         native/gfx_es2/gl_state.cpp
929         native/gfx_es2/gl_state.h
930         native/gfx_es2/gpu_features.cpp
931         native/gfx_es2/gpu_features.h
932         native/gfx_es2/glsl_program.cpp
933         native/gfx_es2/glsl_program.h
934         native/gfx_es2/vertex_format.cpp
935         native/gfx_es2/vertex_format.h
936         native/gfx_es2/gl3stub.c
937         native/gfx_es2/gl3stub.h
938         native/i18n/i18n.cpp
939         native/i18n/i18n.h
940         native/image/png_load.cpp
941         native/image/png_load.h
942         native/image/zim_load.cpp
943         native/image/zim_load.h
944         native/image/zim_save.cpp
945         native/image/zim_save.h
946         native/input/gesture_detector.cpp
947         native/input/gesture_detector.h
948         native/input/keycodes.h
949         native/input/input_state.h
950         native/input/input_state.cpp
951         native/math/fast/fast_math.c
952         native/math/fast/fast_matrix.c
953         native/math/curves.cpp
954         native/math/curves.h
955         native/math/expression_parser.cpp
956         native/math/expression_parser.h
957         native/math/lin/aabb.cpp
958         native/math/lin/aabb.h
959         native/math/lin/matrix4x4.cpp
960         native/math/lin/matrix4x4.h
961         native/math/lin/plane.cpp
962         native/math/lin/plane.h
963         native/math/lin/quat.cpp
964         native/math/lin/quat.h
965         native/math/lin/ray.h
966         native/math/lin/vec3.cpp
967         native/math/lin/vec3.h
968         native/math/math_util.cpp
969         native/math/math_util.h
970         native/net/http_client.cpp
971         native/net/http_client.h
972         native/net/resolve.cpp
973         native/net/resolve.h
974         native/net/url.cpp
975         native/net/url.h
976         native/profiler/profiler.cpp
977         native/profiler/profiler.h
978         native/thin3d/thin3d.cpp
979         native/thin3d/thin3d.h
980         native/thin3d/thin3d_gl.cpp
981         native/thread/prioritizedworkqueue.cpp
982         native/thread/prioritizedworkqueue.h
983         native/thread/threadutil.cpp
984         native/thread/threadutil.h
985         native/thread/threadpool.cpp
986         native/thread/threadpool.h
987         native/ui/screen.cpp
988         native/ui/screen.h
989         native/ui/ui.cpp
990         native/ui/ui.h
991         native/ui/ui_context.cpp
992         native/ui/ui_context.h
993         native/ui/ui_screen.cpp
994         native/ui/ui_screen.h
995         native/ui/view.cpp
996         native/ui/view.h
997         native/ui/viewgroup.cpp
998         native/ui/viewgroup.h
999         native/ui/virtual_input.cpp
1000         native/ui/virtual_input.h
1001         native/util/bits/bits.cpp
1002         native/util/bits/bits.h
1003         native/util/bits/hamming.h
1004         native/util/bits/varint.cpp
1005         native/util/bits/varint.h
1006         native/util/hash/hash.cpp
1007         native/util/hash/hash.h
1008         native/util/random/perlin.cpp
1009         native/util/random/perlin.h
1010         native/util/random/rng.h
1011         native/util/text/utf8.h
1012         native/util/text/utf8.cpp
1013         native/util/text/parsers.h
1014         native/util/text/parsers.cpp
1015         native/util/const_map.h
1016         native/ext/jpge/jpgd.cpp
1017         native/ext/jpge/jpgd.h
1018         native/ext/jpge/jpge.cpp
1019         native/ext/jpge/jpge.h)
1020 include_directories(native)
1022 if (LINUX AND NOT ANDROID)
1023         SET(RT_LIB rt)
1024 endif()
1026 target_link_libraries(native ${LIBZIP_LIBRARY} ${PNG_LIBRARY} rg_etc1 vjson stb_vorbis snappy udis86 ${RT_LIB} ${GLEW_LIBRARIES})
1028 if(ANDROID)
1029         target_link_libraries(native log EGL)
1030 elseif(WIN32)
1031         target_link_libraries(native ws2_32 winmm)
1032 endif()
1033 setup_target_project(native native)
1035 add_library(kirk STATIC
1036         ext/libkirk/AES.c
1037         ext/libkirk/AES.h
1038         ext/libkirk/amctrl.c
1039         ext/libkirk/amctrl.h
1040         ext/libkirk/SHA1.c
1041         ext/libkirk/SHA1.h
1042         ext/libkirk/bn.c
1043         ext/libkirk/ec.c
1044         ext/libkirk/kirk_engine.c
1045         ext/libkirk/kirk_engine.h)
1046 include_directories(ext/libkirk)
1048 add_library(sfmt19937 STATIC
1049         ext/sfmt19937/SFMT.c
1050         ext/sfmt19937/SFMT.h
1051         ext/sfmt19937/SFMT-common.h
1052         ext/sfmt19937/SFMT-params.h
1053         ext/sfmt19937/SFMT-params19937.h
1055 include_directories(ext/sfmt19937)
1057 add_library(xbrz STATIC
1058         ext/xbrz/xbrz.cpp
1059         ext/xbrz/xbrz.h
1061 include_directories(ext/xbrz)
1063 add_library(xxhash STATIC
1064         ext/xxhash.c
1065         ext/xxhash.h
1067 include_directories(ext/xxhash)
1069 set(CoreExtra)
1070 set(CoreExtraLibs)
1071 if(ARM)
1072         set(CoreExtra ${CoreExtra}
1073                 Core/MIPS/ARM/ArmAsm.cpp
1074                 Core/MIPS/ARM/ArmAsm.h
1075                 Core/MIPS/ARM/ArmCompALU.cpp
1076                 Core/MIPS/ARM/ArmCompBranch.cpp
1077                 Core/MIPS/ARM/ArmCompFPU.cpp
1078                 Core/MIPS/ARM/ArmCompLoadStore.cpp
1079                 Core/MIPS/ARM/ArmCompVFPU.cpp
1080                 Core/MIPS/ARM/ArmCompVFPUNEON.cpp
1081                 Core/MIPS/ARM/ArmCompVFPUNEONUtil.cpp
1082                 Core/MIPS/ARM/ArmCompReplace.cpp
1083                 Core/MIPS/ARM/ArmJit.cpp
1084                 Core/MIPS/ARM/ArmJit.h
1085                 Core/MIPS/ARM/ArmRegCache.cpp
1086                 Core/MIPS/ARM/ArmRegCache.h
1087                 Core/MIPS/ARM/ArmRegCacheFPU.cpp
1088                 Core/MIPS/ARM/ArmRegCacheFPU.h
1089                 GPU/Common/VertexDecoderArm.cpp
1090                 ext/disarm.cpp)
1091 elseif(ARM64)
1092   set(CoreExtra ${CoreExtra}
1093                 Core/MIPS/ARM64/Arm64Asm.cpp
1094                 Core/MIPS/ARM64/Arm64Asm.h
1095                 Core/MIPS/ARM64/Arm64CompALU.cpp
1096                 Core/MIPS/ARM64/Arm64CompBranch.cpp
1097                 Core/MIPS/ARM64/Arm64CompFPU.cpp
1098                 Core/MIPS/ARM64/Arm64CompLoadStore.cpp
1099                 Core/MIPS/ARM64/Arm64CompVFPU.cpp
1100                 Core/MIPS/ARM64/Arm64CompReplace.cpp
1101                 Core/MIPS/ARM64/Arm64Jit.cpp
1102                 Core/MIPS/ARM64/Arm64Jit.h
1103                 Core/MIPS/ARM64/Arm64RegCache.cpp
1104                 Core/MIPS/ARM64/Arm64RegCache.h
1105                 Core/MIPS/ARM64/Arm64RegCacheFPU.cpp
1106                 Core/MIPS/ARM64/Arm64RegCacheFPU.h
1107                 GPU/Common/VertexDecoderArm.cpp
1108                 Core/Util/DisArm64.cpp)
1109 elseif(X86)
1110         set(CoreExtra ${CoreExtra}
1111                 Core/MIPS/x86/Asm.cpp
1112                 Core/MIPS/x86/Asm.h
1113                 Core/MIPS/x86/CompALU.cpp
1114                 Core/MIPS/x86/CompBranch.cpp
1115                 Core/MIPS/x86/CompFPU.cpp
1116                 Core/MIPS/x86/CompLoadStore.cpp
1117                 Core/MIPS/x86/CompVFPU.cpp
1118                 Core/MIPS/x86/CompReplace.cpp
1119                 Core/MIPS/x86/Jit.cpp
1120                 Core/MIPS/x86/Jit.h
1121                 Core/MIPS/x86/JitSafeMem.cpp
1122                 Core/MIPS/x86/JitSafeMem.h
1123                 Core/MIPS/x86/RegCache.cpp
1124                 Core/MIPS/x86/RegCache.h
1125                 Core/MIPS/x86/RegCacheFPU.cpp
1126                 Core/MIPS/x86/RegCacheFPU.h
1127                 GPU/Common/VertexDecoderX86.cpp
1128                 ext/disarm.cpp)
1129 elseif(MIPS)
1130         set(CoreExtra ${CoreExtra}
1131                 Core/MIPS/MIPS/MipsJit.cpp
1132                 Core/MIPS/MIPS/MipsJit.h
1133                 GPU/Common/VertexDecoderFake.cpp
1134                 ext/disarm.cpp)
1135 else()
1136         set(CoreExtra ${CoreExtra}
1137                 Core/MIPS/fake/FakeJit.cpp
1138                 Core/MIPS/fake/FakeJit.h
1139                 GPU/Common/VertexDecoderFake.cpp
1140                 ext/disarm.cpp)
1141 endif()
1143 if(ARMV7)
1144         set(CORE_NEON Core/Util/AudioFormatNEON.cpp Core/Util/AudioFormatNEON.h)
1145 endif()
1147 # 'ppsspp_jni' on ANDROID, 'Core' everywhere else
1148 # SHARED on ANDROID, STATIC everywhere else
1149 add_library(${CoreLibName} ${CoreLinkType}
1150         ${CoreExtra}
1151         Core/Config.cpp
1152         Core/Config.h
1153         Core/Core.cpp
1154         Core/Core.h
1155         Core/CoreParameter.h
1156         Core/CoreTiming.cpp
1157         Core/CoreTiming.h
1158         Core/CwCheat.cpp
1159         Core/CwCheat.h
1160         Core/HDRemaster.cpp
1161         Core/HDRemaster.h
1162         Core/ThreadEventQueue.h
1163         Core/Debugger/Breakpoints.cpp
1164         Core/Debugger/Breakpoints.h
1165         Core/Debugger/DebugInterface.h
1166         Core/Debugger/SymbolMap.cpp
1167         Core/Debugger/SymbolMap.h
1168         Core/Debugger/DisassemblyManager.cpp
1169         Core/Debugger/DisassemblyManager.h
1170         Core/Dialog/PSPDialog.cpp
1171         Core/Dialog/PSPDialog.h
1172         Core/Dialog/PSPGamedataInstallDialog.cpp
1173         Core/Dialog/PSPGamedataInstallDialog.h
1174         Core/Dialog/PSPMsgDialog.cpp
1175         Core/Dialog/PSPMsgDialog.h
1176         Core/Dialog/PSPNetconfDialog.cpp
1177         Core/Dialog/PSPNetconfDialog.h
1178         Core/Dialog/PSPOskDialog.cpp
1179         Core/Dialog/PSPOskDialog.h
1180         Core/Dialog/PSPPlaceholderDialog.cpp
1181         Core/Dialog/PSPPlaceholderDialog.h
1182         Core/Dialog/PSPSaveDialog.cpp
1183         Core/Dialog/PSPSaveDialog.h
1184         Core/Dialog/PSPScreenshotDialog.cpp
1185         Core/Dialog/PSPScreenshotDialog.h
1186         Core/Dialog/SavedataParam.cpp
1187         Core/Dialog/SavedataParam.h
1188         Core/ELF/ElfReader.cpp
1189         Core/ELF/ElfReader.h
1190         Core/ELF/ElfTypes.h
1191         Core/ELF/PBPReader.cpp
1192         Core/ELF/PBPReader.h
1193         Core/ELF/PrxDecrypter.cpp
1194         Core/ELF/PrxDecrypter.h
1195         Core/ELF/ParamSFO.cpp
1196         Core/ELF/ParamSFO.h
1197         Core/FileSystems/tlzrc.cpp
1198         Core/FileSystems/BlockDevices.cpp
1199         Core/FileSystems/BlockDevices.h
1200         Core/FileSystems/DirectoryFileSystem.cpp
1201         Core/FileSystems/DirectoryFileSystem.h
1202         Core/FileSystems/FileSystem.h
1203         Core/FileSystems/FileSystem.cpp
1204         Core/FileSystems/ISOFileSystem.cpp
1205         Core/FileSystems/ISOFileSystem.h
1206         Core/FileSystems/MetaFileSystem.cpp
1207         Core/FileSystems/MetaFileSystem.h
1208         Core/FileSystems/VirtualDiscFileSystem.cpp
1209         Core/FileSystems/VirtualDiscFileSystem.h
1210         Core/Font/PGF.cpp
1211         Core/Font/PGF.h
1212         Core/HLE/FunctionWrappers.h
1213         Core/HLE/HLE.cpp
1214         Core/HLE/HLE.h
1215         Core/HLE/ReplaceTables.cpp
1216         Core/HLE/ReplaceTables.h
1217         Core/HLE/HLEHelperThread.cpp
1218         Core/HLE/HLEHelperThread.h
1219         Core/HLE/HLETables.cpp
1220         Core/HLE/HLETables.h
1221         Core/HLE/KernelWaitHelpers.h
1222         Core/HLE/__sceAudio.cpp
1223         Core/HLE/__sceAudio.h
1224         Core/HLE/sceAdler.cpp
1225         Core/HLE/sceAdler.h
1226         Core/HLE/sceAtrac.cpp
1227         Core/HLE/sceAtrac.h
1228         Core/HLE/sceAudio.cpp
1229         Core/HLE/sceAudiocodec.cpp
1230         Core/HLE/sceAudiocodec.h
1231         Core/HLE/sceAudioRouting.cpp
1232         Core/HLE/sceAudioRouting.h
1233         Core/HLE/sceAudio.h
1234         Core/HLE/sceCcc.h
1235         Core/HLE/sceCcc.cpp
1236         Core/HLE/sceChnnlsv.cpp
1237         Core/HLE/sceChnnlsv.h
1238         Core/HLE/sceCtrl.cpp
1239         Core/HLE/sceCtrl.h
1240         Core/HLE/sceDeflt.cpp
1241         Core/HLE/sceDeflt.h
1242         Core/HLE/sceDisplay.cpp
1243         Core/HLE/sceDisplay.h
1244         Core/HLE/sceDmac.cpp
1245         Core/HLE/sceDmac.h
1246         Core/HLE/sceG729.cpp
1247         Core/HLE/sceG729.h
1248         Core/HLE/sceGameUpdate.cpp
1249         Core/HLE/sceGameUpdate.h
1250         Core/HLE/sceGe.cpp
1251         Core/HLE/sceGe.h
1252         Core/HLE/sceFont.cpp
1253         Core/HLE/sceFont.h
1254         Core/HLE/sceHeap.cpp
1255         Core/HLE/sceHeap.h
1256         Core/HLE/sceHprm.cpp
1257         Core/HLE/sceHprm.h
1258         Core/HLE/sceHttp.cpp
1259         Core/HLE/sceHttp.h
1260         Core/HLE/sceImpose.cpp
1261         Core/HLE/sceImpose.h
1262         Core/HLE/sceIo.cpp
1263         Core/HLE/sceIo.h
1264         Core/HLE/sceJpeg.cpp
1265         Core/HLE/sceJpeg.h
1266         Core/HLE/sceKernel.cpp
1267         Core/HLE/sceKernel.h
1268         Core/HLE/sceKernelAlarm.cpp
1269         Core/HLE/sceKernelAlarm.h
1270         Core/HLE/sceKernelEventFlag.cpp
1271         Core/HLE/sceKernelEventFlag.h
1272         Core/HLE/sceKernelInterrupt.cpp
1273         Core/HLE/sceKernelInterrupt.h
1274         Core/HLE/sceKernelMbx.cpp
1275         Core/HLE/sceKernelMbx.h
1276         Core/HLE/sceKernelMemory.cpp
1277         Core/HLE/sceKernelMemory.h
1278         Core/HLE/sceKernelModule.cpp
1279         Core/HLE/sceKernelModule.h
1280         Core/HLE/sceKernelMsgPipe.cpp
1281         Core/HLE/sceKernelMsgPipe.h
1282         Core/HLE/sceKernelMutex.cpp
1283         Core/HLE/sceKernelMutex.h
1284         Core/HLE/sceKernelSemaphore.cpp
1285         Core/HLE/sceKernelSemaphore.h
1286         Core/HLE/sceKernelThread.cpp
1287         Core/HLE/sceKernelThread.h
1288         Core/HLE/sceKernelTime.cpp
1289         Core/HLE/sceKernelTime.h
1290         Core/HLE/sceKernelVTimer.cpp
1291         Core/HLE/sceKernelVTimer.h
1292         Core/HLE/sceMpeg.cpp
1293         Core/HLE/sceMpeg.h
1294         Core/HLE/sceNet.cpp
1295         Core/HLE/sceNet.h
1296         Core/HLE/sceNetAdhoc.cpp
1297         Core/HLE/sceNetAdhoc.h
1298         Core/HLE/proAdhoc.h
1299         Core/HLE/proAdhoc.cpp
1300         Core/HLE/proAdhocServer.h
1301         Core/HLE/proAdhocServer.cpp
1302         Core/HLE/sceOpenPSID.cpp
1303         Core/HLE/sceOpenPSID.h
1304         Core/HLE/sceP3da.cpp
1305         Core/HLE/sceP3da.h
1306         Core/HLE/sceMt19937.cpp
1307         Core/HLE/sceMt19937.h
1308         Core/HLE/sceMd5.cpp
1309         Core/HLE/sceMd5.h
1310         Core/HLE/sceMp4.cpp
1311         Core/HLE/sceMp4.h
1312         Core/HLE/sceMp3.cpp
1313         Core/HLE/sceMp3.h
1314         Core/HLE/sceParseHttp.cpp
1315         Core/HLE/sceParseHttp.h
1316         Core/HLE/sceParseUri.cpp
1317         Core/HLE/sceParseUri.h
1318         Core/HLE/scePower.cpp
1319         Core/HLE/scePower.h
1320         Core/HLE/scePsmf.cpp
1321         Core/HLE/scePsmf.h
1322         Core/HLE/sceRtc.cpp
1323         Core/HLE/sceRtc.h
1324         Core/HLE/sceSas.cpp
1325         Core/HLE/sceSas.h
1326         Core/HLE/sceSfmt19937.cpp
1327         Core/HLE/sceSfmt19937.h
1328         Core/HLE/sceSha256.cpp
1329         Core/HLE/sceSha256.h
1330         Core/HLE/sceSsl.cpp
1331         Core/HLE/sceSsl.h
1332         Core/HLE/sceUmd.cpp
1333         Core/HLE/sceUmd.h
1334         Core/HLE/sceUsb.cpp
1335         Core/HLE/sceUsb.h
1336         Core/HLE/sceUsbGps.cpp
1337         Core/HLE/sceUsbGps.h
1338         Core/HLE/sceUtility.cpp
1339         Core/HLE/sceUtility.h
1340         Core/HLE/sceVaudio.cpp
1341         Core/HLE/sceVaudio.h
1342         Core/HLE/scePspNpDrm_user.cpp
1343         Core/HLE/scePspNpDrm_user.h
1344         Core/HLE/sceNp.cpp
1345         Core/HLE/sceNp.h
1346         Core/HLE/scePauth.cpp
1347         Core/HLE/scePauth.h
1348         Core/HW/SimpleAudioDec.cpp
1349         Core/HW/SimpleAudioDec.h
1350         Core/HW/AsyncIOManager.cpp
1351         Core/HW/AsyncIOManager.h
1352         Core/HW/MediaEngine.cpp
1353         Core/HW/MediaEngine.h
1354         Core/HW/MpegDemux.cpp
1355         Core/HW/MpegDemux.h
1356         Core/HW/MemoryStick.cpp
1357         Core/HW/MemoryStick.h
1358         Core/HW/SasAudio.cpp
1359         Core/HW/SasAudio.h
1360         Core/HW/StereoResampler.cpp
1361         Core/HW/StereoResampler.h
1362         Core/Host.cpp
1363         Core/Host.h
1364         Core/Loaders.cpp
1365         Core/Loaders.h
1366         Core/FileLoaders/CachingFileLoader.cpp
1367         Core/FileLoaders/CachingFileLoader.h
1368         Core/FileLoaders/DiskCachingFileLoader.cpp
1369         Core/FileLoaders/DiskCachingFileLoader.h
1370         Core/FileLoaders/HTTPFileLoader.cpp
1371         Core/FileLoaders/HTTPFileLoader.h
1372         Core/FileLoaders/LocalFileLoader.cpp
1373         Core/FileLoaders/LocalFileLoader.h
1374         Core/FileLoaders/RetryingFileLoader.cpp
1375         Core/FileLoaders/RetryingFileLoader.h
1376         Core/MIPS/JitCommon/JitCommon.cpp
1377         Core/MIPS/JitCommon/JitCommon.h
1378         Core/MIPS/JitCommon/NativeJit.h
1379         Core/MIPS/JitCommon/JitBlockCache.cpp
1380         Core/MIPS/JitCommon/JitBlockCache.h
1381         Core/MIPS/JitCommon/JitState.cpp
1382         Core/MIPS/JitCommon/JitState.h
1383         Core/MIPS/MIPS.cpp
1384         Core/MIPS/MIPS.h
1385         Core/MIPS/MIPSAnalyst.cpp
1386         Core/MIPS/MIPSAnalyst.h
1387         Core/MIPS/MIPSCodeUtils.cpp
1388         Core/MIPS/MIPSCodeUtils.h
1389         Core/MIPS/MIPSDebugInterface.cpp
1390         Core/MIPS/MIPSDebugInterface.h
1391         Core/MIPS/MIPSDis.cpp
1392         Core/MIPS/MIPSDis.h
1393         Core/MIPS/MIPSDisVFPU.cpp
1394         Core/MIPS/MIPSDisVFPU.h
1395         Core/MIPS/MIPSInt.cpp
1396         Core/MIPS/MIPSInt.h
1397         Core/MIPS/MIPSIntVFPU.cpp
1398         Core/MIPS/MIPSIntVFPU.h
1399         Core/MIPS/MIPSStackWalk.cpp
1400         Core/MIPS/MIPSStackWalk.h
1401         Core/MIPS/MIPSTables.cpp
1402         Core/MIPS/MIPSTables.h
1403         Core/MIPS/MIPSVFPUUtils.cpp
1404         Core/MIPS/MIPSVFPUUtils.h
1405         Core/MIPS/MIPSAsm.cpp
1406         Core/MIPS/MIPSAsm.h
1407         Core/MemMap.cpp
1408         Core/MemMap.h
1409         Core/MemMapFunctions.cpp
1410         Core/MemMapHelpers.h
1411         Core/PSPLoaders.cpp
1412         Core/PSPLoaders.h
1413         Core/Reporting.cpp
1414         Core/Reporting.h
1415         Core/SaveState.cpp
1416         Core/SaveState.h
1417         Core/Screenshot.cpp
1418         Core/Screenshot.h
1419         Core/System.cpp
1420         Core/System.h
1421         Core/Util/AudioFormat.cpp
1422         Core/Util/AudioFormat.h
1423         Core/Util/GameManager.cpp
1424         Core/Util/GameManager.h
1425         Core/Util/BlockAllocator.cpp
1426         Core/Util/BlockAllocator.h
1427         Core/Util/PPGeDraw.cpp
1428         Core/Util/PPGeDraw.h
1429         Core/Util/ppge_atlas.cpp
1430         Core/Util/ppge_atlas.h
1431         ${CORE_NEON}
1432         $<TARGET_OBJECTS:GPU>
1433         Globals.h
1434         git-version.cpp)
1435 target_link_libraries(${CoreLibName} Common native kirk cityhash sfmt19937 xbrz xxhash
1436         ${CoreExtraLibs} ${GLEW_LIBRARIES} ${OPENGL_LIBRARIES} ${X11_LIBRARIES} ${CMAKE_DL_LIBS})
1437 setup_target_project(${CoreLibName} Core)
1439 # Generate git-version.cpp at build time.
1440 add_custom_target(GitVersion ALL
1441         DEPENDS something_that_never_exists)
1442 add_custom_command(OUTPUT something_that_never_exists
1443         COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}
1444                 -P ${CMAKE_CURRENT_SOURCE_DIR}/git-version.cmake)
1446 set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/git-version.cpp
1447         PROPERTIES GENERATED TRUE)
1448 add_dependencies(${CoreLibName} GitVersion)
1450 if(ARMV7)
1451         set(GPU_NEON GPU/Common/TextureDecoderNEON.cpp)
1452 endif()
1453 add_library(GPU OBJECT
1454         GPU/Common/DepalettizeShaderCommon.cpp
1455         GPU/Common/DepalettizeShaderCommon.h
1456         GPU/Common/FramebufferCommon.cpp
1457         GPU/Common/FramebufferCommon.h
1458         GPU/Common/GPUDebugInterface.h
1459         GPU/Common/DrawEngineCommon.cpp
1460         GPU/Common/DrawEngineCommon.h
1461         GPU/Common/SplineCommon.cpp
1462         GPU/Common/SplineCommon.h
1463         GPU/Common/SoftwareTransformCommon.cpp
1464         GPU/Common/SoftwareTransformCommon.h
1465         GPU/Common/VertexDecoderCommon.cpp
1466         GPU/Common/VertexDecoderCommon.h
1467         GPU/Common/TransformCommon.cpp
1468         GPU/Common/TransformCommon.h
1469         GPU/Common/IndexGenerator.cpp
1470         GPU/Common/IndexGenerator.h
1471         GPU/Common/TextureDecoder.cpp
1472         GPU/Common/TextureDecoder.h
1473         GPU/Common/TextureCacheCommon.cpp
1474         GPU/Common/TextureCacheCommon.h
1475         GPU/Common/TextureScalerCommon.cpp
1476         GPU/Common/TextureScalerCommon.h
1477         ${GPU_NEON}
1478         GPU/Common/PostShader.cpp
1479         GPU/Common/PostShader.h
1480         GPU/Common/SplineCommon.h
1481         GPU/Debugger/Breakpoints.cpp
1482         GPU/Debugger/Breakpoints.h
1483         GPU/Debugger/Stepping.cpp
1484         GPU/Debugger/Stepping.h
1485         GPU/GLES/DepalettizeShader.cpp
1486         GPU/GLES/DepalettizeShader.h
1487         GPU/GLES/GLES_GPU.cpp
1488         GPU/GLES/GLES_GPU.h
1489         GPU/GLES/FragmentShaderGenerator.cpp
1490         GPU/GLES/FragmentShaderGenerator.h
1491         GPU/GLES/FragmentTestCache.cpp
1492         GPU/GLES/FragmentTestCache.h
1493         GPU/GLES/Framebuffer.cpp
1494         GPU/GLES/Framebuffer.h
1495         GPU/GLES/ShaderManager.cpp
1496         GPU/GLES/ShaderManager.h
1497         GPU/GLES/StateMapping.cpp
1498         GPU/GLES/StateMapping.h
1499         GPU/GLES/StencilBuffer.cpp
1500         GPU/GLES/TextureCache.cpp
1501         GPU/GLES/TextureCache.h
1502         GPU/GLES/TextureScaler.cpp
1503         GPU/GLES/TextureScaler.h
1504         GPU/GLES/TransformPipeline.cpp
1505         GPU/GLES/TransformPipeline.h
1506         GPU/GLES/VertexShaderGenerator.cpp
1507         GPU/GLES/VertexShaderGenerator.h
1508         GPU/GPUInterface.h
1509         GPU/GeDisasm.cpp
1510         GPU/GeDisasm.h
1511         GPU/GPU.cpp
1512         GPU/GPU.h
1513         GPU/GPUCommon.cpp
1514         GPU/GPUCommon.h
1515         GPU/GPUState.cpp
1516         GPU/GPUState.h
1517         GPU/Math3D.cpp
1518         GPU/Math3D.h
1519         GPU/Null/NullGpu.cpp
1520         GPU/Null/NullGpu.h
1521         GPU/Software/Clipper.cpp
1522         GPU/Software/Clipper.h
1523         GPU/Software/Lighting.cpp
1524         GPU/Software/Lighting.h
1525         GPU/Software/Rasterizer.cpp
1526         GPU/Software/Rasterizer.h
1527         GPU/Software/SoftGpu.cpp
1528         GPU/Software/SoftGpu.h
1529         GPU/Software/TransformUnit.cpp
1530         GPU/Software/TransformUnit.h
1531         GPU/ge_constants.h)
1532 setup_target_project(GPU GPU)
1534 if(WIN32)
1535         add_executable(PPSSPPWindows WIN32
1536                 Windows/Breakpoints.h
1537                 Windows/DSoundStream.cpp
1538                 Windows/DSoundStream.h
1539                 Windows/Debugger/CPURegsInterface.h
1540                 Windows/Debugger/BreakpointWindow.cpp
1541                 Windows/Debugger/BreakpointWindow.h
1542                 Windows/Debugger/CtrlDisAsmView.cpp
1543                 Windows/Debugger/CtrlDisAsmView.h
1544                 Windows/Debugger/CtrlMemView.cpp
1545                 Windows/Debugger/CtrlMemView.h
1546                 Windows/Debugger/CtrlRegisterList.cpp
1547                 Windows/Debugger/CtrlRegisterList.h
1548                 Windows/Debugger/Debugger.h
1549                 Windows/Debugger/DebuggerShared.cpp
1550                 Windows/Debugger/DebuggerShared.h
1551                 Windows/Debugger/Debugger_Disasm.cpp
1552                 Windows/Debugger/Debugger_Disasm.h
1553                 Windows/Debugger/Debugger_MemoryDlg.cpp
1554                 Windows/Debugger/Debugger_MemoryDlg.h
1555                 Windows/Debugger/Debugger_Lists.cpp
1556                 Windows/Debugger/Debugger_Lists.h
1557                 Windows/Debugger/Debugger_Misc.cpp
1558                 Windows/Debugger/Debugger_Misc.h
1559 #               Windows/Debugger/Debugger_Profiler.cpp
1560 #               Windows/Debugger/Debugger_Profiler.h
1561                 Windows/Debugger/Debugger_SymbolMap.h
1562                 Windows/Debugger/Debugger_VFPUDlg.cpp
1563                 Windows/Debugger/Debugger_VFPUDlg.h
1564                 Windows/Debugger/SimpleELF.h
1565 #               Windows/DlgDynaView.cpp
1566 #               Windows/DlgDynaView.h
1567                 Windows/EmuThread.cpp
1568                 Windows/EmuThread.h
1569                 Windows/Globals.cpp
1570                 Windows/InputBox.cpp
1571                 Windows/InputBox.h
1572                 Windows/InputDevice.cpp
1573                 Windows/InputDevice.h
1574                 Windows/KeyboardDevice.cpp
1575                 Windows/KeyboardDevice.h
1576                 Windows/MIPSCompALU.h
1577                 Windows/MIPSCompBranch.h
1578                 Windows/OpenGLBase.cpp
1579                 Windows/OpenGLBase.h
1580                 Windows/W32Util/DialogManager.cpp
1581                 Windows/W32Util/DialogManager.h
1582                 Windows/W32Util/Misc.cpp
1583                 Windows/W32Util/Misc.h
1584                 Windows/W32Util/PropertySheet.cpp
1585                 Windows/W32Util/PropertySheet.h
1586                 Windows/W32Util/ShellUtil.cpp
1587                 Windows/W32Util/ShellUtil.h
1588                 Windows/W32Util/XPTheme.h
1589                 Windows/WindowsFileSystem.h
1590                 Windows/WindowsHost.cpp
1591                 Windows/WindowsHost.h
1592                 Windows/WndMainWindow.cpp
1593                 Windows/WndMainWindow.h
1594                 Windows/XPTheme.h
1595                 Windows/XinputDevice.cpp
1596                 Windows/XinputDevice.h
1597                 Windows/main.cpp
1598                 Windows/main.h
1599                 Windows/ppsspp.rc
1600                 Windows/resource.h
1601                 Windows/stdafx.cpp
1602                 Windows/stdafx.h)
1603         target_link_libraries(PPSSPPWindows ${CoreLibName}
1604                 kernel32 user32 gdi32 shell32 comctl32 dsound xinput)
1605         setup_target_project(PPSSPPWindows Windows)
1606 endif()
1608 set(NativeAssets
1609         android/assets/ui_atlas.zim
1610         assets/shaders
1611         assets/ppge_atlas.zim
1612         assets/langregion.ini
1613         assets/unknown.png)
1614 set(LinkCommon ${CoreLibName} ${CMAKE_THREAD_LIBS_INIT} ${nativeExtraLibs})
1617 if(HEADLESS)
1618         add_executable(PPSSPPHeadless
1619                 headless/Headless.cpp
1620                 UI/OnScreenDisplay.cpp
1621                 headless/StubHost.h
1622                 headless/Compare.cpp
1623                 headless/Compare.h)
1624         target_link_libraries(PPSSPPHeadless
1625                 ${COCOA_LIBRARY} ${LinkCommon})
1626         setup_target_project(PPSSPPHeadless headless)
1627 endif()
1629 if(UNITTEST)
1630         add_executable(unitTest
1631                 unittest/UnitTest.cpp
1632                 unittest/TestArmEmitter.cpp
1633                 unittest/TestArm64Emitter.cpp
1634                 unittest/TestX64Emitter.cpp
1635                 unittest/TestVertexJit.cpp
1636                 unittest/JitHarness.cpp
1637                 Core/MIPS/ARM/ArmRegCache.cpp
1638                 Core/MIPS/ARM/ArmRegCacheFPU.cpp
1639                 UI/OnScreenDisplay.cpp
1640         )
1641         target_link_libraries(unitTest
1642                 ${COCOA_LIBRARY} ${LinkCommon} Common)
1643         setup_target_project(unitTest unittest)
1644 endif()
1646 if (TargetBin)
1647         if (IOS OR APPLE)
1648                 if (APPLE AND NOT IOS)
1649                 set(ICON_PATH_ABS ${CMAKE_CURRENT_SOURCE_DIR}/assets/ppsspp.icns)
1650                 set( MACOSX_BUNDLE_ICON_FILE ppsspp.icns )
1651                 set_source_files_properties(${ICON_PATH_ABS} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
1652                 endif()
1654                 # TODO: there must a native way to copy these.
1655                 # Now this is very prone to errors when changes occur.
1656                 # Also better to have assets under Resources dir for OS X.
1657                 file(GLOB_RECURSE FLASH0_FILES flash0/*)
1658                 file(GLOB_RECURSE LANG_FILES lang/*)
1659                 file(GLOB_RECURSE SHADER_FILES assets/shaders/*)
1661                 if (APPLE AND NOT IOS)
1662                 set_source_files_properties(${NativeAssets} PROPERTIES MACOSX_PACKAGE_LOCATION "MacOS/assets")
1663                 set_source_files_properties(${FLASH0_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION "MacOS/assets/flash0/font")
1664                 set_source_files_properties(${LANG_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION "MacOS/assets/lang")
1665                 set_source_files_properties(${SHADER_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION "MacOS/assets/shaders")
1666                 endif()
1668                 add_executable(${TargetBin} MACOSX_BUNDLE ${ICON_PATH_ABS} ${NativeAssets} ${SHADER_FILES} ${FLASH0_FILES} ${LANG_FILES} ${NativeAppSource})
1669         else()
1670                 add_executable(${TargetBin} ${NativeAppSource})
1671         endif()
1672         target_link_libraries(${TargetBin} ${LinkCommon} Common)
1673 endif()
1675 # installs
1676 file(INSTALL ${NativeAssets} DESTINATION assets)
1677 file(INSTALL flash0 lang DESTINATION assets)
1679 if(APPLE AND NOT IOS)
1680         set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -F /Library/Frameworks")
1681 endif()
1683 # packaging and code signing
1684 if(IOS)
1685         add_dependencies(PPSSPP ${CoreLibName} GPU Common native)
1687         file(GLOB IOSAssets ios/assets/*.png)
1688         file(INSTALL ${IOSAssets} DESTINATION assets)
1689         if (IOS_DEBUG)
1690                 file(INSTALL pspautotests DESTINATION assets)
1691         endif()
1692         set(RSRC_XIB_FILES assets/Icon@2x.png)
1693         set_source_files_properties(${RSRC_XIB_FILES}
1694                 PROPERTIES MACOSX_PACKAGE_LOCATION Resources
1695         )
1696         set(APP_DIR_NAME \${TARGET_BUILD_DIR}/\${FULL_PRODUCT_NAME})
1697         add_custom_command(TARGET PPSSPP POST_BUILD
1698                 COMMAND tar -c -C . --exclude .DS_Store --exclude .git -H gnu assets | tar -x -C '${APP_DIR_NAME}'
1699         )
1700         # Force Xcode to relink the binary.
1701         add_custom_command(TARGET Core PRE_BUILD
1702                 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
1703                 COMMAND rm -f PPSSPP.build/{Debug,Release,MinSizeRel,RelWithDebInfo}-iphoneos/PPSSPP.build/Objects-normal/*/PPSSPP {Debug,Release,MinSizeRel,RelWithDebInfo}-iphoneos/PPSSPP.app/PPSSPP
1704         )
1705         set_target_properties(${TargetBin} PROPERTIES
1706                 MACOSX_BUNDLE_INFO_PLIST "../ios/PPSSPP-Info.plist"
1707                 XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "iPhone/iPad"
1708         XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES
1709         )
1710 endif()
1712 #include(CPack)