forked from anael-seghezzi/CToy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
executable file
·94 lines (80 loc) · 3.64 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
PROJECT(MTCL)
## Let's use a reasonable modern version
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)
SET(CMAKE_HAS_SORT 1)
SET(CMAKE_MODULE_PATH
"${MTCL_SOURCE_DIR}/CMake"
${CMAKE_MODULE_PATH}
)
## Disallow in-source builds
INCLUDE(OutOfSourceBuild)
## Set version and info
SET(MTCL_MAJOR_VERSION 1)
SET(MTCL_MINOR_VERSION 0)
SET(MTCL_PATCH_VERSION 0)
SET(MTCL_PACKAGE "CToy")
SET(MTCL_VENDOR "Anael Seghezzi")
SET(MTCL_VERSION "${MTCL_MAJOR_VERSION}.${MTCL_MINOR_VERSION}.${MTCL_PATCH_VERSION}")
SET(MTCL_COPYRIGHT "Copyright (c) 2016, ${MTCL_VENDOR}.")
MESSAGE(STATUS "${MTCL_PACKAGE} ${MTCL_VERSION}")
## Set install path
SET(MTCL_INSTALL_DIR MTCL)
IF(WIN32 AND NOT MINGW)
FIND_PACKAGE(OpenGL REQUIRED)
SET(MTCL_BUILD_FLAGS "")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MOE_BUILD_FLAGS} /EHsc /nologo /GR /FC /DWIN32 /D_MBCS")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /Z7 /W4 /Od /MDd /D_DEBUG /D__Debug__")
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /W1 /Ox /Ot /MD /DNDEBUG")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MARATIS_BUILD_FLAGS} /EHsc /nologo /GR /FC /DWIN32 /D_MBCS")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Z7 /W4 /Od /MDd /D_DEBUG /D__Debug__")
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /W1 /Ox /Ot /MD /DNDEBUG")
SET(OS_SPECIFIC_LIBRARIES)
ENDIF(WIN32 AND NOT MINGW)
IF(MINGW)
FIND_PACKAGE(OpenGL REQUIRED)
SET(MTCL_BUILD_FLAGS "")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MTCL_BUILD_FLAGS} -O3 -ffast-math -m64 -mavx -DWIN32 -std=c99")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D__Debug__")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MTCL_BUILD_FLAGS} -O3 -ffast-math -m64 -mavx -DWIN32")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D__Debug__")
ENDIF(MINGW)
IF(APPLE)
FIND_PACKAGE(OpenGL REQUIRED)
FIND_LIBRARY(COCOA_LIB Cocoa)
FIND_LIBRARY(VIDEO_LIB CoreVideo)
FIND_LIBRARY(FOUNDATION_LIB CoreFoundation)
FIND_LIBRARY(IOKIT_LIB IOKit)
SET(MTCL_BUILD_FLAGS "-mmacosx-version-min=10.6")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MTCL_BUILD_FLAGS} -O3 -DOSX")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D__Debug__")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MTCL_BUILD_FLAGS} -O3 -DOSX")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D__Debug__")
SET(CMAKE_SHARED_LINKER_FLAGS "-Wl")
SET(OS_SPECIFIC_LIBRARIES ${COCOA_LIB} ${VIDEO_LIB} ${FOUNDATION_LIB} ${IOKIT_LIB})
ENDIF(APPLE)
IF(UNIX AND NOT APPLE)
SET(MTCL_BUILD_FLAGS "")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MTCL_BUILD_FLAGS} -O3 -fPIC -DLINUX")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D__Debug__")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MTCL_BUILD_FLAGS} -O3 -fPIC -DLINUX")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D__Debug__")
SET(CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed,--allow-multiple-definition,--build-id")
SET(OS_SPECIFIC_LIBRARIES pthread Xxf86vm X11 Xrandr Xi dl m)
ENDIF(UNIX AND NOT APPLE)
FIND_PACKAGE(OpenMP)
IF(OPENMP_FOUND)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
ENDIF()
## Set up 3rd party dependencies
SET(GLFW_INCLUDE_DIR "${MTCL_SOURCE_DIR}/3rdparty/glfw/include")
SET(TINYCTHREAD_INCLUDE_DIR "${MTCL_SOURCE_DIR}/3rdparty/tinycthread/source")
SET(GLAD_INCLUDE_DIR "${MTCL_SOURCE_DIR}/3rdparty/glad/include")
SET(TINYCTHREAD_LIBRARIES tinycthread)
## Set up SDK dependencies
SET(MTCL_INCLUDE_DIR "${MTCL_SOURCE_DIR}/src")
## Set up subdirectories...
ADD_SUBDIRECTORY(3rdparty)
MESSAGE( STATUS "GLFW: ${GLFW_LIBRARIES}")
SET(GLFW_LIBRARIES glfw ${GLFW_LIBRARIES})
ADD_SUBDIRECTORY(src)