Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SFMLの本番ビルド対応 #95

Merged
merged 3 commits into from
Jan 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
root = true

[*]
charset = utf-8-bom
end_of_line = lf
indent_size = 4
indent_style = space
trim_trailing_whitespace = true
insert_final_newline = true

[*.tsv]
insert_final_newline = false
75 changes: 62 additions & 13 deletions Projects/MapViewer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,76 @@ cmake_minimum_required(VERSION 3.16)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# os
if(APPLE)
set(OS "macOS")
elseif(UNIX)
set(OS "Ubuntu")
else()
message(FATAL_ERROR "Unsupported OS")
endif()

include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/../../Library
${CMAKE_CURRENT_SOURCE_DIR}/../../ExternalLibrary
)

find_package(SFML 2.5 COMPONENTS graphics)
if(SFML_FOUND)
add_executable(SFMLMapviewer CMake/SFML/Main.cpp)
target_link_libraries(SFMLMapviewer sfml-graphics)
set(SOURCE_TSV_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${OS}/Config.tsv")
set(DESTINATION_DIR "${CMAKE_CURRENT_BINARY_DIR}")

set(SOURCE_TSV_FILE "${CMAKE_CURRENT_SOURCE_DIR}/CMake/Config.tsv")
set(DESTINATION_DIR "${CMAKE_CURRENT_BINARY_DIR}")
set(PAXS_BUILD_TYPE "Development" CACHE STRING "Choose the type of build (Development or Production)")

set(PAXS_BUILD_TYPE "Development" CACHE STRING "Choose the type of build (Development or Production)")
# Devビルドの場合
if(PAXS_BUILD_TYPE STREQUAL "Development")
if(PAXS_BUILD_TYPE STREQUAL "Development")
find_package(SFML 2.5 COMPONENTS graphics)
if(SFML_FOUND)
add_executable(SFMLMapviewer ${OS}/SFML_2.6.1/Main.cpp)
target_link_libraries(SFMLMapviewer sfml-graphics)
add_definitions(-DPAXS_DEVELOPMENT)
add_custom_command(
TARGET SFMLMapviewer POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${SOURCE_TSV_FILE} ${DESTINATION_DIR}
)
endif()
elseif(PAXS_BUILD_TYPE STREQUAL "Production")
if(APPLE)
set(SFML_INCLUDE_DIR "${OS}/SFML_2.6.1/include")
set(SFML_LIBRARY_DIR "${OS}/SFML_2.6.1/lib")

include_directories(${SFML_INCLUDE_DIR})

add_executable(SFMLMapviewer ${OS}/SFML_2.6.1/Main.cpp)

target_link_directories(SFMLMapviewer PRIVATE ${SFML_LIBRARY_DIR})
target_link_libraries(SFMLMapviewer sfml-graphics.2.6.1 sfml-window.2.6.1 sfml-system.2.6.1)
add_custom_command(
TARGET SFMLMapviewer POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${SOURCE_TSV_FILE} ${DESTINATION_DIR}
)

set_target_properties(SFMLMapviewer PROPERTIES
INSTALL_RPATH "@executable_path/../Resources/SFML/lib"
BUILD_WITH_INSTALL_RPATH TRUE
)
elseif(UNIX)
find_package(SFML 2.5 COMPONENTS graphics)

add_custom_command(
TARGET SFMLMapviewer POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${SOURCE_TSV_FILE} ${DESTINATION_DIR}
)
add_executable(PAXS ${OS}/SFML/Main.cpp)
target_link_libraries(PAXS sfml-graphics)

add_custom_command(
TARGET PAXS POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${SOURCE_TSV_FILE} ${DESTINATION_DIR}
)

install(FILES ${DESTINATION_DIR}/Config.tsv DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${OS}/Data DESTINATION ${CMAKE_CURRENT_BINARY_DIR})

set(CPACK_GENERATOR "DEB")
set(CPACK_PACKAGE_NAME "PAX SAPIENTICA")
set(CPACK_PACKAGE_VERSION "1.0.0")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "PAX SAPIENTICA")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libsfml-dev")

include(CPack)
endif()
endif()
1 change: 1 addition & 0 deletions Projects/MapViewer/Ubuntu/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Data
2 changes: 2 additions & 0 deletions Projects/MapViewer/Ubuntu/Config.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
key value
asset_file ./
1 change: 1 addition & 0 deletions Projects/MapViewer/Ubuntu/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ここにDataフォルダを作成し、必要なファイルを配置してください。
23 changes: 23 additions & 0 deletions Projects/MapViewer/Ubuntu/SFML/Main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*##########################################################################################

PAX SAPIENTICA Library 💀🌿🌏

[Planning] 2023-2024 As Project
[Production] 2023-2024 As Project
[Contact Us] wanotaitei@gmail.com https://github.com/AsPJT/PAX_SAPIENTICA
[License] Distributed under the CC0 1.0. https://creativecommons.org/publicdomain/zero/1.0/

##########################################################################################*/

#define _CRT_SECURE_NO_WARNINGS
#define PAXS_USING_SFML
#include <SFML/Graphics.hpp>
#include <omp.h>
#include <PAX_MAHOROBA/Main.hpp>

// その他の処理 (Windows)
int main() {

paxs::startMain();
return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2023 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
//
////////////////////////////////////////////////////////////

#ifndef SFML_AUDIO_HPP
#define SFML_AUDIO_HPP

////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////

#include <SFML/System.hpp>
#include <SFML/Audio/InputSoundFile.hpp>
#include <SFML/Audio/Listener.hpp>
#include <SFML/Audio/Music.hpp>
#include <SFML/Audio/OutputSoundFile.hpp>
#include <SFML/Audio/Sound.hpp>
#include <SFML/Audio/SoundBuffer.hpp>
#include <SFML/Audio/SoundBufferRecorder.hpp>
#include <SFML/Audio/SoundFileFactory.hpp>
#include <SFML/Audio/SoundFileReader.hpp>
#include <SFML/Audio/SoundFileWriter.hpp>
#include <SFML/Audio/SoundRecorder.hpp>
#include <SFML/Audio/SoundSource.hpp>
#include <SFML/Audio/SoundStream.hpp>


#endif // SFML_AUDIO_HPP

////////////////////////////////////////////////////////////
/// \defgroup audio Audio module
///
/// Sounds, streaming (musics or custom sources), recording,
/// spatialization.
///
////////////////////////////////////////////////////////////
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2023 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
//
////////////////////////////////////////////////////////////

#ifndef SFML_ALRESOURCE_HPP
#define SFML_ALRESOURCE_HPP

////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Audio/Export.hpp>


namespace sf
{
////////////////////////////////////////////////////////////
/// \brief Base class for classes that require an OpenAL context
///
////////////////////////////////////////////////////////////
class SFML_AUDIO_API AlResource
{
protected:

////////////////////////////////////////////////////////////
/// \brief Default constructor
///
////////////////////////////////////////////////////////////
AlResource();

////////////////////////////////////////////////////////////
/// \brief Destructor
///
////////////////////////////////////////////////////////////
~AlResource();
};

} // namespace sf


#endif // SFML_ALRESOURCE_HPP

////////////////////////////////////////////////////////////
/// \class sf::AlResource
/// \ingroup audio
///
/// This class is for internal use only, it must be the base
/// of every class that requires a valid OpenAL context in
/// order to work.
///
////////////////////////////////////////////////////////////
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2023 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
//
////////////////////////////////////////////////////////////

#ifndef SFML_AUDIO_EXPORT_HPP
#define SFML_AUDIO_EXPORT_HPP

////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Config.hpp>


////////////////////////////////////////////////////////////
// Define portable import / export macros
////////////////////////////////////////////////////////////
#if defined(SFML_AUDIO_EXPORTS)

#define SFML_AUDIO_API SFML_API_EXPORT

#else

#define SFML_AUDIO_API SFML_API_IMPORT

#endif


#endif // SFML_AUDIO_EXPORT_HPP
Loading