Skip to content

Commit

Permalink
Merge pull request #342 from amarsman/bugfix/macOSbuildFixes-old-ui
Browse files Browse the repository at this point in the history
Bugfix/mac o sbuild fixes old ui
  • Loading branch information
amarsman authored Aug 31, 2019
2 parents a8f9077 + ea58421 commit f56fb9d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 33 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
/tbe
/CMakeLists.txt.user
/Users/
/i18n/*.gmo
/i18n/*.qm
6 changes: 6 additions & 0 deletions cmake/MacOSX-libs.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
set_target_properties( tbe PROPERTIES MACOSX_BUNDLE false )

find_package( Intl REQUIRED )

target_include_directories(tbe PUBLIC ${Intl_INCLUDE_DIRS})
target_link_libraries(tbe ${Intl_LIBRARIES})
37 changes: 4 additions & 33 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ include_directories(
${CMAKE_WORK_DIR}
${QT_INCLUDES}
.
/opt/local/include
)

if (MINGW)
Expand Down Expand Up @@ -88,41 +87,13 @@ else()
TARGET_LINK_LIBRARIES(tbe Qt5::Xml Qt5::Svg Box2D)
endif ()

IF (APPLE)
include(MacOSX-libs)
ENDIF()

IF (WIN32)
TARGET_LINK_LIBRARIES(tbe ${CMAKE_SOURCE_DIR}/src/libintl/libintl.dll.a)
ENDIF ()

if (APPLE)
# Detect if the "port" command is valid on this system; if so, return full path
EXECUTE_PROCESS(COMMAND which port RESULT_VARIABLE DETECT_MACPORTS OUTPUT_VARIABLE MACPORTS_PREFIX ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)

IF (${DETECT_MACPORTS} EQUAL 0)
# "/opt/local/bin/port" doesn't have libs, so we get the parent directory
GET_FILENAME_COMPONENT(MACPORTS_PREFIX ${MACPORTS_PREFIX} DIRECTORY)

# "/opt/local/bin" doesn't have libs, so we get the parent directory
GET_FILENAME_COMPONENT(MACPORTS_PREFIX ${MACPORTS_PREFIX} DIRECTORY)

# "/opt/local" is where MacPorts lives, add `/lib` suffix and link
LINK_DIRECTORIES(${LINK_DIRECTORIES} ${MACPORTS_PREFIX}/lib)

MESSAGE("-- Detected MacPorts: ${MACPORTS_PREFIX}")
ENDIF()

find_library(LIBINTL_LIBRARIES
NAMES intl
PATHS /usr/lib /usr/local/lib ${MACPORTS_PREFIX}/lib
)
IF(LIBINTL_LIBRARIES)
SET(LIBINTL_FOUND TRUE)
ELSE()
SET(LIBINTL_FOUND FALSE)
ENDIF()
MESSAGE("-- Detected LIBINTL: ${LIBINTL_FOUND} ${LIBINTL_LIBRARIES}")
endif ()

IF (APPLE)
TARGET_LINK_LIBRARIES(tbe ${LIBINTL_LIBRARIES})
ENDIF ()

INSTALL(TARGETS tbe DESTINATION ${TBE_BIN_DIR})

0 comments on commit f56fb9d

Please sign in to comment.