CMakeLists.txt
changeset 7709 631852904cee
parent 7705 15f5d3cd35c6
child 7718 97ba379164ec
equal deleted inserted replaced
7708:95de696e4711 7709:631852904cee
    14 #detect Mercurial revision (if present)
    14 #detect Mercurial revision (if present)
    15 set(version_suffix "-dev") #UNSET THIS VARIABLE AT RELEASE TIME
    15 set(version_suffix "-dev") #UNSET THIS VARIABLE AT RELEASE TIME
    16 set(HGCHANGED "")
    16 set(HGCHANGED "")
    17 IF(version_suffix MATCHES "-dev")
    17 IF(version_suffix MATCHES "-dev")
    18     set(HW_DEV true)
    18     set(HW_DEV true)
    19     IF (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.hg)
    19     set(default_build_type "DEBUG")
       
    20     IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.hg)
    20         FIND_PROGRAM(HGCOMMAND hg)
    21         FIND_PROGRAM(HGCOMMAND hg)
    21         IF(HGCOMMAND)
    22         IF(HGCOMMAND)
    22             exec_program(${HGCOMMAND}
    23             exec_program(${HGCOMMAND}
    23                      ARGS identify -in ${CMAKE_CURRENT_SOURCE_DIR}
    24                      ARGS identify -in ${CMAKE_CURRENT_SOURCE_DIR}
    24                      OUTPUT_VARIABLE version_suffix
    25                      OUTPUT_VARIABLE version_suffix
    33             set(version_suffix "-${version_suffix}")
    34             set(version_suffix "-${version_suffix}")
    34         ENDIF()
    35         ENDIF()
    35     ENDIF()
    36     ENDIF()
    36 ELSE()
    37 ELSE()
    37     set(HW_DEV false)
    38     set(HW_DEV false)
       
    39     set(default_build_type "RELEASE")
    38 ENDIF()
    40 ENDIF()
    39 
    41 
    40 
    42 
    41 #versioning
    43 #versioning
    42 set(CPACK_PACKAGE_VERSION_MAJOR 0)
    44 set(CPACK_PACKAGE_VERSION_MAJOR 0)
   136     message(STATUS "Target system: Mac OS X ${minimum_macosx_version} for architecture(s):${CMAKE_OSX_ARCHITECTURES}")
   138     message(STATUS "Target system: Mac OS X ${minimum_macosx_version} for architecture(s):${CMAKE_OSX_ARCHITECTURES}")
   137 endif(APPLE)
   139 endif(APPLE)
   138 
   140 
   139 
   141 
   140 #when build type is not specified, assume Debug/Release according to build version information
   142 #when build type is not specified, assume Debug/Release according to build version information
   141 if (NOT CMAKE_BUILD_TYPE)
   143 if (CMAKE_BUILD_TYPE)
   142     if(HW_DEV)
   144     string (TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE)
   143         set (build_type "DEBUG")
   145     if ( NOT( (CMAKE_BUILD_TYPE MATCHES "RELEASE") OR (CMAKE_BUILD_TYPE MATCHES "DEBUG") ) )
   144     else()
   146         set (CMAKE_BUILD_TYPE ${default_build_type} CACHE STRING "Only 'Debug' or 'Release' options are allowed." FORCE)
   145         set (build_type "RELEASE")
   147         message (STATUS "Unknown build type, using default (${default_build_type})")
   146     endif()
   148     endif ()
   147     set (CMAKE_BUILD_TYPE ${build_type} CACHE STRING "Choose the type of build, options are: Debug Release." FORCE)
   149 else (CMAKE_BUILD_TYPE)
   148 endif (NOT CMAKE_BUILD_TYPE)
   150     set (CMAKE_BUILD_TYPE ${default_build_type} CACHE STRING "Choose the build type, options are: Debug Release." FORCE)
       
   151 endif (CMAKE_BUILD_TYPE)
   149 
   152 
   150 
   153 
   151 #set default flags values for all projects
   154 #set default flags values for all projects
   152 set(CMAKE_C_FLAGS "-pipe ${CMAKE_C_FLAGS}")
   155 set(CMAKE_C_FLAGS "-pipe ${CMAKE_C_FLAGS}")
   153 set(CMAKE_C_FLAGS_RELEASE "-w -Os -fomit-frame-pointer ${CMAKE_C_FLAGS_RELEASE}")
   156 set(CMAKE_C_FLAGS_RELEASE "-w -Os -fomit-frame-pointer ${CMAKE_C_FLAGS_RELEASE}")
   169 
   172 
   170 set(pascal_flags ${fpflags_parsed} "-B" "-FE../bin" "-Cs2000000" "-vewn" "-dDEBUGFILE" ${pascal_flags})
   173 set(pascal_flags ${fpflags_parsed} "-B" "-FE../bin" "-Cs2000000" "-vewn" "-dDEBUGFILE" ${pascal_flags})
   171 set(haskell_flags "-O2" ${ghflags_parsed} ${haskell_flags})
   174 set(haskell_flags "-O2" ${ghflags_parsed} ${haskell_flags})
   172 
   175 
   173 #get BUILD_TYPE and enable/disable optimisation
   176 #get BUILD_TYPE and enable/disable optimisation
   174 if(CMAKE_BUILD_TYPE MATCHES "DEBUG" OR CMAKE_BUILD_TYPE MATCHES "Debug" OR CMAKE_BUILD_TYPE MATCHES "debug")
   177 if(CMAKE_BUILD_TYPE MATCHES "DEBUG")
   175     message(STATUS "Building Debug")
   178     message(STATUS "Building Debug flavour")
   176     set(pascal_flags "-O-" "-g" "-gl" "-gv" "-Ct" ${pascal_flags})
   179     set(pascal_flags "-O-" "-g" "-gl" "-gv" "-Ct" ${pascal_flags})
   177     set(haskell_flags "-Wall" "-debug" "-dcore-lint" "-fno-warn-unused-do-bind" ${haskell_flags})
   180     set(haskell_flags "-Wall" "-debug" "-dcore-lint" "-fno-warn-unused-do-bind" ${haskell_flags})
   178 else()
   181 else()
   179     message(STATUS "Building Release")
   182     message(STATUS "Building Release flavour")
   180 #    set(pascal_flags "-O3" "-OpPENTIUM4" "-CfSSE3" "-Xs" "-Si" ${pascal_flags})
   183 #    set(pascal_flags "-O3" "-OpPENTIUM4" "-CfSSE3" "-Xs" "-Si" ${pascal_flags})
   181     set(pascal_flags "-Os" "-Ooregvar" "-Xs" "-Si" ${pascal_flags})
   184     set(pascal_flags "-Os" "-Ooregvar" "-Xs" "-Si" ${pascal_flags})
   182     set(haskell_flags "-w" "-fno-warn-unused-do-bind" ${haskell_flags})
   185     set(haskell_flags "-w" "-fno-warn-unused-do-bind" ${haskell_flags})
   183 endif()
   186 endif()
   184 
   187