Skip to content

Commit

Permalink
🎨 Convert to a header-only library (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
AnotherFoxGuy authored Jan 12, 2021
1 parent f7fe317 commit c7b0151
Show file tree
Hide file tree
Showing 19 changed files with 1,090 additions and 1,404 deletions.
24 changes: 24 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignTrailingComments: true
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: true
AllowShortIfStatementsOnASingleLine: WithoutElse
BasedOnStyle: Microsoft
BreakBeforeBraces: Allman
ColumnLimit: 130
Cpp11BracedListStyle: true
FixNamespaceComments: true
IncludeBlocks: Regroup
IndentPPDirectives: BeforeHash
IndentWidth: 4
Language: Cpp
NamespaceIndentation: All
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesInParentheses: false
Standard: c++11
UseTab: Never
21 changes: 21 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Build & Test
on: [ push, pull_request ]
jobs:
build:
name: Testing on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
steps:
- uses: actions/checkout@v1

- name: Configure
run: cmake -DBUILD_TEST=ON .

- name: Build
run: cmake --build .

- name: Test
run: ctest -C Debug .
40 changes: 0 additions & 40 deletions .travis.yml

This file was deleted.

25 changes: 0 additions & 25 deletions .travis/install.sh

This file was deleted.

13 changes: 0 additions & 13 deletions .travis/run.sh

This file was deleted.

38 changes: 2 additions & 36 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,55 +1,21 @@
#-------------------------------------------------------
# moFileReader Main Build Script
#
# Defined Variables:
# - COMPILE_DLL
# - ON : Compiles the code as a shared Library
# - OFF : Compiles the code as a static Library
# - BUILD_DEBUG
# - ON : Compiles Debug-Information into the output
# - OFF : Optimizes the compilation with O2.
#
# Run cmake with -DVARNAME=ON/OFF to benefit from those
# possible settings.
#-------------------------------------------------------
cmake_minimum_required(VERSION 3.0)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_CXX_STANDARD 11)

project(moFileReader)

# Let the user choose between static lib and dll
# To use it, call cmake -DCOMPILE_DLL=ON
option(COMPILE_DLL "Set this to ON if you want to compile the library as an DLL. When this is OFF, a static library is created (default)." OFF)
if (COMPILE_DLL)
# DLL
target_compile_definitions(moReader PRIVATE _USRDLL MOFILE_EXPORTS)
endif ()

add_library(moFileReader STATIC ${CMAKE_SOURCE_DIR}/src/moFileReader.cpp ${CMAKE_SOURCE_DIR}/src/mo.cpp)
add_executable(moReader ${CMAKE_SOURCE_DIR}/src/mo.cpp)

target_include_directories(moFileReader PRIVATE ${CMAKE_SOURCE_DIR}/include)
target_include_directories(moReader PRIVATE ${CMAKE_SOURCE_DIR}/include)

if (COMPILE_DLL)
target_compile_definitions(moReader PRIVATE _CONSOLE MOFILE_IMPORT)
else ()
target_compile_definitions(moReader PRIVATE _CONSOLE)
endif ()

add_dependencies(moReader moFileReader)
target_link_libraries(moReader moFileReader)

install(TARGETS moReader
RUNTIME DESTINATION bin
)
install(TARGETS moFileReader
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
PUBLIC_HEADER DESTINATION include
)

install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/ DESTINATION include/)

option(BUILD_TEST "Set this to ON if you want to build the test" OFF)
Expand Down
30 changes: 0 additions & 30 deletions appveyor.yml

This file was deleted.

7 changes: 0 additions & 7 deletions build.py

This file was deleted.

17 changes: 17 additions & 0 deletions cmake/FindCatch2.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
set(Catch2_FOUND TRUE)

set(CATCH2_VERSION "v2.13.4")
set(CATCH2_INCLUDEDIR "${CMAKE_BINARY_DIR}/catch-${CATCH2_VERSION}")
list(APPEND CMAKE_MODULE_PATH "${CATCH2_INCLUDEDIR}")

if (NOT EXISTS "${CATCH2_INCLUDEDIR}/catch.hpp")
file(MAKE_DIRECTORY "${CATCH2_INCLUDEDIR}")
message(STATUS "Downloading catch.hpp from https://github.com/catchorg/Catch2/")
file(DOWNLOAD "https://github.com/catchorg/Catch2/releases/download/${CATCH2_VERSION}/catch.hpp" "${CATCH2_INCLUDEDIR}/catch.hpp")
file(DOWNLOAD "https://cdn.statically.io/gh/catchorg/Catch2/${CATCH2_VERSION}/contrib/Catch.cmake" "${CATCH2_INCLUDEDIR}/Catch.cmake")
file(DOWNLOAD "https://cdn.statically.io/gh/catchorg/Catch2/${CATCH2_VERSION}/contrib/CatchAddTests.cmake" "${CATCH2_INCLUDEDIR}/CatchAddTests.cmake")
file(DOWNLOAD "https://cdn.statically.io/gh/catchorg/Catch2/${CATCH2_VERSION}/contrib/ParseAndAddCatchTests.cmake" "${CATCH2_INCLUDEDIR}/ParseAndAddCatchTests.cmake")
endif ()

add_library(Catch2::Catch2 INTERFACE IMPORTED)
set_target_properties(Catch2::Catch2 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CATCH2_INCLUDEDIR}")
22 changes: 6 additions & 16 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,14 @@
from conans import ConanFile, CMake, tools
import os
from conans import ConanFile


class MofilereaderConan(ConanFile):
name = "MofileReader"
version = "1.0.0"
version = "1.1.0"
license = "MIT"
url = "https://github.com/AnotherFoxGuy/conan-MofileReader/"
url = "https://github.com/AnotherFoxGuy/MofileReader/"
description = "This API lets you read .mo-Files and use their content just as you would do with GNUs gettext."
settings = "os", "compiler", "build_type", "arch"
exports_sources = "include*", "src*", "CMakeLists.txt"


def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
exports_sources = "include*"

def package(self):
cmake = CMake(self)
cmake.install()

def package_info(self):
self.cpp_info.libs = tools.collect_libs(self)
self.copy("*.hpp", "include", "include")
69 changes: 0 additions & 69 deletions include/moFileConfig.h

This file was deleted.

Loading

0 comments on commit c7b0151

Please sign in to comment.