1 cmake_minimum_required(VERSION 2.8)
3 # The name of our project is "HELLO". CMakeLists files in this project can
4 # refer to the root source directory of the project as ${HELLO_SOURCE_DIR} and
5 # to the root binary directory of the project as ${HELLO_BINARY_DIR}.
8 if (UNIX AND NOT WIN32)
10 "Linux vendor-command paths require CAP_SYS_RAWIO. "
11 "A normal build does not install this capability. "
12 "After validating the exact executable, run "
13 "validation/friidump-linux-rawio-capability.sh install. "
14 "Do not run the entire FriiDump process as root; rebuilding or replacing "
15 "the executable clears file capabilities."
20 # msvc2005 deprecated warnings
21 add_definitions (-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
24 add_definitions (-fPIC)
29 include (TestBigEndian)
31 test_big_endian (CMAKE_WORDS_BIGENDIAN)
34 include (CheckIncludeFiles)
36 check_include_files (stdbool.h HAVE_STDBOOL_H)
39 include (CheckFunctionExists)
41 check_function_exists (fseeko HAVE_FSEEKO)
42 check_function_exists (ftello HAVE_FTELLO)
43 check_function_exists (fseek64 HAVE_FSEEK64)
44 check_function_exists (ftell64 HAVE_FTELL64)
47 include(CheckTypeSize)
49 set (CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64)
51 set (CMAKE_EXTRA_INCLUDE_FILES sys/types.h)
52 check_type_size ("off_t" OFF_T)
53 set (CMAKE_EXTRA_INCLUDE_FILES)
55 set (CMAKE_EXTRA_INCLUDE_FILES stdio.h)
56 check_type_size ("fpos_t" FPOS_T)
57 set (CMAKE_EXTRA_INCLUDE_FILES)
59 set (CMAKE_REQUIRED_DEFINITIONS)
64 "Enable debugging messages"
71 "Build a static binary (has precedence over ALL_LIBS_SHARED)"
77 "Build all libraries as shared"
82 BUILD_NATIVE_REPORT_TESTS
83 "Build the native-report fixture generator"
88 BUILD_HLDS_PROFILE_TESTS
89 "Build the read-only HLDS E7 profile-selection tests"
97 "Full 40-character Git commit embedded in native compatibility reports"
100 if (FRIIDUMP_BUILD_COMMIT)
101 string (LENGTH "${FRIIDUMP_BUILD_COMMIT}" FRIIDUMP_BUILD_COMMIT_LENGTH)
102 if (NOT FRIIDUMP_BUILD_COMMIT_LENGTH EQUAL 40 OR FRIIDUMP_BUILD_COMMIT MATCHES "[^0-9A-Fa-f]")
103 message (FATAL_ERROR "FRIIDUMP_BUILD_COMMIT must be exactly 40 hexadecimal characters")
107 if (BUILD_STATIC_BINARY)
108 set (libmultihash_type STATIC)
109 set (libfriidump_type STATIC)
110 elseif (BUILD_ALL_LIBS_SHARED)
111 set (libmultihash_type SHARED)
112 set (libfriidump_type SHARED)
113 else (BUILD_STATIC_BINARY)
114 # This is how we build libraries by default
115 set (libmultihash_type STATIC)
116 set (libfriidump_type SHARED)
117 endif (BUILD_STATIC_BINARY)
120 # set (CMAKE_BUILD_TYPE superoptimized)
121 set (CMAKE_C_FLAGS_SUPEROPTIMIZED "-march=athlon-xp -m3dnow -O3 -funroll-all-loops")
123 set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall")
125 # set (CMAKE_BUILD_TYPE release)
127 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
128 add_definitions(-DHAVE_CONFIG_H)
129 include_directories (
130 ${FriiDump_BINARY_DIR}
133 # Recurse into the "Hello" and "Demo" subdirectories. This does not actually
134 # cause another cmake executable to run. The same process will walk through
135 # the project's entire directory structure.
136 add_subdirectory (libmultihash)
137 add_subdirectory (libfriidump)
138 add_subdirectory (src)
140 if (BUILD_HLDS_PROFILE_TESTS)
142 include_directories (
143 ${FriiDump_SOURCE_DIR}/libfriidump
146 test_hlds_e7_profiles
147 tests/test_hlds_e7_profiles.c
149 target_link_libraries (
150 test_hlds_e7_profiles
154 NAME hlds_e7_profiles
155 COMMAND test_hlds_e7_profiles
157 endif (BUILD_HLDS_PROFILE_TESTS)
161 install (FILES AUTHORS DESTINATION / RENAME Authors.txt)
162 #install (CODE "exec_program (${CMAKE_CURRENT_SOURCE_DIR}/utils/unix2dos.exe ${CMAKE_OUTPUT_BINARY_DIR} ARGS Authors.txt)")
163 install (FILES ChangeLog DESTINATION / RENAME ChangeLog.txt)
164 install (FILES COPYING DESTINATION / RENAME Copying.txt)
165 install (FILES README DESTINATION / RENAME ReadMe.txt)
166 install (FILES TODO DESTINATION / RENAME ToDo.txt)
171 include (InstallRequiredSystemLibraries)
173 set (CPACK_PACKAGE_NAME "friidump")
174 set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Dump Nintendo GameCube/Wii discs")
175 set (CPACK_PACKAGE_VENDOR "Arep")
176 set (CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
177 set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
178 set (CPACK_PACKAGE_VERSION_MAJOR "0")
179 set (CPACK_PACKAGE_VERSION_MINOR "3")
180 set (CPACK_PACKAGE_VERSION_PATCH "0")
181 set (CPACK_PACKAGE_INSTALL_DIRECTORY "FriiDump ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
182 set (CPACK_PACKAGE_EXECUTABLES "friidump" "FriiDump")
184 set (CPACK_SOURCE_GENERATOR "TBZ2;ZIP")
185 set (CPACK_SOURCE_IGNORE_FILES
191 "\\\\.kdevelop\\\\.pcs$"
197 set (CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
199 if(WIN32 AND NOT UNIX)
200 set (CPACK_GENERATOR "NSIS;ZIP")
201 # There is a bug in NSI that does not handle full unix paths properly. Make
202 # sure there is at least one set of four (4) backlasshes.
203 # set (CPACK_PACKAGE_ICON "${CMake_SOURCE_DIR}/Utilities/Release\\\\InstallIcon.bmp")
204 # set (CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\MyExecutable.exe")
205 set (CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} installer")
206 set (CPACK_NSIS_HELP_LINK "http:\\\\\\\\wii.console-tribe.com")
207 set (CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\www.my-personal-home-page.com")
208 set (CPACK_NSIS_CONTACT "arep@no.net")
209 set (CPACK_NSIS_MODIFY_PATH ON)
211 set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-Win32")
212 else(WIN32 AND NOT UNIX)
213 set (CPACK_GENERATOR "TBZ2")
214 set (CPACK_STRIP_FILES "bin/friidump;lib/libfriidump.so.1.0.0")
215 # set (CPACK_SOURCE_STRIP_FILES "")
216 set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-LinuxBin")
217 endif(WIN32 AND NOT UNIX)