mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-24 21:11:52 +00:00
- Add support for cross compiling so that OS X PowerPC builds can still be made on systems without rosetta (10.7+). (Compiling x86 binaries on ppc should also be possible.)
This commit is contained in:
parent
853c1c4f1e
commit
49edd7c60c
8 changed files with 56 additions and 13 deletions
|
@ -13,6 +13,17 @@ else(${CMAKE_MAJOR_VERSION} GREATER 2 OR ${CMAKE_MINOR_VERSION} GREATER 7)
|
|||
set( NO_GENERATOR_EXPRESSIONS ON )
|
||||
endif(${CMAKE_MAJOR_VERSION} GREATER 2 OR ${CMAKE_MINOR_VERSION} GREATER 7)
|
||||
|
||||
# Support cross compiling
|
||||
option( FORCE_CROSSCOMPILE "Turn on cross compiling." NO )
|
||||
if( FORCE_CROSSCOMPILE )
|
||||
set( CMAKE_CROSSCOMPILING TRUE )
|
||||
endif( FORCE_CROSSCOMPILE )
|
||||
|
||||
if(CMAKE_CROSSCOMPILING)
|
||||
set(IMPORT_EXECUTABLES "IMPORTFILE-NOTFOUND" CACHE FILEPATH "Export file from native build.")
|
||||
include(${IMPORT_EXECUTABLES})
|
||||
endif(CMAKE_CROSSCOMPILING)
|
||||
|
||||
# Simplify pk3 building, add_pk3(filename srcdirectory)
|
||||
function( add_pk3 PK3_NAME PK3_DIR )
|
||||
get_target_property(ZIPDIR_EXE zipdir LOCATION)
|
||||
|
@ -208,3 +219,7 @@ add_subdirectory( src )
|
|||
if( NOT WIN32 AND NOT APPLE )
|
||||
add_subdirectory( output_sdl )
|
||||
endif( NOT WIN32 AND NOT APPLE )
|
||||
|
||||
if( NOT CMAKE_CROSSCOMPILING )
|
||||
export(TARGETS ${CROSS_EXPORTS} FILE "${CMAKE_BINARY_DIR}/ImportExecutables.cmake" )
|
||||
endif( NOT CMAKE_CROSSCOMPILING )
|
||||
|
|
|
@ -16,13 +16,18 @@ include_directories( ${CMAKE_CURRENT_BINARY_DIR} )
|
|||
add_definitions( -DINFNAN_CHECK -DMULTIPLE_THREADS )
|
||||
|
||||
if( NOT MSVC )
|
||||
add_executable( arithchk arithchk.c )
|
||||
if( NOT CMAKE_CROSSCOMPILING )
|
||||
add_executable( arithchk arithchk.c )
|
||||
endif( NOT CMAKE_CROSSCOMPILING )
|
||||
get_target_property( ARITHCHK_EXE arithchk LOCATION )
|
||||
add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/arith.h
|
||||
COMMAND ${ARITHCHK_EXE} >${CMAKE_CURRENT_BINARY_DIR}/arith.h
|
||||
DEPENDS arithchk )
|
||||
|
||||
add_executable( qnan qnan.c arith.h )
|
||||
if( NOT CMAKE_CROSSCOMPILING )
|
||||
add_executable( qnan qnan.c arith.h )
|
||||
set( CROSS_EXPORTS ${CROSS_EXPORTS} arithchk qnan PARENT_SCOPE )
|
||||
endif( NOT CMAKE_CROSSCOMPILING )
|
||||
get_target_property( QNAN_EXE qnan LOCATION )
|
||||
add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gd_qnan.h
|
||||
COMMAND ${QNAN_EXE} >${CMAKE_CURRENT_BINARY_DIR}/gd_qnan.h
|
||||
|
|
|
@ -7,3 +7,5 @@ if( WIN32 )
|
|||
endif( WIN32 )
|
||||
add_subdirectory( updaterevision )
|
||||
add_subdirectory( zipdir )
|
||||
|
||||
set( CROSS_EXPORTS ${CROSS_EXPORTS} PARENT_SCOPE )
|
||||
|
|
|
@ -1,2 +1,6 @@
|
|||
cmake_minimum_required( VERSION 2.4 )
|
||||
add_executable( fixrtext fixrtext.c )
|
||||
|
||||
if( NOT CMAKE_CROSSCOMPILING )
|
||||
add_executable( fixrtext fixrtext.c )
|
||||
set( CROSS_EXPORTS ${CROSS_EXPORTS} fixrtext PARENT_SCOPE )
|
||||
endif( NOT CMAKE_CROSSCOMPILING )
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
cmake_minimum_required( VERSION 2.4 )
|
||||
|
||||
set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG" )
|
||||
if( NOT CMAKE_CROSSCOMPILING )
|
||||
set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG" )
|
||||
|
||||
add_executable( lemon lemon.c )
|
||||
add_executable( lemon lemon.c )
|
||||
set( CROSS_EXPORTS ${CROSS_EXPORTS} lemon PARENT_SCOPE )
|
||||
endif( NOT CMAKE_CROSSCOMPILING )
|
||||
|
||||
# Lemon wants lempar.c in its directory
|
||||
if( NOT NO_GENERATOR_EXPRESSIONS )
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
cmake_minimum_required( VERSION 2.4 )
|
||||
|
||||
if( NOT CMAKE_CROSSCOMPILING )
|
||||
|
||||
include( CheckFunctionExists )
|
||||
include( CheckTypeSize )
|
||||
|
||||
|
@ -30,3 +33,7 @@ add_executable( re2c
|
|||
scanner.cc
|
||||
substr.cc
|
||||
translate.cc )
|
||||
|
||||
set( CROSS_EXPORTS ${CROSS_EXPORTS} re2c PARENT_SCOPE )
|
||||
|
||||
endif( NOT CMAKE_CROSSCOMPILING )
|
||||
|
|
|
@ -17,7 +17,10 @@ if( WIN32 )
|
|||
endif( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" )
|
||||
endif( WIN32 )
|
||||
|
||||
add_executable( updaterevision updaterevision.c ${TRUSTINFO} )
|
||||
if( NOT CMAKE_CROSSCOMPILING )
|
||||
add_executable( updaterevision updaterevision.c ${TRUSTINFO} )
|
||||
set( CROSS_EXPORTS ${CROSS_EXPORTS} updaterevision PARENT_SCOPE )
|
||||
endif( NOT CMAKE_CROSSCOMPILING )
|
||||
|
||||
if( MT_MERGE )
|
||||
get_target_property( UPDATEREVISION_EXE updaterevision LOCATION )
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
cmake_minimum_required( VERSION 2.4 )
|
||||
message(STATUS "${ZLIB_INCLUDE_DIR}" )
|
||||
message(STATUS "${BZIP2_INCLUDE_DIR}" )
|
||||
message(STATUS "${LZMA_INCLUDE_DIR}" )
|
||||
include_directories( "${ZLIB_INCLUDE_DIR}" "${BZIP2_INCLUDE_DIR}" "${LZMA_INCLUDE_DIR}" )
|
||||
add_executable( zipdir
|
||||
zipdir.c )
|
||||
target_link_libraries( zipdir ${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES} lzma )
|
||||
|
||||
if(NOT CMAKE_CROSSCOMPILING)
|
||||
message(STATUS "${ZLIB_INCLUDE_DIR}" )
|
||||
message(STATUS "${BZIP2_INCLUDE_DIR}" )
|
||||
message(STATUS "${LZMA_INCLUDE_DIR}" )
|
||||
include_directories( "${ZLIB_INCLUDE_DIR}" "${BZIP2_INCLUDE_DIR}" "${LZMA_INCLUDE_DIR}" )
|
||||
add_executable( zipdir
|
||||
zipdir.c )
|
||||
target_link_libraries( zipdir ${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES} lzma )
|
||||
set( CROSS_EXPORTS ${CROSS_EXPORTS} zipdir PARENT_SCOPE )
|
||||
endif(NOT CMAKE_CROSSCOMPILING)
|
||||
|
|
Loading…
Reference in a new issue