Misc. changes to support Linux builds

This commit is contained in:
Oliver Hamlet
2016-09-18 20:49:42 +01:00
parent 645c2ac47b
commit 459234e91a
2 changed files with 25 additions and 5 deletions
+19 -3
View File
@@ -48,9 +48,15 @@ add_subdirectory(${PYBIND11_EXTRACTED_PATH})
# LOOT API
#######################################
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
set(LOOT_API_URL "https://bintray.com/wrinklyninja/loot/download_file?file_path=loot-api_0.9.2-74-g6809c39_dev.7z")
else()
set(LOOT_API_URL "https://bintray.com/wrinklyninja/loot/download_file?file_path=loot-api_0.9.2-74-g6809c39_dev.tar.xz")
endif()
ExternalProject_Add(loot-api-c++
PREFIX "external"
URL "https://bintray.com/wrinklyninja/loot/download_file?file_path=loot-api_0.9.2-74-g6809c39_dev.7z"
URL ${LOOT_API_URL}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND "")
@@ -81,7 +87,12 @@ ExternalProject_Add(test-masterlist
pybind11_add_module(loot_api "${CMAKE_SOURCE_DIR}/src/main.cpp" "${CMAKE_BINARY_DIR}/generated/wrapper_version.cpp")
add_dependencies(loot_api loot-api-c++ test-masterlist)
target_link_libraries(loot_api PRIVATE ${LOOT_API_STATIC_LIBRARY})
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
target_link_libraries(loot_api PRIVATE ${LOOT_API_STATIC_LIBRARY})
else()
target_link_libraries(loot_api PRIVATE ${LOOT_API_SHARED_LIBRARY})
endif()
########################################
# Testing
@@ -143,7 +154,12 @@ ELSE()
SET (GIT_DESCRIBE_STRING "unknown-version")
ENDIF ()
set(CPACK_GENERATOR "7Z")
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
set(CPACK_GENERATOR "7Z")
else()
set(CPACK_GENERATOR "TXZ")
endif()
set(CPACK_PACKAGE_VERSION ${GIT_DESCRIBE_STRING})
set(CPACK_PACKAGE_DIRECTORY "${CMAKE_BINARY_DIR}/package")
+6 -2
View File
@@ -15,6 +15,7 @@ from loot_api import is_compatible
class GameFixture(unittest.TestCase):
game_path = os.path.join(u'.', u'Oblivion')
local_path = os.path.join(u'.', u'local')
def setUp(self):
data_path = os.path.join(self.game_path, 'Data')
@@ -23,8 +24,11 @@ class GameFixture(unittest.TestCase):
os.makedirs(data_path)
open(master_file, 'a').close()
os.makedirs(self.local_path)
def tearDown(self):
shutil.rmtree(self.game_path)
shutil.rmtree(self.local_path)
class TestLootApi(GameFixture):
def test_is_compatible(self):
@@ -45,7 +49,7 @@ class TestLootApi(GameFixture):
self.assertNotEqual(WrapperVersion.revision, Version.revision)
def test_create_db(self):
db = create_database(GameType.tes4, self.game_path, u'')
db = create_database(GameType.tes4, self.game_path, self.local_path)
self.assertNotEqual(db, None)
class TestDatabaseInterface(GameFixture):
@@ -54,7 +58,7 @@ class TestDatabaseInterface(GameFixture):
def setUp(self):
super(TestDatabaseInterface, self).setUp()
self.db = create_database(GameType.tes4, self.game_path, u'')
self.db = create_database(GameType.tes4, self.game_path, self.local_path)
def test_load_lists(self):
self.db.load_lists(self.masterlist_path, u'')