Enable OSX builds

pull/231/head
Hleb Valoshka 2019-02-08 00:05:08 +03:00
parent 37b964ab50
commit 7e4a6d62f8
3 changed files with 42 additions and 3 deletions

View File

@ -11,15 +11,25 @@ notifications:
os:
- linux
- osx
env:
- LUA=5.1
- LUA=5.2
- LUA=5.3
matrix:
exclude:
- os: osx
env: LUA=5.1
- os: osx
env: LUA=5.2
allow_failures:
- os: osx
before_script:
- sudo apt install -y liblua${LUA}-dev
- git submodule update --init
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt install -y liblua${LUA}-dev; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ] ; then brew link gettext --force; fi
- mkdir build
- cd build
@ -39,3 +49,13 @@ addons:
- qtbase5-dev
- qtbase5-dev-tools
- libqt5opengl5-dev
homebrew:
packages:
- cspice
- fmt
- freeglut
- gettext
- glew
- libpng
- lua
- qt5

View File

@ -260,6 +260,14 @@ add_definitions(
-DGIT_COMMIT=${GIT_COMMIT}
)
if(APPLE)
# TARGET_OS_MAC should be replaced with __APPLE__
add_definitions(-DTARGET_OS_MAC)
# Dirty hack to prevent AIFF.h inclusion which provides `struct Marker`
# conflicting with out `class Marker`.
add_definitions(-D__AIFF__)
endif()
string(TOLOWER "${CMAKE_BUILD_TYPE}" build_type_lc)
if(NOT "${build_type_lc}" STREQUAL "debug")
add_definitions(-DNO_DEBUG -DEIGEN_NO_DEBUG)

View File

@ -3,6 +3,13 @@ if(NOT ENABLE_QT)
return()
endif()
if(APPLE AND EXISTS /usr/local/opt/qt5)
# Homebrew installs Qt5 (up to at least 5.9.1) in
# /usr/local/qt5, ensure it can be found by CMake since
# it is not in the default /usr/local prefix.
list(APPEND CMAKE_PREFIX_PATH "/usr/local/opt/qt5")
endif()
set(QT_LIBS Widgets OpenGL)
find_package(Qt5 COMPONENTS ${QT_LIBS} CONFIG REQUIRED)
@ -54,7 +61,7 @@ set(CMAKE_AUTOUIC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
qt5_add_resources(RC_SRC "icons.qrc")
if (WIN32)
if(WIN32)
set (RES celestia.rc)
endif()
@ -62,4 +69,8 @@ add_executable(celestia-qt WIN32 ${QT_SOURCES} ${RC_SRC} ${RES})
cotire(celestia-qt)
qt5_use_modules(celestia-qt ${QT_LIBS})
target_link_libraries(celestia-qt ${CELESTIA_LIBS})
if(APPLE)
set_property(TARGET celestia-qt APPEND_STRING PROPERTY LINK_FLAGS " -framework CoreFoundation")
set_property(TARGET celestia-qt APPEND_STRING PROPERTY LINK_FLAGS " -framework CoreServices")
endif()
install(TARGETS celestia-qt RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})