Skip to content

Commit

Permalink
Merge pull request #20 from tumcms/vs2019
Browse files Browse the repository at this point in the history
Updated BlueFramework for Vs2019 and C++20
  • Loading branch information
pjanck authored Dec 29, 2020
2 parents 626aa08 + 3b6be67 commit ca91e7f
Show file tree
Hide file tree
Showing 35 changed files with 254 additions and 2,680 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ make.bat
Tools/updateVersion.pyo
build/*
.vscode
.vs
external/log_install_*
BlueFrameworkConfig.cmake
BlueFrameworkConfigVersion.cmake
out
CMakeSettings.json
11 changes: 6 additions & 5 deletions Application/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,20 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

add_definitions(-DNOMINMAX)
add_definitions(-DBLUEFRAMEWORK_EXPORT)

# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)

# Unicode rules!
add_definitions(-D_UNICODE -DQT_NO_KEYWORDS)
add_compile_definitions(
BLUEFRAMEWORK_EXPORT
QT_NO_KEYWORDS
)

if (WIN32)
# TODO: for now this only works on windows. Change BlueApplication.h to support GCC
add_definitions(-DBLUEAPPLICATION_EXPORT)
add_compile_definitions(BLUEAPPLICATION_EXPORT)
endif(WIN32)

file(GLOB BlueFramework_Application_Data_Source src/BlueFramework/Application/Data/*.*)
Expand Down
35 changes: 14 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
cmake_minimum_required(VERSION 3.14.3) # Kittens will die if you switch to an earlier version of CMake.
cmake_policy(VERSION 3.14.3)

project(BlueFramework)
project(BlueFramework CXX)

set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMake/)
include(ProjectVersion)
Expand All @@ -37,6 +37,11 @@ if(MSVC_VERSION EQUAL 1900)
elseif(MSVC_VERSION GREATER_EQUAL 1910 AND MSVC_VERSION LESS_EQUAL 1919)
set(MSVC_VERSION_STRING "vs2017")
set(MSVC_VERSION_YEAR "2017")
set(CMAKE_CXX_STANDARD 17)
elseif(MSVC_VERSION GREATER_EQUAL 1920 AND MSVC_VERSION LESS_EQUAL 1930)
set(MSVC_VERSION_STRING "vs2019")
set(MSVC_VERSION_YEAR "2019")
set(CMAKE_CXX_STANDARD 20)
else()
message(${MSVC_VERSION})
message("Please switch to Visual Studio 14 2015 or Visual Studio 15 2017.")
Expand Down Expand Up @@ -81,7 +86,7 @@ else()
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/MinSizeRel)
endif()

option(BLUEFRAMEWORK_USE_PREDEFINED_THIRDPARTY_PATH "Set to ON to set boost, Eigen and Qt path" ON)
option(BLUEFRAMEWORK_USE_PREDEFINED_THIRDPARTY_PATH "Set to ON to set boost, Eigen and Qt path" OFF)

if(BLUEFRAMEWORK_USE_PREDEFINED_THIRDPARTY_PATH)
# Try to find Boost, Eigen3, Qt5 and other dependencies without user input
Expand Down Expand Up @@ -115,9 +120,10 @@ set(CMAKE_PDB_OUTPUT_DIRECTORY_MINSIZEREL ${CMAKE_BINARY_DIR}/MinSizeRel)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set_property(GLOBAL PROPERTY AUTOGEN_TARGETS_FOLDER AutoMoc)

add_definitions(
-DEIGEN_MPL2_ONLY # Use only MP2 licenced code of Eigen
-D_UNICODE # Unicode rules
add_compile_definitions(
EIGEN_MPL2_ONLY # Use only MP2 licenced code of Eigen
NOMINMAX
_UNICODE # Unicode rules https://docs.microsoft.com/en-us/cpp/text/unicode-programming-summary?view=msvc-160
)

set(CMAKE_DEBUG_POSTFIX "d")
Expand All @@ -130,23 +136,15 @@ endif (WIN32)

# remember the Kittens... do not switch to earlier versions...
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost 1.65.1 COMPONENTS log signals system filesystem REQUIRED) # we suggest Boost 1.65.1
find_package(Boost 1.75.0 COMPONENTS log system filesystem REQUIRED) # we suggest Boost 1.75.0

FetchContent_Declare(
eigen
GIT_REPOSITORY https://github.com/eigenteam/eigen-git-mirror.git
GIT_TAG 3.3.7
)

FetchContent_GetProperties(eigen)
if(NOT eigen_POPULATED)
FetchContent_Populate(eigen)
add_subdirectory(${eigen_SOURCE_DIR} ${eigen_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()

FetchContent_MakeAvailable(eigen)

#find_package(gtest COMPONENTS gtest gtest_main REQUIRED)
#find_package(TinyXML2 REQUIRED)
FetchContent_Declare(
tinyxml2
GIT_REPOSITORY https://github.com/leethomason/tinyxml2.git
Expand All @@ -162,15 +160,10 @@ endif()

# find_package(Vulkan REQUIRED)

# We suggest boost 1.64.0 - but 1.63.0 is also fine
if(${Boost_MAJOR_VERSION} EQUAL 1 AND ${Boost_MINOR_VERSION} EQUAL 63 )
message("Please consider to switch to Boost 1.64.0 or newer")
endif()

# Qt library (do not switch to earlier versions... meow!)
cmake_policy(SET CMP0020 NEW)

find_package(Qt5 5.9.0 COMPONENTS Core Widgets Xml XmlPatterns REQUIRED)
find_package(Qt5 5.14.2 COMPONENTS Core Widgets Xml XmlPatterns REQUIRED)

if(Qt5_FOUND AND WIN32 AND TARGET Qt5::qmake AND NOT TARGET Qt5::windeployqt)
get_target_property(_qt5_qmake_location Qt5::qmake IMPORTED_LOCATION)
Expand Down
19 changes: 19 additions & 0 deletions Core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,22 @@ source_group(BlueFramework\\Core\\Math FILES ${BlueFramewo
source_group(BlueFramework\\Core\\UtfConverter FILES ${BlueFramework_Core_UtfConverter_Source})
source_group(BlueFramework\\Core FILES ${BlueFramework_Core_Source})

FetchContent_Declare(
jk_stackwalker
GIT_REPOSITORY https://github.com/JochenKalmbach/StackWalker
GIT_TAG 1.20
)
FetchContent_MakeAvailable(jk_stackwalker)

target_compile_definitions(StackWalker PUBLIC _UNICODE)

FetchContent_Declare(
c42f_tinyformat
GIT_REPOSITORY https://github.com/c42f/tinyformat
GIT_TAG v2.3.0
)
FetchContent_MakeAvailable(c42f_tinyformat)

add_library(BlueFramework.Core SHARED
${BlueFramework_Core_Diagnostics_IC_Source}
${BlueFramework_Core_Diagnostics_Source}
Expand All @@ -43,6 +59,8 @@ target_include_directories(BlueFramework.Core
PUBLIC
${Boost_INCLUDE_DIR}
src
${jk_stackwalker_SOURCE_DIR}/Main/StackWalker
${c42f_tinyformat_SOURCE_DIR}
)

target_link_libraries(BlueFramework.Core
Expand All @@ -51,6 +69,7 @@ target_link_libraries(BlueFramework.Core
Boost::boost
Boost::log
eigen
StackWalker
)

install(TARGETS BlueFramework.Core
Expand Down
Loading

0 comments on commit ca91e7f

Please sign in to comment.