Build static libraries

This commit is contained in:
Dane Johnson 2021-03-16 13:33:49 -05:00
parent 1fa59c3fad
commit 27cd78510e
6 changed files with 36 additions and 23 deletions

3
.gitignore vendored
View File

@ -1,4 +1,5 @@
*.o *.o
build/ build/
build-win/ build-win/
binaries/ binaries/
dist/

View File

@ -24,6 +24,8 @@ add_dependencies(couchlib shader_headers)
target_include_directories(couchlib target_include_directories(couchlib
PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/shaders/") PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/shaders/")
file(COPY LICENSE CORRESPONDINGSOURCE.txt DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
if(WIN32) if(WIN32)
target_link_libraries(couch glfw3dll) target_link_libraries(couch glfw3dll)
target_link_libraries(couch ssp) target_link_libraries(couch ssp)

View File

@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
set -e set -e
cd `dirname $0`
mkdir -p build mkdir -p build
cd build cd build

View File

@ -16,7 +16,7 @@ if (LUA_ENABLED)
find_package(Lua REQUIRED) find_package(Lua REQUIRED)
endif () endif ()
add_library(couchlib SHARED) add_library(couchlib STATIC)
target_sources(couchlib PUBLIC target_sources(couchlib PUBLIC
Camera.h Camera.h
Camera.cpp Camera.cpp
@ -69,11 +69,8 @@ target_sources(couchlib PUBLIC
Shaders/SkyboxShader.cpp) Shaders/SkyboxShader.cpp)
if (WIN32) add_library(couchlib_luascripting STATIC)
add_library(couchlib_luascripting STATIC)
else ()
add_library(couchlib_luascripting SHARED)
endif ()
target_sources(couchlib_luascripting PUBLIC target_sources(couchlib_luascripting PUBLIC
Scripting/Lua.h Scripting/Lua.h
Scripting/Lua.cpp) Scripting/Lua.cpp)

18
package.sh Executable file
View File

@ -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

View File

@ -4,21 +4,15 @@ set_property(SOURCE couch.i PROPERTY CPLUSPLUS ON)
set_property(SOURCE couch.i PROPERTY USE_TARGET_INCLUDE_DIRECTORIES ON) set_property(SOURCE couch.i PROPERTY USE_TARGET_INCLUDE_DIRECTORIES ON)
if (LUA_ENABLED) if (LUA_ENABLED)
if (NOT WIN32) swig_add_library(couchlua
swig_add_library(couchlua TYPE STATIC
TYPE SHARED LANGUAGE lua
LANGUAGE lua SOURCES couch.i lua/helpers.i)
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_link_libraries(couchlua target_include_directories(couchlua PRIVATE "${PROJECT_SOURCE_DIR}/core")
PRIVATE
couchlib swig_link_libraries(couchlua
${LUA_LIBRARIES}) PRIVATE
couchlib
${LUA_LIBRARIES})
endif () endif ()