-
Notifications
You must be signed in to change notification settings - Fork 69
/
CMakeLists.txt
91 lines (74 loc) · 3.38 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
cmake_minimum_required(VERSION 3.10)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
file(STRINGS VERSION version)
list(GET version 0 PROJECT_VERSION_MAJOR)
list(GET version 1 PROJECT_VERSION_MINOR)
list(GET version 2 PROJECT_VERSION_PATCH)
SET(PROJECT_VERSION_STRING "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
add_compile_definitions(PROJECT_VERSION_STRING="${PROJECT_VERSION_STRING}")
project(ImStudio C CXX)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
find_package(Git)
if(Git_FOUND)
include(GetGitRevisionDescription)
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
add_compile_definitions(GIT_SHA1="${GIT_SHA1}")
endif()
if (WIN32 OR APPLE)
include(glfw)
else() # Linux
find_package(glfw3 REQUIRED)
set(GLFW_LIBRARIES glfw)
endif()
find_package(OpenGL REQUIRED)
find_package(Threads REQUIRED)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
include(CheckCXXCompilerFlag)
if (WIN32)
add_compile_definitions(WIN32_LEAN_AND_MEAN)
add_compile_definitions(NOMINMAX)
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
add_compile_definitions(_SCL_SECURE_NO_WARNINGS)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ENTRY:mainCRTStartup")
else()
find_program(CCACHE_FOUND ccache)
if (CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif (CCACHE_FOUND)
endif()
add_subdirectory(src)
SET(CPACK_PACKAGE_DIRECTORY ${CMAKE_BINARY_DIR}/packages)
SET(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
SET(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
SET(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE)
if (WIN32)
configure_file(${CMAKE_SOURCE_DIR}/cmake/CPackWixPatch.cmake.in ${CMAKE_SOURCE_DIR}/cmake/wixpatch.xml @ONLY)
configure_file("${CMAKE_SOURCE_DIR}/LICENSE" "${CMAKE_BINARY_DIR}/LICENSE.txt" COPYONLY)
set(CPACK_GENERATOR WIX)
set(CPACK_PACKAGE_INSTALL_DIRECTORY "ImStudio")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_BINARY_DIR}/LICENSE.txt")
set(CPACK_PACKAGE_EXECUTABLES "ImStudio" "ImStudio")
set(CPACK_WIX_PATCH_FILE "${CMAKE_SOURCE_DIR}/cmake/wixpatch.xml")
set(CPACK_WIX_PROPERTY_ARPURLINFOABOUT "https://github.com/Raais/ImStudio")
set(CPACK_WIX_PROGRAM_MENU_FOLDER "ImStudio")
set(CPACK_WIX_UPGRADE_GUID "9BE85238-AE46-4597-AE56-9D719DDBF4B4")
elseif(APPLE)
# TODO
#set(MACOSX_BUNDLE_BUNDLE_NAME "ImStudio")
#set(MACOSX_BUNDLE_GUI_IDENTIFIER "org.ImStudio")
#set(MACOSX_BUNDLE_INFO_STRING "ImStudio")
#set(MACOSX_BUNDLE_ICON_FILE "icns")
#set(MACOSX_BUNDLE_LONG_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
#set(MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
#set(MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
elseif(UNIX AND NOT APPLE)
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Raais <?? @ ?? .com>")
set(CPACK_DEBIAN_FILE_NAME "ImStudio-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-Ubuntu.deb")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libglfw3")
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE all)
set(CPACK_GENERATOR "TGZ;DEB")
endif()
include(CPack)