Skip to content

Commit

Permalink
Add new feature-showcase project for testing features
Browse files Browse the repository at this point in the history
  • Loading branch information
mogemimi committed Sep 5, 2018
1 parent 28ab1cd commit 03dbe2c
Show file tree
Hide file tree
Showing 30 changed files with 2,192 additions and 0 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(POMDOG_BUILD_TARGET_ALL ON)
add_subdirectory(build/pomdog)
add_subdirectory(build/pomdog_experimental)
add_subdirectory(examples/FeatureShowcase)
add_subdirectory(examples/Pong)
add_subdirectory(examples/QuickStart)
add_subdirectory(test)
35 changes: 35 additions & 0 deletions examples/FeatureShowcase/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
*.a
*.exe
*.filters
*.lib
*.pdb
*.props
*.sdf
*.sln
*.so
*.suo
*.user
*.vcproj
*.vcxproj
.DS_Store
/out/
/build
/ThirdParty/pomdog

# Build output for Xcode
/Builds/build

# Xcode
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
*.xcuserstate
*.xcscmblueprint
208 changes: 208 additions & 0 deletions examples/FeatureShowcase/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
cmake_minimum_required(VERSION 3.10)
project(FeatureShowcase CXX)

# NOTE: Remove /RTC1 option from default compiler options for Visual Studio
STRING(REGEX REPLACE "/RTC(su|[1su])" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")

set(PRODUCT_NAME FeatureShowcase)
set(POMDOG_DIR "../..")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED on)
set(CMAKE_CXX_EXTENSIONS off)
set(CMAKE_CONFIGURATION_TYPES Debug Release)

source_group(Source REGULAR_EXPRESSION "Source/*")
source_group(Source\\EntityComponentTest REGULAR_EXPRESSION "Source/EntityComponentTest/*")
source_group(Source\\PolygonBatchTest REGULAR_EXPRESSION "Source/PolygonBatchTest/*")
source_group(Source\\SpriteBatchTest REGULAR_EXPRESSION "Source/SpriteBatchTest/*")
source_group(Source\\SpriteFontTest REGULAR_EXPRESSION "Source/SpriteFontTest/*")
source_group(Platform REGULAR_EXPRESSION "Platform.*/*")

set(RESOURCE_FILES
# `Content` directory
Content

# On Mac
$<$<PLATFORM_ID:Darwin>:
Platform.Cocoa/Assets.xcassets
Platform.Cocoa/Base.lproj/MainMenu.xib
>
)

add_executable(${PRODUCT_NAME} WIN32
Source/FeatureShowcaseGame.cpp
Source/FeatureShowcaseGame.hpp
Source/PolygonBatchTest/PolygonBatchTest.cpp
Source/PolygonBatchTest/PolygonBatchTest.hpp
Source/SpriteBatchTest/SpriteBatchTest.cpp
Source/SpriteBatchTest/SpriteBatchTest.hpp
Source/SpriteFontTest/SpriteFontTest.cpp
Source/SpriteFontTest/SpriteFontTest.hpp
${RESOURCE_FILES}

# On Mac
$<$<PLATFORM_ID:Darwin>:
Platform.Cocoa/main.mm
Platform.Cocoa/AppDelegate.h
Platform.Cocoa/AppDelegate.mm
>

# On Linux
$<$<PLATFORM_ID:Linux>:
Platform.X11/main.cpp
>

# On Windows
$<$<PLATFORM_ID:Windows>:
Platform.Win32/main.cpp
Platform.Win32/Resource.hpp
Platform.Win32/game.rc
>
)

target_include_directories(${PRODUCT_NAME} PRIVATE
${POMDOG_DIR}/include
${POMDOG_DIR}/experimental
)

target_compile_definitions(${PRODUCT_NAME} PRIVATE
$<$<CONFIG:DEBUG>:DEBUG>
$<$<CONFIG:RELEASE>:NDEBUG>

# On Windows
$<$<PLATFORM_ID:Windows>:
WIN32_LEAN_AND_MEAN
NOMINMAX
>
)

target_compile_options(${PRODUCT_NAME} PRIVATE
# Clang and GCC
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:GNU>,$<STREQUAL:${CMAKE_GENERATOR},Xcode>>:
-pedantic
$<$<CONFIG:DEBUG>:-g;-O0>
$<$<CONFIG:RELEASE>:-O3>
>
# MSVC
$<$<CXX_COMPILER_ID:MSVC>:
/W4
$<$<CONFIG:DEBUG>:/Od;/MTd>
$<$<CONFIG:RELEASE>:/O2;/Ob2;/MT>
>
)

if(WIN32)
# Replace with target_link_options() when upgrading CMake 3.12
target_link_libraries(${PRODUCT_NAME}
debug -INCREMENTAL
debug -DEBUG
optimized -INCREMENTAL:NO
optimized -OPT:REF
)
endif()

if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
# Copying 'Content' directory into shippable directory after building executable
add_custom_command(
COMMENT "Copying contents to ${CMAKE_BINARY_DIR}/Content"
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Content
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_CURRENT_SOURCE_DIR}/Content
${CMAKE_CURRENT_BINARY_DIR}/Content
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/Content
)
endif()

if(APPLE)
set_source_files_properties(
${RESOURCE_FILES}
PROPERTIES
MACOSX_PACKAGE_LOCATION Resources
)

set_target_properties(
${PRODUCT_NAME} PROPERTIES
MACOSX_BUNDLE TRUE
RESOURCE "${RESOURCE_FILES}"
)

# TODO: Replace with the following, CMake >= 3.12
# `target_link_options(${PRODUCT_NAME} PUBLIC "${LINK_FRAMEWORKS}")`
# https://cmake.org/cmake/help/git-stage/command/target_link_options.html
set(LINK_FRAMEWORKS "${LINK_FRAMEWORKS} -framework Metal")
set(LINK_FRAMEWORKS "${LINK_FRAMEWORKS} -framework AudioToolBox")
set(LINK_FRAMEWORKS "${LINK_FRAMEWORKS} -framework OpenAL")
set(LINK_FRAMEWORKS "${LINK_FRAMEWORKS} -framework Cocoa")
set(LINK_FRAMEWORKS "${LINK_FRAMEWORKS} -framework OpenGL")
set(LINK_FRAMEWORKS "${LINK_FRAMEWORKS} -framework QuartzCore")
set(LINK_FRAMEWORKS "${LINK_FRAMEWORKS} -framework IOKit")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LINK_FRAMEWORKS}")
endif()

set_target_properties(${PRODUCT_NAME} PROPERTIES
# Change working directory in Visual Studio
VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"

# Xcode
XCODE_ATTRIBUTE_GCC_OPTIMIZATION_LEVEL[variant=Debug] "0" # -O0
XCODE_ATTRIBUTE_GCC_OPTIMIZATION_LEVEL[variant=Release] "3" # -O3
XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH[variant=Debug] "YES"
XCODE_ATTRIBUTE_COMBINE_HIDPI_IMAGES "YES"

XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.llvm.clang.1_0"
XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++17"
XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++"
XCODE_ATTRIBUTE_MACOSX_DEPLOYMENT_TARGET "10.11"

MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_LIST_DIR}/Platform.Cocoa/Info.plist
XCODE_ATTRIBUTE_LD_RUNPATH_SEARCH_PATHS "$(inherited) @loader_path @executable_path/../Frameworks"

# Warnings (Clang)
XCODE_ATTRIBUTE_CLANG_WARN_BOOL_CONVERSION "YES"
XCODE_ATTRIBUTE_CLANG_WARN_CONSTANT_CONVERSION "YES"
XCODE_ATTRIBUTE_CLANG_WARN_EMPTY_BODY "YES"
XCODE_ATTRIBUTE_CLANG_WARN_ENUM_CONVERSION "YES"
XCODE_ATTRIBUTE_CLANG_WARN_INT_CONVERSION "YES"
XCODE_ATTRIBUTE_CLANG_WARN_UNREACHABLE_CODE "YES"

# Warnings (GCC and Clang)
XCODE_ATTRIBUTE_GCC_WARN_64_TO_32_BIT_CONVERSION "YES"
XCODE_ATTRIBUTE_GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS "YES"
XCODE_ATTRIBUTE_GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS "YES"
XCODE_ATTRIBUTE_GCC_WARN_ABOUT_MISSING_NEWLINE "YES"
XCODE_ATTRIBUTE_GCC_WARN_ABOUT_RETURN_TYPE "YES_ERROR"
XCODE_ATTRIBUTE_GCC_WARN_CHECK_SWITCH_STATEMENTS "YES"
XCODE_ATTRIBUTE_GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS "YES"
XCODE_ATTRIBUTE_GCC_WARN_MISSING_PARENTHESES "YES"
XCODE_ATTRIBUTE_GCC_WARN_NON_VIRTUAL_DESTRUCTOR "YES"
XCODE_ATTRIBUTE_GCC_WARN_SHADOW "YES"
XCODE_ATTRIBUTE_GCC_WARN_SIGN_COMPARE "YES"
XCODE_ATTRIBUTE_GCC_WARN_TYPECHECK_CALLS_TO_PRINTF "YES"
XCODE_ATTRIBUTE_GCC_WARN_UNINITIALIZED_AUTOS "YES_AGGRESSIVE"
XCODE_ATTRIBUTE_GCC_WARN_UNKNOWN_PRAGMAS "YES"
XCODE_ATTRIBUTE_GCC_WARN_UNUSED_FUNCTION "YES"
XCODE_ATTRIBUTE_GCC_WARN_UNUSED_LABEL "YES"
XCODE_ATTRIBUTE_GCC_WARN_UNUSED_VALUE "YES"
XCODE_ATTRIBUTE_GCC_WARN_UNUSED_VARIABLE "YES"

# Warnings - Objective-C
XCODE_ATTRIBUTE_CLANG_WARN_DIRECT_OBJC_ISA_USAGE "YES_ERROR"
XCODE_ATTRIBUTE_CLANG_WARN__DUPLICATE_METHOD_MATCH "YES"
XCODE_ATTRIBUTE_GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL "YES"
XCODE_ATTRIBUTE_GCC_WARN_UNDECLARED_SELECTOR "YES"
XCODE_ATTRIBUTE_CLANG_WARN_OBJC_ROOT_CLASS "YES_ERROR"

# Warning Policies
XCODE_ATTRIBUTE_GCC_TREAT_WARNINGS_AS_ERRORS "YES"

# Symbols
XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC "YES"
XCODE_ATTRIBUTE_GCC_INLINES_ARE_PRIVATE_EXTERN "YES" # -fvisibility-inlines-hidden
XCODE_ATTRIBUTE_GCC_SYMBOLS_PRIVATE_EXTERN "YES" # -fvisibility=hidden
)

if(NOT POMDOG_BUILD_TARGET_ALL)
add_subdirectory(${POMDOG_DIR}/build/pomdog ${CMAKE_CURRENT_BINARY_DIR}/pomdog_build)
endif()
target_link_libraries(${PRODUCT_NAME} pomdog_static)
92 changes: 92 additions & 0 deletions examples/FeatureShowcase/Content/Fonts/NotoSans/LICENSE_OFL.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
This Font Software is licensed under the SIL Open Font License,
Version 1.1.

This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL

-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font
creation efforts of academic and linguistic communities, and to
provide a free and open framework in which fonts may be shared and
improved in partnership with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply to
any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software
components as distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to,
deleting, or substituting -- in part or in whole -- any of the
components of the Original Version, by changing formats or by porting
the Font Software to a new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed,
modify, redistribute, and sell modified and unmodified copies of the
Font Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components, in
Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the
corresponding Copyright Holder. This restriction only applies to the
primary font name as presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created using
the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions examples/FeatureShowcase/Platform.Cocoa/AppDelegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#import <Cocoa/Cocoa.h>

@interface AppDelegate : NSObject <NSApplicationDelegate>

@end
Loading

0 comments on commit 03dbe2c

Please sign in to comment.