Переглянути джерело

bundle clang and sfml

opengl-renderer-broken
Martin Dørum 4 роки тому
джерело
коміт
dba1185667

+ 11
- 3
CMakeLists.txt Переглянути файл

@@ -1,8 +1,10 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.0)
project(swan)

find_package(SFML 2.5 COMPONENTS graphics system window REQUIRED)

message(STATUS "SFML is ${SFML_INCLUDE_PATH}")

add_compile_options(-std=c++2a -Wall -Wextra -Wpedantic -Wno-unused-parameter)
if(CMAKE_BUILD_TYPE STREQUAL Debug OR CMAKE_BUILD_TYPE STREQUAL "")
message(STATUS "Build mode: Debug")
@@ -16,13 +18,16 @@ else()
message(FATAL_ERROR "CMAKE_BUILD_TYPE must be Debug or Release.")
endif()

include_directories("${PROJECT_SOURCE_DIR}/libswan/include" "${PROJECT_SOURCE_DIR}/third_party")
include_directories(
${PROJECT_SOURCE_DIR}/libswan/include
${PROJECT_SOURCE_DIR}/third_party)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib;${CMAKE_INSTALL_PREFIX}/swan/libswan")

add_subdirectory(libswan)
add_subdirectory(core.mod)

add_executable(swan src/main.cc)
target_link_libraries(swan libswan sfml-graphics sfml-system sfml-window sfml-audio dl)
target_link_libraries(swan libswan)

set(assets
assets/icon.png
@@ -30,3 +35,6 @@ set(assets
foreach(a ${assets})
configure_file("${a}" "${a}" COPYONLY)
endforeach(a)

install(TARGETS swan DESTINATION swan)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/assets DESTINATION swan)

+ 3
- 0
core.mod/CMakeLists.txt Переглянути файл

@@ -15,3 +15,6 @@ set(assets
foreach(a ${assets})
configure_file("${a}" "${a}" COPYONLY)
endforeach(a)

install(TARGETS core.mod DESTINATION swan/core.mod)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/assets DESTINATION swan/core.mod)

+ 41
- 0
dist/CMakeLists.txt Переглянути файл

@@ -0,0 +1,41 @@
cmake_minimum_required(VERSION 3.0)
project(swan-dist)
include(ExternalProject)

ExternalProject_Add(compiler
GIT_REPOSITORY https://github.com/llvm/llvm-project.git
GIT_TAG llvmorg-9.0.0
GIT_SHALLOW true
GIT_PROGRESS true
SOURCE_SUBDIR llvm
LIST_SEPARATOR ::
CMAKE_ARGS
-DCMAKE_BUILD_TYPE=Release
-DLLVM_ENABLE_PROJECTS=clang::clang-tools-extra::libcxx::libcxxabi::libunwind::compiler-rt::lld
-DCMAKE_INSTALL_PREFIX=${PROJECT_BINARY_DIR}/prefix)

set(PREFIX_DIR ${PROJECT_BINARY_DIR}/prefix)

set(toolchain
-DCMAKE_CXX_COMPILER=${PREFIX_DIR}/bin/clang++
-DCMAKE_C_COMPILER=${PREFIX_DIR}/bin/clang
-DCMAKE_LINKER=${PREFIX_DIR}/bin/lld
-DCMAKE_PREFIX_PATH=${PREFIX})

ExternalProject_Add(sfml
GIT_REPOSITORY https://github.com/SFML/SFML.git
GIT_TAG 2.5.1
GIT_SHALLOW true
GIT_PROGRESS true
CMAKE_ARGS
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX=${PROJECT_BINARY_DIR}/prefix
${toolchain}
DEPENDS compiler)

ExternalProject_Add(swan
SOURCE_DIR ${PROJECT_SOURCE_DIR}/..
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${PROJECT_BINARY_DIR}/prefix
${toolchain}
DEPENDS compiler sfml)

+ 3
- 0
libswan/CMakeLists.txt Переглянути файл

@@ -13,3 +13,6 @@ add_library(libswan SHARED
src/WorldPlane.cc)
target_include_directories(libswan PUBLIC "include/swan")
set_target_properties(libswan PROPERTIES OUTPUT_NAME swan)
target_link_libraries(libswan sfml-graphics sfml-system sfml-window sfml-audio dl)

install(TARGETS libswan DESTINATION swan/libswan)

+ 3
- 1
libswan/include/swan/Vector2.h Переглянути файл

@@ -91,9 +91,11 @@ public:
T x_;
T y_;

static constexpr Vector2<T> ZERO = Vector2<T>(0, 0);
static const Vector2<T> ZERO;
};

template<typename T> const Vector2<T> Vector2<T>::ZERO = Vector2<T>(0, 0);

using Vec2 = Vector2<float>;
using Vec2i = Vector2<int>;


Завантаження…
Відмінити
Зберегти