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

Annotation of /trunk/cmake/BuildParameters.cmake

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.22