CMakeLists.txt
changeset 3338 dee9beba85cc
parent 3306 fcdf6d85b042
child 3345 25ad24233e77
equal deleted inserted replaced
3337:75e7455c69ed 3338:dee9beba85cc
    88 
    88 
    89 	message(STATUS "Target system: Mac OS X ${minimum_macosx} ${CMAKE_OSX_ARCHITECTURES}")	
    89 	message(STATUS "Target system: Mac OS X ${minimum_macosx} ${CMAKE_OSX_ARCHITECTURES}")	
    90 
    90 
    91 	if(minimum_macosx MATCHES "10.4")
    91 	if(minimum_macosx MATCHES "10.4")
    92 		set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.4u.sdk/")
    92 		set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.4u.sdk/")
       
    93 		if(current_macosx_version MATCHES "10.4")
       
    94 			find_package(SDL_mixer REQUIRED)
       
    95 			set(pascal_compiler_flags_cmn "-k-dylib_file @loader_path/Frameworks/smpeg.framework/Versions/A/smpeg:${SDLMIXER_LIBRARY}/SDL_mixer.framework/Versions/A/Frameworks/smpeg.framework/Versions/A/smpeg" ${pascal_compiler_flags_cmn})
       
    96 			set(pascal_compiler_flags_cmn "-k-dylib_file @loader_path/Frameworks/mikmod.framework/Versions/A/mikmod:${SDLMIXER_LIBRARY}/SDL_mixer.framework/Versions/A/Frameworks/mikmod.framework/Versions/A/mikmod" ${pascal_compiler_flags_cmn})
       
    97 			set(CMAKE_C_FLAGS "-dylib_file @loader_path/Frameworks/smpeg.framework/Versions/A/smpeg:${SDLMIXER_LIBRARY}/SDL_mixer.framework/Versions/A/Frameworks/smpeg.framework/Versions/A/smpeg -dylib_file @loader_path/Frameworks/mikmod.framework/Versions/A/mikmod:${SDLMIXER_LIBRARY}/SDL_mixer.framework/Versions/A/Frameworks/mikmod.framework/Versions/A/mikmod")
       
    98 		endif()
    93 	else()
    99 	else()
    94 		set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX${minimum_macosx}.sdk/")
   100 		set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX${minimum_macosx}.sdk/")
    95 	endif()
   101 	endif()
    96 
   102 
    97 	#1.set deployment target; 2.link with libsdlmain.a; 3.link with liblua.a (which requires readline)
   103 	#1.set deployment target; 2.link with libsdlmain.a; 3.link with liblua.a (which requires readline)
   120 	set(Optz false)
   126 	set(Optz false)
   121 endif()
   127 endif()
   122 
   128 
   123 
   129 
   124 #set default flags values for all the project
   130 #set default flags values for all the project
   125 set(CMAKE_C_FLAGS "-pipe")
   131 set(CMAKE_C_FLAGS "-pipe ${CMAKE_C_FLAGS}")
   126 set(CMAKE_C_FLAGS_RELEASE "-w -O2 -fomit-frame-pointer")
   132 set(CMAKE_C_FLAGS_RELEASE "-w -O2 -fomit-frame-pointer ${CMAKE_C_FLAGS_RELEASE}")
   127 set(CMAKE_C_FLAGS_DEBUG "-Wall -O0 -g -DDEBUG")
   133 set(CMAKE_C_FLAGS_DEBUG "-Wall -O0 -g -DDEBUG ${CMAKE_C_FLAGS_DEBUG}")
   128 set(CMAKE_CXX_FLAGS ${CMAKE_C_FLAGS})
   134 set(CMAKE_CXX_FLAGS ${CMAKE_C_FLAGS})
   129 set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
   135 set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
   130 set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
   136 set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
   131 
   137 
   132 set(pascal_compiler_flags_cmn "-B" "-FE../bin" "-Cs2000000" "-vwi" ${pascal_compiler_flags_cmn})
   138 set(pascal_compiler_flags_cmn "-B" "-FE../bin" "-Cs2000000" "-vwi" ${pascal_compiler_flags_cmn})
   155 set(HEDGEWARS_PROTO_VER 32)
   161 set(HEDGEWARS_PROTO_VER 32)
   156 
   162 
   157 if(WITH_SERVER)
   163 if(WITH_SERVER)
   158 	set(HAVE_NETSERVER true)
   164 	set(HAVE_NETSERVER true)
   159 	add_subdirectory(gameServer)
   165 	add_subdirectory(gameServer)
   160 	if(APPLE)
       
   161 		#workaround for http://hackage.haskell.org/trac/ghc/ticket/3400
       
   162 		set(haskell_compiler_flags_cmn ${haskell_compiler_flags_cmn} "-optc-m32" "-opta-m32" "-optl-arch\ i386")
       
   163 	endif()
       
   164 else(WITH_SERVER)
   166 else(WITH_SERVER)
   165 	set(HAVE_NETSERVER false)
   167 	set(HAVE_NETSERVER false)
   166 endif(WITH_SERVER)
   168 endif(WITH_SERVER)
   167 
   169 
   168 
   170 
   173 add_subdirectory(tools)
   175 add_subdirectory(tools)
   174 add_subdirectory(misc/liblua)
   176 add_subdirectory(misc/liblua)
   175 
   177 
   176 # CPack vars
   178 # CPack vars
   177 
   179 
   178 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Hedgewars, a turn-based strategy")
   180 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Hedgewars, a free turn-based strategy")
   179 set(CPACK_PACKAGE_VENDOR "Hedgewars Project")
   181 set(CPACK_PACKAGE_VENDOR "Hedgewars Project")
   180 set(CPACK_PACKAGE_FILE_NAME "hedgewars-${HEDGEWARS_VERSION}")
   182 set(CPACK_PACKAGE_FILE_NAME "hedgewars-${HEDGEWARS_VERSION}")
   181 set(CPACK_SOURCE_PACKAGE_FILE_NAME "hedgewars-src-${HEDGEWARS_VERSION}")
   183 set(CPACK_SOURCE_PACKAGE_FILE_NAME "hedgewars-src-${HEDGEWARS_VERSION}")
   182 set(CPACK_SOURCE_GENERATOR "TBZ2")
   184 set(CPACK_SOURCE_GENERATOR "TBZ2")
   183 set(CPACK_PACKAGE_EXECUTABLES "hedgewars" "hedgewars")
   185 set(CPACK_PACKAGE_EXECUTABLES "hedgewars" "hedgewars")
   184 set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
   186 set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
   185 set(CPACK_PACKAGE_INSTALL_DIRECTORY "Hedgewars ${HEDGEWARS_VERSION}")
   187 set(CPACK_PACKAGE_INSTALL_DIRECTORY "Hedgewars ${HEDGEWARS_VERSION}")
   186 
   188 
   187 if(WIN32 AND NOT UNIX)
   189 if(WIN32 AND NOT UNIX)
   188 	set(CPACK_NSIS_DISPLAY_NAME "Hedgewars, a free turn-based strategy game") 
   190 	set(CPACK_NSIS_DISPLAY_NAME ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}) 
   189 	set(CPACK_NSIS_HELP_LINK "http://www.hedgewars.org/")
   191 	set(CPACK_NSIS_HELP_LINK "http://www.hedgewars.org/")
   190 	set(CPACK_NSIS_URL_INFO_ABOUT "http://www.hedgewars.org/")
   192 	set(CPACK_NSIS_URL_INFO_ABOUT "http://www.hedgewars.org/")
   191 	set(CPACK_NSIS_CONTACT "unC0Rr@gmail.com")
   193 	set(CPACK_NSIS_CONTACT "unC0Rr@gmail.com")
   192 	set(CPACK_NSIS_MODIFY_PATH OFF)
   194 	set(CPACK_NSIS_MODIFY_PATH OFF)
   193 	set(CPACK_GENERATOR "ZIP;NSIS")
   195 	set(CPACK_GENERATOR "ZIP;NSIS")