/[pcsx2_0.9.7]/trunk/cmake/BuildParameters.cmake
ViewVC logotype

Contents of /trunk/cmake/BuildParameters.cmake

Parent Directory Parent Directory | Revision Log Revision Log


Revision 62 - (show annotations) (download)
Tue Sep 7 11:08:22 2010 UTC (9 years, 11 months ago) by william
File size: 6240 byte(s)
Auto Commited Import of: pcsx2-0.9.7-r3738-debug in ./trunk
1 ### Select the build type
2 # Use Release/Devel/Debug : -DCMAKE_BUILD_TYPE=Release|Devel|Debug
3 # Enable/disable the stipping : -DCMAKE_BUILD_STRIP=TRUE|FALSE
4 ### Force the choice of 3rd party library in pcsx2 over system libraries
5 # Use all internal lib: -DFORCE_INTERNAL_ALL=TRUE
6 # Use soundtouch internal lib: -DFORCE_INTERNAL_SOUNDTOUCH=TRUE
7 # Use zlib internal lib: -DFORCE_INTERNAL_ZLIB=TRUE
8 ### Add some flags to the build process
9 # control C flags : -DUSER_CMAKE_C_FLAGS="cflags"
10 # control C++ flags : -DUSER_CMAKE_CXX_FLAGS="cxxflags"
11 # control link flags : -DUSER_CMAKE_LD_FLAGS="ldflags"
12 #-------------------------------------------------------------------------------
13
14 #-------------------------------------------------------------------------------
15 # if no build type is set, use Devel as default
16 # Note without the CMAKE_BUILD_TYPE options the value is still defined to ""
17 # Ensure that the value set by the User is correct to avoid some bad behavior later
18 #-------------------------------------------------------------------------------
19 if(NOT CMAKE_BUILD_TYPE MATCHES "Debug|Devel|Release")
20 set(CMAKE_BUILD_TYPE Devel)
21 message(STATUS "BuildType set to ${CMAKE_BUILD_TYPE} by default")
22 endif(NOT CMAKE_BUILD_TYPE MATCHES "Debug|Devel|Release")
23 #-------------------------------------------------------------------------------
24
25 #-------------------------------------------------------------------------------
26 # Set default strip option. Can be set with -DCMAKE_BUILD_STRIP=TRUE/FALSE
27 #-------------------------------------------------------------------------------
28 if(NOT DEFINED CMAKE_BUILD_STRIP)
29 if(CMAKE_BUILD_TYPE STREQUAL "Release")
30 set(CMAKE_BUILD_STRIP TRUE)
31 message(STATUS "Enable the stripping by default in ${CMAKE_BUILD_TYPE} build !!!")
32 else(CMAKE_BUILD_TYPE STREQUAL "Release")
33 set(CMAKE_BUILD_STRIP FALSE)
34 message(STATUS "Disable the stripping by default in ${CMAKE_BUILD_TYPE} build !!!")
35 endif(CMAKE_BUILD_TYPE STREQUAL "Release")
36 endif(NOT DEFINED CMAKE_BUILD_STRIP)
37
38 #-------------------------------------------------------------------------------
39 # Control GCC flags
40 #-------------------------------------------------------------------------------
41 ### Cmake set default value for various compilation variable
42 ### Here the list of default value for documentation purpose
43 # ${CMAKE_SHARED_LIBRARY_CXX_FLAGS} = "-fPIC"
44 # ${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS} = "-rdynamic"
45 #
46 # ${CMAKE_C_FLAGS} = "-g -O2"
47 # ${CMAKE_CXX_FLAGS} = "-g -O2"
48 # Use in debug mode
49 # ${CMAKE_CXX_FLAGS_DEBUG} = "-g"
50 # Use in release mode
51 # ${CMAKE_CXX_FLAGS_RELEASE} = "-O3 -DNDEBUG"
52
53 #-------------------------------------------------------------------------------
54 # Do not use default cmake flags
55 #-------------------------------------------------------------------------------
56 set(CMAKE_C_FLAGS_DEBUG "")
57 set(CMAKE_CXX_FLAGS_DEBUG "")
58 set(CMAKE_C_FLAGS_DEVEL "")
59 set(CMAKE_CXX_FLAGS_DEVEL "")
60 set(CMAKE_C_FLAGS_RELEASE "")
61 set(CMAKE_CXX_FLAGS_RELEASE "")
62
63 #-------------------------------------------------------------------------------
64 # Remove bad default option
65 #-------------------------------------------------------------------------------
66 # Remove -rdynamic option that can some segmentation fault when openining pcsx2 plugins
67 set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
68 set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
69 # Remove -fPIC option. No good reason to use it for plugins. Moreover we
70 # only support x86 architecture. And last but not least it impact the performance.
71 # Long term future note :), amd64 build will need the -fPIC flags
72 set(CMAKE_SHARED_LIBRARY_C_FLAGS "")
73 set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "")
74
75 #-------------------------------------------------------------------------------
76 # Allow user to set some default flags
77 # Note: string STRIP must be used to remove trailing and leading spaces.
78 # See policy CMP0004
79 #-------------------------------------------------------------------------------
80 ### linker flags
81 if(DEFINED USER_CMAKE_LD_FLAGS)
82 message(STATUS "Pcsx2 is very sensible with gcc flags, so use USER_CMAKE_LD_FLAGS at your own risk !!!")
83 string(STRIP "${USER_CMAKE_LD_FLAGS}" USER_CMAKE_LD_FLAGS)
84 else(DEFINED USER_CMAKE_LD_FLAGS)
85 set(USER_CMAKE_LD_FLAGS "")
86 endif(DEFINED USER_CMAKE_LD_FLAGS)
87
88 # ask the linker to strip the binary
89 if(CMAKE_BUILD_STRIP)
90 string(STRIP "${USER_CMAKE_LD_FLAGS} -s" USER_CMAKE_LD_FLAGS)
91 endif(CMAKE_BUILD_STRIP)
92
93
94 ### c flags
95 # Note CMAKE_C_FLAGS is also send to the linker.
96 # By default allow build on amd64 machine
97 if(DEFINED USER_CMAKE_C_FLAGS)
98 message(STATUS "Pcsx2 is very sensible with gcc flags, so use USER_CMAKE_C_FLAGS at your own risk !!!")
99 string(STRIP "${USER_CMAKE_C_FLAGS}" CMAKE_C_FLAGS)
100 endif(DEFINED USER_CMAKE_C_FLAGS)
101 # Use some default machine flags
102 string(STRIP "${CMAKE_C_FLAGS} -m32 -msse -msse2 -march=i686" CMAKE_C_FLAGS)
103
104
105 ### C++ flags
106 # Note CMAKE_CXX_FLAGS is also send to the linker.
107 # By default allow build on amd64 machine
108 if(DEFINED USER_CMAKE_CXX_FLAGS)
109 message(STATUS "Pcsx2 is very sensible with gcc flags, so use USER_CMAKE_CXX_FLAGS at your own risk !!!")
110 string(STRIP "${USER_CMAKE_CXX_FLAGS}" CMAKE_CXX_FLAGS)
111 endif(DEFINED USER_CMAKE_CXX_FLAGS)
112 # Use some default machine flags
113 string(STRIP "${CMAKE_CXX_FLAGS} -m32 -msse -msse2 -march=i686" CMAKE_CXX_FLAGS)
114
115 #-------------------------------------------------------------------------------
116 # Select library system vs 3rdparty
117 #-------------------------------------------------------------------------------
118 if(FORCE_INTERNAL_ALL)
119 set(FORCE_INTERNAL_SOUNDTOUCH TRUE)
120 set(FORCE_INTERNAL_ZLIB TRUE)
121 endif(FORCE_INTERNAL_ALL)
122
123 if(NOT DEFINED FORCE_INTERNAL_SOUNDTOUCH)
124 set(FORCE_INTERNAL_SOUNDTOUCH TRUE)
125 message(STATUS "Use internal version of Soundtouch by default.
126 Note: There have been issues in the past with sound quality depending on the version of Soundtouch
127 Use -DFORCE_INTERNAL_SOUNDTOUCH=FALSE at your own risk")
128 # set(FORCE_INTERNAL_SOUNDTOUCH FALSE)
129 endif(NOT DEFINED FORCE_INTERNAL_SOUNDTOUCH)
130
131 if(NOT DEFINED FORCE_INTERNAL_ZLIB)
132 set(FORCE_INTERNAL_ZLIB FALSE)
133 endif(NOT DEFINED FORCE_INTERNAL_ZLIB)

  ViewVC Help
Powered by ViewVC 1.1.22