Require cmake 3.1.0 and C++11.

We plan to use C++11 features in the future. Moreover, recent gtkmm
has a hard requirement on C++11.
pull/4/head
whitequark 2015-12-25 23:10:01 +08:00
parent 1b6cd0d632
commit 063dfc4f98
4 changed files with 20 additions and 15 deletions

View File

@ -3,10 +3,10 @@ os:
- linux - linux
- osx - osx
install: install:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo add-apt-repository -y ppa:smspillaz/cmake-2.8.12; sudo add-apt-repository -y ppa:ondrej/php5; sudo apt-get update -qq; sudo apt-get install -q -y cmake cmake-data libpng12-dev zlib1g-dev libjson0-dev libfontconfig1-dev libgtkmm-2.4-dev libpangomm-1.4-dev libgl1-mesa-dev libglu-dev libglew-dev; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo add-apt-repository -y ppa:smspillaz/cmake-master; sudo add-apt-repository -y ppa:ondrej/php5; sudo apt-get update -qq; sudo apt-get install -q -y cmake cmake-data libpng12-dev zlib1g-dev libjson0-dev libfontconfig1-dev libgtkmm-2.4-dev libpangomm-1.4-dev libgl1-mesa-dev libglu-dev libglew-dev; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install cmake libpng; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; brew upgrade cmake libpng; fi
script: script:
- mkdir cbuild - mkdir cbuild
- cd cbuild - cd cbuild
- cmake -DCMAKE_BUILD_TYPE=Debug .. - cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.7 -DCMAKE_BUILD_TYPE=Debug ..
- make - make

View File

@ -1,9 +1,11 @@
# cmake configuration # cmake configuration
cmake_minimum_required(VERSION 2.8.12) cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
cmake_policy(VERSION 2.8.12) cmake_policy(VERSION 3.1.0)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
"${CMAKE_SOURCE_DIR}/cmake/") "${CMAKE_SOURCE_DIR}/cmake/")
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED YES)
include(CheckIncludeFile) include(CheckIncludeFile)
@ -24,7 +26,7 @@ if(WIN32)
set(DISABLE_TTF2C CACHE BOOL "Disable font regeneration with ttf2c, for use on CI") set(DISABLE_TTF2C CACHE BOOL "Disable font regeneration with ttf2c, for use on CI")
endif() endif()
if(NOT WIN32) if(NOT WIN32 AND NOT APPLE)
set(GUI gtk2 CACHE STRING "GUI toolkit to use (one of: gtk2 gtk3)") set(GUI gtk2 CACHE STRING "GUI toolkit to use (one of: gtk2 gtk3)")
endif() endif()
@ -41,15 +43,19 @@ if(WIN32)
-DWIN32_LEAN_AND_MEAN=1) -DWIN32_LEAN_AND_MEAN=1)
endif() endif()
if((CMAKE_CXX_PLATFORM_ID STREQUAL "Linux") AND CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed ${CMAKE_EXE_LINKER_FLAGS}")
endif()
if(MINGW) if(MINGW)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static-libgcc") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static-libgcc")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++")
endif() endif()
if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed ${CMAKE_EXE_LINKER_FLAGS}")
endif()
# dependencies # dependencies
CHECK_INCLUDE_FILE("stdint.h" HAVE_STDINT_H) CHECK_INCLUDE_FILE("stdint.h" HAVE_STDINT_H)

View File

@ -131,7 +131,6 @@ if(WIN32)
comctl32) comctl32)
elseif(APPLE) elseif(APPLE)
add_definitions( add_definitions(
-mmacosx-version-min=10.6
-fobjc-arc) -fobjc-arc)
set(platform_SOURCES set(platform_SOURCES
@ -327,8 +326,6 @@ if(SPACEWARE_FOUND)
endif() endif()
if(APPLE) if(APPLE)
set_target_properties(solvespace PROPERTIES INSTALL_RPATH ON)
set(fixups) set(fixups)
foreach(lib ${platform_BUNDLED_LIBS}) foreach(lib ${platform_BUNDLED_LIBS})
execute_process(COMMAND otool -XD ${lib} execute_process(COMMAND otool -XD ${lib}

View File

@ -489,7 +489,8 @@ bool FullScreenIsActive(void) {
} }
void ShowGraphicsEditControl(int x, int y, char *str) { void ShowGraphicsEditControl(int x, int y, char *str) {
[GWView startEditing:[NSString stringWithUTF8String:str] at:(NSPoint){x, y}]; [GWView startEditing:[NSString stringWithUTF8String:str]
at:(NSPoint){(CGFloat)x, (CGFloat)y}];
} }
void HideGraphicsEditControl(void) { void HideGraphicsEditControl(void) {
@ -1011,7 +1012,8 @@ void SetMousePointerToHand(bool is_hand) {
} }
void ShowTextEditControl(int x, int y, char *str) { void ShowTextEditControl(int x, int y, char *str) {
return [TWView startEditing:[NSString stringWithUTF8String:str] at:(NSPoint){x, y}]; return [TWView startEditing:[NSString stringWithUTF8String:str]
at:(NSPoint){(CGFloat)x, (CGFloat)y}];
} }
void HideTextEditControl(void) { void HideTextEditControl(void) {