2017-03-20 01:09:38 +01:00
|
|
|
if (NOT WIN32)
|
2019-12-11 00:50:44 +01:00
|
|
|
set(CMAKE_C_FLAGS "--std=gnu99 -fPIC -Wno-nullability-completeness ${CMAKE_C_FLAGS}")
|
2018-12-26 16:05:14 +01:00
|
|
|
else ()
|
2017-03-20 01:09:38 +01:00
|
|
|
set(CMAKE_C_FLAGS "--std=gnu99 ${CMAKE_C_FLAGS}")
|
2018-12-26 16:05:14 +01:00
|
|
|
endif ()
|
2016-11-13 15:15:41 +01:00
|
|
|
|
2019-01-31 10:08:54 +01:00
|
|
|
if (APPLE)
|
|
|
|
find_library(zopflipng zopflipng /usr/local/lib)
|
|
|
|
find_library(jpeg jpeg /usr/local/opt/mozjpeg/lib)
|
|
|
|
find_library(turbojpeg turbojpeg /usr/local/opt/mozjpeg/lib)
|
|
|
|
ELSE()
|
|
|
|
find_library(zopflipng zopflipng /usr/lib)
|
|
|
|
find_library(jpeg jpeg /opt/mozjpeg/lib)
|
|
|
|
find_library(turbojpeg turbojpeg /opt/mozjpeg/lib)
|
|
|
|
ENDIF()
|
2016-11-04 11:00:04 +01:00
|
|
|
|
2017-12-29 23:09:13 +01:00
|
|
|
add_library(caesium SHARED caesium.c error.c utils.c png.c vendor/lodepng.c jpeg.c)
|
2016-11-13 14:43:54 +01:00
|
|
|
|
2018-12-26 16:05:14 +01:00
|
|
|
target_link_libraries(caesium jpeg turbojpeg zopflipng)
|
2016-11-14 09:35:45 +01:00
|
|
|
|
2016-11-04 11:00:04 +01:00
|
|
|
# Make sure the compiler can find include files for our Caesium library
|
|
|
|
# when other libraries or executables link to Caesium
|
2016-11-14 09:35:45 +01:00
|
|
|
target_include_directories(caesium PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
2016-11-15 09:47:09 +01:00
|
|
|
|
2017-03-17 10:49:15 +01:00
|
|
|
# OSX installs in local
|
2017-03-17 10:55:26 +01:00
|
|
|
if (APPLE)
|
2017-03-18 22:54:39 +01:00
|
|
|
install(FILES caesium.h DESTINATION /usr/local/include)
|
2019-09-28 20:07:31 +02:00
|
|
|
install(TARGETS caesium
|
|
|
|
LIBRARY DESTINATION /usr/local/lib)
|
2017-03-18 22:15:40 +01:00
|
|
|
elseif (UNIX OR LINUX)
|
|
|
|
install(FILES caesium.h DESTINATION /usr/include)
|
2019-09-28 20:07:31 +02:00
|
|
|
install(TARGETS caesium
|
|
|
|
LIBRARY DESTINATION /usr/lib)
|
2017-03-17 10:55:26 +01:00
|
|
|
else ()
|
|
|
|
install(FILES caesium.h DESTINATION include)
|
2019-09-28 20:07:31 +02:00
|
|
|
install(TARGETS caesium
|
|
|
|
LIBRARY DESTINATION lib)
|
2017-03-17 10:55:26 +01:00
|
|
|
endif ()
|