Commit 42045025 authored by Rafael Kitover's avatar Rafael Kitover
Browse files

mac build/builder improvements

Improve, refactor and clean up `tools/osx/builder` to build a relatively
full-featured ffmpeg as well. This requires lots of other dists. It's
kind of like a mini port system now. Will generalize it shortly to a
sourced library for using with both the mac and the mingw builds. Will
hopefully become a separate repo on github at some point.

Add perl dist support to the builder.

Add an `--env` flag to the builder to print the build environment
variables so that they can be read in with `eval` for debugging
purposes.

Also add the `FFMPEG_STATIC` cmake option to link static ffmpeg
libraries correctly.

Move the codesigning and zipping of the `.app` bundle to the builder
script and out of cmake, as this is something most users don't need.
parent f527d0a2
...@@ -193,9 +193,21 @@ SET(VBAMCORE_LIBS ...@@ -193,9 +193,21 @@ SET(VBAMCORE_LIBS
) )
if(ENABLE_FFMPEG) if(ENABLE_FFMPEG)
FIND_PACKAGE ( PkgConfig REQUIRED ) FIND_PACKAGE(PkgConfig REQUIRED)
PKG_CHECK_MODULES(FFMPEG REQUIRED libavcodec libavformat libswscale libavutil) PKG_CHECK_MODULES(FFMPEG REQUIRED libavcodec libavformat libswscale libavutil)
if(FFMPEG_STATIC)
set(FFMPEG_LIBRARIES ${FFMPEG_STATIC_LIBRARIES})
set(FFMPEG_LDFLAGS ${FFMPEG_STATIC_LDFLAGS} ${FFMPEG_STATIC_OTHER_LDFLAGS})
if(APPLE)
set(FFMPEG_LDFLAGS ${FFMPEG_LDFLAGS} -framework CoreText -framework ApplicationServices)
endif()
else()
set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES})
set(FFMPEG_LDFLAGS ${FFMPEG_LDFLAGS} ${FFMPEG_OTHER_LDFLAGS})
endif()
endif(ENABLE_FFMPEG) endif(ENABLE_FFMPEG)
if(NOT ENABLE_FFMPEG) if(NOT ENABLE_FFMPEG)
......
...@@ -118,24 +118,26 @@ cmake .. -DCMAKE_BUILD_TYPE=Debug ...@@ -118,24 +118,26 @@ cmake .. -DCMAKE_BUILD_TYPE=Debug
Here is the complete list: Here is the complete list:
| **CMake Option** | **What it Does** | **Defaults** | | **CMake Option** | **What it Does** | **Defaults** |
|----------------------|----------------------------------------------------------------------|-----------------------| |-----------------------|----------------------------------------------------------------------|-----------------------|
| ENABLE_SDL | Build the SDL port | OFF | | ENABLE_SDL | Build the SDL port | OFF |
| ENABLE_WX | Build the wxWidgets port | ON | | ENABLE_WX | Build the wxWidgets port | ON |
| ENABLE_DEBUGGER | Enable the debugger | ON | | ENABLE_DEBUGGER | Enable the debugger | ON |
| ENABLE_NLS | Enable translations | ON | | ENABLE_NLS | Enable translations | ON |
| ENABLE_ASM_CORE | Enable x86 ASM CPU cores (**BUGGY AND DANGEROUS**) | OFF | | ENABLE_ASM_CORE | Enable x86 ASM CPU cores (**BUGGY AND DANGEROUS**) | OFF |
| ENABLE_ASM | Enable the following two ASM options | ON for 32 bit builds | | ENABLE_ASM | Enable the following two ASM options | ON for 32 bit builds |
| ENABLE_ASM_SCALERS | Enable x86 ASM graphic filters | ON for 32 bit builds | | ENABLE_ASM_SCALERS | Enable x86 ASM graphic filters | ON for 32 bit builds |
| ENABLE_MMX | Enable MMX | ON for 32 bit builds | | ENABLE_MMX | Enable MMX | ON for 32 bit builds |
| ENABLE_LINK | Enable GBA linking functionality (requires SFML) | ON | | ENABLE_LINK | Enable GBA linking functionality (requires SFML) | ON |
| ENABLE_LIRC | Enable LIRC support | OFF | | ENABLE_LIRC | Enable LIRC support | OFF |
| ENABLE_FFMPEG | Enable ffmpeg A/V recording | ON on Linux and MSys2 | | ENABLE_FFMPEG | Enable ffmpeg A/V recording | ON on Linux and MSys2 |
| ENABLE_LTO | Compile with Link Time Optimization (gcc and clang only) | ON for release build | | ENABLE_LTO | Compile with Link Time Optimization (gcc and clang only) | ON for release build |
| ENABLE_GBA_LOGGING | Enable extended GBA logging | ON | | ENABLE_GBA_LOGGING | Enable extended GBA logging | ON |
| ENABLE_DIRECT3D | Direct3D rendering for wxWidgets (Windows, **NOT IMPLEMENTED!!!**) | ON | | ENABLE_DIRECT3D | Direct3D rendering for wxWidgets (Windows, **NOT IMPLEMENTED!!!**) | ON |
| ENABLE_XAUDIO2 | Enable xaudio2 sound output for wxWidgets (Windows only) | ON | | ENABLE_XAUDIO2 | Enable xaudio2 sound output for wxWidgets (Windows only) | ON |
| ENABLE_OPENAL | Enable OpenAL for the wxWidgets port | ON | | ENABLE_OPENAL | Enable OpenAL for the wxWidgets port | ON |
| SFML_STATIC_LIBRARIES | Set this to ON if linking static SFML libraries | OFF |
| FFMPEG_STATIC | Set this to ON if linking static ffmpeg librariesl | OFF |
Note for distro packagers, we use the CMake module Note for distro packagers, we use the CMake module
[GNUInstallDirs](https://cmake.org/cmake/help/v2.8.12/cmake.html#module:GNUInstallDirs) [GNUInstallDirs](https://cmake.org/cmake/help/v2.8.12/cmake.html#module:GNUInstallDirs)
......
# From: https://stackoverflow.com/a/7216542
function(JOIN VALUES GLUE OUTPUT)
string (REGEX REPLACE "([^\\]|^);" "\\1${GLUE}" _TMP_STR "${VALUES}")
string (REGEX REPLACE "[\\](.)" "\\1" _TMP_STR "${_TMP_STR}") #fixes escaping
set (${OUTPUT} "${_TMP_STR}" PARENT_SCOPE)
endfunction()
...@@ -5,6 +5,8 @@ IF(NOT CMAKE_VERSION VERSION_LESS 3.0) ...@@ -5,6 +5,8 @@ IF(NOT CMAKE_VERSION VERSION_LESS 3.0)
cmake_policy(SET CMP0043 NEW) # for wxWidgets cmake_policy(SET CMP0043 NEW) # for wxWidgets
ENDIF() ENDIF()
include(VbamFunctions)
if( WIN32 ) if( WIN32 )
# not yet implemented # not yet implemented
option( ENABLE_DIRECT3D "Enable Direct3D rendering for the wxWidgets port" ON ) option( ENABLE_DIRECT3D "Enable Direct3D rendering for the wxWidgets port" ON )
...@@ -511,6 +513,13 @@ TARGET_LINK_LIBRARIES ( ...@@ -511,6 +513,13 @@ TARGET_LINK_LIBRARIES (
${OPENAL_LIBRARY} ${OPENAL_LIBRARY}
) )
join("${FFMPEG_LDFLAGS}" " " FFMPEG_LDFLAGS_STR)
set_target_properties(
visualboyadvance-m
PROPERTIES LINK_FLAGS ${FFMPEG_LDFLAGS_STR}
)
# Build a console app in debug mode on Windows # Build a console app in debug mode on Windows
IF(WIN32 AND CMAKE_BUILD_TYPE STREQUAL Debug) IF(WIN32 AND CMAKE_BUILD_TYPE STREQUAL Debug)
SET(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} -Wl,--subsystem,console") SET(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} -Wl,--subsystem,console")
...@@ -535,14 +544,6 @@ if(APPLE) ...@@ -535,14 +544,6 @@ if(APPLE)
ADD_CUSTOM_COMMAND(TARGET visualboyadvance-m POST_BUILD ADD_CUSTOM_COMMAND(TARGET visualboyadvance-m POST_BUILD
COMMAND ${CMAKE_SOURCE_DIR}/tools/osx/third_party_libs_tool ./visualboyadvance-m.app COMMAND ${CMAKE_SOURCE_DIR}/tools/osx/third_party_libs_tool ./visualboyadvance-m.app
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}") WORKING_DIRECTORY "${CMAKE_BINARY_DIR}")
ADD_CUSTOM_COMMAND(TARGET visualboyadvance-m POST_BUILD
COMMAND codesign -s "Developer ID Application" --deep ./visualboyadvance-m.app
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}")
ADD_CUSTOM_COMMAND(TARGET visualboyadvance-m POST_BUILD
COMMAND zip -9r ./visualboyadvance-m-Mac.zip ./visualboyadvance-m.app
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}")
ENDIF() ENDIF()
endif(APPLE) endif(APPLE)
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment