Scripts/Compiler.cmake

Sun, 12 Oct 2014 20:36:43 +0300

author
cemkalyoncu
date
Sun, 12 Oct 2014 20:36:43 +0300
branch
gscript
changeset 568
776f8dd57c04
parent 439
18e279c6317d
child 584
5bfe659d0b59
permissions
-rw-r--r--

* Partial support for reference counting for reference types

415
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
1 cmake_minimum_required(VERSION 2.8)
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
2
418
dcdaafd460d7 * Testing framework finished
cemkalyoncu
parents: 416
diff changeset
3 OPTION(IGNORE_COMPILER_VERSION "Ignore compiler version check" OFF)
dcdaafd460d7 * Testing framework finished
cemkalyoncu
parents: 416
diff changeset
4 OPTION(IGNORE_COMPILER_VENDOR "Ignore compiler vendor check" OFF)
dcdaafd460d7 * Testing framework finished
cemkalyoncu
parents: 416
diff changeset
5
415
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
6 #compiler check
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
7 IF(CMAKE_COMPILER_IS_GNUCXX)
416
7c04a3e33dcc * Partial testing system
cemkalyoncu
parents: 415
diff changeset
8 EXECUTE_PROCESS(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
7c04a3e33dcc * Partial testing system
cemkalyoncu
parents: 415
diff changeset
9
415
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
10 IF(GCC_VERSION VERSION_LESS 4.8)
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
11 IF(IGNORE_COMPILER_VERSION)
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
12 MESSAGE(STATUS "Gorgon Library requires GCC 4.8+")
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
13 ELSE()
418
dcdaafd460d7 * Testing framework finished
cemkalyoncu
parents: 416
diff changeset
14 MESSAGE(STATUS "use cmake -DIGNORE_COMPILER_VERSION=ON to continue anyway")
415
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
15 MESSAGE(FATAL_ERROR "Gorgon Library requires GCC 4.8+")
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
16 ENDIF()
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
17 ENDIF()
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
18 ELSEIF(MSVC)
439
18e279c6317d * VS 2012 is no longer supported, VS 2013 is required
cemkalyoncu
parents: 435
diff changeset
19 IF(MSVC_VERSION VERSION_LESS 12)
415
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
20 IF(IGNORE_COMPILER_VERSION)
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
21 MESSAGE(STATUS "Gorgon Library requires Visual Studio 2012+")
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
22 ELSE()
418
dcdaafd460d7 * Testing framework finished
cemkalyoncu
parents: 416
diff changeset
23 MESSAGE(STATUS "use cmake -DIGNORE_COMPILER_VERSION=ON to continue anyway")
415
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
24 MESSAGE(FATAL_ERROR "Gorgon Library requires Visual Studio 2012+")
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
25 ENDIF()
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
26 ENDIF()
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
27 ELSE()
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
28 IF(IGNORE_COMPILER_VENDOR)
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
29 MESSAGE(STATUS "Unsupported compiler! Gorgon Library requires GCC 4.8+ OR Visual Studio 2012+")
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
30 MESSAGE(STATUS "You may need to manually activate C++11 features")
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
31 ELSE()
418
dcdaafd460d7 * Testing framework finished
cemkalyoncu
parents: 416
diff changeset
32 MESSAGE(STATUS "use cmake -DIGNORE_COMPILER_VENDOR=ON to continue anyway")
415
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
33 MESSAGE(FATAL_ERROR "Unsupported compiler! Gorgon Library requires GCC 4.8+ OR Visual Studio 2012+")
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
34 ENDIF()
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
35 ENDIF()
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
36
568
776f8dd57c04 * Partial support for reference counting for reference types
cemkalyoncu
parents: 439
diff changeset
37 OPTION(ENABLE_64_BIT "Enable 64 bit compilation" OFF)
776f8dd57c04 * Partial support for reference counting for reference types
cemkalyoncu
parents: 439
diff changeset
38
416
7c04a3e33dcc * Partial testing system
cemkalyoncu
parents: 415
diff changeset
39 #enable C++11 and 32-bit compilation
415
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
40 INCLUDE(CheckCXXCompilerFlag)
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
41 IF(CMAKE_COMPILER_IS_GNUCXX)
568
776f8dd57c04 * Partial support for reference counting for reference types
cemkalyoncu
parents: 439
diff changeset
42 IF(${ENABLE_64_BIT})
776f8dd57c04 * Partial support for reference counting for reference types
cemkalyoncu
parents: 439
diff changeset
43 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
776f8dd57c04 * Partial support for reference counting for reference types
cemkalyoncu
parents: 439
diff changeset
44 ELSE()
776f8dd57c04 * Partial support for reference counting for reference types
cemkalyoncu
parents: 439
diff changeset
45 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -m32")
776f8dd57c04 * Partial support for reference counting for reference types
cemkalyoncu
parents: 439
diff changeset
46 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
776f8dd57c04 * Partial support for reference counting for reference types
cemkalyoncu
parents: 439
diff changeset
47 ENDIF()
415
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
48 ENDIF()
416
7c04a3e33dcc * Partial testing system
cemkalyoncu
parents: 415
diff changeset
49
7c04a3e33dcc * Partial testing system
cemkalyoncu
parents: 415
diff changeset
50 #make sure 64bits cannot be activated
7c04a3e33dcc * Partial testing system
cemkalyoncu
parents: 415
diff changeset
51 IF(MSVC)
435
79cb74c6e90a * Size is reorganized
cemkalyoncu
parents: 421
diff changeset
52 ADD_DEFINITIONS(-D_SBCS -D_CRT_SECURE_NO_WARNINGS)
568
776f8dd57c04 * Partial support for reference counting for reference types
cemkalyoncu
parents: 439
diff changeset
53 IF(${CMAKE_CL_64} AND NOT(${ENABLE_64_BIT}))
416
7c04a3e33dcc * Partial testing system
cemkalyoncu
parents: 415
diff changeset
54 MESSAGE(FATAL_ERROR "Gorgon Library works only 32bits")
7c04a3e33dcc * Partial testing system
cemkalyoncu
parents: 415
diff changeset
55 ENDIF()
418
dcdaafd460d7 * Testing framework finished
cemkalyoncu
parents: 416
diff changeset
56 ENDIF()

mercurial