Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to support Mac OSX #270

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,10 @@
# zlib https://github.com/madler/zlib
# UnitTest++ https://github.com/unittest-cpp/unittest-cpp
#
# b) additional, for Linux & macOS platforms (but not for Android):
# b) additional, for Linux platforms (but not for Android or macOS):
# fontconfig https://gitlab.freedesktop.org/fontconfig/fontconfig
#
# It also uses (included as part of the surce tree):
# It also uses (included as part of the source tree):
# utfcpp
# agg
# pugixml
Expand Down Expand Up @@ -197,6 +197,11 @@ cmake_policy(SET CMP0042 NEW) #MACOSX_RPATH is enabled by default
#Windows 10 camplains
cmake_policy(SET CMP0054 NEW) # quoted arguments will not be further dereferenced

#OSX complains
if (${CMAKE_VERSION} GREATER "3.12")
cmake_policy(SET CMP0078 NEW) # evaluate generator expressions for install(CODE) and install(SCRIPT)
endif()

#prevent in-source builds
# make sure the user doesn't play dirty with symlinks
get_filename_component(srcdir "${CMAKE_SOURCE_DIR}" REALPATH)
Expand Down Expand Up @@ -632,7 +637,7 @@ if( LOMSE_ENABLE_PNG )
endif(LOMSE_ENABLE_PNG)

# Check for fontconfig
if (UNIX) #Linux, macOS & Android
if (UNIX AND NOT APPLE) #Linux & Android - not macOS
find_path(FONTCONFIG_INCLUDE_DIR fontconfig/fontconfig.h)
find_library(FONTCONFIG_LIBRARIES NAMES fontconfig)
if (("${FONTCONFIG_INCLUDE_DIR}" STREQUAL "FONTCONFIG_INCLUDE_DIR-NOTFOUND")
Expand Down Expand Up @@ -875,12 +880,12 @@ endif(LOMSE_BUILD_EXAMPLE)

if( UNIX )
# copy generated libraries
install( TARGETS ${LOMSE} DESTINATION ${LOMSE_LIBDIR} )
install( TARGETS ${LOMSE_STATIC} DESTINATION ${LOMSE_LIBDIR} )
install( TARGETS ${LOMSE_SHARED} LIBRARY DESTINATION ${LOMSE_LIBDIR} )

#create symlink to library
install( CODE
"EXECUTE_PROCESS(COMMAND ln -fs ${CMAKE_INSTALL_PREFIX}/lib/${LOMSE_SHARED}
"EXECUTE_PROCESS(COMMAND ln -fs ${CMAKE_INSTALL_PREFIX}/lib/$<TARGET_FILE_NAME:lomse-shared>
${CMAKE_INSTALL_PREFIX}/lib/liblomse.so )"
)

Expand All @@ -889,7 +894,7 @@ elseif( WIN32 )
set(INSTALL_BRAVURA_FONT 1)

# copy generated libraries
install( TARGETS ${LOMSE} DESTINATION "${CMAKE_INSTALL_PREFIX}/lib" )
install( TARGETS ${LOMSE_STATIC} DESTINATION "${CMAKE_INSTALL_PREFIX}/lib" )
install( TARGETS ${LOMSE_SHARED} DESTINATION "${CMAKE_INSTALL_PREFIX}/lib" )

endif()
Expand Down
4 changes: 2 additions & 2 deletions add-sources.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This is part of CMake configuration file for building makefiles and installfiles
# for the Lomse library
#-------------------------------------------------------------------------------------
# This moule is for defining the source files to compile for building the library
# This module is for defining the source files to compile for building the library
#
#-------------------------------------------------------------------------------------

Expand Down Expand Up @@ -225,7 +225,7 @@ if( LOMSE_ENABLE_COMPRESSION )
endif()

# platform dependent implementation files
if(UNIX)
if(UNIX AND NOT APPLE)
set(PLATFORM_FILES
${LOMSE_SRC_DIR}/platform/lomse_linux.cpp
)
Expand Down
5 changes: 5 additions & 0 deletions examples/tutorials/tutorial-1-wx/tutorial-1-wx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ void MyFrame::initialize_lomse()

//initialize the library with these values
m_lomse.init_library(pixel_format,resolution, reverse_y_axis);

#ifdef __APPLE__
// Set fonts path manually on OSX, not using fontconfig
m_lomse.set_default_fonts_path("../../../fonts/");
#endif
}

//---------------------------------------------------------------------------------------
Expand Down
8 changes: 8 additions & 0 deletions examples/tutorials/tutorial-2-wx/tutorial-2-wx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,11 @@ void MyFrame::initialize_lomse()

//initialize the library with these values
m_lomse.init_library(pixel_format,resolution, reverse_y_axis);

#ifdef __APPLE__
// Set fonts path manually on OSX, not using fontconfig
m_lomse.set_default_fonts_path("../../../fonts/");
#endif
}

//---------------------------------------------------------------------------------------
Expand Down Expand Up @@ -616,10 +621,13 @@ void MyCanvas::on_key(int x, int y, unsigned key, unsigned flags)
spInteractor->switch_task(TaskFactory::k_task_selection);
break;
case '+':
case '=': // '+' is SHIFT = in UK & US
case WXK_NUMPAD_ADD: // support numpad +
spInteractor->zoom_in(x, y);
force_redraw();
break;
case '-':
case WXK_NUMPAD_SUBTRACT: // support numpad -
spInteractor->zoom_out(x, y);
force_redraw();
break;
Expand Down
5 changes: 5 additions & 0 deletions examples/tutorials/tutorial-3-wx/tutorial-3-wx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,11 @@ void MyFrame::initialize_lomse()

//initialize the library with these values
m_lomse.init_library(pixel_format,resolution, reverse_y_axis);

#ifdef __APPLE__
// Set fonts path manually on OSX, not using fontconfig
m_lomse.set_default_fonts_path("../../../fonts/");
#endif
}

//---------------------------------------------------------------------------------------
Expand Down
5 changes: 5 additions & 0 deletions examples/tutorials/tutorial-4-wx/tutorial-4-wx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,11 @@ void MyFrame::initialize_lomse()

//set required callbacks
m_lomse.set_notify_callback(this, wrapper_lomse_event);

#ifdef __APPLE__
// Set fonts path manually on OSX, not using fontconfig
m_lomse.set_default_fonts_path("../../../fonts/");
#endif
}

//---------------------------------------------------------------------------------------
Expand Down