Merge pull request #58 from cjcliffe/osx-app-build

OSX App Build
This commit is contained in:
Charles J. Cliffe 2015-02-22 11:23:04 -05:00
commit adf160ca00
10 changed files with 120 additions and 33 deletions

View File

@ -1,6 +1,9 @@
cmake_minimum_required (VERSION 2.8)
IF (NOT APPLE)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
ENDIF(NOT APPLE)
macro(configure_files srcDir destDir globStr)
message(STATUS "Copying ${srcDir}/${globStr} to directory ${destDir}")
@ -63,7 +66,7 @@ SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PROJECT_BINARY_DIR}/${EX_PLATFORM_
find_package(OpenGL REQUIRED)
find_package(wxWidgets REQUIRED gl core base)
find_package(wxWidgets COMPONENTS gl core base REQUIRED)
set(wxWidgets_CONFIGURATION mswu)
include(${wxWidgets_USE_FILE})
@ -183,6 +186,7 @@ IF (APPLE)
set(RTLSDR_LIB "/opt/local/lib" CACHE FILEPATH "RTL-SDR Lib Path")
include_directories(${RTLSDR_INCLUDE})
link_directories(${RTLSDR_LIB})
set(LIB_DIRS "${LIB_DIRS} ${RTLSDR_LIB}")
set(FFTW_LIB fftw3f)
set(LIQUID_LIB liquid)
@ -193,6 +197,8 @@ IF (APPLE)
FIND_LIBRARY(COREAUDIO_LIBRARY CoreAudio)
SET (OTHER_LIBRARIES ${COREAUDIO_LIBRARY})
set(BUNDLE_APP OFF CACHE BOOL "Bundle Application")
ENDIF (APPLE)
@ -296,17 +302,18 @@ include_directories (
ELSE (MSVC)
ADD_DEFINITIONS(
-std=c++0x # or -std=c++11
-std=c++0x
-pthread
)
ENDIF(MSVC)
configure_files(${PROJECT_SOURCE_DIR}/font ${CMAKE_BINARY_DIR}/${EX_PLATFORM_NAME} "*.fnt")
configure_files(${PROJECT_SOURCE_DIR}/font ${CMAKE_BINARY_DIR}/${EX_PLATFORM_NAME} "*.png")
add_executable(CubicSDR ${cubicsdr_sources} ${cubicsdr_headers})
target_link_libraries(CubicSDR rtlsdr ${LIQUID_LIB} ${FFTW_LIB} ${wxWidgets_LIBRARIES} ${OPENGL_LIBRARIES} ${OTHER_LIBRARIES})
IF (NOT BUNDLE_APP)
configure_files(${PROJECT_SOURCE_DIR}/font ${CMAKE_BINARY_DIR}/${EX_PLATFORM_NAME} "*.fnt")
configure_files(${PROJECT_SOURCE_DIR}/font ${CMAKE_BINARY_DIR}/${EX_PLATFORM_NAME} "*.png")
add_executable(CubicSDR ${cubicsdr_sources} ${cubicsdr_headers})
target_link_libraries(CubicSDR rtlsdr ${LIQUID_LIB} ${FFTW_LIB} ${wxWidgets_LIBRARIES} ${OPENGL_LIBRARIES} ${OTHER_LIBRARIES})
ENDIF (NOT BUNDLE_APP)
IF (MSVC)
set_target_properties(CubicSDR PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:WINDOWS")
@ -320,3 +327,82 @@ IF (MSVC)
set(CMAKE_CREATE_WIN32_EXE "/SUBSYSTEM:WINDOWS /ENTRY:\"mainCRTStartup\"")
ENDIF(MSVC)
IF (APPLE AND BUNDLE_APP)
PROJECT(CubicSDR)
SET(MACOSX_BUNDLE_BUNDLE_NAME CubicSDR)
ADD_DEFINITIONS(
-std=c++0x
-pthread
-D_OSX_APP_
-DHAVE_TYPE_TRAITS=1
-mmacosx-version-min=10.9
)
ADD_EXECUTABLE(CubicSDR
MACOSX_BUNDLE
${cubicsdr_sources}
${cubicsdr_headers}
${PROJECT_SOURCE_DIR}/font/vera_sans_mono12.fnt
${PROJECT_SOURCE_DIR}/font/vera_sans_mono16.fnt
${PROJECT_SOURCE_DIR}/font/vera_sans_mono18.fnt
${PROJECT_SOURCE_DIR}/font/vera_sans_mono24.fnt
${PROJECT_SOURCE_DIR}/font/vera_sans_mono32.fnt
${PROJECT_SOURCE_DIR}/font/vera_sans_mono48.fnt
${PROJECT_SOURCE_DIR}/font/vera_sans_mono12_0.png
${PROJECT_SOURCE_DIR}/font/vera_sans_mono16_0.png
${PROJECT_SOURCE_DIR}/font/vera_sans_mono18_0.png
${PROJECT_SOURCE_DIR}/font/vera_sans_mono24_0.png
${PROJECT_SOURCE_DIR}/font/vera_sans_mono32_0.png
${PROJECT_SOURCE_DIR}/font/vera_sans_mono48_0.png
${PROJECT_SOURCE_DIR}/icon/CubicSDR.icns
)
SET_SOURCE_FILES_PROPERTIES(
${PROJECT_SOURCE_DIR}/font/vera_sans_mono12.fnt
${PROJECT_SOURCE_DIR}/font/vera_sans_mono16.fnt
${PROJECT_SOURCE_DIR}/font/vera_sans_mono18.fnt
${PROJECT_SOURCE_DIR}/font/vera_sans_mono24.fnt
${PROJECT_SOURCE_DIR}/font/vera_sans_mono32.fnt
${PROJECT_SOURCE_DIR}/font/vera_sans_mono48.fnt
${PROJECT_SOURCE_DIR}/font/vera_sans_mono12_0.png
${PROJECT_SOURCE_DIR}/font/vera_sans_mono16_0.png
${PROJECT_SOURCE_DIR}/font/vera_sans_mono18_0.png
${PROJECT_SOURCE_DIR}/font/vera_sans_mono24_0.png
${PROJECT_SOURCE_DIR}/font/vera_sans_mono32_0.png
${PROJECT_SOURCE_DIR}/font/vera_sans_mono48_0.png
${PROJECT_SOURCE_DIR}/icon/CubicSDR.icns
PROPERTIES
MACOSX_PACKAGE_LOCATION Resources
)
target_link_libraries(CubicSDR rtlsdr ${LIQUID_LIB} ${FFTW_LIB} ${wxWidgets_LIBRARIES} ${OPENGL_LIBRARIES} ${OTHER_LIBRARIES})
SET_TARGET_PROPERTIES(CubicSDR PROPERTIES MACOSX_BUNDLE TRUE)
SET_TARGET_PROPERTIES(CubicSDR PROPERTIES
MACOSX_BUNDLE_BUNDLE_NAME "CubicSDR"
# MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
# MACOSX_BUNDLE_LONG_VERSION_STRING "${PROJECT_VERSION}"
# MACOSX_BUNDLE_SHORT_VERSION_STRING "${PROJECT_VERSION}"
MACOSX_BUNDLE_GUI_IDENTIFIER "com.cubicproductions.cubicsdr"
MACOSX_BUNDLE_ICON_FILE CubicSDR.icns
)
SET(APPS "${CMAKE_BINARY_DIR}/${EX_PLATFORM_NAME}/CubicSDR.app")
# SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
# SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
INSTALL(CODE "
SET(BU_COPY_FULL_FRAMEWORK_CONTENTS ON)
include(BundleUtilities)
fixup_bundle(\"${APPS}\" \"\" \"${RTLSDR_LIB}\")
VERIFY_APP(\"${APPS}\")
" COMPONENT Runtime)
INSTALL(TARGETS CubicSDR
BUNDLE DESTINATION . COMPONENT Runtime
)
set(CPACK_BINARY_DRAGNDROP ON)
include(CPack)
ENDIF (APPLE AND BUNDLE_APP)

BIN
icon/CubicSDR.icns Normal file

Binary file not shown.

BIN
icon/CubicSDR.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

View File

@ -1,5 +1,7 @@
#define OPENGL
#include "CubicSDRDefs.h"
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
@ -13,9 +15,25 @@
#include "CubicSDR.h"
#include "AppFrame.h"
#ifdef _OSX_APP_
#include "CoreFoundation/CoreFoundation.h"
#endif
IMPLEMENT_APP(CubicSDR)
bool CubicSDR::OnInit() {
#ifdef _OSX_APP_
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle);
char path[PATH_MAX];
if (!CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX))
{
// error!
}
CFRelease(resourcesURL);
chdir(path);
#endif
if (!wxApp::OnInit())
return false;

View File

@ -3,6 +3,7 @@
#include <vector>
#include <algorithm>
#include "DemodulatorThread.h"
#include <memory.h>
#ifdef USE_MIXER
std::map<int, AudioThread *> AudioThread::deviceController;

View File

@ -5,13 +5,6 @@
#include <map>
#include <string>
#include <atomic>
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include "wx/thread.h"
#include "AudioThread.h"
#include "ThreadQueue.h"

View File

@ -1,7 +1,12 @@
#include "DemodulatorThread.h"
#include "CubicSDRDefs.h"
#include "DemodulatorThread.h"
#include <vector>
#include <cmath>
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#ifdef __APPLE__
#include <pthread.h>
#endif

View File

@ -2,13 +2,6 @@
#include <queue>
#include <vector>
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include "wx/thread.h"
#include "liquid/liquid.h"
#include "AudioThread.h"

View File

@ -2,15 +2,8 @@
#include <atomic>
#include "wx/wxprec.h"
#include "rtl-sdr.h"
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include "wx/thread.h"
#include "ThreadQueue.h"
#include "DemodulatorMgr.h"

View File

@ -39,15 +39,13 @@ void PrimaryGLContext::CheckGLError() {
return;
if (err == errLast) {
wxLogError
(wxT("OpenGL error state couldn't be reset."));
std::cout << "OpenGL error state couldn't be reset." << std::endl;
return;
}
errLast = err;
wxLogError
(wxT("OpenGL error %d"), err);
std::cout << "OpenGL Error " << err << std::endl;
}
}