Annotation of previous/CMakeLists.txt, revision 1.1.1.4

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)
1.1.1.2   root       12: include(CheckCCompilerFlag)
1.1       root       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
1.1.1.2   root       32:            CACHE BOOL "Built Previous as Mac OS X application bundle")
1.1       root       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: 
1.1.1.3   root       47: find_package(SDL2 REQUIRED)
                     48: if(NOT SDL2_FOUND)
                     49:        message(FATAL_ERROR "SDL2 library not found!")
                     50: endif(NOT SDL2_FOUND)
1.1       root       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: # ################
                     83: # CPP Definitions:
                     84: # ################
                     85: 
                     86: add_definitions(-DCONFDIR=\"/etc\")
                     87: 
                     88: # Test for large file support:
                     89: execute_process(COMMAND getconf LFS_CFLAGS
                     90:                 OUTPUT_VARIABLE DETECTED_LFS_CFLAGS
                     91:                 ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
                     92: if(DETECTED_LFS_CFLAGS)
                     93:        add_definitions(${DETECTED_LFS_CFLAGS})
                     94:        # message(STATUS "Large filesystem flags: ${DETECTED_LFS_CFLAGS}")
                     95: endif(DETECTED_LFS_CFLAGS)
                     96: 
                     97: # Additional CFLAGS suggested by the SDL library:
1.1.1.3   root       98: execute_process(COMMAND pkg-config --cflags-only-other sdl2
                     99:                OUTPUT_VARIABLE DETECTED_SDL_CFLAGS
                    100:                ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
1.1       root      101: 
                    102: # ###########################
                    103: # Check for optional headers:
                    104: # ###########################
                    105: 
                    106: check_include_files(termios.h HAVE_TERMIOS_H)
                    107: check_include_files(strings.h HAVE_STRINGS_H)
                    108: check_include_files(malloc.h HAVE_MALLOC_H)
                    109: check_include_files(sys/times.h HAVE_SYS_TIMES_H)
                    110: check_include_files("sys/socket.h;sys/un.h" HAVE_UNIX_DOMAIN_SOCKETS)
1.1.1.3   root      111: check_include_files(SDL2/SDL_config.h HAVE_SDL2_SDL_CONFIG_H)
1.1       root      112: 
                    113: # #############################
                    114: # Check for optional functions:
                    115: # #############################
                    116: 
                    117: check_function_exists(cfmakeraw HAVE_CFMAKERAW)
                    118: check_function_exists(setenv HAVE_SETENV)
                    119: check_function_exists(select HAVE_SELECT)
                    120: check_function_exists(posix_memalign HAVE_POSIX_MEMALIGN)
                    121: check_function_exists(memalign HAVE_MEMALIGN)
                    122: 
1.1.1.2   root      123: check_function_exists(gettimeofday HAVE_GETTIMEOFDAY)
                    124: check_function_exists(nanosleep HAVE_NANOSLEEP)
                    125: check_function_exists(alphasort HAVE_ALPHASORT)
                    126: check_function_exists(scandir HAVE_SCANDIR)
1.1.1.4 ! root      127: check_function_exists(strdup HAVE_STRDUP)
1.1.1.2   root      128: 
                    129: 
1.1       root      130: # #############
                    131: # Other CFLAGS:
                    132: # #############
                    133: 
                    134: # Warning flags:
                    135: if(CMAKE_COMPILER_IS_GNUCC)
1.1.1.4 ! root      136:        set(CMAKE_C_FLAGS "-Wcast-qual -g -O0 -Wbad-function-cast -Wpointer-arith ${CMAKE_C_FLAGS} -D__USE_MINGW_ANSI_STDIO=1")
1.1       root      137:        set(CMAKE_C_FLAGS "-Wmissing-prototypes -Wstrict-prototypes ${CMAKE_C_FLAGS}")
                    138:        set(CMAKE_C_FLAGS "-Wall -Wwrite-strings -Wsign-compare ${CMAKE_C_FLAGS}")
1.1.1.2   root      139:        #set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wextra -Wno-unused-parameter -Wno-empty-body")
1.1.1.3   root      140:        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wformat-security -std=gnu99")
1.1.1.2   root      141:        #set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wshadow -D_FORTIFY_SOURCE=2 -Werror")
1.1       root      142: endif(CMAKE_COMPILER_IS_GNUCC)
                    143: 
1.1.1.2   root      144: # Building Previous w/o optimization is no fun...
1.1       root      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)

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.