- Last few improvements for build scripts.

This commit is contained in:
ccremers 2007-01-09 09:47:06 +00:00
parent 7898de5f15
commit da94176985
7 changed files with 67 additions and 8 deletions

View File

@ -4,8 +4,5 @@
# Author: Cas Cremers
################################################################
message (STATUS "Building Apple Mac PPC version")
set (scythername "scyther-macppc")
add_executable (${scythername} ${Scyther_sources})
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fnested-functions -arch ppc")
include (BuildMacPPC.cmake)

View File

@ -1,6 +1,6 @@
################################################################
# Name: BuildMacIntel.cmake
# Purpose: Build MacIntel binary on self
# Purpose: Build MacIntel binary
# Author: Cas Cremers
################################################################

View File

@ -0,0 +1,8 @@
################################################################
# Name: BuildMacPPC-MacIntel.cmake
# Purpose: Build MacIntel binary on MacPPC
# Author: Cas Cremers
################################################################
include (BuildMacIntel.cmake)

11
src/BuildMacPPC.cmake Normal file
View File

@ -0,0 +1,11 @@
################################################################
# Name: BuildMacPPC.cmake
# Purpose: Build MacPPC binary
# Author: Cas Cremers
################################################################
message (STATUS "Building Apple Mac PPC version")
set (scythername "scyther-macppc")
add_executable (${scythername} ${Scyther_sources})
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fnested-functions -arch ppc")

View File

@ -4,10 +4,14 @@
# Author: Cas Cremers
################################################################
# Add target for Universal Binary when needed
if (APPLE)
include (UniversalBinary.cmake)
endif (APPLE)
# Retrieve Source_OS, Destination_OS (from -DTARGET)
include (GetOS.cmake)
message (STATUS "Test ${Source_OS} ${Destination_OS}")
# From source_os and destination_os make a new name for the build script
if (Source_OS STREQUAL Destination_OS)
set (BuildScriptName "Build${Source_OS}.cmake")

View File

@ -31,7 +31,7 @@ else (WIN32)
endif (UNIX)
endif (APPLE)
endif (WIN32)
message (STATUS "Source platform: ${Source_OS}")
#message (STATUS "Source platform: ${Source_OS}")
# Destination? If target is unset, we just take the source
if (TARGETOS)
@ -39,5 +39,5 @@ if (TARGETOS)
else (TARGETOS)
set (Destination_OS "${Source_OS}")
endif (TARGETOS)
message (STATUS "Destination platform: ${Destination_OS}")
#message (STATUS "Destination platform: ${Destination_OS}")

39
src/UniversalBinary.cmake Normal file
View File

@ -0,0 +1,39 @@
################################################################
# Name: UniversalBinary.cmake
# Purpose: Add target to make a Mac universal binary
# Needs pre-build mac versions first!
# Author: Cas Cremers
################################################################
find_program(lipoexecutable lipo)
if (lipoexecutable)
# Check whether we already have the binaries
set (requiredfiles false)
find_file (ppcfile "scyther-macppc" .)
if (ppcfile)
find_file (intelfile "scyther-macintel" .)
if (intelfile)
set (requiredfiles true)
else (intelfile)
message (FATAL_ERROR "Could not find scyther-macintel, which is required for the universal binary.")
endif (intelfile)
else (ppcfile)
message (FATAL_ERROR "Could not find scyther-macppc, which is required for the universal binary.")
endif (ppcfile)
# Use information to proceed
if (requiredfiles)
message (STATUS "Adding target for Mac universal binary")
add_custom_target (scyther-mac
COMMAND lipo -create ${ppcfile} ${intelfile} -output scyther-mac
)
else (requiredfiles)
message (STATUS "No universal binary possible yet. Please do the following:")
message (STATUS " cmake -DTARGETOS=MacPPC . && make")
message (STATUS " cmake -DTARGETOS=MacIntel . && make")
message (STATUS " cmake . && make scyther-mac")
endif (requiredfiles)
else (lipoexecutable)
message (FATAL_ERROR "Cannot find lipo program to create universal binaries")
endif (lipoexecutable)