Rework project layout and tests
parent
3756f31e20
commit
19df5df68d
@ -0,0 +1,60 @@
|
||||
|
||||
# Find dependencies
|
||||
find_package(Python COMPONENTS Interpreter Development.Module)
|
||||
find_package(pybind11 CONFIG REQUIRED)
|
||||
find_package(OpenMP)
|
||||
|
||||
#Collect source files
|
||||
set(SOURCE_FILES
|
||||
Matrix4x4.cpp OldColor.cpp
|
||||
s3tc/bc1/BC1Block.cpp s3tc/bc1/BC1Decoder.cpp
|
||||
s3tc/bc1/BC1Encoder.cpp s3tc/bc1/OrderTable.cpp s3tc/bc1/OrderTable4.cpp
|
||||
s3tc/bc3/BC3Decoder.cpp s3tc/bc3/BC3Encoder.cpp
|
||||
s3tc/bc4/BC4Block.cpp s3tc/bc4/BC4Decoder.cpp s3tc/bc4/BC4Encoder.cpp
|
||||
s3tc/bc5/BC5Decoder.cpp s3tc/bc5/BC5Encoder.cpp
|
||||
s3tc/interpolator/Interpolator.cpp
|
||||
texture/RawTexture.cpp texture/Window.cpp)
|
||||
|
||||
set(BINDING_FILES
|
||||
_bindings.cpp
|
||||
s3tc/_bindings.cpp
|
||||
s3tc/bc1/_bindings.cpp
|
||||
s3tc/bc3/_bindings.cpp
|
||||
s3tc/bc4/_bindings.cpp
|
||||
s3tc/bc5/_bindings.cpp
|
||||
s3tc/interpolator/_bindings.cpp)
|
||||
|
||||
file(GLOB_RECURSE HEADER_FILES "**.h")
|
||||
file(GLOB_RECURSE PYTHON_FILES "**.py")
|
||||
|
||||
# Organize source files together for some IDEs
|
||||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SOURCE_FILES} ${BINDING_FILES} ${HEADER_FILES} ${PYTHON_FILES})
|
||||
|
||||
# Declare implementation module
|
||||
add_library(quicktex STATIC ${SOURCE_FILES} ${HEADER_FILES})
|
||||
|
||||
# Link openMP if available
|
||||
if (OpenMP_CXX_FOUND)
|
||||
target_link_libraries(quicktex PUBLIC OpenMP::OpenMP_CXX)
|
||||
endif ()
|
||||
|
||||
# Link XSimd
|
||||
target_link_libraries(quicktex PUBLIC xsimd)
|
||||
|
||||
# Set library features, like C/C++ standards
|
||||
target_compile_features(quicktex PUBLIC cxx_std_20 c_std_11)
|
||||
set_property(TARGET quicktex PROPERTY CXX_VISIBILITY_PRESET hidden)
|
||||
|
||||
# Include source root for project-relative includes
|
||||
target_include_directories(quicktex PUBLIC .)
|
||||
|
||||
# Set compiler warnings and SIMD flags
|
||||
set_project_warnings(quicktex)
|
||||
set_simd_flags(quicktex)
|
||||
|
||||
# Declare python module
|
||||
pybind11_add_module(_quicktex ${BINDING_FILES} ${HEADER_FILES})
|
||||
target_compile_definitions(_quicktex PRIVATE VERSION_INFO=${QUICKTEX_VERSION_INFO})
|
||||
|
||||
# Link python module with implementation
|
||||
target_link_libraries(_quicktex PUBLIC quicktex)
|
@ -0,0 +1,23 @@
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
googletest
|
||||
URL https://github.com/google/googletest/archive/e2239ee6043f73722e7aa812a459f54a28552929.zip
|
||||
)
|
||||
# For Windows: Prevent overriding the parent project's compiler/linker settings
|
||||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||
FetchContent_MakeAvailable(googletest)
|
||||
|
||||
file(GLOB_RECURSE TEST_HEADER_FILES "**.h")
|
||||
file(GLOB_RECURSE TEST_SOURCE_FILES "**.cpp")
|
||||
file(GLOB_RECURSE TEST_PYTHON_FILES "**.py")
|
||||
|
||||
# Organize source files together for some IDEs
|
||||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${TEST_SOURCE_FILES} ${TEST_HEADER_FILES} ${TEST_PYTHON_FILES})
|
||||
|
||||
add_executable(Test ${TEST_SOURCE_FILES} ${TEST_HEADER_FILES})
|
||||
|
||||
target_link_libraries(Test PUBLIC quicktex gtest_main)
|
||||
|
||||
include(GoogleTest)
|
||||
gtest_discover_tests(Test)
|
||||
|
@ -1,5 +0,0 @@
|
||||
from _quicktex import _run_ctests
|
||||
|
||||
|
||||
def test_ctests():
|
||||
_run_ctests()
|
Loading…
Reference in New Issue