Skip to content

Commit

Permalink
fix build in Xcode
Browse files Browse the repository at this point in the history
  • Loading branch information
bholt committed Nov 17, 2013
1 parent ca553f5 commit 5eb8373
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 10 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
# message(FATAL_ERROR "you must set CC & CXX environment variables!")
# endif()

set(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.clang.3_4")

project(Grappa)

set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -g")
Expand Down
16 changes: 11 additions & 5 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,14 @@ if opt.used_cc_flag
end
end

unless opt.generator =~ /Xcode/ # (Xcode generator currently chokes on other compilers...)
# Xcode generator must have CC set to a version of Clang, and must have a corresponding plugin
# see github.com/bholt/Clang-Head.xcplugin for an example

### unless opt.generator =~ /Xcode/ # (Xcode generator currently chokes on other compilers...)
if not(opt.cc) || not(opt.cxx)
abort("Must specify C compiler (either use '--cc=' flag, or set the environment variables CC & CXX\nhint: if the compiler you want is on your PATH, you can do: --cc=$(which gcc)...")
end
end
### end

def configure(generator, mode, opt)
root_dir = File.expand_path(File.dirname(__FILE__))
Expand All @@ -54,9 +57,12 @@ def configure(generator, mode, opt)
puts "Note: '--mode' not supported for Xcode, ignoring..."
mode = nil
args << "-GXcode"
# workaround, since it looks like the Xcode generator currently needs to use clang:
opt.cc = nil
opt.cxx = nil

# need to specify --cc && have the corresponding Xcode plugin
###########################
### workaround, since it looks like the Xcode generator currently needs to use clang:
### opt.cc = nil
### opt.cxx = nil
else
args << %Q[-G"#{generator}"]
end
Expand Down
5 changes: 2 additions & 3 deletions system/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,8 @@ if( GOOGLE_PROFILER )
list(APPEND GRAPPA_LIBS "profiler")
endif()

# (a bit of a hack) without this, stack.o isn't generated
# ... could also add custom command, but this seems easier
set_source_files_properties( stack.S PROPERTIES LANGUAGE C )
enable_language(ASM)
set_source_files_properties( stack.S PROPERTIES LANGUAGE ASM )

add_library(Grappa
${SYSTEM_SOURCES}
Expand Down
4 changes: 2 additions & 2 deletions tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ ExternalProject_Add( tool-gflags
BINARY_DIR ${EXTERN_BUILD_DIR}/gflags
INSTALL_DIR ${TOOLS_INSTALL_DIR}
CONFIGURE_COMMAND
CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} CFLAGS=-g <SOURCE_DIR>/configure --prefix=<INSTALL_DIR>
CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} CFLAGS=-g CXXFLAGS=-stdlib=libstdc++ <SOURCE_DIR>/configure --prefix=<INSTALL_DIR>
BUILD_COMMAND make -j
INSTALL_COMMAND make install
)
Expand All @@ -70,7 +70,7 @@ ExternalProject_Add( tool-glog
BINARY_DIR ${EXTERN_BUILD_DIR}/glog
INSTALL_DIR ${TOOLS_INSTALL_DIR}
CONFIGURE_COMMAND
CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} CFLAGS=-g <SOURCE_DIR>/configure --prefix=<INSTALL_DIR> CFLAGS=-I${TOOLS_INSTALL_DIR}/include LDFLAGS=-L${TOOLS_INSTALL_DIR}/lib
CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} CFLAGS=-g CXXFLAGS=-stdlib=libstdc++ <SOURCE_DIR>/configure --prefix=<INSTALL_DIR> CFLAGS=-I${TOOLS_INSTALL_DIR}/include LDFLAGS=-L${TOOLS_INSTALL_DIR}/lib
BUILD_COMMAND make -j
INSTALL_COMMAND make install
DEPENDS tool-gflags
Expand Down
3 changes: 3 additions & 0 deletions tools/google-glog/src/glog/stl_logging.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@
#include <utility>
#include <vector>

#undef __GNUC__

#ifdef __GNUC__
# error shouldn't be here!
# include <ext/hash_set>
# include <ext/hash_map>
# include <ext/slist>
Expand Down

2 comments on commit 5eb8373

@bmyerz
Copy link
Member

@bmyerz bmyerz commented on 5eb8373 Nov 21, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the tools/CMakeLists.txt change broke the Linux build

@bholt
Copy link
Member Author

@bholt bholt commented on 5eb8373 Nov 21, 2013 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.