forked from tastytea/libravatarserv
First test: Output png
This commit is contained in:
parent
fd395355fb
commit
a0ecad23d9
|
@ -5,6 +5,8 @@ project(libravatarserv
|
||||||
)
|
)
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
find_package(PkgConfig REQUIRED)
|
||||||
|
pkg_check_modules(LIBPNG REQUIRED libpng)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 14)
|
set(CMAKE_CXX_STANDARD 14)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
@ -13,6 +15,9 @@ set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -g -Og")
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -g -Og")
|
||||||
|
|
||||||
include_directories(${PROJECT_BINARY_DIR})
|
include_directories(${PROJECT_BINARY_DIR})
|
||||||
|
include_directories(${LIBPNG_INCLUDE_DIRS})
|
||||||
|
|
||||||
|
link_directories(${LIBPNG_LIBRARY_DIRS})
|
||||||
|
|
||||||
# Write version in header
|
# Write version in header
|
||||||
configure_file(
|
configure_file(
|
||||||
|
@ -22,5 +27,5 @@ configure_file(
|
||||||
|
|
||||||
file(GLOB sources src/*.cpp)
|
file(GLOB sources src/*.cpp)
|
||||||
add_executable(${CMAKE_PROJECT_NAME} ${sources})
|
add_executable(${CMAKE_PROJECT_NAME} ${sources})
|
||||||
#target_link_libraries(${CMAKE_PROJECT_NAME})
|
target_link_libraries(${CMAKE_PROJECT_NAME} ${LIBPNG_LIBRARIES})
|
||||||
install(TARGETS ${CMAKE_PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
|
install(TARGETS ${CMAKE_PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||||
|
|
|
@ -14,14 +14,20 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cstdlib> // getenv()
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <cstdlib> // getenv()
|
||||||
|
#include <png++/png.hpp>
|
||||||
|
|
||||||
using std::cout;
|
using std::cout;
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
cout << "Content-type: text/plain\r\n\r\n";
|
cout << "Content-type: image/png\r\n\r\n";
|
||||||
cout << std::getenv("REQUEST_URI") << "\r\n";
|
cout << std::getenv("REQUEST_URI") << "\r\n";
|
||||||
|
|
||||||
|
png::image<png::rgba_pixel> image(argv[1]);
|
||||||
|
|
||||||
|
image.write("/dev/stdout");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue