Fixing CMake for Mac OS

This commit is contained in:
Alexander Bock
2015-05-23 19:50:03 +02:00
parent 4585ee1422
commit 433d0ba3a6
10 changed files with 51 additions and 7 deletions

View File

@@ -26,6 +26,7 @@
#define SYNCBUFFER_H
#include <vector>
#include <ghoul/opengl/ghoul_gl.h>
#include <sgct.h>
#include <stdint.h>

View File

@@ -24,6 +24,8 @@
#include <openspace/engine/openspaceengine.h>
#include <ghoul/opengl/ghoul_gl.h>
#define SGCT_WINDOWS_INCLUDE
#include <sgct.h>
#include <openspace/version.h>

View File

@@ -24,6 +24,8 @@
#include <openspace/gui/gui.h>
#include <ghoul/opengl/ghoul_gl.h>
// This needs to be included first due to Windows.h / winsock2.h complications
#define SGCT_WINDOWS_INCLUDE
#include <sgct.h>

View File

@@ -30,6 +30,7 @@
#include <ghoul/filesystem/cachemanager.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/misc/clipboard.h>
#include <ghoul/opengl/ghoul_gl.h>
#include <string>
#include <iostream>

View File

@@ -26,6 +26,7 @@
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/logging/logging>
#include <openspace/rendering/renderengine.h>
#include <ghoul/opengl/ghoul_gl.h>
#include <sgct.h>
sgct::Engine* _sgctEngine;

View File

@@ -31,6 +31,8 @@
#include <chrono>
#include <thread>
#include <ghoul/opengl/ghoul_gl.h>
#include "sgct.h"
namespace {

View File

@@ -24,6 +24,7 @@
#include <openspace/util/screenlog.h>
#include <ghoul/opengl/ghoul_gl.h>
#include <sgct.h> // sgct::Engine::instance()->getTime()
namespace openspace {

View File

@@ -41,7 +41,7 @@ function (create_new_module module_name output_library_name)
add_module_files()
# Create the library
add_library(${library_name} ${sources})
add_library(${library_name} STATIC ${sources})
# Set compile settings that are common to all modules
set_common_compile_settings(${library_name})
@@ -87,7 +87,37 @@ function (set_common_compile_settings target_name)
if (OPENSPACE_WARNINGS_AS_ERRORS)
target_compile_options(${library_name} PUBLIC "/Wx")
endif ()
endif ()
elseif (APPLE)
target_compile_definitions(${library_name} PUBLIC "__APPLE__")
include (CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
mark_as_advanced(COMPILER_SUPPORTS_CXX11, COMPILER_SUPPORTS_CXX0X)
if (COMPILER_SUPPORTS_CXX11)
target_compile_options(${library_name} PUBLIC "-std=c++11")
elseif (COMPILER_SUPPORTS_CXX0X)
target_compile_options(${library_name} PUBLIC "-std=c++0x")
else ()
message(FATAL_ERROR "Compiler does not have C++11 support")
endif ()
target_compile_options(${library_name} PUBLIC "-stdlib=libc++")
elseif (UNIX)
include (CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
mark_as_advanced(COMPILER_SUPPORTS_CXX11, COMPILER_SUPPORTS_CXX0X)
if (COMPILER_SUPPORTS_CXX11)
target_compile_options(${library_name} PUBLIC "-std=c++11")
elseif (COMPILER_SUPPORTS_CXX0X)
target_compile_options(${library_name} PUBLIC "-std=c++0x")
else ()
message(FATAL_ERROR "Compiler does not have C++11 support")
endif ()
target_compile_definitions(${library_name} PUBLIC "-ggdb")
endif ()
endfunction ()
@@ -111,6 +141,7 @@ function (set_openspace_settings target_name)
)
target_compile_definitions(${target_name} PUBLIC ${OPENSPACE_DEFINES})
target_link_libraries(${target_name} Ghoul)
target_link_libraries(${target_name} libOpenSpace)
endfunction ()

View File

@@ -67,6 +67,7 @@ endfunction ()
function (create_openspace_targets)
add_library(libOpenSpace STATIC ${OPENSPACE_HEADER} ${OPENSPACE_SOURCE})
target_include_directories(libOpenSpace PUBLIC ${OPENSPACE_BASE_DIR}/include)
target_include_directories(libOpenSpace PUBLIC ${OPENSPACE_BASE_DIR})
target_include_directories(libOpenSpace PUBLIC ${CMAKE_BINARY_DIR}/_generated/include)
add_executable(OpenSpace ${OPENSPACE_MAIN})
@@ -102,9 +103,9 @@ function (set_compile_settings)
message(FATAL_ERROR "Compiler does not have C++11 support")
endif ()
target_compile_options(libOpenSpace PUBLIC"-stdlib=libc++")
target_compile_options(libOpenSpace PUBLIC "-stdlib=libc++")
target_include_directories(libOpenSpace "/Developer/Headers/FlatCarbon")
target_include_directories(libOpenSpace PUBLIC "/Developer/Headers/FlatCarbon")
find_library(COREFOUNDATION_LIBRARY CoreFoundation)
find_library(CARBON_LIBRARY Carbon)
find_library(COCOA_LIBRARY Carbon)
@@ -177,7 +178,9 @@ function (add_external_dependencies)
target_include_directories(libOpenSpace SYSTEM PUBLIC ${KAMELEON_INCLUDES})
target_link_libraries(libOpenSpace ccmc)
set_property(TARGET ccmc PROPERTY FOLDER "External")
set_property(TARGET cdf PROPERTY FOLDER "External")
if (TARGET cdf)
set_property(TARGET cdf PROPERTY FOLDER "External")
endif ()
# Imgui
add_subdirectory(${OPENSPACE_EXT_DIR}/imgui)
@@ -305,7 +308,7 @@ function (handle_internal_modules)
if (${optionName})
create_library_name(${module} libraryName)
add_subdirectory(${OPENSPACE_MODULE_DIR}/${module})
target_link_libraries(libOpenSpace ${libraryName})
target_link_libraries(OpenSpace ${libraryName})
# Create registration file
string(TOUPPER ${module} module_upper)