Browse Source

Improve Build

pull/42/head
TheBrokenRail 2 weeks ago
parent
commit
0e7a108a0a
  1. 2
      CMakeLists.txt
  2. 12
      dependencies/libpng/CMakeLists.txt

2
CMakeLists.txt

@ -95,7 +95,7 @@ endif()
# Optimizations
if(CMAKE_BUILD_TYPE STREQUAL "Release")
add_compile_options(-O3)
add_compile_options(-O3 -s)
else()
add_compile_options(-g)
endif()

12
dependencies/libpng/CMakeLists.txt vendored

@ -7,13 +7,18 @@ add_compile_options(-w)
# Options
set(PNG_TESTS FALSE CACHE BOOL "" FORCE)
set(PNG_STATIC ${BUILD_NATIVE_COMPONENTS} CACHE BOOL "" FORCE)
set(PNG_SHARED ${BUILD_ARM_COMPONENTS} CACHE BOOL "" FORCE)
if(BUILD_NATIVE_COMPONENTS)
set(PNG_NO_STDIO FALSE CACHE BOOL "" FORCE)
else()
set(PNG_NO_STDIO TRUE CACHE BOOL "" FORCE)
endif()
if(BUILD_ARM_COMPONENTS)
set(PNG_STATIC FALSE CACHE BOOL "" FORCE)
set(PNG_SHARED TRUE CACHE BOOL "" FORCE)
else()
set(PNG_STATIC TRUE CACHE BOOL "" FORCE)
set(PNG_SHARED FALSE CACHE BOOL "" FORCE)
endif()
# Download
set(ZLIB_LIBRARY zlibstatic)
@ -24,11 +29,14 @@ set(CMAKE_POLICY_DEFAULT_CMP0054 NEW) # Re-Enable New Behavior
if(TARGET png12)
set_target_properties(png12 PROPERTIES LINK_OPTIONS "LINKER:--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libpng.vers") # Use Symbol Versioning
set_target_properties(png12 PROPERTIES DEBUG_POSTFIX "") # Fix LibPNG Suffix In Debug Mode
target_include_directories(png12 PUBLIC src)
endif()
if(TARGET png12_static)
find_library(M_LIBRARY NAMES m REQUIRED)
target_link_libraries(png12_static "${ZLIB_LIBRARY}" "${M_LIBRARY}")
target_include_directories(png12_static PUBLIC src)
else()
add_library(png12_static ALIAS png12)
endif()
# Ensure Build

Loading…
Cancel
Save