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 )
|
set( NO_GENERATOR_EXPRESSIONS ON )
|
||||||
endif(${CMAKE_MAJOR_VERSION} GREATER 2 OR ${CMAKE_MINOR_VERSION} GREATER 7)
|
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)
|
# Simplify pk3 building, add_pk3(filename srcdirectory)
|
||||||
function( add_pk3 PK3_NAME PK3_DIR )
|
function( add_pk3 PK3_NAME PK3_DIR )
|
||||||
get_target_property(ZIPDIR_EXE zipdir LOCATION)
|
get_target_property(ZIPDIR_EXE zipdir LOCATION)
|
||||||
|
@ -208,3 +219,7 @@ add_subdirectory( src )
|
||||||
if( NOT WIN32 AND NOT APPLE )
|
if( NOT WIN32 AND NOT APPLE )
|
||||||
add_subdirectory( output_sdl )
|
add_subdirectory( output_sdl )
|
||||||
endif( NOT WIN32 AND NOT APPLE )
|
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 )
|
add_definitions( -DINFNAN_CHECK -DMULTIPLE_THREADS )
|
||||||
|
|
||||||
if( NOT MSVC )
|
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 )
|
get_target_property( ARITHCHK_EXE arithchk LOCATION )
|
||||||
add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/arith.h
|
add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/arith.h
|
||||||
COMMAND ${ARITHCHK_EXE} >${CMAKE_CURRENT_BINARY_DIR}/arith.h
|
COMMAND ${ARITHCHK_EXE} >${CMAKE_CURRENT_BINARY_DIR}/arith.h
|
||||||
DEPENDS arithchk )
|
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 )
|
get_target_property( QNAN_EXE qnan LOCATION )
|
||||||
add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gd_qnan.h
|
add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gd_qnan.h
|
||||||
COMMAND ${QNAN_EXE} >${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 )
|
endif( WIN32 )
|
||||||
add_subdirectory( updaterevision )
|
add_subdirectory( updaterevision )
|
||||||
add_subdirectory( zipdir )
|
add_subdirectory( zipdir )
|
||||||
|
|
||||||
|
set( CROSS_EXPORTS ${CROSS_EXPORTS} PARENT_SCOPE )
|
||||||
|
|
|
@ -1,2 +1,6 @@
|
||||||
cmake_minimum_required( VERSION 2.4 )
|
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 )
|
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
|
# Lemon wants lempar.c in its directory
|
||||||
if( NOT NO_GENERATOR_EXPRESSIONS )
|
if( NOT NO_GENERATOR_EXPRESSIONS )
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
cmake_minimum_required( VERSION 2.4 )
|
cmake_minimum_required( VERSION 2.4 )
|
||||||
|
|
||||||
|
if( NOT CMAKE_CROSSCOMPILING )
|
||||||
|
|
||||||
include( CheckFunctionExists )
|
include( CheckFunctionExists )
|
||||||
include( CheckTypeSize )
|
include( CheckTypeSize )
|
||||||
|
|
||||||
|
@ -30,3 +33,7 @@ add_executable( re2c
|
||||||
scanner.cc
|
scanner.cc
|
||||||
substr.cc
|
substr.cc
|
||||||
translate.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( "${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 )
|
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 )
|
if( MT_MERGE )
|
||||||
get_target_property( UPDATEREVISION_EXE updaterevision LOCATION )
|
get_target_property( UPDATEREVISION_EXE updaterevision LOCATION )
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
cmake_minimum_required( VERSION 2.4 )
|
cmake_minimum_required( VERSION 2.4 )
|
||||||
message(STATUS "${ZLIB_INCLUDE_DIR}" )
|
|
||||||
message(STATUS "${BZIP2_INCLUDE_DIR}" )
|
if(NOT CMAKE_CROSSCOMPILING)
|
||||||
message(STATUS "${LZMA_INCLUDE_DIR}" )
|
message(STATUS "${ZLIB_INCLUDE_DIR}" )
|
||||||
include_directories( "${ZLIB_INCLUDE_DIR}" "${BZIP2_INCLUDE_DIR}" "${LZMA_INCLUDE_DIR}" )
|
message(STATUS "${BZIP2_INCLUDE_DIR}" )
|
||||||
add_executable( zipdir
|
message(STATUS "${LZMA_INCLUDE_DIR}" )
|
||||||
zipdir.c )
|
include_directories( "${ZLIB_INCLUDE_DIR}" "${BZIP2_INCLUDE_DIR}" "${LZMA_INCLUDE_DIR}" )
|
||||||
target_link_libraries( zipdir ${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES} lzma )
|
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