|
@ -5,22 +5,34 @@ endif() |
|
|
|
|
|
|
|
|
cmake_minimum_required(VERSION 3.25) |
|
|
cmake_minimum_required(VERSION 3.25) |
|
|
|
|
|
|
|
|
|
|
|
set(APPLICATION_NAME "Antkeeper") |
|
|
|
|
|
set(APPLICATION_VERSION "0.0.1") |
|
|
|
|
|
set(APPLICATION_AUTHOR "C. J. Howard") |
|
|
|
|
|
|
|
|
|
|
|
# Slugify application name |
|
|
|
|
|
string(TOLOWER ${APPLICATION_NAME} APPLICATION_SLUG) |
|
|
|
|
|
string(REPLACE " " "-" APPLICATION_SLUG ${APPLICATION_SLUG}) |
|
|
|
|
|
|
|
|
# Create superbuild project |
|
|
# Create superbuild project |
|
|
project(antkeeper-superbuild VERSION "0.0.1") |
|
|
|
|
|
|
|
|
project(${APPLICATION_SLUG}-superbuild VERSION ${APPLICATION_VERSION}) |
|
|
|
|
|
|
|
|
|
|
|
set(APPLICATION_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) |
|
|
|
|
|
set(APPLICATION_VERSION_MINOR ${PROJECT_VERSION_MINOR}) |
|
|
|
|
|
set(APPLICATION_VERSION_PATCH ${PROJECT_VERSION_PATCH}) |
|
|
|
|
|
|
|
|
# Setup package variables |
|
|
# Setup package variables |
|
|
set(PACKAGE_NAME ${PROJECT_NAME}) |
|
|
|
|
|
set(PACKAGE_VERSION ${PROJECT_VERSION}) |
|
|
|
|
|
set(PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) |
|
|
|
|
|
set(PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR}) |
|
|
|
|
|
set(PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH}) |
|
|
|
|
|
|
|
|
set(PACKAGE_NAME ${APPLICATION_NAME}) |
|
|
|
|
|
set(PACKAGE_VERSION ${APPLICATION_VERSION}) |
|
|
|
|
|
set(PACKAGE_VERSION_MAJOR ${APPLICATION_VERSION_MAJOR}) |
|
|
|
|
|
set(PACKAGE_VERSION_MINOR ${APPLICATION_VERSION_MINOR}) |
|
|
|
|
|
set(PACKAGE_VERSION_PATCH ${APPLICATION_VERSION_PATCH}) |
|
|
get_filename_component(PACKAGE_PLATFORM ${CMAKE_BINARY_DIR} NAME CACHE) |
|
|
get_filename_component(PACKAGE_PLATFORM ${CMAKE_BINARY_DIR} NAME CACHE) |
|
|
if(CMAKE_BUILD_TYPE STREQUAL "Debug") |
|
|
if(CMAKE_BUILD_TYPE STREQUAL "Debug") |
|
|
set(PACKAGE_BUILD_TYPE debug) |
|
|
set(PACKAGE_BUILD_TYPE debug) |
|
|
else() |
|
|
else() |
|
|
set(PACKAGE_BUILD_TYPE release) |
|
|
set(PACKAGE_BUILD_TYPE release) |
|
|
endif() |
|
|
endif() |
|
|
set(PACKAGE_FILENAME ${PACKAGE_NAME}-${PACKAGE_VERSION}-${PACKAGE_PLATFORM}) |
|
|
|
|
|
|
|
|
set(PACKAGE_FILENAME ${APPLICATION_SLUG}-${PACKAGE_VERSION}-${PACKAGE_PLATFORM}) |
|
|
set(PACKAGE_INSTALL_DIR ${CMAKE_SOURCE_DIR}/bin/${PACKAGE_BUILD_TYPE}/${PACKAGE_FILENAME}) |
|
|
set(PACKAGE_INSTALL_DIR ${CMAKE_SOURCE_DIR}/bin/${PACKAGE_BUILD_TYPE}/${PACKAGE_FILENAME}) |
|
|
set(PACKAGE_DIST_DIR ${CMAKE_SOURCE_DIR}/dist/${PACKAGE_BUILD_TYPE}) |
|
|
set(PACKAGE_DIST_DIR ${CMAKE_SOURCE_DIR}/dist/${PACKAGE_BUILD_TYPE}) |
|
|
|
|
|
|
|
@ -41,30 +53,23 @@ endif() |
|
|
|
|
|
|
|
|
# Options |
|
|
# Options |
|
|
set(BLENDER "blender" CACHE FILEPATH "Path to Blender executable") |
|
|
set(BLENDER "blender" CACHE FILEPATH "Path to Blender executable") |
|
|
set(INKSCAPE "inkscape" CACHE FILEPATH "Path to Inkscape executable") |
|
|
|
|
|
|
|
|
|
|
|
# Set C++ compiler flags |
|
|
|
|
|
if(CMAKE_COMPILER_IS_GNUCC) |
|
|
|
|
|
set(CMAKE_CXX_FLAGS "-Wall -Wextra") |
|
|
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -g") |
|
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3") |
|
|
|
|
|
elseif(MSVC) |
|
|
|
|
|
set(CMAKE_CXX_FLAGS "/MP /W3 /GR- /GS- /EHsc /D_WIN32_WINNT=0x0501 /DWINVER=0x0501") |
|
|
|
|
|
|
|
|
# Set compiler and linker flags |
|
|
|
|
|
if(MSVC) |
|
|
|
|
|
set(CMAKE_CXX_FLAGS "/MP /GR- /GS- /EHsc /D_WIN32_WINNT=0x0501 /DWINVER=0x0501") |
|
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} /MTd") |
|
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} /MTd") |
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} /MT /O2") |
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} /MT /O2") |
|
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /nologo") |
|
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /OPT:REF /OPT:ICF /INCREMENTAL:NO") |
|
|
|
|
|
elseif(CMAKE_COMPILER_IS_GNUCC) |
|
|
|
|
|
set(CMAKE_CXX_FLAGS "") |
|
|
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -g") |
|
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3") |
|
|
endif() |
|
|
endif() |
|
|
|
|
|
|
|
|
# Set C compiler flags |
|
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS}") |
|
|
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS}") |
|
|
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") |
|
|
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") |
|
|
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") |
|
|
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") |
|
|
|
|
|
|
|
|
# Set executable linker flags |
|
|
|
|
|
if(MSVC) |
|
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /nologo") |
|
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /OPT:REF /OPT:ICF /INCREMENTAL:NO") |
|
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
# Setup module directories |
|
|
# Setup module directories |
|
|
set(MODULE_SOURCE_DIR "${PROJECT_SOURCE_DIR}/modules") |
|
|
set(MODULE_SOURCE_DIR "${PROJECT_SOURCE_DIR}/modules") |
|
|
set(MODULE_BUILD_DIR "${PROJECT_BINARY_DIR}/modules/build") |
|
|
set(MODULE_BUILD_DIR "${PROJECT_BINARY_DIR}/modules/build") |
|
@ -288,7 +293,9 @@ ExternalProject_Add(antkeeper-source |
|
|
"-DCMAKE_INSTALL_PREFIX=${PACKAGE_INSTALL_DIR}" |
|
|
"-DCMAKE_INSTALL_PREFIX=${PACKAGE_INSTALL_DIR}" |
|
|
"-DPACKAGE_PLATFORM=${PACKAGE_PLATFORM}" |
|
|
"-DPACKAGE_PLATFORM=${PACKAGE_PLATFORM}" |
|
|
"-DCMAKE_PREFIX_PATH=${MODULE_INSTALL_DIR}" |
|
|
"-DCMAKE_PREFIX_PATH=${MODULE_INSTALL_DIR}" |
|
|
"-DVERSION_STRING=${PROJECT_VERSION}" |
|
|
|
|
|
|
|
|
"-DAPPLICATION_NAME=${APPLICATION_NAME}" |
|
|
|
|
|
"-DAPPLICATION_VERSION=${APPLICATION_VERSION}" |
|
|
|
|
|
"-DAPPLICATION_AUTHOR=${APPLICATION_AUTHOR}" |
|
|
"-DCMAKE_CXX_FLAGS='${CMAKE_CXX_FLAGS}'" |
|
|
"-DCMAKE_CXX_FLAGS='${CMAKE_CXX_FLAGS}'" |
|
|
"-DCMAKE_CXX_FLAGS_DEBUG='${CMAKE_CXX_FLAGS_DEBUG}'" |
|
|
"-DCMAKE_CXX_FLAGS_DEBUG='${CMAKE_CXX_FLAGS_DEBUG}'" |
|
|
"-DCMAKE_CXX_FLAGS_RELEASE='${CMAKE_CXX_FLAGS_RELEASE}'" |
|
|
"-DCMAKE_CXX_FLAGS_RELEASE='${CMAKE_CXX_FLAGS_RELEASE}'" |
|
@ -309,8 +316,10 @@ if(EXISTS ${MODULE_SOURCE_DIR}/antkeeper-data/CMakeLists.txt) |
|
|
"-DCMAKE_INSTALL_PREFIX=${PACKAGE_INSTALL_DIR}" |
|
|
"-DCMAKE_INSTALL_PREFIX=${PACKAGE_INSTALL_DIR}" |
|
|
"-DPACKAGE_PLATFORM=${PACKAGE_PLATFORM}" |
|
|
"-DPACKAGE_PLATFORM=${PACKAGE_PLATFORM}" |
|
|
"-DCMAKE_PREFIX_PATH=${MODULE_INSTALL_DIR}" |
|
|
"-DCMAKE_PREFIX_PATH=${MODULE_INSTALL_DIR}" |
|
|
|
|
|
"-DAPPLICATION_NAME=${APPLICATION_NAME}" |
|
|
|
|
|
"-DAPPLICATION_VERSION=${APPLICATION_VERSION}" |
|
|
|
|
|
"-DAPPLICATION_AUTHOR=${APPLICATION_AUTHOR}" |
|
|
"-DBLENDER=${BLENDER}" |
|
|
"-DBLENDER=${BLENDER}" |
|
|
"-DINKSCAPE=${INKSCAPE}" |
|
|
|
|
|
BUILD_ALWAYS 1) |
|
|
BUILD_ALWAYS 1) |
|
|
endif() |
|
|
endif() |
|
|
|
|
|
|
|
@ -333,13 +342,13 @@ add_custom_target(cpack |
|
|
add_custom_target(dist DEPENDS cpack) |
|
|
add_custom_target(dist DEPENDS cpack) |
|
|
|
|
|
|
|
|
# Configure CPack variables |
|
|
# Configure CPack variables |
|
|
set(CPACK_PACKAGE_NAME "${PACKAGE_NAME}") |
|
|
|
|
|
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_PACKAGE_FILE_NAME "${PACKAGE_NAME}-${PACKAGE_VERSION}-${PACKAGE_PLATFORM}") |
|
|
|
|
|
|
|
|
set(CPACK_PACKAGE_NAME "${APPLICATION_NAME}") |
|
|
|
|
|
set(CPACK_PACKAGE_VERSION_MAJOR "${APPLICATION_VERSION_MAJOR}") |
|
|
|
|
|
set(CPACK_PACKAGE_VERSION_MINOR "${APPLICATION_VERSION_MINOR}") |
|
|
|
|
|
set(CPACK_PACKAGE_VERSION_PATCH "${APPLICATION_VERSION_PATCH}") |
|
|
|
|
|
set(CPACK_PACKAGE_FILE_NAME "${APPLICATION_SLUG}-${PACKAGE_VERSION}-${PACKAGE_PLATFORM}") |
|
|
set(CPACK_PACKAGE_DESCRIPTION "") |
|
|
set(CPACK_PACKAGE_DESCRIPTION "") |
|
|
set(CPACK_PACKAGE_CONTACT "Christopher J. Howard <cjhoward@cjhoward.org>") |
|
|
|
|
|
|
|
|
set(CPACK_PACKAGE_CONTACT "${APPLICATION_AUTHOR}") |
|
|
set(CPACK_COMPONENTS_ALL "package") |
|
|
set(CPACK_COMPONENTS_ALL "package") |
|
|
|
|
|
|
|
|
# Configure .tgz and .zip distribution packages |
|
|
# Configure .tgz and .zip distribution packages |
|
|