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
)
if(ENABLE_FFMPEG)
FIND_PACKAGE ( PkgConfig REQUIRED )
FIND_PACKAGE(PkgConfig REQUIRED)
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)
if(NOT ENABLE_FFMPEG)
......
......@@ -119,7 +119,7 @@ cmake .. -DCMAKE_BUILD_TYPE=Debug
Here is the complete list:
| **CMake Option** | **What it Does** | **Defaults** |
|----------------------|----------------------------------------------------------------------|-----------------------|
|-----------------------|----------------------------------------------------------------------|-----------------------|
| ENABLE_SDL | Build the SDL port | OFF |
| ENABLE_WX | Build the wxWidgets port | ON |
| ENABLE_DEBUGGER | Enable the debugger | ON |
......@@ -136,6 +136,8 @@ Here is the complete list:
| ENABLE_DIRECT3D | Direct3D rendering for wxWidgets (Windows, **NOT IMPLEMENTED!!!**) | ON |
| ENABLE_XAUDIO2 | Enable xaudio2 sound output for wxWidgets (Windows only) | 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
[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)
cmake_policy(SET CMP0043 NEW) # for wxWidgets
ENDIF()
include(VbamFunctions)
if( WIN32 )
# not yet implemented
option( ENABLE_DIRECT3D "Enable Direct3D rendering for the wxWidgets port" ON )
......@@ -511,6 +513,13 @@ TARGET_LINK_LIBRARIES (
${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
IF(WIN32 AND CMAKE_BUILD_TYPE STREQUAL Debug)
SET(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} -Wl,--subsystem,console")
......@@ -535,14 +544,6 @@ if(APPLE)
ADD_CUSTOM_COMMAND(TARGET visualboyadvance-m POST_BUILD
COMMAND ${CMAKE_SOURCE_DIR}/tools/osx/third_party_libs_tool ./visualboyadvance-m.app
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(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