CMakeLists.txt
branchtransitional_engine
changeset 16021 6a3dc15b78b9
parent 16009 7544a7d7c819
child 16023 0fd23fc57947
equal deleted inserted replaced
16009:7544a7d7c819 16021:6a3dc15b78b9
     1 cmake_minimum_required(VERSION 2.6.4)
     1 cmake_minimum_required(VERSION 3.12.0)
     2 
       
     3 project(hedgewars)
       
     4 
     2 
     5 #initialise cmake environment
     3 #initialise cmake environment
     6 foreach(hwpolicy CMP0003 CMP0012 CMP0017 CMP0018)
     4 foreach(hwpolicy CMP0003 CMP0012 CMP0017 CMP0018 CMP0048)
     7     if(POLICY ${hwpolicy})
     5     if(POLICY ${hwpolicy})
     8         cmake_policy(SET ${hwpolicy} NEW)
     6         cmake_policy(SET ${hwpolicy} NEW)
     9     endif()
     7     endif()
    10 endforeach()
     8 endforeach()
    11 
     9 
    12 foreach(hwpolicy CMP0026 CMP0068)
    10 foreach(hwpolicy CMP0026 CMP0068)
    13     if(POLICY ${hwpolicy})
    11     if(POLICY ${hwpolicy})
    14         cmake_policy(SET ${hwpolicy} OLD)
    12         cmake_policy(SET ${hwpolicy} OLD)
    15     endif()
    13     endif()
    16 endforeach()
    14 endforeach()
       
    15 
       
    16 project(hedgewars VERSION 1.1.0)
    17 
    17 
    18 set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules")
    18 set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules")
    19 include(${CMAKE_MODULE_PATH}/utils.cmake)
    19 include(${CMAKE_MODULE_PATH}/utils.cmake)
    20 
    20 
    21 #possible cmake configuration
    21 #possible cmake configuration
    87 #subdirectories will NOT be searched.
    87 #subdirectories will NOT be searched.
    88 #all fonts that can't be found will be bundled with hedgewars
    88 #all fonts that can't be found will be bundled with hedgewars
    89 set(FONTS_DIRS "" CACHE STRING "Additional paths to folders where required fonts can be found ( ; is separator)")
    89 set(FONTS_DIRS "" CACHE STRING "Additional paths to folders where required fonts can be found ( ; is separator)")
    90 
    90 
    91 #versioning
    91 #versioning
    92 set(CPACK_PACKAGE_VERSION_MAJOR 1)
       
    93 set(CPACK_PACKAGE_VERSION_MINOR 1)
       
    94 set(CPACK_PACKAGE_VERSION_PATCH 0)
       
    95 set(HEDGEWARS_PROTO_VER 60)
    92 set(HEDGEWARS_PROTO_VER 60)
    96 if((CMAKE_BUILD_TYPE STREQUAL "Release") OR (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"))
    93 if((CMAKE_BUILD_TYPE STREQUAL "Release") OR (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"))
    97     set(HEDGEWARS_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
    94     set(HEDGEWARS_VERSION "${CMAKE_PROJECT_VERSION_MAJOR}.${CMAKE_PROJECT_VERSION_MINOR}.${CMAKE_PROJECT_VERSION_PATCH}")
    98 else()
    95 else()
    99     set(HEDGEWARS_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-dev")
    96     set(HEDGEWARS_VERSION "${CMAKE_PROJECT_VERSION_MAJOR}.${CMAKE_PROJECT_VERSION_MINOR}.${CMAKE_PROJECT_VERSION_PATCH}-dev")
   100 endif()
    97 endif()
   101 include(${CMAKE_MODULE_PATH}/revinfo.cmake)
    98 include(${CMAKE_MODULE_PATH}/revinfo.cmake)
   102 
    99 
   103 message(STATUS "Building ${HEDGEWARS_VERSION}-r${HEDGEWARS_REVISION} (${HEDGEWARS_HASH})")
   100 message(STATUS "Building ${HEDGEWARS_VERSION}-r${HEDGEWARS_REVISION} (${HEDGEWARS_HASH})")
   104 
   101 
   106 include(${CMAKE_MODULE_PATH}/paths.cmake)
   103 include(${CMAKE_MODULE_PATH}/paths.cmake)
   107 #general utilities
   104 #general utilities
   108 include(${CMAKE_MODULE_PATH}/utils.cmake)
   105 include(${CMAKE_MODULE_PATH}/utils.cmake)
   109 #platform specific init code
   106 #platform specific init code
   110 include(${CMAKE_MODULE_PATH}/platform.cmake)
   107 include(${CMAKE_MODULE_PATH}/platform.cmake)
   111 
       
   112 add_subdirectory(tools/corrosion)
       
   113 
   108 
   114 #when build type is not specified, assume Debug/Release according to build version information
   109 #when build type is not specified, assume Debug/Release according to build version information
   115 if(CMAKE_BUILD_TYPE)
   110 if(CMAKE_BUILD_TYPE)
   116     if(NOT((CMAKE_BUILD_TYPE STREQUAL "Release") OR
   111     if(NOT((CMAKE_BUILD_TYPE STREQUAL "Release") OR
   117            (CMAKE_BUILD_TYPE STREQUAL "Debug") OR
   112            (CMAKE_BUILD_TYPE STREQUAL "Debug") OR
   264     message(FATAL_ERROR "Missing PhysFS! Install PhysFS to fix this.")
   259     message(FATAL_ERROR "Missing PhysFS! Install PhysFS to fix this.")
   265 endif()
   260 endif()
   266 
   261 
   267 find_package_or_disable_msg(LIBAV NOVIDEOREC "Video recording will not be built")
   262 find_package_or_disable_msg(LIBAV NOVIDEOREC "Video recording will not be built")
   268 
   263 
       
   264 
   269 #physfs helper library
   265 #physfs helper library
   270 add_subdirectory(misc/libphyslayer)
   266 add_subdirectory(misc/libphyslayer)
       
   267 
       
   268 
       
   269 #rust libraries
       
   270 add_subdirectory(tools/corrosion)
       
   271 corrosion_import_crate(MANIFEST_PATH rust/lib-hedgewars-engine/Cargo.toml)
       
   272 
   271 
   273 
   272 #maybe this could be merged inside hedgewars/CMakeLists.txt
   274 #maybe this could be merged inside hedgewars/CMakeLists.txt
   273 if(BUILD_ENGINE_C)
   275 if(BUILD_ENGINE_C)
   274     #pascal to c converter
   276     #pascal to c converter
   275     add_subdirectory(tools/pas2c)
   277     add_subdirectory(tools/pas2c)