-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
83 lines (83 loc) · 3.11 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
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
project(bchtool)
if(MSVC_VERSION EQUAL 1700 AND MSVC_IDE)
set(CMAKE_GENERATOR_TOOLSET "v110_xp" CACHE STRING "Name of generator toolset." FORCE)
endif()
if(MSVC_VERSION EQUAL 1800 AND MSVC_IDE)
set(CMAKE_GENERATOR_TOOLSET "v120_xp" CACHE STRING "Name of generator toolset." FORCE)
endif()
if(MSVC_VERSION EQUAL 1900 AND MSVC_IDE)
set(CMAKE_GENERATOR_TOOLSET "v140_xp" CACHE STRING "Name of generator toolset." FORCE)
endif()
if(MSVC_VERSION GREATER 1909 AND MSVC_VERSION LESS 1920 AND MSVC_IDE)
set(CMAKE_GENERATOR_TOOLSET "v141_xp" CACHE STRING "Name of generator toolset." FORCE)
endif()
if(MSVC_VERSION GREATER 1600 AND NOT MSVC_IDE)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:CONSOLE,5.02")
else()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:CONSOLE,5.01")
endif()
endif()
if(APPLE)
set(CMAKE_MACOSX_RPATH 1)
endif()
set(BCHTOOL_MAJOR 1)
set(BCHTOOL_MINOR 3)
set(BCHTOOL_PATCHLEVEL 3)
if(NOT MSVC_IDE AND NOT XCODE_VERSION AND NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." FORCE)
endif()
option(BUILD64 "Build x86_64(unix only)" ON)
if(MSVC OR APPLE OR (NOT CYGWIN AND NOT MINGW))
option(USE_DEP "Use prebuilt dep" ON)
endif()
set(CMAKE_INSTALL_PREFIX "${PROJECT_SOURCE_DIR}")
set(ROOT_SOURCE_DIR "${PROJECT_SOURCE_DIR}")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${ROOT_SOURCE_DIR}/cmake")
include(AddDep)
include(AddTarget)
include(AutoFiles)
ADD_DEP_INCLUDE_DIR("${ROOT_SOURCE_DIR}/dep/libsundaowen")
if(USE_DEP)
ADD_DEP_INCLUDE_DIR("${ROOT_SOURCE_DIR}/dep/libpng")
ADD_DEP_LIBRARY_DIR("${ROOT_SOURCE_DIR}/dep/zlib")
ADD_DEP_LIBRARY_DIR("${ROOT_SOURCE_DIR}/dep/libpng")
endif()
ADD_DEP_INCLUDE_DIR("${ROOT_SOURCE_DIR}/dep/PVRTexTool/Library")
ADD_DEP_LIBRARY_DIR("${ROOT_SOURCE_DIR}/dep/PVRTexTool/Library")
if(UNIX OR MINGW)
if(CYGWIN)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
if(NOT APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++")
endif()
endif()
if((UNIX AND BUILD64) OR (MINGW AND CMAKE_SIZEOF_VOID_P EQUAL 8))
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
endif()
endif()
if(MSVC_IDE OR XCODE_VERSION)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/bin")
else()
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE}")
endif()
add_definitions(-DBCHTOOL_VERSION="${BCHTOOL_MAJOR}.${BCHTOOL_MINOR}.${BCHTOOL_PATCHLEVEL}")
if(WIN32)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()
if(UNIX OR MINGW)
add_definitions(-D_FILE_OFFSET_BITS=64)
if(NOT APPLE)
add_definitions(-Wno-multichar -Wno-unused-result)
endif()
set(CMAKE_INSTALL_RPATH .)
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
endif()
add_subdirectory(src)