Skip to content

Commit

Permalink
CMake renamed for Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
cryham committed Nov 15, 2024
1 parent af23dff commit 3150997
Show file tree
Hide file tree
Showing 42 changed files with 772 additions and 772 deletions.
File renamed without changes.
88 changes: 44 additions & 44 deletions CMake/Bootstrap.cmake
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@

set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG" )

if (NOT APPLE)
if (CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "One of: Debug Release RelWithDebInfo MinSizeRel." FORCE)
endif ()
else ()
set(MACOSX_BUNDLE_GUI_IDENTIFIER "org.ogre3d.\${PRODUCT_NAME:rfc1034identifier}")
endif ()
if( NOT APPLE )
if( CMAKE_BUILD_TYPE STREQUAL "" )
set( CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "One of: Debug Release RelWithDebInfo MinSizeRel." FORCE )
endif()
else()
set(MACOSX_BUNDLE_GUI_IDENTIFIER "org.ogre3d.\${PRODUCT_NAME:rfc1034identifier}")
endif()

if (NOT MSVC)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG=1 -D_DEBUG=1 -g")
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -Os -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O2 -g")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-overloaded-virtual")
#set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-overloaded-virtual" )
endif ()
if( NOT MSVC )
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG=1 -D_DEBUG=1 -g" )
set( CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -Os -DNDEBUG" )
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -DNDEBUG" )
set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O2 -g" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-overloaded-virtual" )
#set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-overloaded-virtual" )
endif()

if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-limit-debug-info")
endif ()
if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-limit-debug-info" )
endif()

# Determine if we are compiling for a 32bit or 64bit system
if (NOT APPLE)
include(CheckTypeSize)
CHECK_TYPE_SIZE("void*" ARCH_PTR_SIZE BUILTIN_TYPES_ONLY)
if (ARCH_PTR_SIZE EQUAL 8)
set(PLATFORM_X64 TRUE)
else ()
set(PLATFORM_X64 FALSE)
endif ()
endif ()
if( NOT APPLE )
include(CheckTypeSize)
CHECK_TYPE_SIZE("void*" ARCH_PTR_SIZE BUILTIN_TYPES_ONLY)
if (ARCH_PTR_SIZE EQUAL 8)
set(PLATFORM_X64 TRUE)
else ()
set(PLATFORM_X64 FALSE)
endif ()
endif()

if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
if (NOT PLATFORM_X64)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2")
endif ()
add_definitions(-DUNICODE -D_UNICODE)
endif ()
if( MSVC )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
if( NOT PLATFORM_X64 )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2")
endif()
add_definitions( -DUNICODE -D_UNICODE )
endif()

if (APPLE)
macro(add_recursive dir retVal)
file(GLOB_RECURSE ${retVal} ${dir}/*.h ${dir}/*.cpp ${dir}/*.c ${dir}/*.mm ${dir}/*.m)
endmacro()
else ()
macro(add_recursive dir retVal)
file(GLOB_RECURSE ${retVal} ${dir}/*.h ${dir}/*.cpp ${dir}/*.c)
endmacro()
endif ()
if( APPLE )
macro( add_recursive dir retVal )
file( GLOB_RECURSE ${retVal} ${dir}/*.h ${dir}/*.cpp ${dir}/*.c ${dir}/*.mm ${dir}/*.m )
endmacro()
else()
macro( add_recursive dir retVal )
file( GLOB_RECURSE ${retVal} ${dir}/*.h ${dir}/*.cpp ${dir}/*.c )
endmacro()
endif()
File renamed without changes.
125 changes: 111 additions & 14 deletions CMake/DependenciesConfig.cmake
Original file line number Diff line number Diff line change
@@ -1,17 +1,114 @@
set(CMAKE_THREAD_PREFER_PTHREAD YES)
include(DependenciesFunctions)

set(CMAKE_THREAD_PREFER_PTHREAD YES)
find_package(Threads REQUIRED)

find_package(Boost REQUIRED)
find_package(Bullet REQUIRED)
find_package(enet REQUIRED)
find_package(MyGUI REQUIRED)
find_package(Ogg REQUIRED)
find_package(OGRE REQUIRED)
find_package(OpenAL REQUIRED)
find_package(RapidJSON REQUIRED)
find_package(SDL2 REQUIRED)
find_package(tinyxml2 REQUIRED)
find_package(Vorbis REQUIRED)

include(AddMissingTargets)
# Some pkg-config files are broken, that is why they are commented out

# fails
#add_external_lib(
# Boost
# boost/1.81.0
# REQUIRED
# FIND_PACKAGE_OPTIONS COMPONENTS system thread
#)

#add_external_lib(
# OGRE
# ogre3d/13.4.4@anotherfoxguy/stable
# REQUIRED
# CONAN_PKG_NAME OGRE
# CONAN_OPTIONS ogre3d:nodeless_positioning=True ogre3d:resourcemanager_strict=off
# # uncomment below for Ogre 1.9
# #PKG_CONFIG "OGRE, OGRE-Terrain, OGRE-Paging, OGRE-Overlay"
# FIND_PACKAGE_OPTIONS CONFIG COMPONENTS Bites Overlay Paging RTShaderSystem MeshLodGenerator Terrain
#)

add_external_lib(
BULLET
bullet3/3.24
REQUIRED
FIND_PACKAGE
CONAN_OPTIONS bullet3:extras=True bullet3:network_support=True
INTERFACE_NAME Bullet::Bullet
)

#add_external_lib(
# SDL2
# sdl/2.0.20
# REQUIRED
# PKG_CONFIG "sdl2 >= 2.0"
# FIND_PACKAGE_OPTIONS CONFIG
# CONAN_OPTIONS sdl:sdl2main=False
#)

#add_external_lib(
# MyGUI
# mygui/3.4.1@anotherfoxguy/stable
# REQUIRED
# # PKG_CONFIG "MYGUI = 3.4.0"
# FIND_PACKAGE
#)

add_external_lib(
OGG
ogg/1.3.5
REQUIRED
PKG_CONFIG "ogg >= 1.2"
FIND_PACKAGE
)

add_external_lib(
VorbisFile
vorbis/1.3.7
REQUIRED
PKG_CONFIG "vorbis >= 1.2, vorbisfile >= 1.2"
FIND_PACKAGE
)

# todo: fix Cannot load recipe.
#add_external_lib(
# OpenAL
# openal/1.22.2
# REQUIRED
# PKG_CONFIG "openal >= 1.18"
# FIND_PACKAGE_OPTIONS CONFIG
#)

#add_external_lib(
# ENet
# enet/1.3.17
# REQUIRED
# PKG_CONFIG "libenet >= 1.2"
# FIND_PACKAGE
#)

add_external_lib(
tinyxml2
tinyxml2/9.0.0
REQUIRED
PKG_CONFIG "tinyxml2 >= 6"
FIND_PACKAGE
)


set(LIBS
#Boost::Boost # fails
#Threads::Threads
#OGRE::OGRE
#- Bullet::Bullet // fixme?
#SDL2::SDL2
#MyGUI::MyGUI
VorbisFile::VorbisFile
OGG::OGG
#OpenAL::OpenAL # fails
#ENet::ENet # fails
tinyxml2::tinyxml2
)

#set(SERVER_LIBS Boost::Boost ENet::ENet)


find_package( ENet REQUIRED )

find_package( Boost COMPONENTS system thread REQUIRED )
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions CMake/FindMyGUI.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ find_path(MyGUI_INCLUDE_DIR MyGUI.h PATH_SUFFIXES MYGUI)

# Find release libraries
find_library(MyGUI_MyGUIEngine_LIBRARY_REL MyGUIEngine PATH_SUFFIXES release relwithdebinfo minsizerel)
find_library(MyGUI_OgrePlatform_LIBRARY_REL MyGUI.Ogre2Platform PATH_SUFFIXES release relwithdebinfo minsizerel)
find_library(MyGUI_OgrePlatform_LIBRARY_REL MyGUI.OgrePlatform PATH_SUFFIXES release relwithdebinfo minsizerel)

# Find debug libraries
find_library(MyGUI_MyGUIEngine_LIBRARY_DBG NAMES MyGUIEngine_d MyGUIEngine PATH_SUFFIXES debug)
find_library(MyGUI_OgrePlatform_LIBRARY_DBG NAMES MyGUIOgre2Platform_d MyGUI.Ogre2Platform PATH_SUFFIXES debug)
find_library(MyGUI_OgrePlatform_LIBRARY_DBG NAMES MyGUI.OgrePlatform_d MyGUI.OgrePlatform PATH_SUFFIXES debug)

# set include directories and libraries
set(MyGUI_INCLUDE_DIRS ${MyGUI_INCLUDE_DIR})
Expand Down
File renamed without changes.
File renamed without changes.
34 changes: 0 additions & 34 deletions CMake/Macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -200,37 +200,3 @@ function(cmd_option name desc)

set(${name} "${${name}}" PARENT_SCOPE)
endfunction()

# Helper to retrieve the settings returned from pkg_check_modules()
macro(get_package_interface package)
set(INCLUDES ${${package}_INCLUDE_DIRS})

set(LINKDIRS ${${package}_LIBDIR})

# We resolve the full path of each library to ensure the
# correct one is referenced while linking
foreach (lib ${${package}_LIBRARIES})
find_library(LIB_${lib} ${lib} HINTS ${LINKDIRS})
list(APPEND LIBRARIES ${LIB_${lib}})
endforeach ()
endmacro()

macro(find_with_pkg package interface_name PKG_CONFIG)
pkg_check_modules(${package} ${PKG_CONFIG})

if (${package}_FOUND)
message(STATUS "Using '${package}' system library (Found by pkg_config)")

# Create the target interface library
add_library(${interface_name} INTERFACE IMPORTED GLOBAL)

# Retrieve the package information
get_package_interface(${package})

# And add it to our target
target_include_directories(${interface_name} INTERFACE ${INCLUDES})
target_link_libraries(${interface_name} INTERFACE ${LIBRARIES})

message(STATUS "Added inteface ${interface_name} ${INCLUDES} ${LIBRARIES}")
endif ()
endmacro()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
52 changes: 52 additions & 0 deletions CMakeCI/Bootstrap.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@

set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")

if (NOT APPLE)
if (CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "One of: Debug Release RelWithDebInfo MinSizeRel." FORCE)
endif ()
else ()
set(MACOSX_BUNDLE_GUI_IDENTIFIER "org.ogre3d.\${PRODUCT_NAME:rfc1034identifier}")
endif ()

if (NOT MSVC)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG=1 -D_DEBUG=1 -g")
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -Os -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O2 -g")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-overloaded-virtual")
#set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-overloaded-virtual" )
endif ()

if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-limit-debug-info")
endif ()

# Determine if we are compiling for a 32bit or 64bit system
if (NOT APPLE)
include(CheckTypeSize)
CHECK_TYPE_SIZE("void*" ARCH_PTR_SIZE BUILTIN_TYPES_ONLY)
if (ARCH_PTR_SIZE EQUAL 8)
set(PLATFORM_X64 TRUE)
else ()
set(PLATFORM_X64 FALSE)
endif ()
endif ()

if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
if (NOT PLATFORM_X64)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2")
endif ()
add_definitions(-DUNICODE -D_UNICODE)
endif ()

if (APPLE)
macro(add_recursive dir retVal)
file(GLOB_RECURSE ${retVal} ${dir}/*.h ${dir}/*.cpp ${dir}/*.c ${dir}/*.mm ${dir}/*.m)
endmacro()
else ()
macro(add_recursive dir retVal)
file(GLOB_RECURSE ${retVal} ${dir}/*.h ${dir}/*.cpp ${dir}/*.c)
endmacro()
endif ()
File renamed without changes.
17 changes: 17 additions & 0 deletions CMakeCI/DependenciesConfig.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
set(CMAKE_THREAD_PREFER_PTHREAD YES)

find_package(Threads REQUIRED)

find_package(Boost REQUIRED)
find_package(Bullet REQUIRED)
find_package(enet REQUIRED)
find_package(MyGUI REQUIRED)
find_package(Ogg REQUIRED)
find_package(OGRE REQUIRED)
find_package(OpenAL REQUIRED)
find_package(RapidJSON REQUIRED)
find_package(SDL2 REQUIRED)
find_package(tinyxml2 REQUIRED)
find_package(Vorbis REQUIRED)

include(AddMissingTargets)
File renamed without changes.
4 changes: 2 additions & 2 deletions CMakeManual/FindMyGUI.cmake → CMakeCI/FindMyGUI.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ find_path(MyGUI_INCLUDE_DIR MyGUI.h PATH_SUFFIXES MYGUI)

# Find release libraries
find_library(MyGUI_MyGUIEngine_LIBRARY_REL MyGUIEngine PATH_SUFFIXES release relwithdebinfo minsizerel)
find_library(MyGUI_OgrePlatform_LIBRARY_REL MyGUI.OgrePlatform PATH_SUFFIXES release relwithdebinfo minsizerel)
find_library(MyGUI_OgrePlatform_LIBRARY_REL MyGUI.Ogre2Platform PATH_SUFFIXES release relwithdebinfo minsizerel)

# Find debug libraries
find_library(MyGUI_MyGUIEngine_LIBRARY_DBG NAMES MyGUIEngine_d MyGUIEngine PATH_SUFFIXES debug)
find_library(MyGUI_OgrePlatform_LIBRARY_DBG NAMES MyGUI.OgrePlatform_d MyGUI.OgrePlatform PATH_SUFFIXES debug)
find_library(MyGUI_OgrePlatform_LIBRARY_DBG NAMES MyGUIOgre2Platform_d MyGUI.Ogre2Platform PATH_SUFFIXES debug)

# set include directories and libraries
set(MyGUI_INCLUDE_DIRS ${MyGUI_INCLUDE_DIR})
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 3150997

Please sign in to comment.