From 27cd78510e375129f1b7e6d3a56c36cb13fe1cc3 Mon Sep 17 00:00:00 2001 From: Dane Johnson Date: Tue, 16 Mar 2021 13:33:49 -0500 Subject: [PATCH] Build static libraries --- .gitignore | 3 ++- CMakeLists.txt | 2 ++ cmake-builds.sh | 1 + core/CMakeLists.txt | 9 +++------ package.sh | 18 ++++++++++++++++++ scripting/CMakeLists.txt | 26 ++++++++++---------------- 6 files changed, 36 insertions(+), 23 deletions(-) create mode 100755 package.sh diff --git a/.gitignore b/.gitignore index dc28286..b7a61e6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *.o build/ build-win/ -binaries/ \ No newline at end of file +binaries/ +dist/ \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 470bd18..004895c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,8 @@ add_dependencies(couchlib shader_headers) target_include_directories(couchlib PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/shaders/") +file(COPY LICENSE CORRESPONDINGSOURCE.txt DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") + if(WIN32) target_link_libraries(couch glfw3dll) target_link_libraries(couch ssp) diff --git a/cmake-builds.sh b/cmake-builds.sh index e86b99f..652d414 100755 --- a/cmake-builds.sh +++ b/cmake-builds.sh @@ -1,6 +1,7 @@ #!/bin/bash set -e +cd `dirname $0` mkdir -p build cd build diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index a1c0d6f..a075026 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -16,7 +16,7 @@ if (LUA_ENABLED) find_package(Lua REQUIRED) endif () -add_library(couchlib SHARED) +add_library(couchlib STATIC) target_sources(couchlib PUBLIC Camera.h Camera.cpp @@ -69,11 +69,8 @@ target_sources(couchlib PUBLIC Shaders/SkyboxShader.cpp) -if (WIN32) - add_library(couchlib_luascripting STATIC) -else () - add_library(couchlib_luascripting SHARED) -endif () +add_library(couchlib_luascripting STATIC) + target_sources(couchlib_luascripting PUBLIC Scripting/Lua.h Scripting/Lua.cpp) diff --git a/package.sh b/package.sh new file mode 100755 index 0000000..4749080 --- /dev/null +++ b/package.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +set -e +cd `dirname $0` + +mkdir -p dist + +mkdir -p build +cd build +cmake .. -DCMAKE_BUILD_TYPE=Release +make +rm -f couch-linux.tgz +tar cvzf couch-linux.tgz \ + couch \ + CORRESPONDINGSOURCE.txt \ + LICENSE +mv couch-linux.tgz ../dist + diff --git a/scripting/CMakeLists.txt b/scripting/CMakeLists.txt index 94e84ae..bd8ae6d 100644 --- a/scripting/CMakeLists.txt +++ b/scripting/CMakeLists.txt @@ -4,21 +4,15 @@ set_property(SOURCE couch.i PROPERTY CPLUSPLUS ON) set_property(SOURCE couch.i PROPERTY USE_TARGET_INCLUDE_DIRECTORIES ON) if (LUA_ENABLED) - if (NOT WIN32) - swig_add_library(couchlua - TYPE SHARED - LANGUAGE lua - SOURCES couch.i lua/helpers.i) - else() - swig_add_library(couchlua - TYPE STATIC - LANGUAGE lua - SOURCES couch.i lua/helpers.i) - endif() -target_include_directories(couchlua PRIVATE "${PROJECT_SOURCE_DIR}/core") + swig_add_library(couchlua + TYPE STATIC + LANGUAGE lua + SOURCES couch.i lua/helpers.i) -swig_link_libraries(couchlua - PRIVATE - couchlib - ${LUA_LIBRARIES}) + target_include_directories(couchlua PRIVATE "${PROJECT_SOURCE_DIR}/core") + + swig_link_libraries(couchlua + PRIVATE + couchlib + ${LUA_LIBRARIES}) endif ()