Giter VIP home page Giter VIP logo

Comments (5)

jslee02 avatar jslee02 commented on June 25, 2024

According to this comment of the Author, this library is meant to be used as the source code itself rather than binaries. 😄

from lodepng.

tpham3783 avatar tpham3783 commented on June 25, 2024

Understood, but if it is a static library, it is easier for the developer to link to it. Below is a Makefile to compile the library, developers can just link to it with "-static -llodepng" :-)

PREFIX?=/usr
INSTALL?=install

SRC=$(wildcard *.cpp)

SRC:=$(filter-out lodepng_unittest.cpp,$(SRC))
SRC:=$(filter-out lodepng_benchmark.cpp,$(SRC))

OBJS=$(SRC:.cpp=.o)

CXXFLAGS:=-fPIC -Os

TARGET=liblodepng.a liblodepng.so

all: $(TARGET)
	echo "Built libraries $(TARGET) successfully."
	
liblodepng.a: $(OBJS)
	$(AR) $(ARFLAGS) $@ $^
	
	
liblodepng.so: $(OBJS)
	$(CXX) -o $@ -shared $^
	

install: $(TARGET)
	$(INSTALL) lodepng.h lodepng_util.h $(DESTDIR)/$(PREFIX)/include
	
	
clean:
	rm -f $(OBJS) $(TARGET)

from lodepng.

jslee02 avatar jslee02 commented on June 25, 2024

It could be. @lvandeve may have the right answer for you. I just replied as this reminds me the comment. 😓

from lodepng.

lvandeve avatar lvandeve commented on June 25, 2024

Yes, it is only one source file and one header and is intended to be added directly as source files to your project. The source file also has no dependencies. It can also be renamed to have the .c extension to use as pure C only. There is a second source file lodepng_util but it is only needed for edge cases.

There is no makefile, it opens a whole can of worms and requires a lot of maintenance as platforms and popular make systems change. For this simple project, the actual C source is in fact simpler to be multiplatform than a makefile :)

I would suggest to integrate the source files in the build system you are using, it's only 1 file and one header after all.

from lodepng.

jlaumon avatar jlaumon commented on June 25, 2024

What about adding a LODEPNG_API macro to give the user the ability of adding __declspec(dllexport) if needed? (Some other one-file libraries do it that way (eg. dear imgui))

from lodepng.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.