Add support for CMake (buildsystem generator) (#2468)
Co-authored-by: Edgar <Edgar@AnotherFoxGuy.com>
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_path(LRUCache_INCLUDE_DIR lrucache/lrucache.hpp HINTS ${CMAKE_SOURCE_DIR}/lib/lrucache)
|
||||
|
||||
find_package_handle_standard_args(LRUCache DEFAULT_MSG LRUCache_INCLUDE_DIR)
|
||||
|
||||
if (LRUCache_FOUND)
|
||||
add_library(LRUCache INTERFACE IMPORTED)
|
||||
set_target_properties(LRUCache PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${LRUCache_INCLUDE_DIR}"
|
||||
)
|
||||
endif ()
|
||||
|
||||
mark_as_advanced(LRUCache_INCLUDE_DIR)
|
||||
@@ -0,0 +1,28 @@
|
||||
find_path(IrcCore_INCLUDE_DIR irc.h PATH_SUFFIXES IrcCore)
|
||||
find_library(IrcCore_LIBRARY Core)
|
||||
|
||||
find_path(IrcModel_INCLUDE_DIR ircmodel.h PATH_SUFFIXES IrcModel)
|
||||
find_library(IrcModel_LIBRARY Model)
|
||||
|
||||
find_path(IrcUtil_INCLUDE_DIR ircutil.h PATH_SUFFIXES IrcUtil)
|
||||
find_library(IrcUtil_LIBRARY Util)
|
||||
|
||||
set(LibCommuni_INCLUDE_DIRS ${IrcCore_INCLUDE_DIR} ${IrcModel_INCLUDE_DIR} ${IrcUtil_INCLUDE_DIR})
|
||||
set(LibCommuni_LIBRARIES ${IrcCore_LIBRARY} ${IrcModel_LIBRARY} ${IrcUtil_LIBRARY})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(LibCommuni
|
||||
DEFAULT_MSG IrcCore_LIBRARY IrcModel_LIBRARY IrcUtil_LIBRARY IrcCore_INCLUDE_DIR IrcModel_INCLUDE_DIR IrcUtil_INCLUDE_DIR
|
||||
)
|
||||
|
||||
if (LibCommuni_FOUND)
|
||||
add_library(LibCommuni::LibCommuni INTERFACE IMPORTED)
|
||||
set_target_properties(LibCommuni::LibCommuni PROPERTIES
|
||||
INTERFACE_LINK_LIBRARIES "${LibCommuni_LIBRARIES}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${LibCommuni_INCLUDE_DIRS}"
|
||||
)
|
||||
endif ()
|
||||
|
||||
mark_as_advanced(LibCommuni_INCLUDE_DIRS LibCommuni_LIBRARIES
|
||||
IrcCore_LIBRARY IrcModel_LIBRARY IrcUtil_LIBRARY
|
||||
IrcCore_INCLUDE_DIR IrcModel_INCLUDE_DIR IrcUtil_INCLUDE_DIR)
|
||||
@@ -0,0 +1,14 @@
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_path(PajladaSerialize_INCLUDE_DIR pajlada/serialize.hpp HINTS ${CMAKE_SOURCE_DIR}/lib/serialize/include)
|
||||
|
||||
find_package_handle_standard_args(PajladaSerialize DEFAULT_MSG PajladaSerialize_INCLUDE_DIR)
|
||||
|
||||
if (PajladaSerialize_FOUND)
|
||||
add_library(Pajlada::Serialize INTERFACE IMPORTED)
|
||||
set_target_properties(Pajlada::Serialize PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${PajladaSerialize_INCLUDE_DIR}"
|
||||
)
|
||||
endif ()
|
||||
|
||||
mark_as_advanced(PajladaSerialize_INCLUDE_DIR)
|
||||
@@ -0,0 +1,16 @@
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_path(PajladaSettings_INCLUDE_DIR pajlada/settings.hpp)
|
||||
find_library(PajladaSettings_LIBRARY PajladaSettings)
|
||||
|
||||
find_package_handle_standard_args(PajladaSettings DEFAULT_MSG PajladaSettings_INCLUDE_DIR PajladaSettings_LIBRARY)
|
||||
|
||||
if (PajladaSettings_FOUND)
|
||||
add_library(Pajlada::Settings INTERFACE IMPORTED)
|
||||
set_target_properties(Pajlada::Settings PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${PajladaSettings_INCLUDE_DIR}"
|
||||
INTERFACE_LINK_LIBRARIES "${PajladaSettings_LIBRARY}"
|
||||
)
|
||||
endif ()
|
||||
|
||||
mark_as_advanced(PajladaSettings_INCLUDE_DIR PajladaSettings_LIBRARY)
|
||||
@@ -0,0 +1,14 @@
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_path(PajladaSignals_INCLUDE_DIR pajlada/signals/signal.hpp HINTS ${CMAKE_SOURCE_DIR}/lib/signals/include)
|
||||
|
||||
find_package_handle_standard_args(PajladaSignals DEFAULT_MSG PajladaSignals_INCLUDE_DIR)
|
||||
|
||||
if (PajladaSignals_FOUND)
|
||||
add_library(Pajlada::Signals INTERFACE IMPORTED)
|
||||
set_target_properties(Pajlada::Signals PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${PajladaSignals_INCLUDE_DIR}"
|
||||
)
|
||||
endif ()
|
||||
|
||||
mark_as_advanced(PajladaSignals_INCLUDE_DIR)
|
||||
@@ -0,0 +1,14 @@
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_path(RapidJSON_INCLUDE_DIRS rapidjson/rapidjson.h HINTS ${CMAKE_SOURCE_DIR}/lib/rapidjson/include)
|
||||
|
||||
find_package_handle_standard_args(RapidJSON DEFAULT_MSG RapidJSON_INCLUDE_DIRS)
|
||||
|
||||
if (RapidJSON_FOUND)
|
||||
add_library(RapidJSON::RapidJSON INTERFACE IMPORTED)
|
||||
set_target_properties(RapidJSON::RapidJSON PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${RapidJSON_INCLUDE_DIRS}"
|
||||
)
|
||||
endif ()
|
||||
|
||||
mark_as_advanced(RapidJSON_INCLUDE_DIRS)
|
||||
@@ -0,0 +1,14 @@
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_path(Websocketpp_INCLUDE_DIRS websocketpp/version.hpp HINTS ${CMAKE_SOURCE_DIR}/lib/websocketpp)
|
||||
|
||||
find_package_handle_standard_args(Websocketpp DEFAULT_MSG Websocketpp_INCLUDE_DIRS)
|
||||
|
||||
if (Websocketpp_FOUND)
|
||||
add_library(websocketpp::websocketpp INTERFACE IMPORTED)
|
||||
set_target_properties(websocketpp::websocketpp PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${Websocketpp_INCLUDE_DIRS}"
|
||||
)
|
||||
endif ()
|
||||
|
||||
mark_as_advanced(Websocketpp_INCLUDE_DIRS)
|
||||
@@ -0,0 +1,12 @@
|
||||
if (EXISTS ${CMAKE_SOURCE_DIR}/lib/WinToast/src/wintoastlib.cpp)
|
||||
set(WinToast_FOUND TRUE)
|
||||
add_library(WinToast ${CMAKE_SOURCE_DIR}/lib/WinToast/src/wintoastlib.cpp)
|
||||
target_include_directories(WinToast PUBLIC "${CMAKE_SOURCE_DIR}/lib/WinToast/src/")
|
||||
else ()
|
||||
set(WinToast_FOUND FALSE)
|
||||
message("WinToast submodule not found!")
|
||||
endif ()
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
# This script will set the following variables:
|
||||
# GIT_HASH
|
||||
# If the git binary is found and the git work tree is intact, GIT_HASH is worked out using the `git rev-parse --short HEAD` command
|
||||
# The value of GIT_HASH can be overriden by defining the GIT_HASH environment variable
|
||||
# GIT_COMMIT
|
||||
# If the git binary is found and the git work tree is intact, GIT_COMMIT is worked out using the `git rev-parse HEAD` command
|
||||
# The value of GIT_COMMIT can be overriden by defining the GIT_COMMIT environment variable
|
||||
# GIT_RELEASE
|
||||
# If the git binary is found and the git work tree is intact, GIT_RELEASE is worked out using the `git describe` command
|
||||
# The value of GIT_RELEASE can be overriden by defining the GIT_RELEASE environment variable
|
||||
|
||||
find_package(Git)
|
||||
|
||||
set(GIT_HASH "GIT-REPOSITORY-NOT-FOUND")
|
||||
set(GIT_COMMIT "GIT-REPOSITORY-NOT-FOUND")
|
||||
set(GIT_RELEASE "${PROJECT_VERSION}")
|
||||
|
||||
if (GIT_EXECUTABLE)
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} rev-parse --is-inside-work-tree
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
RESULT_VARIABLE GIT_REPOSITORY_NOT_FOUND
|
||||
ERROR_QUIET
|
||||
)
|
||||
if (GIT_REPOSITORY_NOT_FOUND)
|
||||
set(GIT_REPOSITORY_FOUND 0)
|
||||
else ()
|
||||
set(GIT_REPOSITORY_FOUND 1)
|
||||
endif()
|
||||
|
||||
if (GIT_REPOSITORY_FOUND)
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_HASH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_COMMIT
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} describe
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_RELEASE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
endif (GIT_REPOSITORY_FOUND)
|
||||
endif (GIT_EXECUTABLE)
|
||||
|
||||
if (DEFINED ENV{GIT_HASH})
|
||||
set(GIT_HASH "$ENV{GIT_HASH}")
|
||||
endif ()
|
||||
if (DEFINED ENV{GIT_COMMIT})
|
||||
set(GIT_COMMIT "$ENV{GIT_COMMIT}")
|
||||
endif ()
|
||||
if (DEFINED ENV{GIT_RELEASE})
|
||||
set(GIT_RELEASE "$ENV{GIT_RELEASE}")
|
||||
endif ()
|
||||
|
||||
message(STATUS "Injected git values: ${GIT_COMMIT} (${GIT_RELEASE}) ${GIT_HASH}")
|
||||
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>${MACOSX_BUNDLE_INFO_STRING}</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>${MACOSX_BUNDLE_ICON_FILE}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleLongVersionString</key>
|
||||
<string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
|
||||
<key>CSResourcesFileMapped</key>
|
||||
<true/>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,80 @@
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2016 Fabian Killus
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||
# associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||
# including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||
# sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all copies or
|
||||
# substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
|
||||
# NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
# ================================================================================================ #
|
||||
# GENERATE_SOURCE_GROUPS( SOURCE_FILES ) #
|
||||
# #
|
||||
# In CMake the source_group() command can be used to provide guidance for IDEs such as Visual
|
||||
# Studio or XCode how to organize source files.
|
||||
# This function takes a list of source files and creates sensible source groups based on the
|
||||
# path provided for each file. In addition header and source files are sorted into separate super
|
||||
# groups. For example:
|
||||
#
|
||||
# path/to/file.cpp
|
||||
# path/to/file.h
|
||||
#
|
||||
# might be displayed in an IDE somewhat like this
|
||||
#
|
||||
# |-Header Files
|
||||
# ||-path
|
||||
# | |-to
|
||||
# | |-file.h
|
||||
# |-Source Files
|
||||
# ||-path
|
||||
# | |-to
|
||||
# | |-file.cpp
|
||||
#
|
||||
|
||||
function(generate_source_groups)
|
||||
|
||||
set(SOURCES_GROUP "Source Files")
|
||||
set(HEADERS_GROUP "Header Files")
|
||||
|
||||
foreach (f IN LISTS ARGN)
|
||||
# Split filename into its components
|
||||
get_filename_component(filename ${f} NAME)
|
||||
get_filename_component(filedir ${f} DIRECTORY)
|
||||
|
||||
# Extract group name from directory path
|
||||
if (filedir AND NOT ARG_FLAT_STRUCTURE)
|
||||
string(REPLACE "${CMAKE_SOURCE_DIR}/" "" tmp_dir ${filedir})
|
||||
string(REPLACE "/" "\\\\" groupdir ${tmp_dir})
|
||||
else ()
|
||||
set(groupdir "")
|
||||
endif ()
|
||||
list(APPEND GROUPDIRS ${groupdir})
|
||||
|
||||
# sort according to filetype
|
||||
if (${filename} MATCHES ".*\\.(c|cc|cpp|cxx)")
|
||||
list(APPEND ${groupdir}_SOURCES ${f})
|
||||
elseif (${filename} MATCHES ".*\\.(h|hpp|hxx|txx)")
|
||||
list(APPEND ${groupdir}_HEADERS ${f})
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
list(REMOVE_DUPLICATES GROUPDIRS)
|
||||
|
||||
foreach (groupdir IN LISTS GROUPDIRS)
|
||||
source_group("${SOURCES_GROUP}\\${groupdir}" FILES ${${groupdir}_SOURCES})
|
||||
source_group("${HEADERS_GROUP}\\${groupdir}" FILES ${${groupdir}_HEADERS})
|
||||
endforeach ()
|
||||
|
||||
endfunction()
|
||||
|
||||
Reference in New Issue
Block a user