-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathCMakeLists.txt
79 lines (67 loc) · 3.36 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
#------------------------------------------------------------------------------
# NAppGUI CMake build script
# Copyright (C) 2018 Francisco García Collado
# MIT License (See LICENSE.txt)
#------------------------------------------------------------------------------
# https://gitlab.kitware.com/cmake/cmake/-/issues/25196
if(${CMAKE_VERSION} VERSION_GREATER "3.26.999")
cmake_minimum_required(VERSION 3.5)
else()
cmake_minimum_required(VERSION 3.0)
endif()
project(NAppGUI)
set(NAPPGUI_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})
# Configurations
set(CMAKE_CONFIGURATION_TYPES "Debug;Release;ReleaseWithAssert" CACHE INTERNAL "Configuration Types" FORCE)
set(CMAKE_CXX_FLAGS_RELEASEWITHASSERT ${CMAKE_CXX_FLAGS_RELEASE})
set(CMAKE_C_FLAGS_RELEASEWITHASSERT ${CMAKE_C_FLAGS_RELEASE})
set(CMAKE_EXE_LINKER_FLAGS_RELEASEWITHASSERT ${CMAKE_EXE_LINKER_FLAGS_RELEASE})
set(CMAKE_SHARED_LINKER_FLAGS_RELEASEWITHASSERT ${CMAKE_SHARED_LINKER_FLAGS_RELEASE})
# Globals
set(NAPPGUI_SHARED False CACHE BOOL "Build NAppGUI shared libraries.")
set(NAPPGUI_DEMO True CACHE BOOL "Build NAppGUI demo examples.")
set(NAPPGUI_WEB True CACHE BOOL "Build NAppGUI WebView support.")
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(INSTALL_PERM "OWNER_READ;OWNER_WRITE;OWNER_EXECUTE;GROUP_READ;GROUP_EXECUTE;WORLD_READ;WORLD_EXECUTE")
# Welcome
string(TIMESTAMP CURRENT_YEAR %Y)
include(${NAPPGUI_ROOT_PATH}/prj/NAppVersion.cmake)
include(${NAPPGUI_ROOT_PATH}/prj/NAppCompilers.cmake)
include(${NAPPGUI_ROOT_PATH}/prj/NAppUtils.cmake)
message (STATUS "---------------------------------------------")
message (STATUS "NAppGUI Cross-Platform SDK")
message (STATUS "2015-${CURRENT_YEAR} Francisco Garcia Collado")
message (STATUS "MIT License")
message (STATUS "---------------------------------------------")
nap_build_opt_init()
nap_config_compiler()
nap_check_webview_support()
nap_build_opt("VERSION" "${NAPPGUI_MAJOR}.${NAPPGUI_MINOR}.${NAPPGUI_PATCH}.${NAPPGUI_BUILD}")
nap_build_opt("GENERATOR" "${CMAKE_GENERATOR}")
nap_build_opt("BUILD_SHARED" "${NAPPGUI_SHARED}")
nap_build_opt("COMPILER" "${CMAKE_CXX_COMPILER_ID}")
nap_build_opt("COMPILER_VERSION" "${CMAKE_CXX_COMPILER_VERSION}")
nap_build_opt("WEB_SUPPORT" "${WEB_SUPPORT}")
nap_build_opt("BUILD_TYPE" "${CMAKE_BUILD_TYPE}")
nap_build_opt("BUILD_ARCH" "${CMAKE_ARCHITECTURE}")
nap_build_opt("HOST_ARCH" "${CMAKE_HOST_ARCHITECTURE}")
nap_build_opt("PACKAGE_ID" "${CMAKE_PACKAGE_ID}")
message (STATUS "---------------------------------------------")
# Tools required to generate NAppGUI projets ('nrc')
# They need to be compiled before NAppGUI configure/generate
include(${NAPPGUI_ROOT_PATH}/prj/NAppGenerateTools.cmake)
nap_generate_tools()
# Generate targets
include(${NAPPGUI_ROOT_PATH}/prj/NAppTarget.cmake)
include(${NAPPGUI_ROOT_PATH}/CMakeTargets.cmake)
foreach (target ${ALL_TARGETS})
add_subdirectory(${target})
endforeach()
# Install global files
install(FILES "${NAPPGUI_ROOT_PATH}/src/nappgui.h" DESTINATION "inc" PERMISSIONS ${INSTALL_PERM})
install(FILES "${NAPPGUI_NRC}" DESTINATION "bin" PERMISSIONS ${INSTALL_PERM})
install(DIRECTORY "${NAPPGUI_ROOT_PATH}/prj" DESTINATION ".")
install(EXPORT nappgui-targets DESTINATION "cmake" NAMESPACE nappgui::)
install(FILES "${NAPPGUI_ROOT_PATH}/prj/nappgui-config.cmake" DESTINATION "cmake")
install(FILES "${NAPPGUI_INSTALL_DEFINES}" DESTINATION "cmake")
install(FILES "${NAPPGUI_INSTALL_OPTIONS}" DESTINATION "cmake")