Skip to content

Instantly share code, notes, and snippets.

@DustVoice
Created October 10, 2019 16:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DustVoice/9b0ca6861b70d833fa28bcea585f1ddc to your computer and use it in GitHub Desktop.
Save DustVoice/9b0ca6861b70d833fa28bcea585f1ddc to your computer and use it in GitHub Desktop.
cmake_minimum_required(VERSION 3.4)
project("CommuniCare e.V. Manager")
# =======================
# | Set project version |
# =======================
set(CommuniCare_eV_Manager_MAJOR 1)
set(CommuniCare_eV_Manager_MAJOR 12)
# ==========================
# | Compiler configuration |
# ==========================
include(CheckCXXCompilerFlag)
# TODO: Include C++17 back after removing 'using namespace std' and fixing prefix
# CHECK_CXX_COMPILER_FLAG("-std=c++17" COMPILER_SUPPORTS_CXX17)
# if(COMPILER_SUPPORTS_CXX17)
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
# set(USER_CXX_VERSION "C++17")
# else()
CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14)
if(COMPILER_SUPPORTS_CXX14)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
set(USER_CXX_VERSION "C++14")
else()
message(WARNING "This software needs a compiler that at least supports c++14 (-std=c++14) in order to work properly. Continuing anyways, which may lead to unexpected behaviour")
endif()
# endif()
# =============
# | FRUT_PATH |
# =============
if (NOT DEFINED FRUT_PATH)
if (NOT DEFINED ENV{FRUT_PATH})
message(FATAL_ERROR "$FRUT_PATH not defined!
Please either pass the path to -cmake's cmake directory directly, or export it!
Example 1:
cmake -DFRUT_PATH=~/Tools/FRUT/cmake ..
Example 2:
export FRUT_PATH=~/Tools/FRUT/cmake
cmake ..")
else()
set(USER_FRUT_PATH $ENV{FRUT_PATH})
endif()
else()
set(USER_FRUT_PATH ${FRUT_PATH})
endif()
# =============
# | JUCE_PATH |
# =============
if (NOT DEFINED JUCE_PATH)
if (NOT DEFINED ENV{JUCE_PATH})
message(FATAL_ERROR "$JUCE_PATH not defined!
Please either pass the path to your JUCE modules directory directly, or export it!
Example 1:
cmake -DJUCE_PATH=~/Tools/JUCE/moudles ..
Example 2:
export JUCE_PATH=~/Tools/JUCE/modules
cmake ..")
else()
set(USER_JUCE_PATH $ENV{JUCE_PATH})
endif()
else()
set(USER_JUCE_PATH ${JUCE_PATH})
endif()
# ===================
# | Initialize FRUT |
# ===================
list(APPEND CMAKE_MODULE_PATH "${USER_FRUT_PATH}")
include(Reprojucer)
# ===================
# | Initialize JUCE |
# ===================
set(JUCE_MODULES_GLOBAL_PATH "${USER_JUCE_PATH}")
# ===========================
# | Directory configuration |
# ===========================
set(USER_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/Source)
set(USER_LIBRARIES_DIR ${CMAKE_CURRENT_LIST_DIR}/Libraries)
set(USER_RESOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/Resources)
set(USER_JUCELIBRARYCODE_DIR ${CMAKE_CURRENT_LIST_DIR}/JuceLibraryCode)
# ===============================
# | Build and include libraries |
# ===============================
add_subdirectory(${USER_LIBRARIES_DIR})
foreach(include_item ${EXTRA_INCLUDES})
include_directories(${USER_LIBRARIES_DIR}/${include_item})
endforeach()
# TODO: Remove if obsolete
# ==================================
# | Include JUCE related libraries |
# ==================================
# include_directories(${USER_JUCE_PATH} ${USER_JUCELIBRARYCODE_DIR})
# ===================
# | Set .jucer file |
# ===================
set(USER_JUCER_FILE "${CMAKE_CURRENT_LIST_DIR}/CommuniCare_Manager.jucer")
# TODO: Look into CLion exporter on which DEFINITIONS need to be included
# ==================
# | Set build type |
# ==================
if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "")
string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UPPER)
if(${CMAKE_BUILD_TYPE_UPPER} STREQUAL "DEBUG")
add_compile_definitions(DEBUG)
add_compile_definitions(_DEBUG)
add_compile_definitions(JUCE_DEBUG)
else()
add_compile_definitions(NDEBUG)
endif()
endif()
# ======================
# | Setup JUCE project |
# ======================
jucer_project_begin(
JUCER_VERSION "5.4.3"
PROJECT_FILE "${USER_JUCER_FILE}"
PROJECT_ID "tkeReJ"
)
jucer_project_settings(
PROJECT_NAME "CommuniCare e.V. Manager"
PROJECT_VERSION "1.12.0"
COMPANY_NAME "DustVoice"
COMPANY_WEBSITE "https://dustvoice.de"
COMPANY_EMAIL "info@dustvoice.de"
REPORT_JUCE_APP_USAGE ON # Required for closed source applications without an Indie or Pro JUCE license
DISPLAY_THE_JUCE_SPLASH_SCREEN ON # Required for closed source applications without an Indie or Pro JUCE license
PROJECT_TYPE "GUI Application"
BUNDLE_IDENTIFIER "com.dustvoice.communicare-ev.manager"
CXX_LANGUAGE_STANDARD "${USER_CXX_VERSION}"
)
# Compile | Xcode Resource | Binary Resource | Filepath
# x := yes | . := no
jucer_project_files("ComminuCare e.V. Manager/Resources"
. x x "Resources/Logo.png"
)
jucer_project_files("ComminuCare e.V. Manager/Source"
x . . "Source/AddComponent.cpp"
. . . "Source/AddComponent.h"
x . . "Source/AddEntryComponent.cpp"
. . . "Source/AddEntryComponent.h"
. . . "Source/AdditionalFunctions.h"
x . . "Source/AddUserComponent.cpp"
. . . "Source/AddUserComponent.h"
. . . "Source/ConstFields.h"
x . . "Source/CustomTableListBox.cpp"
. . . "Source/CustomTableListBox.h"
. . . "Source/DustLookAndFeel.h"
x . . "Source/ExpandArea.cpp"
. . . "Source/ExpandArea.h"
x . . "Source/ExpandEntryArea.cpp"
. . . "Source/ExpandEntryArea.h"
x . . "Source/ExpandUserArea.cpp"
. . . "Source/ExpandUserArea.h"
. . . "Source/Global.h"
x . . "Source/Main.cpp"
x . . "Source/PostFunctions.cpp"
. . . "Source/PostFunctions.h"
. . . "Source/targetver.h"
. . . "Source/ToggleAreaButton.h"
. . . "Source/UserInteraction.h"
)
jucer_project_module(
juce_core
PATH "${JUCE_MODULES_GLOBAL_PATH}"
# JUCE_FORCE_DEBUG
# JUCE_LOG_ASSERTIONS
# JUCE_CHECK_MEMORY_LEAKS
# JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
# JUCE_INCLUDE_ZLIB_CODE
# JUCE_USE_CURL
# JUCE_LOAD_CURL_SYMBOLS_LAZILY
# JUCE_CATCH_UNHANDLED_EXCEPTIONS
# JUCE_ALLOW_STATIC_NULL_VARIABLES
JUCE_STRICT_REFCOUNTEDPOINTER ON
)
jucer_project_module(
juce_data_structures
PATH "${JUCE_MODULES_GLOBAL_PATH}"
)
jucer_project_module(
juce_events
PATH "${JUCE_MODULES_GLOBAL_PATH}"
# JUCE_EXECUTE_APP_SUSPEND_ON_IOS_BACKGROUND_TASK
)
jucer_project_module(
juce_graphics
PATH "${JUCE_MODULES_GLOBAL_PATH}"
# JUCE_USE_COREIMAGE_LOADER
# JUCE_USE_DIRECTWRITE
# JUCE_DISABLE_COREGRAPHICS_FONT_SMOOTHING
)
jucer_project_module(
juce_gui_basics
PATH "${JUCE_MODULES_GLOBAL_PATH}"
# JUCE_ENABLE_REPAINT_DEBUGGING
# JUCE_USE_XRANDR
# JUCE_USE_XINERAMA
# JUCE_USE_XSHM
# JUCE_USE_XRENDER
# JUCE_USE_XCURSOR
# JUCE_WIN_PER_MONITOR_DPI_AWARE
)
jucer_project_module(
juce_gui_extra
PATH "${JUCE_MODULES_GLOBAL_PATH}"
# JUCE_WEB_BROWSER
# JUCE_ENABLE_LIVE_CONSTANT_EDITOR
)
jucer_project_module(
juce_opengl
PATH "${JUCE_MODULES_GLOBAL_PATH}"
)
# TODO: Remove if obsolete
# set(USER_APPCONFIG_HEADER "// (You can add your own code in this section, and the Projucer will not overwrite it)\n\n")
#
# if(DEFINED JUCE_TITLE_BAR)
# message(STATUS "Using JUCE's own titlebar implementation.")
# message(WARNING "Please be aware that this disables native window-manager functionalities, like snap, maximizing on dragging the window to the edge, etc.!")
# set(USER_APPCONFIG_HEADER "#define JUCE_TITLE_BAR\n")
# endif()
#
# if(DEFINED JUCE_TITLE_BAR)
# message(STATUS "Using a light colorscheme")
# message(WARNING "Please be aware that this colorscheme is not fully implemented at the moment and might look incomplete!")
# set(USER_APPCONFIG_HEADER "#define USE_LIGHT_COLORSCHEME\n")
# endif()
set(USER_APPCONFIG_HEADER "#include \"../Source/CMake.h\"")
jucer_appconfig_header(USER_CODE_SECTION "${USER_APPCONFIG_HEADER}")
jucer_export_target(
"Xcode (MacOSX)"
ICON_SMALL "Resources/Logo.png"
ICON_LARGE "Resources/Logo.png"
KEEP_CUSTOM_XCODE_SCHEMES ON
)
jucer_export_target_configuration(
"Xcode (MacOSX)"
NAME "Debug"
DEBUG_MODE ON
BINARY_NAME "CommuniCare_Manager"
)
jucer_export_target_configuration(
"Xcode (MacOSX)"
NAME "Release"
DEBUG_MODE OFF
BINARY_NAME "CommuniCare_Manager"
)
jucer_export_target(
"Visual Studio 2017"
EXTRA_COMPILER_FLAGS
"/bigobj"
"/utf-8"
ICON_SMALL "Resources/Logo.png"
ICON_LARGE "Resources/Logo.png"
)
jucer_export_target_configuration(
"Visual Studio 2017"
NAME "Debug"
DEBUG_MODE ON
BINARY_NAME "CommuniCare_Manager"
INCREMENTAL_LINKING ON
CHARACTER_SET "Unicode"
)
jucer_export_target_configuration(
"Visual Studio 2017"
NAME "Release"
DEBUG_MODE OFF
BINARY_NAME "CommuniCare_Manager"
CHARACTER_SET "Unicode"
)
jucer_export_target(
"Linux Makefile"
ICON_SMALL "Resources/Logo.png"
ICON_LARGE "Resources/Logo.png"
)
jucer_export_target_configuration(
"Linux Makefile"
NAME "Debug"
DEBUG_MODE ON
BINARY_NAME "CommuniCare_Manager"
)
jucer_export_target_configuration(
"Linux Makefile"
NAME "Release"
DEBUG_MODE OFF
BINARY_NAME "CommuniCare_Manager"
)
jucer_export_target(
"Code::Blocks (Windows)"
ICON_SMALL "Resources/Logo.png"
ICON_LARGE "Resources/Logo.png"
)
jucer_export_target_configuration(
"Code::Blocks (Windows)"
NAME "Debug"
DEBUG_MODE ON
BINARY_NAME "CommuniCare_Manager"
)
jucer_export_target_configuration(
"Code::Blocks (Windows)"
NAME "Release"
DEBUG_MODE OFF
BINARY_NAME "CommuniCare_Manager"
)
jucer_project_end()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment