1
1
cmake_minimum_required (VERSION 2.8)
2
2
project (KoRE)
3
3
4
-
5
-
6
- if (MSVC10)
7
- message ("Compiler is MSVC." )
8
- endif ()
9
- if (CMAKE_COMPILER_IS_GNUCXX)
10
- message ("Compiler is GNU++" )
11
- endif ()
12
-
13
4
# For custom cmake modules.
14
5
set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR} /cmake" )
15
6
LINK_DIRECTORIES (${CMAKE_SOURCE_DIR} /lib)
@@ -40,6 +31,16 @@ set(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/lib)
40
31
set (EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR} /bin)
41
32
set (CMAKE_LIBRARY_PATH ${CMAKE_SOURCE_DIR} /ext /lib)
42
33
34
+ if (APPLE )
35
+ INCLUDE_DIRECTORIES (/System /Library/Frameworks)
36
+ find_library (COCOA_LIBRARY Cocoa)
37
+ find_library (IOKit IOKit)
38
+ find_library (OpenGL_LIBRARY OpenGL)
39
+ MARK_AS_ADVANCED (COCOA_LIBRARY
40
+ OpenGL_LIBRARY)
41
+ set (EXTRA_LIBS ${COCOA_LIBRARY} ${IOKit} ${OpenGL_LIBRARY} )
42
+ endif ()
43
+
43
44
if (CMAKE_COMPILER_IS_GNUCXX)
44
45
set (CMAKE_CXX_FLAGS "-std=c++0x" )
45
46
#set(CMAKE_CXX_FLAGS "-std=gnu++11")
@@ -55,24 +56,6 @@ file(GLOB_RECURSE HEADER src/KoRE/*.h)
55
56
add_library (KoRE ${SOURCES} ${HEADER} )
56
57
include_directories (src)
57
58
58
- # Build Clipper library (?!)
59
- #file(GLOB_RECURSE SOURCES ext/contrib/clipper/*.cpp)
60
- #file(GLOB_RECURSE HEADER ext/contrib/clipper/*.hpp)
61
- #add_library(clipper ${SOURCES} ${HEADER})
62
-
63
- # Build Tinyxml library (?!)
64
- #file(GLOB_RECURSE SOURCES ext/include/tinyxml/*.cpp)
65
- #file(GLOB_RECURSE HEADER ext/include/tinyxml/*.h)
66
- #add_library(tinyxml ${SOURCES} ${HEADER})
67
- #include_directories( ext/include/tinyxml)
68
-
69
- # Build poly2Tri library (?!)
70
- #file(GLOB_RECURSE SOURCES ext/contrib/poly2tri/poly2tri/*.cpp)
71
- #file(GLOB_RECURSE HEADER ext/contrib/poly2tri/poly2tri/*.h)
72
- #add_library(p2t ${SOURCES} ${HEADER})
73
- #SET_TARGET_PROPERTIES(p2t PROPERTIES LINKER_LANGUAGE C)
74
-
75
-
76
59
if (CMAKE_COMPILER_IS_GNUCXX)
77
60
#Link external libraries to KoRE
78
61
link_directories (${CMAKE_LIBRARY_PATH} )
@@ -95,7 +78,7 @@ if(CMAKE_COMPILER_IS_GNUCXX)
95
78
target_link_libraries (KoRE glew32)
96
79
97
80
add_library ( assimp STATIC IMPORTED )
98
- set_target_properties ( assimp PROPERTIES IMPORTED_LOCATION ${CMAKE_LIBRARY_PATH} /libassimp.a )
81
+ set_target_properties ( assimp PROPERTIES IMPORTED_LOCATION ${CMAKE_LIBRARY_PATH} /libassimp.dll )
99
82
100
83
target_link_libraries (KoRE opengl32)
101
84
else ()
@@ -108,6 +91,31 @@ if(CMAKE_COMPILER_IS_GNUCXX)
108
91
target_link_libraries (KoRE assimp)
109
92
endif ()
110
93
94
+ if (APPLE )
95
+ add_library ( tinyxml STATIC IMPORTED )
96
+ set_target_properties ( tinyxml PROPERTIES IMPORTED_LOCATION $$${CMAKE_LIBRARY_PATH} /tinyxml.a )
97
+
98
+ add_library ( assimp STATIC IMPORTED )
99
+ set_target_properties ( assimp PROPERTIES IMPORTED_LOCATION $${CMAKE_LIBRARY_PATH} /libassimp.a )
100
+
101
+ add_library ( glfw STATIC IMPORTED )
102
+ set_target_properties ( glfw PROPERTIES IMPORTED_LOCATION $${CMAKE_LIBRARY_PATH} /libglfw.a )
103
+
104
+ add_library ( glew STATIC IMPORTED )
105
+ set_target_properties ( glew PROPERTIES IMPORTED_LOCATION $${CMAKE_LIBRARY_PATH} /libGLEW.a )
106
+
107
+ add_library ( libz SHARED IMPORTED )
108
+ set_target_properties ( libz PROPERTIES IMPORTED_LOCATION /usr/lib/libz.dylib)
109
+
110
+ target_link_libraries (KoRE tinyxml)
111
+ target_link_libraries (KoRE assimp)
112
+ target_link_libraries (KoRE glfw)
113
+ target_link_libraries (KoRE glew)
114
+ target_link_libraries (KoRE libz)
115
+
116
+ target_link_libraries (KoRE ${EXTRA_LIBS} )
117
+ endif (APPLE )
118
+
111
119
set (IGNORE "-build/include" )
112
120
113
121
#check code stlye
0 commit comments