Skip to content

Commit

Permalink
fix cmake dependency and move headers to include
Browse files Browse the repository at this point in the history
  • Loading branch information
Lectem committed Nov 5, 2016
1 parent 0d77ab2 commit 32f7f18
Show file tree
Hide file tree
Showing 35 changed files with 130 additions and 90 deletions.
73 changes: 39 additions & 34 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -301,16 +301,16 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL Linux)
endif()
endif()

option(WITH_STATIC "Compile static linked library" OFF)
if(WITH_STATIC)
add_library(${LIBRARY_NAME} STATIC ${SRC_FILES} ${SRC_ADDITIONAL_FILES})
target_link_libraries(${LIBRARY_NAME} ${LINK_LIBS})
else()
add_library(${LIBRARY_NAME} SHARED ${SRC_FILES} ${SRC_ADDITIONAL_FILES})
target_link_libraries(${LIBRARY_NAME} ${LINK_LIBS})
option(BUILD_SHARED_LIBS "Compile shared libraries" OFF)

add_library(${LIBRARY_NAME} ${SRC_FILES} ${SRC_ADDITIONAL_FILES})
target_link_libraries(${LIBRARY_NAME} ${LINK_LIBS})
target_compile_definitions(${LIBRARY_NAME} PUBLIC -D__STORMLIB_NO_AUTO_LINK__) #CMake should take care of the linking
target_include_directories(${LIBRARY_NAME} PUBLIC include/)
set_target_properties(${LIBRARY_NAME} PROPERTIES PUBLIC_HEADER "include/StormLib.h;include/StormPort.h")
if(BUILD_SHARED_LIBS)
if(APPLE)
set_target_properties(${LIBRARY_NAME} PROPERTIES FRAMEWORK true)
set_target_properties(${LIBRARY_NAME} PROPERTIES PUBLIC_HEADER "src/StormLib.h src/StormPort.h")
set_target_properties(${LIBRARY_NAME} PROPERTIES LINK_FLAGS "-framework Carbon")
endif()
if(UNIX)
Expand All @@ -326,37 +326,42 @@ else()
if(WIN32)
set_target_properties(${LIBRARY_NAME} PROPERTIES OUTPUT_NAME StormLib)
endif()
endif()
install(TARGETS ${LIBRARY_NAME}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
FRAMEWORK DESTINATION /Library/Frameworks
PUBLIC_HEADER DESTINATION include
INCLUDES DESTINATION include)

install(TARGETS ${LIBRARY_NAME} RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib FRAMEWORK DESTINATION /Library/Frameworks)

#CPack configurtion
SET(CPACK_GENERATOR "DEB" "RPM")
SET(CPACK_PACKAGE_NAME ${PROJECT_NAME})
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MPQ manipulation library")
SET(CPACK_PACKAGE_VENDOR "Ladislav Zezula")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
SET(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}")
SET(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}")
SET(CPACK_PACKAGE_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}")
#CPack configurtion
SET(CPACK_GENERATOR "DEB" "RPM")
SET(CPACK_PACKAGE_NAME ${PROJECT_NAME})
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MPQ manipulation library")
SET(CPACK_PACKAGE_VENDOR "Ladislav Zezula")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
SET(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}")
SET(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}")
SET(CPACK_PACKAGE_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}")

#DEB configuration
SET(CPACK_DEBIAN_PACKAGE_SECTION "libs")
SET(CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://www.zezula.net/en/mpq/stormlib.html")
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "[email protected]")
SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "zlib1g,bzip2")
#DEB configuration
SET(CPACK_DEBIAN_PACKAGE_SECTION "libs")
SET(CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://www.zezula.net/en/mpq/stormlib.html")
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "[email protected]")
SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "zlib1g,bzip2")

#RPM configuration
SET(CPACK_RPM_PACKAGE_RELEASE 1)
SET(CPACK_RPM_PACKAGE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
SET(CPACK_RPM_PACKAGE_GROUP "${PROJECT_NAME}")
SET(CPACK_RPM_PACKAGE_URL "http://www.zezula.net/en/mpq/stormlib.html")
SET(CPACK_RPM_PACKAGE_REQUIRES "zlib,bzip2")
#RPM configuration
SET(CPACK_RPM_PACKAGE_RELEASE 1)
SET(CPACK_RPM_PACKAGE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
SET(CPACK_RPM_PACKAGE_GROUP "${PROJECT_NAME}")
SET(CPACK_RPM_PACKAGE_URL "http://www.zezula.net/en/mpq/stormlib.html")
SET(CPACK_RPM_PACKAGE_REQUIRES "zlib,bzip2")

INCLUDE(CPack)
INCLUDE(CPack)

endif()

option(WITH_TEST "Compile Test application" OFF)
if(WITH_TEST)
Expand Down
6 changes: 3 additions & 3 deletions Makefile.linux
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ AR = ar
DFLAGS = -D__SYS_ZLIB
OFLAGS =
LFLAGS = -lbz2 -lz
CFLAGS = -fPIC -D_7ZIP_ST
CFLAGS = -fPIC -D_7ZIP_ST -Iinclude
CFLAGS += $(OFLAGS) $(DFLAGS)

OBJS = src/adpcm/adpcm.o \
Expand Down Expand Up @@ -292,6 +292,6 @@ all: $(LIB)
install: $(LIB)
install $(LIB) /usr/local/lib
mkdir -p /usr/local/include/StormLib
cp src/StormLib.h /usr/local/include/StormLib
cp src/StormPort.h /usr/local/include/StormLib
cp include/StormLib.h /usr/local/include/StormLib
cp include/StormPort.h /usr/local/include/StormLib
ldconfig
2 changes: 1 addition & 1 deletion Makefile.mac
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

CPP = g++
CC = gcc
CFLAGS = -Wall
CFLAGS = -Wall -Iinclude
LFLAGS = -lbz2 -lz -framework Carbon
ARCH = -arch x86_64
DFLAGS = -D__SYS_BZLIB -D__SYS_ZLIB -D_7ZIP_ST
Expand Down
2 changes: 2 additions & 0 deletions Premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ solution 'StormLib'
'src/pklib/crc32.c',
'src/zlib/compress.c',
}

includedirs { "include" }

filter 'configurations:Debug*'
flags { 'Symbols' }
Expand Down
20 changes: 18 additions & 2 deletions StormLib_vs12.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@
<PrecompiledHeader />
<WarningLevel>Level1</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>include</AdditionalIncludeDirectories>
</ClCompile>
<Lib>
<OutputFile>./bin/$(ProjectName)/$(Platform)/$(Configuration)/$(TargetName).lib</OutputFile>
Expand All @@ -334,6 +335,7 @@
<PrecompiledHeader />
<WarningLevel>Level1</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>include</AdditionalIncludeDirectories>
</ClCompile>
<Lib>
<OutputFile>./bin/$(ProjectName)/$(Platform)/$(Configuration)/$(TargetName).lib</OutputFile>
Expand All @@ -352,6 +354,7 @@
<PrecompiledHeader />
<WarningLevel>Level1</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>include</AdditionalIncludeDirectories>
</ClCompile>
<Lib>
<OutputFile>./bin/$(ProjectName)/$(Platform)/$(Configuration)/$(TargetName).lib</OutputFile>
Expand All @@ -373,6 +376,7 @@
<PrecompiledHeader />
<WarningLevel>Level1</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>include</AdditionalIncludeDirectories>
</ClCompile>
<Lib>
<OutputFile>./bin/$(ProjectName)/$(Platform)/$(Configuration)/$(TargetName).lib</OutputFile>
Expand All @@ -389,6 +393,7 @@
<PrecompiledHeader />
<WarningLevel>Level1</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>include</AdditionalIncludeDirectories>
</ClCompile>
<Lib>
<OutputFile>./bin/$(ProjectName)/$(Platform)/$(Configuration)/$(TargetName).lib</OutputFile>
Expand All @@ -408,6 +413,7 @@
<PrecompiledHeader />
<WarningLevel>Level1</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>include</AdditionalIncludeDirectories>
</ClCompile>
<Lib>
<OutputFile>./bin/$(ProjectName)/$(Platform)/$(Configuration)/$(TargetName).lib</OutputFile>
Expand All @@ -424,6 +430,7 @@
<PrecompiledHeader />
<WarningLevel>Level1</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>include</AdditionalIncludeDirectories>
</ClCompile>
<Lib>
<OutputFile>./bin/$(ProjectName)/$(Platform)/$(Configuration)/$(TargetName).lib</OutputFile>
Expand All @@ -443,6 +450,7 @@
<PrecompiledHeader />
<WarningLevel>Level1</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>include</AdditionalIncludeDirectories>
</ClCompile>
<Lib>
<OutputFile>./bin/$(ProjectName)/$(Platform)/$(Configuration)/$(TargetName).lib</OutputFile>
Expand All @@ -461,6 +469,7 @@
<PrecompiledHeader />
<WarningLevel>Level1</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>include</AdditionalIncludeDirectories>
</ClCompile>
<Lib>
<OutputFile>./bin/$(ProjectName)/$(Platform)/$(Configuration)/$(TargetName).lib</OutputFile>
Expand All @@ -482,6 +491,7 @@
<PrecompiledHeader />
<WarningLevel>Level1</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>include</AdditionalIncludeDirectories>
</ClCompile>
<Lib>
<OutputFile>./bin/$(ProjectName)/$(Platform)/$(Configuration)/$(TargetName).lib</OutputFile>
Expand All @@ -500,6 +510,7 @@
<PrecompiledHeader />
<WarningLevel>Level1</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>include</AdditionalIncludeDirectories>
</ClCompile>
<Lib>
<OutputFile>./bin/$(ProjectName)/$(Platform)/$(Configuration)/$(TargetName).lib</OutputFile>
Expand All @@ -521,6 +532,7 @@
<PrecompiledHeader />
<WarningLevel>Level1</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>include</AdditionalIncludeDirectories>
</ClCompile>
<Lib>
<OutputFile>./bin/$(ProjectName)/$(Platform)/$(Configuration)/$(TargetName).lib</OutputFile>
Expand All @@ -537,6 +549,7 @@
<PrecompiledHeader />
<WarningLevel>Level1</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>include</AdditionalIncludeDirectories>
</ClCompile>
<Lib>
<OutputFile>./bin/$(ProjectName)/$(Platform)/$(Configuration)/$(TargetName).lib</OutputFile>
Expand All @@ -556,6 +569,7 @@
<PrecompiledHeader />
<WarningLevel>Level1</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>include</AdditionalIncludeDirectories>
</ClCompile>
<Lib>
<OutputFile>./bin/$(ProjectName)/$(Platform)/$(Configuration)/$(TargetName).lib</OutputFile>
Expand All @@ -572,6 +586,7 @@
<PrecompiledHeader />
<WarningLevel>Level1</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>include</AdditionalIncludeDirectories>
</ClCompile>
<Lib>
<OutputFile>./bin/$(ProjectName)/$(Platform)/$(Configuration)/$(TargetName).lib</OutputFile>
Expand All @@ -591,6 +606,7 @@
<PrecompiledHeader />
<WarningLevel>Level1</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>include</AdditionalIncludeDirectories>
</ClCompile>
<Lib>
<OutputFile>./bin/$(ProjectName)/$(Platform)/$(Configuration)/$(TargetName).lib</OutputFile>
Expand All @@ -606,8 +622,8 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\StormCommon.h" />
<ClInclude Include="src\StormLib.h" />
<ClInclude Include="src\StormPort.h" />
<ClInclude Include="include\StormLib.h" />
<ClInclude Include="include\StormPort.h" />
<ClInclude Include="src\adpcm\adpcm.h" />
<ClInclude Include="src\huffman\huff.h" />
<ClInclude Include="src\pklib\pklib.h" />
Expand Down
4 changes: 2 additions & 2 deletions StormLib_vs12.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@
<ClInclude Include="src\StormCommon.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\StormLib.h">
<ClInclude Include="include\StormLib.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\StormPort.h">
<ClInclude Include="include\StormPort.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\adpcm\adpcm.h">
Expand Down
Loading

0 comments on commit 32f7f18

Please sign in to comment.