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 the candidate validation "
13 "script's capability phase or 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"
91 "Full 40-character Git commit embedded in native compatibility reports"
94 if (FRIIDUMP_BUILD_COMMIT)
95 string (LENGTH "${FRIIDUMP_BUILD_COMMIT}" FRIIDUMP_BUILD_COMMIT_LENGTH)
96 if (NOT FRIIDUMP_BUILD_COMMIT_LENGTH EQUAL 40 OR FRIIDUMP_BUILD_COMMIT MATCHES "[^0-9A-Fa-f]")
97 message (FATAL_ERROR "FRIIDUMP_BUILD_COMMIT must be exactly 40 hexadecimal characters")
101 if (BUILD_STATIC_BINARY)
102 set (libmultihash_type STATIC)
103 set (libfriidump_type STATIC)
104 elseif (BUILD_ALL_LIBS_SHARED)
105 set (libmultihash_type SHARED)
106 set (libfriidump_type SHARED)
107 else (BUILD_STATIC_BINARY)
108 # This is how we build libraries by default
109 set (libmultihash_type STATIC)
110 set (libfriidump_type SHARED)
111 endif (BUILD_STATIC_BINARY)
114 # set (CMAKE_BUILD_TYPE superoptimized)
115 set (CMAKE_C_FLAGS_SUPEROPTIMIZED "-march=athlon-xp -m3dnow -O3 -funroll-all-loops")
117 set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall")
119 # set (CMAKE_BUILD_TYPE release)
121 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
122 add_definitions(-DHAVE_CONFIG_H)
123 include_directories (
124 ${FriiDump_BINARY_DIR}
127 # Recurse into the "Hello" and "Demo" subdirectories. This does not actually
128 # cause another cmake executable to run. The same process will walk through
129 # the project's entire directory structure.
130 add_subdirectory (libmultihash)
131 add_subdirectory (libfriidump)
132 add_subdirectory (src)
136 install (FILES AUTHORS DESTINATION / RENAME Authors.txt)
137 #install (CODE "exec_program (${CMAKE_CURRENT_SOURCE_DIR}/utils/unix2dos.exe ${CMAKE_OUTPUT_BINARY_DIR} ARGS Authors.txt)")
138 install (FILES ChangeLog DESTINATION / RENAME ChangeLog.txt)
139 install (FILES COPYING DESTINATION / RENAME Copying.txt)
140 install (FILES README DESTINATION / RENAME ReadMe.txt)
141 install (FILES TODO DESTINATION / RENAME ToDo.txt)
146 include (InstallRequiredSystemLibraries)
148 set (CPACK_PACKAGE_NAME "friidump")
149 set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Dump Nintendo GameCube/Wii discs")
150 set (CPACK_PACKAGE_VENDOR "Arep")
151 set (CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
152 set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
153 set (CPACK_PACKAGE_VERSION_MAJOR "0")
154 set (CPACK_PACKAGE_VERSION_MINOR "3")
155 set (CPACK_PACKAGE_VERSION_PATCH "0")
156 set (CPACK_PACKAGE_INSTALL_DIRECTORY "FriiDump ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
157 set (CPACK_PACKAGE_EXECUTABLES "friidump" "FriiDump")
159 set (CPACK_SOURCE_GENERATOR "TBZ2;ZIP")
160 set (CPACK_SOURCE_IGNORE_FILES
166 "\\\\.kdevelop\\\\.pcs$"
172 set (CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
174 if(WIN32 AND NOT UNIX)
175 set (CPACK_GENERATOR "NSIS;ZIP")
176 # There is a bug in NSI that does not handle full unix paths properly. Make
177 # sure there is at least one set of four (4) backlasshes.
178 # set (CPACK_PACKAGE_ICON "${CMake_SOURCE_DIR}/Utilities/Release\\\\InstallIcon.bmp")
179 # set (CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\MyExecutable.exe")
180 set (CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} installer")
181 set (CPACK_NSIS_HELP_LINK "http:\\\\\\\\wii.console-tribe.com")
182 set (CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\www.my-personal-home-page.com")
183 set (CPACK_NSIS_CONTACT "arep@no.net")
184 set (CPACK_NSIS_MODIFY_PATH ON)
186 set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-Win32")
187 else(WIN32 AND NOT UNIX)
188 set (CPACK_GENERATOR "TBZ2")
189 set (CPACK_STRIP_FILES "bin/friidump;lib/libfriidump.so.1.0.0")
190 # set (CPACK_SOURCE_STRIP_FILES "")
191 set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-LinuxBin")
192 endif(WIN32 AND NOT UNIX)