forked from louipc/opennurbs
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Unified patch for opennurbs to compile under linux
- Loading branch information
Showing
10 changed files
with
2,157 additions
and
1,513 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm | ||
| # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 | ||
|
|
||
| # User-specific stuff: | ||
| .idea/**/workspace.xml | ||
| .idea/**/tasks.xml | ||
| .idea/dictionaries | ||
| .idea/* | ||
|
|
||
| # Sensitive or high-churn files: | ||
| .idea/**/dataSources/ | ||
| .idea/**/dataSources.ids | ||
| .idea/**/dataSources.local.xml | ||
| .idea/**/sqlDataSources.xml | ||
| .idea/**/dynamic.xml | ||
| .idea/**/uiDesigner.xml | ||
|
|
||
| # Gradle: | ||
| .idea/**/gradle.xml | ||
| .idea/**/libraries | ||
|
|
||
| .vscode/* | ||
|
|
||
| # CMake | ||
| cmake-build-debug/ | ||
| cmake-build-release/ | ||
| cmake/CMakeFiles/ | ||
| CMakeFiles/ | ||
| CMakeCache.txt | ||
| Makefile | ||
| *.so | ||
| opennurbs_lib.cbp | ||
| # Mongo Explorer plugin: | ||
| .idea/**/mongoSettings.xml | ||
|
|
||
| ## File-based project format: | ||
| *.iws | ||
|
|
||
| ## Plugin-specific files: | ||
|
|
||
| # IntelliJ | ||
| out/ | ||
|
|
||
| # mpeltonen/sbt-idea plugin | ||
| .idea_modules/ | ||
|
|
||
| # JIRA plugin | ||
| atlassian-ide-plugin.xml | ||
|
|
||
| # Cursive Clojure plugin | ||
| .idea/replstate.xml | ||
|
|
||
| # Crashlytics plugin (for Android Studio and IntelliJ) | ||
| com_crashlytics_export_strings.xml | ||
| crashlytics.properties | ||
| crashlytics-build.properties | ||
| fabric.properties |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR) | ||
|
|
||
| ################### Variables. #################### | ||
| # Change if you want modify path or other values. # | ||
| ################################################### | ||
| set(PROJECT_NAME opennurbs_lib) | ||
| # Build as shared, or as static | ||
| if (NOT DEFINED ON_BUILD_SHARED_LIBS) | ||
| set(ON_BUILD_SHARED_LIBS ON) | ||
| endif() | ||
|
|
||
| if (NOT DEFINED ON_BUILD_EXAMPLES) | ||
| set(ON_BUILD_EXAMPLES ON) | ||
| endif() | ||
|
|
||
| # Output Variables | ||
| set(OUTPUT_DEBUG Build/Debug/bin) | ||
| set(OUTPUT_RELEASE Build/Release/bin) | ||
| # Folders files | ||
| set(PROJECT_SOURCE_DIR .) | ||
| set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) | ||
| set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) | ||
| set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) | ||
|
|
||
| message(${CMAKE_BINARY_DIR}) | ||
|
|
||
| ############## CMake Project ################ | ||
| # The main options of project # | ||
| ############################################# | ||
|
|
||
| project(${PROJECT_NAME} CXX C) | ||
| #project(${PROJECT_NAME}2 C) | ||
|
|
||
| # Define Release by default. | ||
| if (NOT CMAKE_BUILD_TYPE) | ||
| set(CMAKE_BUILD_TYPE "Release") | ||
| message(STATUS "Build type not specified: Use Release by default.") | ||
| endif (NOT CMAKE_BUILD_TYPE) | ||
|
|
||
| # We are compiling opennurbs | ||
| SET(ON_COMPILE -DON_COMPILING_OPENNURBS) | ||
| # These flags will be applied to all opennurbs (lib and examples) | ||
| SET(ON_GENERAL) | ||
|
|
||
| ############## Artefacts Output ################# | ||
| # Defines outputs , depending Debug or Release. # | ||
| ################################################# | ||
|
|
||
| if (CMAKE_BUILD_TYPE STREQUAL "Debug") | ||
| set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OUTPUT_DEBUG}") | ||
| set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OUTPUT_DEBUG}") | ||
| set(CMAKE_EXECUTABLE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OUTPUT_DEBUG}") | ||
| else () | ||
| set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OUTPUT_REL}") | ||
| set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OUTPUT_REL}") | ||
| set(CMAKE_EXECUTABLE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OUTPUT_REL}") | ||
| endif (CMAKE_BUILD_TYPE STREQUAL "Debug") | ||
|
|
||
| ################# Flags ################ | ||
| # Defines Flags for Windows and Linux. # | ||
| ######################################## | ||
|
|
||
| if (MSVC) | ||
| # Flags for visual studio compiler. Not tested at all. | ||
| set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MD /Od /EHsc") | ||
| set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GL /Od /Oi /Gy /EHsc") | ||
| endif (MSVC) | ||
| if (NOT MSVC) | ||
| if (UNIX AND NOT APPLE) | ||
| # Tested on linux. | ||
| # Use the on_runtime_android flags. | ||
| SET(ON_GENERAL "${ON_GENERAL}ON_RUNTIME_ANDROID") | ||
| include(TestBigEndian) | ||
| TEST_BIG_ENDIAN(IS_BIG_ENDIAN) | ||
| if (IS_BIG_ENDIAN) | ||
| SET(ON_GENERAL "${ON_GENERAL} -DON_BIG_ENDIAN") | ||
| else () | ||
| SET(ON_GENERAL "${ON_GENERAL} -DON_LITTLE_ENDIAN") | ||
| endif () | ||
| endif () | ||
| set(CMAKE_C_FLAGS_INIT "-Wall -std=c11") | ||
| # Ignore uknown pargma, unused private field, missing all catches, and no-overloaded-virtual compile errors. | ||
| set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++14 -Wno-unknown-pragmas -Wno-unused-private-field -Wno-switch -Wno-overloaded-virtual") | ||
| if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") | ||
| # include stdlib | ||
| set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") | ||
| else () | ||
| message("NOT USING CLANG but ${CMAKE_CXX_COMPILER_ID}") | ||
| endif () | ||
| endif (NOT MSVC) | ||
|
|
||
| if (CMAKE_SIZEOF_VOID_P EQUAL 8) | ||
| # tested on linux. | ||
| SET(ON_GENERAL "${ON_GENERAL} -DON_64BIT_RUNTIME") | ||
| elseif (CMAKE_SIZEOF_VOID_P EQUAL 4) | ||
| # Not tested. Also not supported by mcneel | ||
| SET(ON_GENERAL "${ON_GENERAL} -DON_32BIT_RUNTIME") | ||
| endif () | ||
|
|
||
| # using pkg-config to configure uuid | ||
| # when compiling for clang under linux, the pthreads package is required. (apt install pth | ||
| find_package(PkgConfig REQUIRED) | ||
| find_package(Threads REQUIRED) | ||
| # Use the system provided uuid lib | ||
| pkg_search_module(UUID REQUIRED uuid) | ||
|
|
||
|
|
||
| message("Current shared libs ${BUILD_SHARED_LIBS}") | ||
| # make mcneel provided zlib package | ||
| include(cmake/packages/zlib.cmake) | ||
| # make mcneel provided freetype package | ||
| include(cmake/packages/freetype.cmake) | ||
| # make opennurbs library | ||
| include(cmake/packages/opennurbs.cmake) | ||
|
|
||
| if (ON_BUILD_EXAMPLES) | ||
| # build all examples | ||
| include(cmake/packages/examples.cmake) | ||
| endif(ON_BUILD_EXAMPLES) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| add_executable(example_read_exe example_read/example_read.cpp) | ||
| target_compile_definitions(example_read_exe PRIVATE ${ON_GENERAL}) | ||
| target_link_libraries(example_read_exe opennurbs uuid pthread c++abi) | ||
|
|
||
| add_executable(example_brep_exe example_brep/example_brep.cpp) | ||
| target_link_libraries(example_brep_exe opennurbs uuid pthread c++abi) | ||
| target_compile_definitions(example_brep_exe PRIVATE ${ON_GENERAL}) | ||
|
|
||
| add_executable(example_convert_exe example_convert/example_convert.cpp) | ||
| target_link_libraries(example_convert_exe opennurbs uuid pthread c++abi) | ||
| target_compile_definitions(example_convert_exe PRIVATE ${ON_GENERAL}) | ||
|
|
||
| add_executable(example_write_exe example_write/example_write.cpp example_userdata/example_ud.h example_userdata/example_ud.cpp) | ||
| target_link_libraries(example_write_exe opennurbs uuid pthread c++abi) | ||
| target_compile_definitions(example_write_exe PRIVATE ${ON_GENERAL}) | ||
|
|
||
| add_executable(example_userdata_exe example_userdata/example_userdata.cpp example_userdata/example_ud.h example_userdata/example_ud.cpp) | ||
| target_link_libraries(example_userdata_exe opennurbs uuid pthread c++abi) | ||
| target_compile_definitions(example_userdata_exe PRIVATE ${ON_GENERAL}) | ||
|
|
||
| add_executable(example_roundtrip_exe example_roundtrip/example_roundtrip.cpp) | ||
| target_link_libraries(example_roundtrip_exe opennurbs uuid pthread c++abi) | ||
| target_compile_definitions(example_roundtrip_exe PRIVATE ${ON_GENERAL}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| file(GLOB_RECURSE FREETYPE_INC ${CMAKE_CURRENT_SOURCE_DIR}/freetype263/include/*.h) | ||
| set(FREETYPE_SRC | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/freetype263/src/autofit/autofit.c | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/freetype263/src/bdf/bdf.c | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/freetype263/src/cff/cff.c | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/freetype263/src/base/ftbase.c | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/freetype263/src/base/ftbitmap.c | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/freetype263/src/base/ftfstype.c | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/freetype263/src/base/ftgasp.c | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/freetype263/src/base/ftglyph.c | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/freetype263/src/gzip/ftgzip.c | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/freetype263/src/base/ftinit.c | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/freetype263/src/lzw/ftlzw.c | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/freetype263/src/base/ftstroke.c | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/freetype263/src/base/ftsystem.c | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/freetype263/src/smooth/smooth.c | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/freetype263/src/base/ftbbox.c | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/freetype263/src/base/ftfntfmt.c | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/freetype263/src/base/ftgxval.c | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/freetype263/src/base/ftlcdfil.c | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/freetype263/src/base/ftmm.c | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/freetype263/src/base/ftotval.c | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/freetype263/src/base/ftpatent.c | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/freetype263/src/base/ftpfr.c | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/freetype263/src/base/ftsynth.c | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/freetype263/src/base/fttype1.c | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/freetype263/src/base/ftwinfnt.c | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/freetype263/src/pcf/pcf.c | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/freetype263/src/pfr/pfr.c | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/freetype263/src/psaux/psaux.c | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/freetype263/src/pshinter/pshinter.c | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/freetype263/src/psnames/psmodule.c | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/freetype263/src/raster/raster.c | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/freetype263/src/sfnt/sfnt.c | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/freetype263/src/truetype/truetype.c | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/freetype263/src/type1/type1.c | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/freetype263/src/cid/type1cid.c | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/freetype263/src/type42/type42.c | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/freetype263/src/winfonts/winfnt.c | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/freetype263/src/cache/ftcache.c | ||
| ) | ||
|
|
||
| if(${ON_BUILD_SHARED_LIBS}) | ||
| add_library(freetype SHARED | ||
| ${FREETYPE_INC} | ||
| ${FREETYPE_SRC} | ||
| ) | ||
| else() | ||
| add_library(freetype OBJECT | ||
| ${FREETYPE_INC} | ||
| ${FREETYPE_SRC} | ||
| ) | ||
| endif() | ||
| target_include_directories(freetype PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/freetype263/include) | ||
| target_compile_definitions(freetype PRIVATE -DFT2_BUILD_LIBRARY) |
Oops, something went wrong.