|
|
1.1 ! root 1: ! 2: cmake_minimum_required(VERSION 2.6 FATAL_ERROR) ! 3: ! 4: project(Previous) ! 5: ! 6: SET(APP_NAME "Previous") ! 7: ! 8: set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") ! 9: ! 10: include(CheckIncludeFiles) ! 11: include(CheckFunctionExists) ! 12: ! 13: include(DistClean) ! 14: ! 15: # Set build type to "Release" if user did not specify any build type yet ! 16: # Other possible values: Debug, Release, RelWithDebInfo and MinSizeRel ! 17: if(NOT CMAKE_BUILD_TYPE) ! 18: set(CMAKE_BUILD_TYPE Release) ! 19: endif(NOT CMAKE_BUILD_TYPE) ! 20: ! 21: # set(CMAKE_VERBOSE_MAKEFILE 1) ! 22: ! 23: # ########################## ! 24: # Conditional build features ! 25: # ########################## ! 26: ! 27: set(ENABLE_TRACING 1 ! 28: CACHE BOOL "Enable tracing messages for debugging") ! 29: ! 30: if(APPLE) ! 31: set(ENABLE_OSX_BUNDLE 1 ! 32: CACHE BOOL "Built Hatari as Mac OS X application bundle") ! 33: # set(CMAKE_OSX_ARCHITECTURES "i386" CACHE STRING "Target architectures" FORCE) ! 34: # set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.6.sdk" CACHE STRING "10.6 SDK" FORCE) ! 35: # set(CMAKE_OSX_DEPLOYMENT_TARGET "10.5" CACHE STRING "Target Min 10.5" FORCE) ! 36: set(ADDITIONAL_INCLUDES ${FRAMEWORKS}) ! 37: set_source_files_properties(${FRAMEWORKS} PROPERTIES MACOSX_PACKAGE_LOCATION Frameworks) ! 38: else() ! 39: set(ENABLE_OSX_BUNDLE 0 ! 40: CACHE BOOL "Built Hatari as Mac OS X application bundle") ! 41: endif(APPLE) ! 42: ! 43: # #################### ! 44: # Check for libraries: ! 45: # #################### ! 46: ! 47: find_package(SDL REQUIRED) ! 48: if(NOT SDL_FOUND) ! 49: message(FATAL_ERROR "SDL library not found!") ! 50: endif(NOT SDL_FOUND) ! 51: ! 52: find_package(Math) ! 53: ! 54: find_package(Readline) ! 55: if(READLINE_FOUND) ! 56: set(CMAKE_REQUIRED_LIBRARIES "readline") ! 57: check_function_exists(rl_filename_completion_function HAVE_RL_COMPLETION_FUNCTION) ! 58: if(HAVE_RL_COMPLETION_FUNCTION) ! 59: set(HAVE_LIBREADLINE 1) ! 60: else() ! 61: unset(READLINE_FOUND) ! 62: endif(HAVE_RL_COMPLETION_FUNCTION) ! 63: set(CMAKE_REQUIRED_LIBRARIES "") ! 64: endif(READLINE_FOUND) ! 65: ! 66: find_package(ZLIB) ! 67: if(ZLIB_FOUND) ! 68: set(HAVE_LIBZ 1) ! 69: set(HAVE_ZLIB_H 1) ! 70: endif(ZLIB_FOUND) ! 71: ! 72: find_package(PNG) ! 73: if(PNG_FOUND) ! 74: set(HAVE_LIBPNG 1) ! 75: endif(PNG_FOUND) ! 76: ! 77: find_package(X11) ! 78: if(X11_FOUND) ! 79: set(HAVE_X11 1) ! 80: endif(X11_FOUND) ! 81: ! 82: find_package(PortAudio) ! 83: if(PORTAUDIO_FOUND) ! 84: set(HAVE_PORTAUDIO 1) ! 85: endif(PORTAUDIO_FOUND) ! 86: ! 87: # ################ ! 88: # CPP Definitions: ! 89: # ################ ! 90: ! 91: add_definitions(-DCONFDIR=\"/etc\") ! 92: ! 93: # Test for large file support: ! 94: execute_process(COMMAND getconf LFS_CFLAGS ! 95: OUTPUT_VARIABLE DETECTED_LFS_CFLAGS ! 96: ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) ! 97: if(DETECTED_LFS_CFLAGS) ! 98: add_definitions(${DETECTED_LFS_CFLAGS}) ! 99: # message(STATUS "Large filesystem flags: ${DETECTED_LFS_CFLAGS}") ! 100: endif(DETECTED_LFS_CFLAGS) ! 101: ! 102: # Additional CFLAGS suggested by the SDL library: ! 103: execute_process(COMMAND pkg-config --cflags-only-other sdl ! 104: OUTPUT_VARIABLE DETECTED_SDL_CFLAGS ! 105: ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) ! 106: if(DETECTED_SDL_CFLAGS) ! 107: add_definitions(${DETECTED_SDL_CFLAGS}) ! 108: # message(STATUS "Additional CFLAGS of SDL: ${DETECTED_SDL_CFLAGS}") ! 109: endif(DETECTED_SDL_CFLAGS) ! 110: ! 111: # ########################### ! 112: # Check for optional headers: ! 113: # ########################### ! 114: ! 115: check_include_files(termios.h HAVE_TERMIOS_H) ! 116: check_include_files(strings.h HAVE_STRINGS_H) ! 117: check_include_files(malloc.h HAVE_MALLOC_H) ! 118: check_include_files(SDL/SDL_config.h HAVE_SDL_SDL_CONFIG_H) ! 119: check_include_files(sys/times.h HAVE_SYS_TIMES_H) ! 120: check_include_files("sys/socket.h;sys/un.h" HAVE_UNIX_DOMAIN_SOCKETS) ! 121: ! 122: # ############################# ! 123: # Check for optional functions: ! 124: # ############################# ! 125: ! 126: check_function_exists(cfmakeraw HAVE_CFMAKERAW) ! 127: check_function_exists(setenv HAVE_SETENV) ! 128: check_function_exists(select HAVE_SELECT) ! 129: check_function_exists(posix_memalign HAVE_POSIX_MEMALIGN) ! 130: check_function_exists(memalign HAVE_MEMALIGN) ! 131: ! 132: # ############# ! 133: # Other CFLAGS: ! 134: # ############# ! 135: ! 136: # Warning flags: ! 137: if(CMAKE_COMPILER_IS_GNUCC) ! 138: set(CMAKE_C_FLAGS "-Wcast-qual -g -O0 -Wbad-function-cast -Wpointer-arith ${CMAKE_C_FLAGS}") ! 139: set(CMAKE_C_FLAGS "-Wmissing-prototypes -Wstrict-prototypes ${CMAKE_C_FLAGS}") ! 140: set(CMAKE_C_FLAGS "-Wall -Wwrite-strings -Wsign-compare ${CMAKE_C_FLAGS}") ! 141: # set(CMAKE_C_FLAGS "-Wshadow -Werror ${CMAKE_C_FLAGS}") ! 142: endif(CMAKE_COMPILER_IS_GNUCC) ! 143: ! 144: # Building Hatari w/o optimization is no fun... ! 145: IF (CMAKE_BUILD_TYPE STREQUAL "Debug") ! 146: set(CMAKE_C_FLAGS "-O ${CMAKE_C_FLAGS}") ! 147: ENDIF (CMAKE_BUILD_TYPE STREQUAL "Debug") ! 148: ! 149: # #################### ! 150: # Paths configuration: ! 151: # #################### ! 152: ! 153: if(NOT BINDIR) ! 154: set(BINDIR bin) ! 155: endif() ! 156: ! 157: if(NOT DATADIR) ! 158: set(DATADIR share/previous) ! 159: endif() ! 160: ! 161: if(NOT BIN2DATADIR) ! 162: if(WIN32) ! 163: set(BIN2DATADIR "." ! 164: CACHE STRING "Relative path from bindir to datadir") ! 165: elseif(ENABLE_OSX_BUNDLE) ! 166: set(BIN2DATADIR "../Resources" ! 167: CACHE STRING "Relative path from bindir to datadir") ! 168: else() ! 169: set(BIN2DATADIR "../share/hatari" ! 170: CACHE STRING "Relative path from bindir to datadir") ! 171: endif(WIN32) ! 172: mark_as_advanced(BIN2DATADIR) ! 173: endif() ! 174: ! 175: if(NOT MANDIR) ! 176: set(MANDIR share/man/man1) ! 177: endif() ! 178: ! 179: if(NOT DOCDIR) ! 180: set(DOCDIR share/doc/previous) ! 181: endif() ! 182: ! 183: # ######################################### ! 184: # Create config.h and recurse into subdirs: ! 185: # ######################################### ! 186: ! 187: configure_file(${CMAKE_SOURCE_DIR}/cmake/config-cmake.h ! 188: ${CMAKE_BINARY_DIR}/config.h) ! 189: ! 190: add_subdirectory(src) ! 191: ! 192: include(FindPythonInterp) ! 193: if(PYTHONINTERP_FOUND) ! 194: add_subdirectory(python-ui) ! 195: endif(PYTHONINTERP_FOUND)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.