summaryrefslogtreecommitdiff
blob: f041be5fa15ad660c2c252f738d6c2876e7917d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
From 683b871c320ec14b777ec3937dc609b69b3cf5a5 Mon Sep 17 00:00:00 2001
From: nE0sIghT <ykonotopov@gmail.com>
Date: Sat, 8 Aug 2015 19:12:37 +0300
Subject: [PATCH 3/3] Use global compiler optimization flags instead of
 defining them for every plugin/binary

---
 cmake/BuildParameters.cmake                        | 35 ++++++++++-------
 common/src/Utilities/CMakeLists.txt                | 45 +---------------------
 common/src/x86emitter/CMakeLists.txt               | 45 +---------------------
 pcsx2/CMakeLists.txt                               | 45 +---------------------
 plugins/CDVDiso/src/CMakeLists.txt                 | 16 +-------
 plugins/CDVDlinuz/Src/CMakeLists.txt               | 21 +---------
 plugins/CDVDnull/CMakeLists.txt                    | 16 +-------
 plugins/FWnull/CMakeLists.txt                      | 16 +-------
 plugins/GSdx/CMakeLists.txt                        |  9 +----
 plugins/GSnull/CMakeLists.txt                      | 16 +-------
 plugins/PadNull/CMakeLists.txt                     | 16 +-------
 plugins/SPU2null/CMakeLists.txt                    | 16 +-------
 plugins/USBnull/CMakeLists.txt                     | 16 +-------
 plugins/dev9null/CMakeLists.txt                    | 16 +-------
 plugins/onepad/CMakeLists.txt                      | 16 +-------
 plugins/spu2-x/src/CMakeLists.txt                  | 16 +-------
 plugins/zerogs/opengl/CMakeLists.txt               |  8 +---
 plugins/zerospu2/CMakeLists.txt                    | 16 +-------
 plugins/zzogl-pg/opengl/CMakeLists.txt             |  8 +---
 .../zzogl-pg/opengl/ZeroGSShaders/CMakeLists.txt   |  8 +---
 tools/bin2cpp/CMakeLists.txt                       |  6 +--
 21 files changed, 51 insertions(+), 355 deletions(-)

diff --git a/cmake/BuildParameters.cmake b/cmake/BuildParameters.cmake
index 48b167c..82e4ded 100644
--- a/cmake/BuildParameters.cmake
+++ b/cmake/BuildParameters.cmake
@@ -117,14 +117,17 @@ if(${PCSX2_TARGET_ARCHITECTURES} MATCHES "i386")
     #     - Only plugins. No package will link to them.
     set(CMAKE_POSITION_INDEPENDENT_CODE OFF)
 
-    if (DISABLE_ADVANCE_SIMD)
-        set(ARCH_FLAG "-msse -msse2 -march=i686")
-    else()
-        # AVX requires some fix of the ABI (mangling) (default 2)
-        # Note: V6 requires GCC 4.7
-        #set(ARCH_FLAG "-march=native -fabi-version=6")
-        set(ARCH_FLAG "-march=native")
+    if(NOT DEFINED ARCH_FLAG)
+        if (DISABLE_ADVANCE_SIMD)
+            set(ARCH_FLAG "-msse -msse2 -march=i686")
+        else()
+            # AVX requires some fix of the ABI (mangling) (default 2)
+            # Note: V6 requires GCC 4.7
+            #set(ARCH_FLAG "-march=native -fabi-version=6")
+            set(ARCH_FLAG "-march=native")
+        endif()
     endif()
+
     add_definitions(-D_ARCH_32=1 -D_M_X86=1 -D_M_X86_32=1)
     set(_ARCH_32 1)
     set(_M_X86 1)
@@ -136,11 +139,13 @@ elseif(${PCSX2_TARGET_ARCHITECTURES} MATCHES "x86_64")
     # SuperVU will not be ported
     set(DISABLE_SVU TRUE)
 
-    if (DISABLE_ADVANCE_SIMD)
-        set(ARCH_FLAG "-msse -msse2")
-    else()
-        #set(ARCH_FLAG "-march=native -fabi-version=6")
-        set(ARCH_FLAG "-march=native")
+    if(NOT DEFINED ARCH_FLAG)
+        if (DISABLE_ADVANCE_SIMD)
+            set(ARCH_FLAG "-msse -msse2")
+        else()
+            #set(ARCH_FLAG "-march=native -fabi-version=6")
+            set(ARCH_FLAG "-march=native")
+        endif()
     endif()
     add_definitions(-D_ARCH_64=1 -D_M_X86=1 -D_M_X86_64=1)
     set(_ARCH_64 1)
@@ -256,8 +261,12 @@ else()
     set(ASAN_FLAG "")
 endif()
 
+if(NOT DEFINED OPTIMIZATION_FLAG)
+    set(OPTIMIZATION_FLAG -O2)
+endif()
+
 # Note: -DGTK_DISABLE_DEPRECATED can be used to test a build without gtk deprecated feature. It could be useful to port to a newer API
-set(DEFAULT_GCC_FLAG "${ARCH_FLAG} ${COMMON_FLAG} ${DEFAULT_WARNINGS} ${AGGRESSIVE_WARNING} ${HARDENING_FLAG} ${DEBUG_FLAG} ${ASAN_FLAG}")
+set(DEFAULT_GCC_FLAG "${ARCH_FLAG} ${COMMON_FLAG} ${DEFAULT_WARNINGS} ${AGGRESSIVE_WARNING} ${HARDENING_FLAG} ${DEBUG_FLAG} ${ASAN_FLAG} ${OPTIMIZATION_FLAG}")
 # c++ only flags
 set(DEFAULT_CPP_FLAG "${DEFAULT_GCC_FLAG} -Wno-invalid-offsetof")
 
diff --git a/common/src/Utilities/CMakeLists.txt b/common/src/Utilities/CMakeLists.txt
index 8f97604..f4b6e27 100644
--- a/common/src/Utilities/CMakeLists.txt
+++ b/common/src/Utilities/CMakeLists.txt
@@ -14,47 +14,6 @@ set(CommonFlags
 	-fno-strict-aliasing
     )
 
-# set optimization flags
-set(OptimizationFlags
-	-falign-functions
-	-falign-jumps
-	-falign-labels
-	-falign-loops
-	-fcaller-saves
-	-fcprop-registers
-	-fcrossjumping
-	-fcse-follow-jumps
-	-fcse-skip-blocks
-	-fdefer-pop
-	-fdelete-null-pointer-checks
-	-fgcse
-	-fgcse-lm
-	-fif-conversion
-	-fif-conversion2
-	-fmerge-constants
-	-foptimize-sibling-calls
-	-fpeephole2
-	-fregmove
-	-freorder-blocks
-	-freorder-functions 
-	-frerun-cse-after-loop
-	-fsched-interblock
-	-fsched-spec
-	-fstrict-overflow
-	-fthread-jumps
-	-ftree-ccp
-	-ftree-ch
-	-ftree-copyrename
-	-ftree-dce
-	-ftree-dominator-opts
-	-ftree-fre
-	-ftree-lrs
-	-ftree-pre
-	-ftree-sra
-	-ftree-ter
-	-ftree-vrp
-	-funit-at-a-time)
-
 #Clang doesn't support a few common flags that GCC does.
 if(NOT USE_CLANG)
 	set(UtilitiesFinalFlags
@@ -79,7 +38,7 @@ if(CMAKE_BUILD_TYPE STREQUAL Devel)
 	# add defines
 	set(UtilitiesFinalFlags
 		${UtilitiesFinalFlags}
-		${CommonFlags} ${OptimizationFlags} -DPCSX2_DEVBUILD
+		${CommonFlags} -DPCSX2_DEVBUILD
 	)
 endif(CMAKE_BUILD_TYPE STREQUAL Devel)
 
@@ -89,7 +48,7 @@ if(CMAKE_BUILD_TYPE STREQUAL Release)
 	# add defines
 	set(UtilitiesFinalFlags
 		${UtilitiesFinalFlags}
-		${CommonFlags} ${OptimizationFlags}
+		${CommonFlags}
 	)
 endif(CMAKE_BUILD_TYPE STREQUAL Release)
 
diff --git a/common/src/x86emitter/CMakeLists.txt b/common/src/x86emitter/CMakeLists.txt
index b37e22a..a8217fc 100644
--- a/common/src/x86emitter/CMakeLists.txt
+++ b/common/src/x86emitter/CMakeLists.txt
@@ -14,47 +14,6 @@ set(CommonFlags
 	-fno-strict-aliasing
     )
 
-# set optimization flags
-set(OptimizationFlags
-	-falign-functions
-	-falign-jumps
-	-falign-labels
-	-falign-loops
-	-fcaller-saves
-	-fcprop-registers
-	-fcrossjumping
-	-fcse-follow-jumps
-	-fcse-skip-blocks
-	-fdefer-pop
-	-fdelete-null-pointer-checks
-	-fgcse
-	-fgcse-lm
-	-fif-conversion
-	-fif-conversion2
-	-fmerge-constants
-	-foptimize-sibling-calls
-	-fpeephole2
-	-fregmove
-	-freorder-blocks
-	-freorder-functions 
-	-frerun-cse-after-loop
-	-fsched-interblock
-	-fsched-spec
-	-fstrict-overflow
-	-fthread-jumps
-	-ftree-ccp
-	-ftree-ch
-	-ftree-copyrename
-	-ftree-dce
-	-ftree-dominator-opts
-	-ftree-fre
-	-ftree-lrs
-	-ftree-pre
-	-ftree-sra
-	-ftree-ter
-	-ftree-vrp
-	-funit-at-a-time)
-
 #Clang doesn't support a few common flags that GCC does.
 if(NOT USE_CLANG)
 	set(x86emitterFinalFlags
@@ -77,7 +36,7 @@ if(CMAKE_BUILD_TYPE STREQUAL Devel)
 	# add defines
 	set(x86emitterFinalFlags
 		${x86emitterFinalFlags}
-		${CommonFlags} ${OptimizationFlags} -DPCSX2_DEVBUILD
+		${CommonFlags} -DPCSX2_DEVBUILD
 	)
 endif(CMAKE_BUILD_TYPE STREQUAL Devel)
 
@@ -87,7 +46,7 @@ if(CMAKE_BUILD_TYPE STREQUAL Release)
 	# add defines
 	set(x86emitterFinalFlags
 		${x86emitterFinalFlags}
-		${CommonFlags} ${OptimizationFlags}
+		${CommonFlags}
 	)
 endif(CMAKE_BUILD_TYPE STREQUAL Release)
 
diff --git a/pcsx2/CMakeLists.txt b/pcsx2/CMakeLists.txt
index 871713e..a98843d 100644
--- a/pcsx2/CMakeLists.txt
+++ b/pcsx2/CMakeLists.txt
@@ -27,47 +27,6 @@ set(CommonFlags
     -DWX_PRECOMP
 	)
 
-# set optimization flags
-set(OptimizationFlags
-	-falign-functions
-	-falign-jumps
-	-falign-labels
-	-falign-loops
-	-fcaller-saves
-	-fcprop-registers
-	-fcrossjumping
-	-fcse-follow-jumps
-	-fcse-skip-blocks
-	-fdefer-pop
-	-fdelete-null-pointer-checks
-	-fgcse
-	-fgcse-lm
-	-fif-conversion
-	-fif-conversion2
-	-fmerge-constants
-	-foptimize-sibling-calls
-	-fpeephole2
-	-fregmove
-	-freorder-blocks
-	-freorder-functions
-	-frerun-cse-after-loop
-	-fsched-interblock
-	-fsched-spec
-	-fstrict-overflow
-	-fthread-jumps
-	-ftree-ccp
-	-ftree-ch
-	-ftree-copyrename
-	-ftree-dce
-	-ftree-dominator-opts
-	-ftree-fre
-	-ftree-lrs
-	-ftree-pre
-	-ftree-sra
-	-ftree-ter
-	-ftree-vrp
-	-funit-at-a-time)
-
 #Clang doesn't support a few common flags that GCC does.
 if(NOT USE_CLANG)
 	set(pcsx2FinalFlags ${CommonFlags} -fno-guess-branch-probability -fno-dse -fno-tree-dse)
@@ -80,11 +39,11 @@ if(CMAKE_BUILD_TYPE STREQUAL Debug)
 
 elseif(CMAKE_BUILD_TYPE STREQUAL Devel)
 	set(Output pcsx2-dev)
-	set(pcsx2FinalFlags ${pcsx2FinalFlags} ${CommonFlags} ${OptimizationFlags} -DPCSX2_DEVBUILD)
+	set(pcsx2FinalFlags ${pcsx2FinalFlags} ${CommonFlags} -DPCSX2_DEVBUILD)
 
 elseif(CMAKE_BUILD_TYPE STREQUAL Release)
 	set(Output pcsx2)
-	set(pcsx2FinalFlags ${pcsx2FinalFlags} ${CommonFlags} ${OptimizationFlags})
+	set(pcsx2FinalFlags ${pcsx2FinalFlags} ${CommonFlags})
 
 endif()
 
diff --git a/plugins/CDVDiso/src/CMakeLists.txt b/plugins/CDVDiso/src/CMakeLists.txt
index 519c92a..97cb832 100644
--- a/plugins/CDVDiso/src/CMakeLists.txt
+++ b/plugins/CDVDiso/src/CMakeLists.txt
@@ -8,21 +8,7 @@ endif()
 
 # plugin name
 set(Output CDVDiso)
-
-set(OptimizationFlags
-    -O2
-    )
-
-if(CMAKE_BUILD_TYPE STREQUAL Debug)
-    set(CDVDisoFinalFlags "")
-
-elseif(CMAKE_BUILD_TYPE STREQUAL Devel)
-	set(CDVDisoFinalFlags ${OptimizationFlags})
-
-elseif(CMAKE_BUILD_TYPE STREQUAL Release)
-	set(CDVDisoFinalFlags ${OptimizationFlags})
-
-endif()
+set(CDVDisoFinalFlags "")
 
 # CDVDiso sources
 set(CDVDisoSources
diff --git a/plugins/CDVDlinuz/Src/CMakeLists.txt b/plugins/CDVDlinuz/Src/CMakeLists.txt
index 943780f..f02198d 100644
--- a/plugins/CDVDlinuz/Src/CMakeLists.txt
+++ b/plugins/CDVDlinuz/Src/CMakeLists.txt
@@ -2,26 +2,7 @@
 
 # plugin name
 set(Output CDVDlinuz)
-
-set(CommonFlags
-    -D_LARGEFILE64_SOURCE
-    )
-
-set(OptimizationFlags
-    -O2
-    -fomit-frame-pointer
-    )
-
-if(CMAKE_BUILD_TYPE STREQUAL Debug)
-    set(CDVDlinuzFinalFlags ${CommonFlags})
-
-elseif(CMAKE_BUILD_TYPE STREQUAL Devel)
-	set(CDVDlinuzFinalFlags ${CommonFlags} ${OptimizationFlags})
-
-elseif(CMAKE_BUILD_TYPE STREQUAL Release)
-	set(CDVDlinuzFinalFlags ${CommonFlags} ${OptimizationFlags})
-
-endif()
+set(CDVDlinuzFinalFlags -D_LARGEFILE64_SOURCE)
 
 # CDVDlinuz sources
 set(CDVDlinuzSources
diff --git a/plugins/CDVDnull/CMakeLists.txt b/plugins/CDVDnull/CMakeLists.txt
index 4fde2f7..5c84959 100644
--- a/plugins/CDVDnull/CMakeLists.txt
+++ b/plugins/CDVDnull/CMakeLists.txt
@@ -8,21 +8,7 @@ endif()
 
 # plugin name
 set(Output CDVDnull)
-
-set(OptimizationFlags
-    -O2
-    )
-
-if(CMAKE_BUILD_TYPE STREQUAL Debug)
-    set(CDVDnullFinalFlags "")
-
-elseif(CMAKE_BUILD_TYPE STREQUAL Devel)
-	set(CDVDnullFinalFlags ${OptimizationFlags})
-
-elseif(CMAKE_BUILD_TYPE STREQUAL Release)
-	set(CDVDnullFinalFlags ${OptimizationFlags})
-
-endif()
+set(CDVDnullFinalFlags "")
 
 # CDVDnull sources
 set(CDVDnullSources
diff --git a/plugins/FWnull/CMakeLists.txt b/plugins/FWnull/CMakeLists.txt
index fd5a45e..aaf9e4e 100644
--- a/plugins/FWnull/CMakeLists.txt
+++ b/plugins/FWnull/CMakeLists.txt
@@ -8,21 +8,7 @@ endif()
 
 # plugin name
 set(Output FWnull-0.7.0)
-
-set(OptimizationFlags
-    -O2
-    )
-
-if(CMAKE_BUILD_TYPE STREQUAL Debug)
-    set(FWnullFinalFlags "")
-
-elseif(CMAKE_BUILD_TYPE STREQUAL Devel)
-	set(FWnullFinalFlags ${OptimizationFlags})
-
-elseif(CMAKE_BUILD_TYPE STREQUAL Release)
-	set(FWnullFinalFlags ${OptimizationFlags})
-
-endif()
+set(FWnullFinalFlags "")
 
 # FWnull sources
 set(FWnullSources
diff --git a/plugins/GSdx/CMakeLists.txt b/plugins/GSdx/CMakeLists.txt
index 13b30c7..6fd6253 100644
--- a/plugins/GSdx/CMakeLists.txt
+++ b/plugins/GSdx/CMakeLists.txt
@@ -18,19 +18,14 @@ set(CommonFlags
     -Wunused-variable # __dummy variable need to be investigated
     )
 
-set(OptimizationFlags
-    -O2
-    )
-
-
 if(CMAKE_BUILD_TYPE STREQUAL Debug)
     set(GSdxFinalFlags ${GSdxFinalFlags} ${CommonFlags} -D_DEBUG)
 
 elseif(CMAKE_BUILD_TYPE STREQUAL Devel)
-    set(GSdxFinalFlags ${GSdxFinalFlags} ${CommonFlags} ${OptimizationFlags} -D_DEVEL)
+    set(GSdxFinalFlags ${GSdxFinalFlags} ${CommonFlags} -D_DEVEL)
 
 elseif(CMAKE_BUILD_TYPE STREQUAL Release)
-    set(GSdxFinalFlags ${GSdxFinalFlags} ${CommonFlags} ${OptimizationFlags} -W)
+    set(GSdxFinalFlags ${GSdxFinalFlags} ${CommonFlags} -W)
 
 endif()
 
diff --git a/plugins/GSnull/CMakeLists.txt b/plugins/GSnull/CMakeLists.txt
index 2216e17..3bde988 100644
--- a/plugins/GSnull/CMakeLists.txt
+++ b/plugins/GSnull/CMakeLists.txt
@@ -8,21 +8,7 @@ endif()
 
 # plugin name
 set(Output GSnull)
-
-set(OptimizationFlags
-    -O2
-    )
-
-if(CMAKE_BUILD_TYPE STREQUAL Debug)
-    set(GSnullFinalFlags "")
-
-elseif(CMAKE_BUILD_TYPE STREQUAL Devel)
-	set(GSnullFinalFlags ${OptimizationFlags})
-
-elseif(CMAKE_BUILD_TYPE STREQUAL Release)
-	set(GSnullFinalFlags ${OptimizationFlags})
-
-endif()
+set(GSnullFinalFlags "")
 
 # GSnull sources
 set(GSnullSources
diff --git a/plugins/PadNull/CMakeLists.txt b/plugins/PadNull/CMakeLists.txt
index acbe758..18b1b6c 100644
--- a/plugins/PadNull/CMakeLists.txt
+++ b/plugins/PadNull/CMakeLists.txt
@@ -7,21 +7,7 @@ endif()
 
 # plugin name
 set(Output PADnull)
-
-set(OptimizationFlags
-    -O2
-    )
-
-if(CMAKE_BUILD_TYPE STREQUAL Debug)
-    set(PadNullFinalFlags "")
-
-elseif(CMAKE_BUILD_TYPE STREQUAL Devel)
-	set(PadNullFinalFlags ${OptimizationFlags})
-
-elseif(CMAKE_BUILD_TYPE STREQUAL Release)
-	set(PadNullFinalFlags ${OptimizationFlags})
-
-endif()
+set(PadNullFinalFlags "")
 
 # PadNull sources
 set(PadNullSources
diff --git a/plugins/SPU2null/CMakeLists.txt b/plugins/SPU2null/CMakeLists.txt
index 5409543..620a521 100644
--- a/plugins/SPU2null/CMakeLists.txt
+++ b/plugins/SPU2null/CMakeLists.txt
@@ -8,21 +8,7 @@ endif()
 
 # plugin name
 set(Output SPU2null)
-
-set(OptimizationFlags
-    -O2
-    )
-
-if(CMAKE_BUILD_TYPE STREQUAL Debug)
-    set(SPU2nullFinalFlags "")
-
-elseif(CMAKE_BUILD_TYPE STREQUAL Devel)
-	set(SPU2nullFinalFlags ${OptimizationFlags})
-
-elseif(CMAKE_BUILD_TYPE STREQUAL Release)
-	set(SPU2nullFinalFlags ${OptimizationFlags})
-
-endif()
+set(SPU2nullFinalFlags "")
 
 # SPU2null sources
 set(SPU2nullSources
diff --git a/plugins/USBnull/CMakeLists.txt b/plugins/USBnull/CMakeLists.txt
index c84890e..7892d03 100644
--- a/plugins/USBnull/CMakeLists.txt
+++ b/plugins/USBnull/CMakeLists.txt
@@ -8,21 +8,7 @@ endif()
 
 # plugin name
 set(Output USBnull-0.7.0)
-
-set(OptimizationFlags
-    -O2
-    )
-
-if(CMAKE_BUILD_TYPE STREQUAL Debug)
-	set(USBnullFinalFlags "")
-
-elseif(CMAKE_BUILD_TYPE STREQUAL Devel)
-	set(USBnullFinalFlags ${OptimizationFlags})
-
-elseif(CMAKE_BUILD_TYPE STREQUAL Release)
-	set(USBnullFinalFlags ${OptimizationFlags})
-
-endif()
+set(USBnullFinalFlags "")
 
 # USBnull sources
 set(USBnullSources
diff --git a/plugins/dev9null/CMakeLists.txt b/plugins/dev9null/CMakeLists.txt
index 09d8bee..b819985 100644
--- a/plugins/dev9null/CMakeLists.txt
+++ b/plugins/dev9null/CMakeLists.txt
@@ -8,21 +8,7 @@ endif()
 
 # plugin name
 set(Output dev9null-0.5.0)
-
-set(OptimizationFlags
-    -O2
-    )
-
-if(CMAKE_BUILD_TYPE STREQUAL Debug)
-    set(dev9nullFinalFlags "")
-
-elseif(CMAKE_BUILD_TYPE STREQUAL Devel)
-	set(dev9nullFinalFlags ${OptimizationFlags})
-
-elseif(CMAKE_BUILD_TYPE STREQUAL Release)
-	set(dev9nullFinalFlags ${OptimizationFlags})
-
-endif()
+set(dev9nullFinalFlags "")
 
 # dev9null sources
 set(dev9nullSources
diff --git a/plugins/onepad/CMakeLists.txt b/plugins/onepad/CMakeLists.txt
index 6a12cd7..68ffb82 100644
--- a/plugins/onepad/CMakeLists.txt
+++ b/plugins/onepad/CMakeLists.txt
@@ -8,21 +8,7 @@ endif()
 
 # plugin name
 set(Output onepad-1.1.0)
-
-set(OptimizationFlags
-    -O2
-    )
-
-if(CMAKE_BUILD_TYPE STREQUAL Debug)
-    set(onepadFinalFlags "")
-
-elseif(CMAKE_BUILD_TYPE STREQUAL Devel)
-	set(onepadFinalFlags ${OptimizationFlags})
-
-elseif(CMAKE_BUILD_TYPE STREQUAL Release)
-	set(onepadFinalFlags ${OptimizationFlags})
-
-endif()
+set(onepadFinalFlags "")
 
 # onepad sources
 set(onepadSources
diff --git a/plugins/spu2-x/src/CMakeLists.txt b/plugins/spu2-x/src/CMakeLists.txt
index 720c4ac..0180704 100644
--- a/plugins/spu2-x/src/CMakeLists.txt
+++ b/plugins/spu2-x/src/CMakeLists.txt
@@ -14,21 +14,7 @@ endif()
 
 # plugin name
 set(Output spu2x-2.0.0)
-
-set(OptimizationFlags
-    -O2
-    )
-
-if(CMAKE_BUILD_TYPE STREQUAL Debug)
-    set(spu2xFinalFlags "")
-
-elseif(CMAKE_BUILD_TYPE STREQUAL Devel)
-	set(spu2xFinalFlags ${OptimizationFlags})
-
-elseif(CMAKE_BUILD_TYPE STREQUAL Release)
-	set(spu2xFinalFlags ${OptimizationFlags})
-
-endif()
+set(spu2xFinalFlags "")
 
 # spu2x sources
 set(spu2xSources
diff --git a/plugins/zerogs/opengl/CMakeLists.txt b/plugins/zerogs/opengl/CMakeLists.txt
index fd33949..79716c6 100644
--- a/plugins/zerogs/opengl/CMakeLists.txt
+++ b/plugins/zerogs/opengl/CMakeLists.txt
@@ -7,10 +7,6 @@ set(CommonFlags
     -Wall
     )
 
-set(OptimizationFlags
-    -O2
-    )
-
 # Debug - Build
 if(CMAKE_BUILD_TYPE STREQUAL Debug)
 	# add defines
@@ -20,13 +16,13 @@ endif(CMAKE_BUILD_TYPE STREQUAL Debug)
 # Devel - Build
 if(CMAKE_BUILD_TYPE STREQUAL Devel)
 	# add defines
-	add_definitions(${CommonFlags} ${OptimizationFlags})
+	add_definitions(${CommonFlags})
 endif(CMAKE_BUILD_TYPE STREQUAL Devel)
 
 # Release - Build
 if(CMAKE_BUILD_TYPE STREQUAL Release)
 	# add defines
-	add_definitions(${CommonFlags} ${OptimizationFlags})
+	add_definitions(${CommonFlags})
 endif(CMAKE_BUILD_TYPE STREQUAL Release)
 
 # zerogs sources
diff --git a/plugins/zerospu2/CMakeLists.txt b/plugins/zerospu2/CMakeLists.txt
index c3e3243..9291706 100644
--- a/plugins/zerospu2/CMakeLists.txt
+++ b/plugins/zerospu2/CMakeLists.txt
@@ -8,21 +8,7 @@ endif()
 
 # plugin name
 set(Output zerospu2)
-
-set(OptimizationFlags
-    -O2
-    )
-
-if(CMAKE_BUILD_TYPE STREQUAL Debug)
-    set(zerospu2FinalFlags "")
-
-elseif(CMAKE_BUILD_TYPE STREQUAL Devel)
-	set(zerospu2FinalFlags ${OptimizationFlags})
-
-elseif(CMAKE_BUILD_TYPE STREQUAL Release)
-	set(zerospu2FinalFlags ${OptimizationFlags})
-
-endif(CMAKE_BUILD_TYPE STREQUAL Release)
+set(zerospu2FinalFlags "")
 
 # zerospu2 sources
 set(zerospu2Sources
diff --git a/plugins/zzogl-pg/opengl/CMakeLists.txt b/plugins/zzogl-pg/opengl/CMakeLists.txt
index fe93246..4798097 100644
--- a/plugins/zzogl-pg/opengl/CMakeLists.txt
+++ b/plugins/zzogl-pg/opengl/CMakeLists.txt
@@ -26,10 +26,6 @@ set(CommonFlags
     -Wunused-variable
     )
 
-set(OptimizationFlags
-    -O2
-    )
-
 #Clang doesn't support a few common flags that GCC does.
 if(NOT USE_CLANG)
 	set(zzoglFinalFlags
@@ -46,12 +42,12 @@ if(CMAKE_BUILD_TYPE STREQUAL Debug)
 elseif(CMAKE_BUILD_TYPE STREQUAL Devel)
     set(zzoglFinalFlags
         ${zzoglFinalFlags}
-        ${CommonFlags} ${OptimizationFlags} -g -W -DZEROGS_DEVBUILD
+        ${CommonFlags} -g -W -DZEROGS_DEVBUILD
     )
 elseif(CMAKE_BUILD_TYPE STREQUAL Release)
     set(zzoglFinalFlags
         ${zzoglFinalFlags}
-        ${CommonFlags} ${OptimizationFlags} -W
+        ${CommonFlags} -W
     )
 endif()
 
diff --git a/plugins/zzogl-pg/opengl/ZeroGSShaders/CMakeLists.txt b/plugins/zzogl-pg/opengl/ZeroGSShaders/CMakeLists.txt
index 156189c..ad1eb49 100644
--- a/plugins/zzogl-pg/opengl/ZeroGSShaders/CMakeLists.txt
+++ b/plugins/zzogl-pg/opengl/ZeroGSShaders/CMakeLists.txt
@@ -17,21 +17,17 @@ set(CommonFlags
     -DNVIDIA_CG_API
     )
 
-set(OptimizationFlags
-    -O2
-    )
-
 if(CMAKE_BUILD_TYPE STREQUAL Debug)
     set(zerogsshadersFinalFlags
         ${CommonFlags} -D_DEBUG
     )
 elseif(CMAKE_BUILD_TYPE STREQUAL Devel)
     set(zerogsshadersFinalFlags
-        ${CommonFlags} ${OptimizationFlags} -g -W -DZEROGS_DEVBUILD
+        ${CommonFlags} -g -W -DZEROGS_DEVBUILD
     )
 elseif(CMAKE_BUILD_TYPE STREQUAL Release)
     set(zerogsshadersFinalFlags
-        ${CommonFlags} ${OptimizationFlags} -W
+        ${CommonFlags} -W
     )
 endif(CMAKE_BUILD_TYPE STREQUAL Release)
 
diff --git a/tools/bin2cpp/CMakeLists.txt b/tools/bin2cpp/CMakeLists.txt
index 1689620..1e3e45c 100644
--- a/tools/bin2cpp/CMakeLists.txt
+++ b/tools/bin2cpp/CMakeLists.txt
@@ -7,7 +7,7 @@ set(bin2cppName bin2cpp)
 if(CMAKE_BUILD_TYPE STREQUAL Debug)
 	# add defines
 	set(bin2cppFinalFlags
-		-O2 -s -Wall -fexceptions
+		-s -Wall -fexceptions
 	)
 endif(CMAKE_BUILD_TYPE STREQUAL Debug)
 
@@ -15,7 +15,7 @@ endif(CMAKE_BUILD_TYPE STREQUAL Debug)
 if(CMAKE_BUILD_TYPE STREQUAL Devel)
 	# add defines
 	set(bin2cppFinalFlags
-		-O2 -s -Wall -fexceptions
+		-s -Wall -fexceptions
 	)
 endif(CMAKE_BUILD_TYPE STREQUAL Devel)
 
@@ -23,7 +23,7 @@ endif(CMAKE_BUILD_TYPE STREQUAL Devel)
 if(CMAKE_BUILD_TYPE STREQUAL Release)
 	# add defines
 	set(bin2cppFinalFlags
-		-O2 -s -Wall -fexceptions
+		-s -Wall -fexceptions
 	)
 endif(CMAKE_BUILD_TYPE STREQUAL Release)
 
-- 
2.4.6